On Wed, 21 Dec 2022 20:24:38 -0800 Ira Weiny <ira.we...@intel.com> wrote:
> To facilitate testing provide a QMP command to inject a general media > event. The event can be added to the log specified. > > Signed-off-by: Ira Weiny <ira.we...@intel.com> Hi Ira, One thing inline that kind of came out of Philippe's review of the earlier cleanup patches. > > --- > Changes from RFC: > Add all fields for this event > irq happens automatically when log transitions from 0 to 1 > --- > hw/mem/cxl_type3.c | 93 > +++++++++++++++++++++++++++++++++++++++++++++ > hw/mem/cxl_type3_stubs.c | 8 ++++ > include/hw/cxl/cxl_events.h | 20 ++++++++++ > qapi/cxl.json | 25 ++++++++++++ > 4 files changed, 146 insertions(+) > > diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c > index a43949cab120..bedd09e500ba 100644 > --- a/hw/mem/cxl_type3.c > +++ b/hw/mem/cxl_type3.c > @@ -916,6 +916,99 @@ static CXLPoisonList *get_poison_list(CXLType3Dev *ct3d) > return &ct3d->poison_list; > } > > +static void cxl_assign_event_header(struct cxl_event_record_hdr *hdr, > + QemuUUID *uuid, uint8_t flags, make that const QemuUUID *uuid and ... > + uint8_t length) > +{ > + hdr->flags[0] = flags; > + hdr->length = length; > + memcpy(&hdr->id, uuid, sizeof(hdr->id)); > + hdr->timestamp = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); > +} > + static const > +QemuUUID gen_media_uuid = { > + .data = UUID(0xfbcd0a77, 0xc260, 0x417f, > + 0x85, 0xa9, 0x08, 0x8b, 0x16, 0x21, 0xeb, 0xa6), > +};