Skip to content

Commit 9071080

Browse files
committed
Merge tag 'cxl-for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull Compute Express Link (CXL) updates from Dave Jiang: "A tweak to the HMAT output that was acked by Rafael, a prep patch for CXL type2 devices support that's coming soon, refactoring of the CXL regblock enumeration code, and a series of patches to update the event records to CXL spec r3.1: - Move HMAT printouts to pr_debug() - Add CXL type2 support to cxl_dvsec_rr_decode() in preparation for type2 support - A series that updates CXL event records to spec r3.1 and related changes - Refactoring of cxl_find_regblock_instance() to count regblocks" * tag 'cxl-for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: cxl/core/regs: Refactor out functions to count regblocks of given type cxl/test: Update test code for event records to CXL spec rev 3.1 cxl/events: Update Memory Module Event Record to CXL spec rev 3.1 cxl/events: Update DRAM Event Record to CXL spec rev 3.1 cxl/events: Update General Media Event Record to CXL spec rev 3.1 cxl/events: Add Component Identifier formatting for CXL spec rev 3.1 cxl/events: Update Common Event Record to CXL spec rev 3.1 cxl/pci: Add CXL Type 1/2 support to cxl_dvsec_rr_decode() ACPI/HMAT: Move HMAT messages to pr_debug()
2 parents aa5216a + 448a60e commit 9071080

File tree

10 files changed

+319
-97
lines changed

10 files changed

+319
-97
lines changed

drivers/acpi/numa/hmat.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,9 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
442442
return -EINVAL;
443443
}
444444

445-
pr_info("Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n",
446-
hmat_loc->flags, hmat_data_type(type), ipds, tpds,
447-
hmat_loc->entry_base_unit);
445+
pr_debug("Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n",
446+
hmat_loc->flags, hmat_data_type(type), ipds, tpds,
447+
hmat_loc->entry_base_unit);
448448

449449
inits = (u32 *)(hmat_loc + 1);
450450
targs = inits + ipds;
@@ -455,9 +455,9 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
455455
value = hmat_normalize(entries[init * tpds + targ],
456456
hmat_loc->entry_base_unit,
457457
type);
458-
pr_info(" Initiator-Target[%u-%u]:%u%s\n",
459-
inits[init], targs[targ], value,
460-
hmat_data_type_suffix(type));
458+
pr_debug(" Initiator-Target[%u-%u]:%u%s\n",
459+
inits[init], targs[targ], value,
460+
hmat_data_type_suffix(type));
461461

462462
hmat_update_target(targs[targ], inits[init],
463463
mem_hier, type, value);
@@ -485,9 +485,9 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
485485
}
486486

487487
attrs = cache->cache_attributes;
488-
pr_info("Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
489-
cache->memory_PD, cache->cache_size, attrs,
490-
cache->number_of_SMBIOShandles);
488+
pr_debug("Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
489+
cache->memory_PD, cache->cache_size, attrs,
490+
cache->number_of_SMBIOShandles);
491491

492492
target = find_mem_target(cache->memory_PD);
493493
if (!target)
@@ -546,9 +546,9 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade
546546
}
547547

548548
if (hmat_revision == 1)
549-
pr_info("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
550-
p->reserved3, p->reserved4, p->flags, p->processor_PD,
551-
p->memory_PD);
549+
pr_debug("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
550+
p->reserved3, p->reserved4, p->flags, p->processor_PD,
551+
p->memory_PD);
552552
else
553553
pr_info("Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
554554
p->flags, p->processor_PD, p->memory_PD);

drivers/cxl/core/pci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,11 @@ static int devm_cxl_enable_hdm(struct device *host, struct cxl_hdm *cxlhdm)
291291
return devm_add_action_or_reset(host, disable_hdm, cxlhdm);
292292
}
293293

294-
int cxl_dvsec_rr_decode(struct device *dev, struct cxl_port *port,
294+
int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
295295
struct cxl_endpoint_dvsec_info *info)
296296
{
297-
struct pci_dev *pdev = to_pci_dev(dev);
298-
struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
297+
struct pci_dev *pdev = to_pci_dev(cxlds->dev);
298+
struct device *dev = cxlds->dev;
299299
int hdm_count, rc, i, ranges = 0;
300300
int d = cxlds->cxl_dvsec;
301301
u16 cap, ctrl;

drivers/cxl/core/regs.c

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -289,21 +289,17 @@ static bool cxl_decode_regblock(struct pci_dev *pdev, u32 reg_lo, u32 reg_hi,
289289
return true;
290290
}
291291

292-
/**
293-
* cxl_find_regblock_instance() - Locate a register block by type / index
294-
* @pdev: The CXL PCI device to enumerate.
295-
* @type: Register Block Indicator id
296-
* @map: Enumeration output, clobbered on error
297-
* @index: Index into which particular instance of a regblock wanted in the
298-
* order found in register locator DVSEC.
299-
*
300-
* Return: 0 if register block enumerated, negative error code otherwise
292+
/*
293+
* __cxl_find_regblock_instance() - Locate a register block or count instances by type / index
294+
* Use CXL_INSTANCES_COUNT for @index if counting instances.
301295
*
302-
* A CXL DVSEC may point to one or more register blocks, search for them
303-
* by @type and @index.
296+
* __cxl_find_regblock_instance() may return:
297+
* 0 - if register block enumerated.
298+
* >= 0 - if counting instances.
299+
* < 0 - error code otherwise.
304300
*/
305-
int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
306-
struct cxl_register_map *map, int index)
301+
static int __cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
302+
struct cxl_register_map *map, int index)
307303
{
308304
u32 regloc_size, regblocks;
309305
int instance = 0;
@@ -342,8 +338,30 @@ int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
342338
}
343339

344340
map->resource = CXL_RESOURCE_NONE;
341+
if (index == CXL_INSTANCES_COUNT)
342+
return instance;
343+
345344
return -ENODEV;
346345
}
346+
347+
/**
348+
* cxl_find_regblock_instance() - Locate a register block by type / index
349+
* @pdev: The CXL PCI device to enumerate.
350+
* @type: Register Block Indicator id
351+
* @map: Enumeration output, clobbered on error
352+
* @index: Index into which particular instance of a regblock wanted in the
353+
* order found in register locator DVSEC.
354+
*
355+
* Return: 0 if register block enumerated, negative error code otherwise
356+
*
357+
* A CXL DVSEC may point to one or more register blocks, search for them
358+
* by @type and @index.
359+
*/
360+
int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
361+
struct cxl_register_map *map, unsigned int index)
362+
{
363+
return __cxl_find_regblock_instance(pdev, type, map, index);
364+
}
347365
EXPORT_SYMBOL_NS_GPL(cxl_find_regblock_instance, "CXL");
348366

349367
/**
@@ -360,7 +378,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_find_regblock_instance, "CXL");
360378
int cxl_find_regblock(struct pci_dev *pdev, enum cxl_regloc_type type,
361379
struct cxl_register_map *map)
362380
{
363-
return cxl_find_regblock_instance(pdev, type, map, 0);
381+
return __cxl_find_regblock_instance(pdev, type, map, 0);
364382
}
365383
EXPORT_SYMBOL_NS_GPL(cxl_find_regblock, "CXL");
366384

@@ -371,19 +389,13 @@ EXPORT_SYMBOL_NS_GPL(cxl_find_regblock, "CXL");
371389
*
372390
* Some regblocks may be repeated. Count how many instances.
373391
*
374-
* Return: count of matching regblocks.
392+
* Return: non-negative count of matching regblocks, negative error code otherwise.
375393
*/
376394
int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type)
377395
{
378396
struct cxl_register_map map;
379-
int rc, count = 0;
380397

381-
while (1) {
382-
rc = cxl_find_regblock_instance(pdev, type, &map, count);
383-
if (rc)
384-
return count;
385-
count++;
386-
}
398+
return __cxl_find_regblock_instance(pdev, type, &map, CXL_INSTANCES_COUNT);
387399
}
388400
EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, "CXL");
389401

0 commit comments

Comments
 (0)