Re: [PATCH v11 05/12] cxl: Cache endpoint decoder settings during PCI enumeration

From: Srirangan Madhavan

Date: Wed Sep 09 2026 - 20:10:23 EST


On 9/2/26 7:03 AM, Li Ming wrote:
+             return true;
+
+     pci_cxl_hdm_init(pdev);

I forgot to ask a question in v10, sorry about that.

I am wondering why calling pci_cxl_hdm_init() in
cxl_pci_hdm_decoder_count_match() is needed. pci_bus_add_device()
already does pci_cxl_hdm_init(), so if my understanding is correct,
pdev->hdm is not NULL here, so this pci_cxl_hdm_init() here will not do
anything except checking if pdev->hdm is NULL. I am not sure if I miss
some cases for that.

Hi Li Ming!
Your question is valid. pci_bus_add_device() is the normal initialization path. The later call is a retry for cases where that attempt did not publish pdev->hdm, for example because allocation or MMIO mapping failed at that point.
If initialization succeeded earlier, the existing cache is detected and the retry returns without rebuilding it. I clarified this behavior in the v12 commit message.

--
Regards,
Srirangan