Skip to contentSkip to conversation

cxl: Multi-headed Single Logical Device (MHSLD)

RFC PATCH New Gregory Price 1 participant 1 message Mar 8, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 cxl: Multi-headed Single Logical Device (MHSLD)

Implement the scaffolding for an MHSLD with a simple multi-headed command set. This device inherits the cxl-type3 device and will provide the hooks needed to serialize multi-system devices.

This device requires linux, as it uses shared memory (shmem) to implement the shared state. This also limits the emulation of multiple guests to a single host.

To instantiate:

-device cxl-mhsld,bus=rp0,volatile-memdev=mem0,id=cxl-mem0,sn=66666,mhd-head=0,mhd-shmid=15

The MH-SLD shared memory region must be initialized via 'init_mhsld' tool located in the cxl/mhsld directory.

usage: init_mhsld <heads> <shmid>
heads : number of heads on the device
shmid : shmid produced by ipcmk

Example:
$shmid1=ipcmk -M 131072
./init_mhseld 4 $shmid

What we should discuss:
* What state needs to be in MHSLDSharedState
- for DCD
- for other CXL extentions? (RAS?)

* What hooks we need to add to cxl-type3 for MHDs
- Example: cvc->mhd_access_valid was added for Niagara
- Additional calls will need to be added for things like DCD

* Shared state design and serialization
- right now we use the same shared memory solution, this makes serialization a little easier since we can use a mutex in shmem
- This limits emulation of MHSLD devices to QEMU guests located on the same host, but this seems fine for functional testing.

* Shared state initialization
- right now i use the external tool, but if we want to limit the ability to test things like restarting hosts, we could instead add an explicit initialize_state=true option to the device and ditch the extra program.

---
 hw/cxl/Kconfig            |   1 +
 hw/cxl/meson.build        |   1 +
 hw/cxl/mhsld/.gitignore   |   1 +
 hw/cxl/mhsld/Kconfig      |   4 +
 hw/cxl/mhsld/init_mhsld.c |  76 ++++++++++++++++
 hw/cxl/mhsld/meson.build  |   3 +
 hw/cxl/mhsld/mhsld.c      | 177 ++++++++++++++++++++++++++++++++++++++
 hw/cxl/mhsld/mhsld.h      |  64 ++++++++++++++
 8 files changed, 327 insertions(+)
 create mode 100644 hw/cxl/mhsld/.gitignore
 create mode 100644 hw/cxl/mhsld/Kconfig
 create mode 100644 hw/cxl/mhsld/init_mhsld.c
 create mode 100644 hw/cxl/mhsld/meson.build
 create mode 100644 hw/cxl/mhsld/mhsld.c
 create mode 100644 hw/cxl/mhsld/mhsld.h
hw/cxl/Kconfig +1 -0
index e603839a62..919e59b598 100644
@@ -1,3 +1,4 @@
+source mhsld/Kconfig
 source vendor/Kconfig
 
 config CXL
hw/cxl/meson.build +1 -0
index e8c8c1355a..394750dd19 100644
@@ -16,4 +16,5 @@ system_ss.add(when: 'CONFIG_I2C_MCTP_CXL', if_true: files('i2c_mctp_cxl.c'))
 
 system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl-host-stubs.c'))
 
+subdir('mhsld')
 subdir('vendor')
hw/cxl/mhsld/.gitignore new file +1 -0
new file mode 100644
index 0000000000..f9f6a37cc0
@@ -0,0 +1 @@
+init_mhsld
hw/cxl/mhsld/Kconfig new file +4 -0
new file mode 100644
index 0000000000..dc2be15140
@@ -0,0 +1,4 @@
+config CXL_MHSLD
+    bool
+    depends on CXL_MEM_DEVICE
+    default y
hw/cxl/mhsld/init_mhsld.c new file +76 -0

76 lines not on this page · raw message

hw/cxl/mhsld/meson.build new file +3 -0
new file mode 100644
index 0000000000..c595558f8a
@@ -0,0 +1,3 @@
+if host_os == 'linux'
+	system_ss.add(when: 'CONFIG_CXL_MHSLD', if_true: files('mhsld.c',))
+endif
hw/cxl/mhsld/mhsld.c new file +177 -0

177 lines not on this page · raw message

hw/cxl/mhsld/mhsld.h new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.39.1