Skip to content

Commit 2dd1827

Browse files
Robert Richterdjbw
authored andcommitted
cxl/pci: Store the endpoint's Component Register mappings in struct cxl_dev_state
Same as for ports and dports, also store the endpoint's Component Register mappings, use struct cxl_dev_state for that. Keep the Component Register base address @component_reg_phys a bit to not break functionality. It will be removed after the transition in a later patch. Signed-off-by: Terry Bowman <terry.bowman@amd.com> Signed-off-by: Robert Richter <rrichter@amd.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20231018171713.1883517-7-rrichter@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 4d75876 commit 2dd1827

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

drivers/cxl/core/mbox.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,8 @@ struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev)
13771377
mutex_init(&mds->mbox_mutex);
13781378
mutex_init(&mds->event.log_lock);
13791379
mds->cxlds.dev = dev;
1380+
mds->cxlds.reg_map.host = dev;
1381+
mds->cxlds.reg_map.resource = CXL_RESOURCE_NONE;
13801382
mds->cxlds.type = CXL_DEVTYPE_CLASSMEM;
13811383

13821384
return mds;

drivers/cxl/cxlmem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ enum cxl_devtype {
397397
*
398398
* @dev: The device associated with this CXL state
399399
* @cxlmd: The device representing the CXL.mem capabilities of @dev
400+
* @reg_map: component and ras register mapping parameters
400401
* @regs: Parsed register blocks
401402
* @cxl_dvsec: Offset to the PCIe device DVSEC
402403
* @rcd: operating in RCD mode (CXL 3.0 9.11.8 CXL Devices Attached to an RCH)
@@ -411,6 +412,7 @@ enum cxl_devtype {
411412
struct cxl_dev_state {
412413
struct device *dev;
413414
struct cxl_memdev *cxlmd;
415+
struct cxl_register_map reg_map;
414416
struct cxl_regs regs;
415417
int cxl_dvsec;
416418
bool rcd;

drivers/cxl/pci.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -835,15 +835,16 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
835835
* still be useful for management functions so don't return an error.
836836
*/
837837
cxlds->component_reg_phys = CXL_RESOURCE_NONE;
838-
rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, &map);
838+
rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT,
839+
&cxlds->reg_map);
839840
if (rc)
840841
dev_warn(&pdev->dev, "No component registers (%d)\n", rc);
841-
else if (!map.component_map.ras.valid)
842+
else if (!cxlds->reg_map.component_map.ras.valid)
842843
dev_dbg(&pdev->dev, "RAS registers not found\n");
843844

844-
cxlds->component_reg_phys = map.resource;
845+
cxlds->component_reg_phys = cxlds->reg_map.resource;
845846

846-
rc = cxl_map_component_regs(&map, &cxlds->regs.component,
847+
rc = cxl_map_component_regs(&cxlds->reg_map, &cxlds->regs.component,
847848
BIT(CXL_CM_CAP_CAP_ID_RAS));
848849
if (rc)
849850
dev_dbg(&pdev->dev, "Failed to map RAS capability.\n");

0 commit comments

Comments
 (0)