Skip to content

Commit f1d0525

Browse files
Robert Richterdjbw
authored andcommitted
cxl/regs: Remove early capability checks in Component Register setup
When probing the Component Registers in function cxl_probe_regs() there are also checks for the existence of the HDM and RAS capabilities. The checks may fail for components that do not implement the HDM capability causing the Component Registers setup to fail too. Remove the checks for a generalized use of cxl_probe_regs() and check them directly before mapping the RAS or HDM capabilities. This allows it to setup other Component Registers esp. of an RCH Downstream Port, which will be implemented in a follow-on patch. Signed-off-by: Robert Richter <rrichter@amd.com> Signed-off-by: Terry Bowman <terry.bowman@amd.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230622205523.85375-12-terry.bowman@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent d8bffff commit f1d0525

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/cxl/core/regs.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,6 @@ static int cxl_probe_regs(struct cxl_register_map *map)
369369
case CXL_REGLOC_RBI_COMPONENT:
370370
comp_map = &map->component_map;
371371
cxl_probe_component_regs(dev, base, comp_map);
372-
if (!comp_map->hdm_decoder.valid) {
373-
dev_err(dev, "HDM decoder registers not found\n");
374-
return -ENXIO;
375-
}
376-
377-
if (!comp_map->ras.valid)
378-
dev_dbg(dev, "RAS registers not found\n");
379-
380372
dev_dbg(dev, "Set up component registers\n");
381373
break;
382374
case CXL_REGLOC_RBI_MEMDEV:

drivers/cxl/pci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
630630
rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, &map);
631631
if (rc)
632632
dev_warn(&pdev->dev, "No component registers (%d)\n", rc);
633+
else if (!map.component_map.ras.valid)
634+
dev_dbg(&pdev->dev, "RAS registers not found\n");
633635

634636
cxlds->component_reg_phys = map.resource;
635637

drivers/cxl/port.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ static int cxl_endpoint_port_probe(struct cxl_port *port)
102102
return rc;
103103

104104
cxlhdm = devm_cxl_setup_hdm(port, &info);
105-
if (IS_ERR(cxlhdm))
105+
if (IS_ERR(cxlhdm)) {
106+
if (PTR_ERR(cxlhdm) == -ENODEV)
107+
dev_err(&port->dev, "HDM decoder registers not found\n");
106108
return PTR_ERR(cxlhdm);
109+
}
107110

108111
/* Cache the data early to ensure is_visible() works */
109112
read_cdat_data(port);

0 commit comments

Comments
 (0)