diff mbox series

[3/3] hw/misc: Remove mmio_interface device

Message ID 20180817114619.22354-4-peter.maydell@linaro.org
State New
Headers show
Series Drop obsolete memory system request_ptr API | expand

Commit Message

Peter Maydell Aug. 17, 2018, 11:46 a.m. UTC
The mmio_interface device was a purely internal artifact
of the implementation of the memory subsystem's request_ptr
APIs. Now that we have removed those APIs, we can remove
the mmio_interface device too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/misc/Makefile.objs            |   1 -
 include/hw/misc/mmio_interface.h |  49 -----------
 hw/misc/mmio_interface.c         | 135 -------------------------------
 3 files changed, 185 deletions(-)
 delete mode 100644 include/hw/misc/mmio_interface.h
 delete mode 100644 hw/misc/mmio_interface.c

Comments

Alistair Francis Aug. 17, 2018, 5:18 p.m. UTC | #1
On Fri, Aug 17, 2018 at 4:46 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> The mmio_interface device was a purely internal artifact
> of the implementation of the memory subsystem's request_ptr
> APIs. Now that we have removed those APIs, we can remove
> the mmio_interface device too.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/misc/Makefile.objs            |   1 -
>  include/hw/misc/mmio_interface.h |  49 -----------
>  hw/misc/mmio_interface.c         | 135 -------------------------------
>  3 files changed, 185 deletions(-)
>  delete mode 100644 include/hw/misc/mmio_interface.h
>  delete mode 100644 hw/misc/mmio_interface.c
>
> diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
> index 51d27b3af1e..22714b08510 100644
> --- a/hw/misc/Makefile.objs
> +++ b/hw/misc/Makefile.objs
> @@ -71,5 +71,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
>  obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
>  obj-$(CONFIG_AUX) += auxbus.o
>  obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
> -obj-y += mmio_interface.o
>  obj-$(CONFIG_MSF2) += msf2-sysreg.o
> diff --git a/include/hw/misc/mmio_interface.h b/include/hw/misc/mmio_interface.h
> deleted file mode 100644
> index 90d34fb2286..00000000000
> --- a/include/hw/misc/mmio_interface.h
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -/*
> - * mmio_interface.h
> - *
> - *  Copyright (C) 2017 : GreenSocs
> - *      http://www.greensocs.com/ , email: info@greensocs.com
> - *
> - *  Developed by :
> - *  Frederic Konrad   <fred.konrad@greensocs.com>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option)any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - *
> - */
> -
> -#ifndef MMIO_INTERFACE_H
> -#define MMIO_INTERFACE_H
> -
> -#include "exec/memory.h"
> -
> -#define TYPE_MMIO_INTERFACE "mmio_interface"
> -#define MMIO_INTERFACE(obj) OBJECT_CHECK(MMIOInterface, (obj),                 \
> -                                         TYPE_MMIO_INTERFACE)
> -
> -typedef struct MMIOInterface {
> -    DeviceState parent_obj;
> -
> -    MemoryRegion *subregion;
> -    MemoryRegion ram_mem;
> -    uint64_t start;
> -    uint64_t end;
> -    bool ro;
> -    uint64_t id;
> -    void *host_ptr;
> -} MMIOInterface;
> -
> -void mmio_interface_map(MMIOInterface *s);
> -void mmio_interface_unmap(MMIOInterface *s);
> -
> -#endif /* MMIO_INTERFACE_H */
> diff --git a/hw/misc/mmio_interface.c b/hw/misc/mmio_interface.c
> deleted file mode 100644
> index 3b0e2039a36..00000000000
> --- a/hw/misc/mmio_interface.c
> +++ /dev/null
> @@ -1,135 +0,0 @@
> -/*
> - * mmio_interface.c
> - *
> - *  Copyright (C) 2017 : GreenSocs
> - *      http://www.greensocs.com/ , email: info@greensocs.com
> - *
> - *  Developed by :
> - *  Frederic Konrad   <fred.konrad@greensocs.com>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option)any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - *
> - */
> -
> -#include "qemu/osdep.h"
> -#include "qemu/log.h"
> -#include "trace.h"
> -#include "hw/qdev-properties.h"
> -#include "hw/misc/mmio_interface.h"
> -#include "qapi/error.h"
> -
> -#ifndef DEBUG_MMIO_INTERFACE
> -#define DEBUG_MMIO_INTERFACE 0
> -#endif
> -
> -static uint64_t mmio_interface_counter;
> -
> -#define DPRINTF(fmt, ...) do {                                                 \
> -    if (DEBUG_MMIO_INTERFACE) {                                                \
> -        qemu_log("mmio_interface: 0x%" PRIX64 ": " fmt, s->id, ## __VA_ARGS__);\
> -    }                                                                          \
> -} while (0)
> -
> -static void mmio_interface_init(Object *obj)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(obj);
> -
> -    if (DEBUG_MMIO_INTERFACE) {
> -        s->id = mmio_interface_counter++;
> -    }
> -
> -    DPRINTF("interface created\n");
> -    s->host_ptr = 0;
> -    s->subregion = 0;
> -}
> -
> -static void mmio_interface_realize(DeviceState *dev, Error **errp)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(dev);
> -
> -    DPRINTF("realize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -
> -    if (!s->host_ptr) {
> -        error_setg(errp, "host_ptr property must be set");
> -        return;
> -    }
> -
> -    if (!s->subregion) {
> -        error_setg(errp, "subregion property must be set");
> -        return;
> -    }
> -
> -    memory_region_init_ram_ptr(&s->ram_mem, OBJECT(s), "ram",
> -                               s->end - s->start + 1, s->host_ptr);
> -    memory_region_set_readonly(&s->ram_mem, s->ro);
> -    memory_region_add_subregion(s->subregion, s->start, &s->ram_mem);
> -}
> -
> -static void mmio_interface_unrealize(DeviceState *dev, Error **errp)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(dev);
> -
> -    DPRINTF("unrealize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -    memory_region_del_subregion(s->subregion, &s->ram_mem);
> -}
> -
> -static void mmio_interface_finalize(Object *obj)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(obj);
> -
> -    DPRINTF("finalize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -    object_unparent(OBJECT(&s->ram_mem));
> -}
> -
> -static Property mmio_interface_properties[] = {
> -    DEFINE_PROP_UINT64("start", MMIOInterface, start, 0),
> -    DEFINE_PROP_UINT64("end", MMIOInterface, end, 0),
> -    DEFINE_PROP_PTR("host_ptr", MMIOInterface, host_ptr),
> -    DEFINE_PROP_BOOL("ro", MMIOInterface, ro, false),
> -    DEFINE_PROP_MEMORY_REGION("subregion", MMIOInterface, subregion),
> -    DEFINE_PROP_END_OF_LIST(),
> -};
> -
> -static void mmio_interface_class_init(ObjectClass *oc, void *data)
> -{
> -    DeviceClass *dc = DEVICE_CLASS(oc);
> -
> -    dc->realize = mmio_interface_realize;
> -    dc->unrealize = mmio_interface_unrealize;
> -    dc->props = mmio_interface_properties;
> -    /* Reason: pointer property "host_ptr", and this device
> -     * is an implementation detail of the memory subsystem,
> -     * not intended to be created directly by the user.
> -     */
> -    dc->user_creatable = false;
> -}
> -
> -static const TypeInfo mmio_interface_info = {
> -    .name          = TYPE_MMIO_INTERFACE,
> -    .parent        = TYPE_DEVICE,
> -    .instance_size = sizeof(MMIOInterface),
> -    .instance_init = mmio_interface_init,
> -    .instance_finalize = mmio_interface_finalize,
> -    .class_init    = mmio_interface_class_init,
> -};
> -
> -static void mmio_interface_register_types(void)
> -{
> -    type_register_static(&mmio_interface_info);
> -}
> -
> -type_init(mmio_interface_register_types)
> --
> 2.18.0
>
>
KONRAD Frederic Aug. 20, 2018, 8:50 a.m. UTC | #2
Le 08/17/2018 à 01:46 PM, Peter Maydell a écrit :
> The mmio_interface device was a purely internal artifact
> of the implementation of the memory subsystem's request_ptr
> APIs. Now that we have removed those APIs, we can remove
> the mmio_interface device too.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com>
> ---
>   hw/misc/Makefile.objs            |   1 -
>   include/hw/misc/mmio_interface.h |  49 -----------
>   hw/misc/mmio_interface.c         | 135 -------------------------------
>   3 files changed, 185 deletions(-)
>   delete mode 100644 include/hw/misc/mmio_interface.h
>   delete mode 100644 hw/misc/mmio_interface.c
> 
> diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
> index 51d27b3af1e..22714b08510 100644
> --- a/hw/misc/Makefile.objs
> +++ b/hw/misc/Makefile.objs
> @@ -71,5 +71,4 @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
>   obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
>   obj-$(CONFIG_AUX) += auxbus.o
>   obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
> -obj-y += mmio_interface.o
>   obj-$(CONFIG_MSF2) += msf2-sysreg.o
> diff --git a/include/hw/misc/mmio_interface.h b/include/hw/misc/mmio_interface.h
> deleted file mode 100644
> index 90d34fb2286..00000000000
> --- a/include/hw/misc/mmio_interface.h
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -/*
> - * mmio_interface.h
> - *
> - *  Copyright (C) 2017 : GreenSocs
> - *      http://www.greensocs.com/ , email: info@greensocs.com
> - *
> - *  Developed by :
> - *  Frederic Konrad   <fred.konrad@greensocs.com>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option)any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - *
> - */
> -
> -#ifndef MMIO_INTERFACE_H
> -#define MMIO_INTERFACE_H
> -
> -#include "exec/memory.h"
> -
> -#define TYPE_MMIO_INTERFACE "mmio_interface"
> -#define MMIO_INTERFACE(obj) OBJECT_CHECK(MMIOInterface, (obj),                 \
> -                                         TYPE_MMIO_INTERFACE)
> -
> -typedef struct MMIOInterface {
> -    DeviceState parent_obj;
> -
> -    MemoryRegion *subregion;
> -    MemoryRegion ram_mem;
> -    uint64_t start;
> -    uint64_t end;
> -    bool ro;
> -    uint64_t id;
> -    void *host_ptr;
> -} MMIOInterface;
> -
> -void mmio_interface_map(MMIOInterface *s);
> -void mmio_interface_unmap(MMIOInterface *s);
> -
> -#endif /* MMIO_INTERFACE_H */
> diff --git a/hw/misc/mmio_interface.c b/hw/misc/mmio_interface.c
> deleted file mode 100644
> index 3b0e2039a36..00000000000
> --- a/hw/misc/mmio_interface.c
> +++ /dev/null
> @@ -1,135 +0,0 @@
> -/*
> - * mmio_interface.c
> - *
> - *  Copyright (C) 2017 : GreenSocs
> - *      http://www.greensocs.com/ , email: info@greensocs.com
> - *
> - *  Developed by :
> - *  Frederic Konrad   <fred.konrad@greensocs.com>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation, either version 2 of the License, or
> - * (at your option)any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - *
> - */
> -
> -#include "qemu/osdep.h"
> -#include "qemu/log.h"
> -#include "trace.h"
> -#include "hw/qdev-properties.h"
> -#include "hw/misc/mmio_interface.h"
> -#include "qapi/error.h"
> -
> -#ifndef DEBUG_MMIO_INTERFACE
> -#define DEBUG_MMIO_INTERFACE 0
> -#endif
> -
> -static uint64_t mmio_interface_counter;
> -
> -#define DPRINTF(fmt, ...) do {                                                 \
> -    if (DEBUG_MMIO_INTERFACE) {                                                \
> -        qemu_log("mmio_interface: 0x%" PRIX64 ": " fmt, s->id, ## __VA_ARGS__);\
> -    }                                                                          \
> -} while (0)
> -
> -static void mmio_interface_init(Object *obj)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(obj);
> -
> -    if (DEBUG_MMIO_INTERFACE) {
> -        s->id = mmio_interface_counter++;
> -    }
> -
> -    DPRINTF("interface created\n");
> -    s->host_ptr = 0;
> -    s->subregion = 0;
> -}
> -
> -static void mmio_interface_realize(DeviceState *dev, Error **errp)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(dev);
> -
> -    DPRINTF("realize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -
> -    if (!s->host_ptr) {
> -        error_setg(errp, "host_ptr property must be set");
> -        return;
> -    }
> -
> -    if (!s->subregion) {
> -        error_setg(errp, "subregion property must be set");
> -        return;
> -    }
> -
> -    memory_region_init_ram_ptr(&s->ram_mem, OBJECT(s), "ram",
> -                               s->end - s->start + 1, s->host_ptr);
> -    memory_region_set_readonly(&s->ram_mem, s->ro);
> -    memory_region_add_subregion(s->subregion, s->start, &s->ram_mem);
> -}
> -
> -static void mmio_interface_unrealize(DeviceState *dev, Error **errp)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(dev);
> -
> -    DPRINTF("unrealize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -    memory_region_del_subregion(s->subregion, &s->ram_mem);
> -}
> -
> -static void mmio_interface_finalize(Object *obj)
> -{
> -    MMIOInterface *s = MMIO_INTERFACE(obj);
> -
> -    DPRINTF("finalize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
> -            " %p\n", s->start, s->end, s->host_ptr);
> -    object_unparent(OBJECT(&s->ram_mem));
> -}
> -
> -static Property mmio_interface_properties[] = {
> -    DEFINE_PROP_UINT64("start", MMIOInterface, start, 0),
> -    DEFINE_PROP_UINT64("end", MMIOInterface, end, 0),
> -    DEFINE_PROP_PTR("host_ptr", MMIOInterface, host_ptr),
> -    DEFINE_PROP_BOOL("ro", MMIOInterface, ro, false),
> -    DEFINE_PROP_MEMORY_REGION("subregion", MMIOInterface, subregion),
> -    DEFINE_PROP_END_OF_LIST(),
> -};
> -
> -static void mmio_interface_class_init(ObjectClass *oc, void *data)
> -{
> -    DeviceClass *dc = DEVICE_CLASS(oc);
> -
> -    dc->realize = mmio_interface_realize;
> -    dc->unrealize = mmio_interface_unrealize;
> -    dc->props = mmio_interface_properties;
> -    /* Reason: pointer property "host_ptr", and this device
> -     * is an implementation detail of the memory subsystem,
> -     * not intended to be created directly by the user.
> -     */
> -    dc->user_creatable = false;
> -}
> -
> -static const TypeInfo mmio_interface_info = {
> -    .name          = TYPE_MMIO_INTERFACE,
> -    .parent        = TYPE_DEVICE,
> -    .instance_size = sizeof(MMIOInterface),
> -    .instance_init = mmio_interface_init,
> -    .instance_finalize = mmio_interface_finalize,
> -    .class_init    = mmio_interface_class_init,
> -};
> -
> -static void mmio_interface_register_types(void)
> -{
> -    type_register_static(&mmio_interface_info);
> -}
> -
> -type_init(mmio_interface_register_types)
>
diff mbox series

Patch

diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index 51d27b3af1e..22714b08510 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -71,5 +71,4 @@  obj-$(CONFIG_PVPANIC) += pvpanic.o
 obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
-obj-y += mmio_interface.o
 obj-$(CONFIG_MSF2) += msf2-sysreg.o
diff --git a/include/hw/misc/mmio_interface.h b/include/hw/misc/mmio_interface.h
deleted file mode 100644
index 90d34fb2286..00000000000
--- a/include/hw/misc/mmio_interface.h
+++ /dev/null
@@ -1,49 +0,0 @@ 
-/*
- * mmio_interface.h
- *
- *  Copyright (C) 2017 : GreenSocs
- *      http://www.greensocs.com/ , email: info@greensocs.com
- *
- *  Developed by :
- *  Frederic Konrad   <fred.konrad@greensocs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option)any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef MMIO_INTERFACE_H
-#define MMIO_INTERFACE_H
-
-#include "exec/memory.h"
-
-#define TYPE_MMIO_INTERFACE "mmio_interface"
-#define MMIO_INTERFACE(obj) OBJECT_CHECK(MMIOInterface, (obj),                 \
-                                         TYPE_MMIO_INTERFACE)
-
-typedef struct MMIOInterface {
-    DeviceState parent_obj;
-
-    MemoryRegion *subregion;
-    MemoryRegion ram_mem;
-    uint64_t start;
-    uint64_t end;
-    bool ro;
-    uint64_t id;
-    void *host_ptr;
-} MMIOInterface;
-
-void mmio_interface_map(MMIOInterface *s);
-void mmio_interface_unmap(MMIOInterface *s);
-
-#endif /* MMIO_INTERFACE_H */
diff --git a/hw/misc/mmio_interface.c b/hw/misc/mmio_interface.c
deleted file mode 100644
index 3b0e2039a36..00000000000
--- a/hw/misc/mmio_interface.c
+++ /dev/null
@@ -1,135 +0,0 @@ 
-/*
- * mmio_interface.c
- *
- *  Copyright (C) 2017 : GreenSocs
- *      http://www.greensocs.com/ , email: info@greensocs.com
- *
- *  Developed by :
- *  Frederic Konrad   <fred.konrad@greensocs.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option)any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "qemu/osdep.h"
-#include "qemu/log.h"
-#include "trace.h"
-#include "hw/qdev-properties.h"
-#include "hw/misc/mmio_interface.h"
-#include "qapi/error.h"
-
-#ifndef DEBUG_MMIO_INTERFACE
-#define DEBUG_MMIO_INTERFACE 0
-#endif
-
-static uint64_t mmio_interface_counter;
-
-#define DPRINTF(fmt, ...) do {                                                 \
-    if (DEBUG_MMIO_INTERFACE) {                                                \
-        qemu_log("mmio_interface: 0x%" PRIX64 ": " fmt, s->id, ## __VA_ARGS__);\
-    }                                                                          \
-} while (0)
-
-static void mmio_interface_init(Object *obj)
-{
-    MMIOInterface *s = MMIO_INTERFACE(obj);
-
-    if (DEBUG_MMIO_INTERFACE) {
-        s->id = mmio_interface_counter++;
-    }
-
-    DPRINTF("interface created\n");
-    s->host_ptr = 0;
-    s->subregion = 0;
-}
-
-static void mmio_interface_realize(DeviceState *dev, Error **errp)
-{
-    MMIOInterface *s = MMIO_INTERFACE(dev);
-
-    DPRINTF("realize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
-            " %p\n", s->start, s->end, s->host_ptr);
-
-    if (!s->host_ptr) {
-        error_setg(errp, "host_ptr property must be set");
-        return;
-    }
-
-    if (!s->subregion) {
-        error_setg(errp, "subregion property must be set");
-        return;
-    }
-
-    memory_region_init_ram_ptr(&s->ram_mem, OBJECT(s), "ram",
-                               s->end - s->start + 1, s->host_ptr);
-    memory_region_set_readonly(&s->ram_mem, s->ro);
-    memory_region_add_subregion(s->subregion, s->start, &s->ram_mem);
-}
-
-static void mmio_interface_unrealize(DeviceState *dev, Error **errp)
-{
-    MMIOInterface *s = MMIO_INTERFACE(dev);
-
-    DPRINTF("unrealize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
-            " %p\n", s->start, s->end, s->host_ptr);
-    memory_region_del_subregion(s->subregion, &s->ram_mem);
-}
-
-static void mmio_interface_finalize(Object *obj)
-{
-    MMIOInterface *s = MMIO_INTERFACE(obj);
-
-    DPRINTF("finalize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
-            " %p\n", s->start, s->end, s->host_ptr);
-    object_unparent(OBJECT(&s->ram_mem));
-}
-
-static Property mmio_interface_properties[] = {
-    DEFINE_PROP_UINT64("start", MMIOInterface, start, 0),
-    DEFINE_PROP_UINT64("end", MMIOInterface, end, 0),
-    DEFINE_PROP_PTR("host_ptr", MMIOInterface, host_ptr),
-    DEFINE_PROP_BOOL("ro", MMIOInterface, ro, false),
-    DEFINE_PROP_MEMORY_REGION("subregion", MMIOInterface, subregion),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
-static void mmio_interface_class_init(ObjectClass *oc, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(oc);
-
-    dc->realize = mmio_interface_realize;
-    dc->unrealize = mmio_interface_unrealize;
-    dc->props = mmio_interface_properties;
-    /* Reason: pointer property "host_ptr", and this device
-     * is an implementation detail of the memory subsystem,
-     * not intended to be created directly by the user.
-     */
-    dc->user_creatable = false;
-}
-
-static const TypeInfo mmio_interface_info = {
-    .name          = TYPE_MMIO_INTERFACE,
-    .parent        = TYPE_DEVICE,
-    .instance_size = sizeof(MMIOInterface),
-    .instance_init = mmio_interface_init,
-    .instance_finalize = mmio_interface_finalize,
-    .class_init    = mmio_interface_class_init,
-};
-
-static void mmio_interface_register_types(void)
-{
-    type_register_static(&mmio_interface_info);
-}
-
-type_init(mmio_interface_register_types)