From: Anisa Su <anisa.su@samsung.com>
This patch adds support for FMAPI Initiate Add command (5604h) for MHSLDs. It
is based on the following branch:
https://gitlab.com/jic23/qemu/-/tree/cxl-2025-07-03
This code was tested by starting 2 VMs, host_1, which initializes the MHSLD, and
host_2, with the following topologies, then sending the FMAPI command from both
hosts.
host_1 = "-device usb-ehci,id=ehci \
-object memory-backend-file,id=cxl-mem1,mem-path=/tmp/t3_cxl1.raw,size=4G \
-object memory-backend-file,id=cxl-lsa1,mem-path=/tmp/t3_lsa1.raw,size=1M \
-device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1,hdm_for_passthrough=true \
-device cxl-rp,port=0,bus=cxl.1,id=cxl_rp_port0,chassis=0,slot=2 \
-device cxl-mhsld,bus=cxl_rp_port0,num-dc-regions=2,volatile-dc-memdev=cxl-mem1,id=cxl-mhd0,sn=99,mhd-head=0,mhd-state_file=mhd_metadata,mhd-init=true \
-device usb-cxl-mctp,bus=ehci.0,id=usb0,target=cxl-mhd0\
-machine cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G,cxl-fmw.0.interleave-granularity=1k"
host_2 = "-device usb-ehci,id=ehci \
-object memory-backend-file,id=cxl-mem1,mem-path=/tmp/t3_cxl1.raw,size=4G \
-object memory-backend-file,id=cxl-lsa1,mem-path=/tmp/t3_lsa1.raw,size=1M \
-device pxb-cxl,bus_nr=12,bus=pcie.0,id=cxl.1,hdm_for_passthrough=true \
-device cxl-rp,port=0,bus=cxl.1,id=cxl_rp_port0,chassis=0,slot=2 \
-device cxl-mhsld,bus=cxl_rp_port0,num-dc-regions=2,volatile-dc-memdev=cxl-mem1,id=cxl-mhd0,sn=99,mhd-head=1,mhd-state_file=mhd_metadata,mhd-init=false \
-device usb-cxl-mctp,bus=ehci.0,id=usb0,target=cxl-mhd0\
-machine cxl-fmw.0.targets.0=cxl.1,cxl-fmw.0.size=4G,cxl-fmw.0.interleave-granularity=1k"
libcxlmi is cloned on both hosts and used to send the FMAPI add/release commands
from both host_1 and host_2 and the expected behavior is verified by printing
the response payload from the Get DC Region Lists command (5603h).
The following interactive program from libcxlmi is
used to do so: https://github.com/computexpresslink/libcxlmi/blob/main/examples/fmapi-mctp.c
Question:
Currently, the input payload to FMAPI Init Add contains an array of CXLDCExtentRaw
elements. The mshld_reserve_extents() function expects a pointer of type
CxlDynamicCapacityExtentList, so a loop is introduced to convert CXLDCExtentRaw[]
to CxlDynamicCapacityExtentList.
I am wondering why the typedefs for extents/extent list in qapi-types-cxl.h
are separate from the typedefs in cxl_device.h? Is there a nice way to avoid
introducing a loop here just to convert types here?
Anisa Su (1):
hw/cxl/cxl-mailbox-utils: Enable FMAPI Initiate Add for MHSLD
hw/cxl/cxl-mailbox-utils.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
--
2.51.0