Linux CXL
 help / color / mirror / Atom feed
* [Question] How to set up DVSEC CXL Range Registers for DCD devices
@ 2023-06-29 17:10 Fan Ni
  2023-07-06  1:46 ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Fan Ni @ 2023-06-29 17:10 UTC (permalink / raw)
  To: linux-cxl
  Cc: dan.j.williams, vishal.l.verma, a.manzanares, dave,
	nmtadam.samsung, nifan, fan.ni, jonathan.cameron

Hi,

When preparing the DCD patches for QEMU emulation and testing, I hit an issue
when trying to load the cxl modules. The issue happens when the kernel tries
to do cxl pci probe where it checks whether the media is ready
through cxl_await_media_ready. The function will check dvsec mem range.

In current QEMU code, the dvsec range registers for type3 memdev is set
only for static ram and pmem in function build_dvsecs, which will cause
the kernel fails the check of media ready of DCD devices without static
capacity.

About the issue, I have following questions that want to ask and
clarify,

1. do we allow DCD device have no static (RAM/PMEM) capacity at all and
only dynamic capacity?

2. Do we need to set dvsec range registers for dynamic capacity? And how
if needed?

In current Qemu code, we assume at least one of ram or pmem static capacity
exists. The code logic of build_dvsec looks like below,
if (vmem){
	set rang1 base and size with vmem info;
	if (pmem)
		set range2 base and size with pmem info;
} else {
	set range1 base and size with pmem info;
}

To fix the issue above and make kernel works for DCD (with no static ram/pmem),
I updated the logic as below and it seems to pass the modprobe.

if (vmem) {
	set rang1 base and size with vmem info;
	if (pmem)
		set range2 base and size with pmem info;
	else if (dc){
		set range2 base and size with dc info;
	}
} else if (pmem){
	set rang1 base and size with pmem info;
	if (dc)
		set range2 base and size with dc info;
} else 
	set rang1 base and size with dc info;

Is the above logic reasonable? If not, what is the right way?


Thanks,
Fan


-- 
Fan Ni <nifan@outlook.com>

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

end of thread, other threads:[~2023-07-12  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-29 17:10 [Question] How to set up DVSEC CXL Range Registers for DCD devices Fan Ni
2023-07-06  1:46 ` Jonathan Cameron
2023-07-10 15:36   ` Davidlohr Bueso
2023-07-11  8:19     ` Jonathan Cameron
2023-07-12  8:48       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox