Hi Gregory,

On 1/9/23 03:29, Gregory Price wrote:
For devices built on top of ct3, we need the init, realize, and
exit functions exposed to correctly start up and tear down.

You shouldn't need this. Your device class can inherit from
the CT3 base class by setting its .parent to TYPE_CXL_TYPE3:

static const TypeInfo my_cxl_types[] = {
    {
        .name           = TYPE_MY_CXL_DEVICE_X,
        .parent         = TYPE_CXL_TYPE3,
        .class_init     = dev_x_class_init,
    },
    {
        .name           = TYPE_MY_CXL_DEVICE_Y,
        .parent         = TYPE_CXL_TYPE3,
        .class_init     = dev_y_class_init,
    }
};

You can see some documentation about QOM here:
https://qemu-project.gitlab.io/qemu/devel/qom.html
But still you'll have to look at examples in the tree.

Signed-off-by: Gregory Price <[email protected]>
---
  hw/mem/cxl_type3.c          | 8 ++++----
  include/hw/cxl/cxl_device.h | 5 +++++
  2 files changed, 9 insertions(+), 4 deletions(-)


Reply via email to