qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] QEMU CXL Provide mock CXL events and irq support
@ 2022-12-22  4:24 Ira Weiny
  2022-12-22  4:24 ` [PATCH v2 1/8] qemu/bswap: Add const_le64() Ira Weiny
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Ira Weiny @ 2022-12-22  4:24 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Michael Tsirkin, Ben Widawsky, Ira Weiny, qemu-devel, linux-cxl,
	Peter Maydell

CXL Event records inform the OS of various CXL device events.  Thus far CXL
memory devices are emulated and therefore don't naturally generate events.

Add an event infrastructure and mock event injection.  Previous versions
included a bulk insertion of lots of events.  However, this series focuses on
providing the ability to inject individual events through QMP.  Only the
General Media Event is included in this series as an example.  Other events can
be added pretty easily once the infrastructure is acceptable.

In addition, this version updates the code to be in line with the
specification based on discussions around the kernel patches.

This series is based on Jonathan's CXL branch here:
https://gitlab.com/jic23/qemu/-/tree/cxl-2022-11-17

Kernel code found here:
https://lore.kernel.org/all/20221212070627.1372402-1-ira.weiny@intel.com/

Previous RFC (V1) version:
https://lore.kernel.org/linux-cxl/20221010222944.3923556-1-ira.weiny@intel.com/

Instructions:

Add qmp option to qemu:

	<host> $ qemu-system-x86_64 ... -qmp unix:/tmp/run_qemu_qmp_0,server,nowait ...

	OR

	<host> $ run_qemu.sh ... --qmp ...

Enable tracing of events within the guest:

	<guest> $ echo "" > /sys/kernel/tracing/trace
	<guest> $ echo 1 > /sys/kernel/tracing/events/cxl/enable
	<guest> $ echo 1 > /sys/kernel/tracing/tracing_on

	OPTIONAL: set up ndctl to monitor for events (events will show up as
		  they are injected)

	<guest> $ <path to ndctl>/cxl monitor

Trigger event generation and interrupts in the host:

	<host> $ qmpcmd="${qemusrcdir}/build/scripts/qmp/qmp-shell /tmp/run_qemu_qmp_0"

	<host> $ echo "cxl-inject-gen-media-event path=cxl-dev0 log=0 flags=1 \
			physaddr=1000 descriptor=127 type=3 transactiontype=192 \
			channel=3 rank=-1 device=5 componentid='Iras mem'" | $qmpcmd

	<Repeat for more events with different values>

View events on the guest:

	<guest> $ cat /sys/kernel/tracing/trace

To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michael Tsirkin <mst@redhat.com>
Cc: Ben Widawsky <bwidawsk@kernel.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: qemu-devel@nongnu.org
Cc: linux-cxl@vger.kernel.org
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Ira Weiny (8):
      qemu/bswap: Add const_le64()
      qemu/uuid: Add UUID static initializer
      hw/cxl/mailbox: Use new UUID network order define for cel_uuid
      hw/cxl/events: Add event status register
      hw/cxl/events: Wire up get/clear event mailbox commands
      hw/cxl/events: Add event interrupt support
      bswap: Add the ability to store to an unaligned 24 bit field
      hw/cxl/events: Add in inject general media event

 hw/cxl/cxl-device-utils.c   |  54 ++++++++--
 hw/cxl/cxl-events.c         | 252 ++++++++++++++++++++++++++++++++++++++++++++
 hw/cxl/cxl-mailbox-utils.c  | 160 ++++++++++++++++++++++------
 hw/cxl/meson.build          |   1 +
 hw/mem/cxl_type3.c          |  96 ++++++++++++++++-
 hw/mem/cxl_type3_stubs.c    |   8 ++
 include/hw/cxl/cxl_device.h |  56 +++++++++-
 include/hw/cxl/cxl_events.h | 126 ++++++++++++++++++++++
 include/qemu/bswap.h        |  40 +++++++
 include/qemu/uuid.h         |  12 +++
 qapi/cxl.json               |  25 +++++
 11 files changed, 785 insertions(+), 45 deletions(-)
---
base-commit: 1b4133103d20fc3fea05c7ceca4a242468a5179d
change-id: 20221221-ira-cxl-events-2022-11-17-fef53f9b9ac2

Best regards,
-- 
Ira Weiny <ira.weiny@intel.com>


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-01-24 17:05 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22  4:24 [PATCH v2 0/8] QEMU CXL Provide mock CXL events and irq support Ira Weiny
2022-12-22  4:24 ` [PATCH v2 1/8] qemu/bswap: Add const_le64() Ira Weiny
2022-12-22  4:24 ` [PATCH v2 2/8] qemu/uuid: Add UUID static initializer Ira Weiny
2022-12-22  4:24 ` [PATCH v2 3/8] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Ira Weiny
2023-01-03 16:30   ` Jonathan Cameron via
2022-12-22  4:24 ` [PATCH v2 4/8] hw/cxl/events: Add event status register Ira Weiny
2023-01-03 16:36   ` Jonathan Cameron via
2022-12-22  4:24 ` [PATCH v2 5/8] hw/cxl/events: Wire up get/clear event mailbox commands Ira Weiny
2023-01-04 18:07   ` Jonathan Cameron via
2023-01-24 17:04   ` Jonathan Cameron via
2022-12-22  4:24 ` [PATCH v2 6/8] hw/cxl/events: Add event interrupt support Ira Weiny
2022-12-22  4:24 ` [PATCH v2 7/8] bswap: Add the ability to store to an unaligned 24 bit field Ira Weiny
2023-01-03 17:14   ` Jonathan Cameron via
2022-12-22  4:24 ` [PATCH v2 8/8] hw/cxl/events: Add in inject general media event Ira Weiny
2023-01-03 18:07   ` Jonathan Cameron via
2023-01-09 19:15     ` Ira Weiny
2023-01-10 15:38       ` Jonathan Cameron via
2023-01-11 14:05         ` Jonathan Cameron via
2023-01-12 15:34   ` Jonathan Cameron via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).