Skip to content

Commit ed97afb

Browse files
Ben Widawskydjbw
authored andcommitted
cxl/pci: Disambiguate cxl_pci further from cxl_mem
Commit 21e9f76 ("cxl: Rename mem to pci") introduced the cxl_pci driver which had formerly been named cxl_mem. At the time, the goal was to be as light touch as possible because there were other patches in flight. Since things have settled now, and a new cxl_mem driver will be introduced shortly, spend the LOC now to clean up the existing names. While here, fix the kernel docs to explain the situation better after the core rework that has already landed. Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent fa9a7d2 commit ed97afb

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

drivers/cxl/pci.c

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
*
1717
* This implements the PCI exclusive functionality for a CXL device as it is
1818
* defined by the Compute Express Link specification. CXL devices may surface
19-
* certain functionality even if it isn't CXL enabled.
19+
* certain functionality even if it isn't CXL enabled. While this driver is
20+
* focused around the PCI specific aspects of a CXL device, it binds to the
21+
* specific CXL memory device class code, and therefore the implementation of
22+
* cxl_pci is focused around CXL memory devices.
2023
*
2124
* The driver has several responsibilities, mainly:
2225
* - Create the memX device and register on the CXL bus.
2326
* - Enumerate device's register interface and map them.
24-
* - Probe the device attributes to establish sysfs interface.
25-
* - Provide an IOCTL interface to userspace to communicate with the device for
26-
* things like firmware update.
27+
* - Registers nvdimm bridge device with cxl_core.
28+
* - Registers a CXL mailbox with cxl_core.
2729
*/
2830

2931
#define cxl_doorbell_busy(cxlm) \
@@ -33,7 +35,7 @@
3335
/* CXL 2.0 - 8.2.8.4 */
3436
#define CXL_MAILBOX_TIMEOUT_MS (2 * HZ)
3537

36-
static int cxl_mem_wait_for_doorbell(struct cxl_mem *cxlm)
38+
static int cxl_pci_mbox_wait_for_doorbell(struct cxl_mem *cxlm)
3739
{
3840
const unsigned long start = jiffies;
3941
unsigned long end = start;
@@ -55,7 +57,7 @@ static int cxl_mem_wait_for_doorbell(struct cxl_mem *cxlm)
5557
return 0;
5658
}
5759

58-
static void cxl_mem_mbox_timeout(struct cxl_mem *cxlm,
60+
static void cxl_pci_mbox_timeout(struct cxl_mem *cxlm,
5961
struct cxl_mbox_cmd *mbox_cmd)
6062
{
6163
struct device *dev = cxlm->dev;
@@ -65,7 +67,7 @@ static void cxl_mem_mbox_timeout(struct cxl_mem *cxlm,
6567
}
6668

6769
/**
68-
* __cxl_mem_mbox_send_cmd() - Execute a mailbox command
70+
* __cxl_pci_mbox_send_cmd() - Execute a mailbox command
6971
* @cxlm: The CXL memory device to communicate with.
7072
* @mbox_cmd: Command to send to the memory device.
7173
*
@@ -86,7 +88,7 @@ static void cxl_mem_mbox_timeout(struct cxl_mem *cxlm,
8688
* not need to coordinate with each other. The driver only uses the primary
8789
* mailbox.
8890
*/
89-
static int __cxl_mem_mbox_send_cmd(struct cxl_mem *cxlm,
91+
static int __cxl_pci_mbox_send_cmd(struct cxl_mem *cxlm,
9092
struct cxl_mbox_cmd *mbox_cmd)
9193
{
9294
void __iomem *payload = cxlm->regs.mbox + CXLDEV_MBOX_PAYLOAD_OFFSET;
@@ -140,9 +142,9 @@ static int __cxl_mem_mbox_send_cmd(struct cxl_mem *cxlm,
140142
cxlm->regs.mbox + CXLDEV_MBOX_CTRL_OFFSET);
141143

142144
/* #5 */
143-
rc = cxl_mem_wait_for_doorbell(cxlm);
145+
rc = cxl_pci_mbox_wait_for_doorbell(cxlm);
144146
if (rc == -ETIMEDOUT) {
145-
cxl_mem_mbox_timeout(cxlm, mbox_cmd);
147+
cxl_pci_mbox_timeout(cxlm, mbox_cmd);
146148
return rc;
147149
}
148150

@@ -181,13 +183,13 @@ static int __cxl_mem_mbox_send_cmd(struct cxl_mem *cxlm,
181183
}
182184

183185
/**
184-
* cxl_mem_mbox_get() - Acquire exclusive access to the mailbox.
186+
* cxl_pci_mbox_get() - Acquire exclusive access to the mailbox.
185187
* @cxlm: The memory device to gain access to.
186188
*
187189
* Context: Any context. Takes the mbox_mutex.
188190
* Return: 0 if exclusive access was acquired.
189191
*/
190-
static int cxl_mem_mbox_get(struct cxl_mem *cxlm)
192+
static int cxl_pci_mbox_get(struct cxl_mem *cxlm)
191193
{
192194
struct device *dev = cxlm->dev;
193195
u64 md_status;
@@ -212,7 +214,7 @@ static int cxl_mem_mbox_get(struct cxl_mem *cxlm)
212214
* Mailbox Interface Ready bit. Therefore, waiting for the doorbell
213215
* to be ready is sufficient.
214216
*/
215-
rc = cxl_mem_wait_for_doorbell(cxlm);
217+
rc = cxl_pci_mbox_wait_for_doorbell(cxlm);
216218
if (rc) {
217219
dev_warn(dev, "Mailbox interface not ready\n");
218220
goto out;
@@ -252,12 +254,12 @@ static int cxl_mem_mbox_get(struct cxl_mem *cxlm)
252254
}
253255

254256
/**
255-
* cxl_mem_mbox_put() - Release exclusive access to the mailbox.
257+
* cxl_pci_mbox_put() - Release exclusive access to the mailbox.
256258
* @cxlm: The CXL memory device to communicate with.
257259
*
258260
* Context: Any context. Expects mbox_mutex to be held.
259261
*/
260-
static void cxl_mem_mbox_put(struct cxl_mem *cxlm)
262+
static void cxl_pci_mbox_put(struct cxl_mem *cxlm)
261263
{
262264
mutex_unlock(&cxlm->mbox_mutex);
263265
}
@@ -266,17 +268,17 @@ static int cxl_pci_mbox_send(struct cxl_mem *cxlm, struct cxl_mbox_cmd *cmd)
266268
{
267269
int rc;
268270

269-
rc = cxl_mem_mbox_get(cxlm);
271+
rc = cxl_pci_mbox_get(cxlm);
270272
if (rc)
271273
return rc;
272274

273-
rc = __cxl_mem_mbox_send_cmd(cxlm, cmd);
274-
cxl_mem_mbox_put(cxlm);
275+
rc = __cxl_pci_mbox_send_cmd(cxlm, cmd);
276+
cxl_pci_mbox_put(cxlm);
275277

276278
return rc;
277279
}
278280

279-
static int cxl_mem_setup_mailbox(struct cxl_mem *cxlm)
281+
static int cxl_pci_setup_mailbox(struct cxl_mem *cxlm)
280282
{
281283
const int cap = readl(cxlm->regs.mbox + CXLDEV_MBOX_CAPS_OFFSET);
282284

@@ -304,7 +306,7 @@ static int cxl_mem_setup_mailbox(struct cxl_mem *cxlm)
304306
return 0;
305307
}
306308

307-
static void __iomem *cxl_mem_map_regblock(struct cxl_mem *cxlm,
309+
static void __iomem *cxl_pci_map_regblock(struct cxl_mem *cxlm,
308310
u8 bar, u64 offset)
309311
{
310312
void __iomem *addr;
@@ -330,12 +332,12 @@ static void __iomem *cxl_mem_map_regblock(struct cxl_mem *cxlm,
330332
return addr;
331333
}
332334

333-
static void cxl_mem_unmap_regblock(struct cxl_mem *cxlm, void __iomem *base)
335+
static void cxl_pci_unmap_regblock(struct cxl_mem *cxlm, void __iomem *base)
334336
{
335337
pci_iounmap(to_pci_dev(cxlm->dev), base);
336338
}
337339

338-
static int cxl_mem_dvsec(struct pci_dev *pdev, int dvsec)
340+
static int cxl_pci_dvsec(struct pci_dev *pdev, int dvsec)
339341
{
340342
int pos;
341343

@@ -427,7 +429,7 @@ static void cxl_decode_register_block(u32 reg_lo, u32 reg_hi,
427429
}
428430

429431
/**
430-
* cxl_mem_setup_regs() - Setup necessary MMIO.
432+
* cxl_pci_setup_regs() - Setup necessary MMIO.
431433
* @cxlm: The CXL memory device to communicate with.
432434
*
433435
* Return: 0 if all necessary registers mapped.
@@ -436,7 +438,7 @@ static void cxl_decode_register_block(u32 reg_lo, u32 reg_hi,
436438
* regions. The purpose of this function is to enumerate and map those
437439
* registers.
438440
*/
439-
static int cxl_mem_setup_regs(struct cxl_mem *cxlm)
441+
static int cxl_pci_setup_regs(struct cxl_mem *cxlm)
440442
{
441443
void __iomem *base;
442444
u32 regloc_size, regblocks;
@@ -445,7 +447,7 @@ static int cxl_mem_setup_regs(struct cxl_mem *cxlm)
445447
struct pci_dev *pdev = to_pci_dev(dev);
446448
struct cxl_register_map *map, maps[CXL_REGLOC_RBI_TYPES];
447449

448-
regloc = cxl_mem_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
450+
regloc = cxl_pci_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
449451
if (!regloc) {
450452
dev_err(dev, "register location dvsec not found\n");
451453
return -ENXIO;
@@ -480,7 +482,7 @@ static int cxl_mem_setup_regs(struct cxl_mem *cxlm)
480482
if (reg_type > CXL_REGLOC_RBI_MEMDEV)
481483
continue;
482484

483-
base = cxl_mem_map_regblock(cxlm, bar, offset);
485+
base = cxl_pci_map_regblock(cxlm, bar, offset);
484486
if (!base)
485487
return -ENOMEM;
486488

@@ -492,7 +494,7 @@ static int cxl_mem_setup_regs(struct cxl_mem *cxlm)
492494
ret = cxl_probe_regs(cxlm, base + offset, map);
493495

494496
/* Always unmap the regblock regardless of probe success */
495-
cxl_mem_unmap_regblock(cxlm, base);
497+
cxl_pci_unmap_regblock(cxlm, base);
496498

497499
if (ret)
498500
return ret;
@@ -511,7 +513,7 @@ static int cxl_mem_setup_regs(struct cxl_mem *cxlm)
511513
return ret;
512514
}
513515

514-
static int cxl_mem_probe(struct pci_dev *pdev, const struct pci_device_id *id)
516+
static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
515517
{
516518
struct cxl_memdev *cxlmd;
517519
struct cxl_mem *cxlm;
@@ -532,11 +534,11 @@ static int cxl_mem_probe(struct pci_dev *pdev, const struct pci_device_id *id)
532534
if (IS_ERR(cxlm))
533535
return PTR_ERR(cxlm);
534536

535-
rc = cxl_mem_setup_regs(cxlm);
537+
rc = cxl_pci_setup_regs(cxlm);
536538
if (rc)
537539
return rc;
538540

539-
rc = cxl_mem_setup_mailbox(cxlm);
541+
rc = cxl_pci_setup_mailbox(cxlm);
540542
if (rc)
541543
return rc;
542544

@@ -569,15 +571,15 @@ static const struct pci_device_id cxl_mem_pci_tbl[] = {
569571
};
570572
MODULE_DEVICE_TABLE(pci, cxl_mem_pci_tbl);
571573

572-
static struct pci_driver cxl_mem_driver = {
574+
static struct pci_driver cxl_pci_driver = {
573575
.name = KBUILD_MODNAME,
574576
.id_table = cxl_mem_pci_tbl,
575-
.probe = cxl_mem_probe,
577+
.probe = cxl_pci_probe,
576578
.driver = {
577579
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
578580
},
579581
};
580582

581583
MODULE_LICENSE("GPL v2");
582-
module_pci_driver(cxl_mem_driver);
584+
module_pci_driver(cxl_pci_driver);
583585
MODULE_IMPORT_NS(CXL);

0 commit comments

Comments
 (0)