cxl_mem error with QEMU device: probe fails
Hi,
I am trying to get familiar with the CXL devices and the CXL driver using the QEMU/CXL emulator. This is the configuration that I am testing:
Kernel : Linux version 5.18.16 on Fedora 36
QEMU : Built from qemu/qemu/tree/staging git
The QEMU parameters that I am using are as follows (to instantiate one type 3 device):
object memory-backend-ram,size=4G,id=mem0 \
-numa node,nodeid=0,cpus=0-3,memdev=mem0 \
-device pxb-cxl,id=cxl.0,bus=pcie.0,bus_nr=52 \
-M cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.size=4G \
-device cxl-rp,id=rp0,bus=cxl.0,chassis=0,slot=2 \
-object memory-backend-file,id=cxl-mem0,mem-path=/tmp/cxltest.raw,size=256M \
-object memory-backend-file,id=lsa0,mem-path=/tmp/lsa.raw,size=256M \
-device cxl-type3,bus=rp0,memdev=cxl-mem0,lsa=lsa0,id=cxl-pmem0
When the VM comes up, I do not see any CXL device that is created.
dmesg has the following:
[ 5.193125] cxl_pci 0000:35:00.0: DVSEC ranges already programmed and HDM decoders not enabled. [ 5.200500] cxl_mem mem0: Active DVSEC range registers in use. Will not bind. [ 5.206712] cxl_mem: probe of mem0 failed with error -16
Browsing the drivers/cxl/mem.c code, it seems that “global_ctrl” variable for HDM decode is not set. Perhaps I am missing some qemu flag to enable HDM decoder?
When I comment out this block (at line 109)
if (!global_enable && info->ranges) {and rebuild, the mem device gets created.
Any help and pointers will be appreciated.
Thanks,
Kannan