Commit 9071080d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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()
parents aa5216a2 448a60e8
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -442,7 +442,7 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
		return -EINVAL;
	}

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

@@ -455,7 +455,7 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
			value = hmat_normalize(entries[init * tpds + targ],
					       hmat_loc->entry_base_unit,
					       type);
			pr_info("  Initiator-Target[%u-%u]:%u%s\n",
			pr_debug("  Initiator-Target[%u-%u]:%u%s\n",
				 inits[init], targs[targ], value,
				 hmat_data_type_suffix(type));

@@ -485,7 +485,7 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
	}

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

@@ -546,7 +546,7 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade
	}

	if (hmat_revision == 1)
		pr_info("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
		pr_debug("Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
			 p->reserved3, p->reserved4, p->flags, p->processor_PD,
			 p->memory_PD);
	else
+3 −3
Original line number Diff line number Diff line
@@ -291,11 +291,11 @@ static int devm_cxl_enable_hdm(struct device *host, struct cxl_hdm *cxlhdm)
	return devm_add_action_or_reset(host, disable_hdm, cxlhdm);
}

int cxl_dvsec_rr_decode(struct device *dev, struct cxl_port *port,
int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
			struct cxl_endpoint_dvsec_info *info)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
	struct pci_dev *pdev = to_pci_dev(cxlds->dev);
	struct device *dev = cxlds->dev;
	int hdm_count, rc, i, ranges = 0;
	int d = cxlds->cxl_dvsec;
	u16 cap, ctrl;
+34 −22
Original line number Diff line number Diff line
@@ -289,20 +289,16 @@ static bool cxl_decode_regblock(struct pci_dev *pdev, u32 reg_lo, u32 reg_hi,
	return true;
}

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

	map->resource = CXL_RESOURCE_NONE;
	if (index == CXL_INSTANCES_COUNT)
		return instance;

	return -ENODEV;
}

/**
 * cxl_find_regblock_instance() - Locate a register block by type / index
 * @pdev: The CXL PCI device to enumerate.
 * @type: Register Block Indicator id
 * @map: Enumeration output, clobbered on error
 * @index: Index into which particular instance of a regblock wanted in the
 *	   order found in register locator DVSEC.
 *
 * Return: 0 if register block enumerated, negative error code otherwise
 *
 * A CXL DVSEC may point to one or more register blocks, search for them
 * by @type and @index.
 */
int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type,
			       struct cxl_register_map *map, unsigned int index)
{
	return __cxl_find_regblock_instance(pdev, type, map, index);
}
EXPORT_SYMBOL_NS_GPL(cxl_find_regblock_instance, "CXL");

/**
@@ -360,7 +378,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_find_regblock_instance, "CXL");
int cxl_find_regblock(struct pci_dev *pdev, enum cxl_regloc_type type,
		      struct cxl_register_map *map)
{
	return cxl_find_regblock_instance(pdev, type, map, 0);
	return __cxl_find_regblock_instance(pdev, type, map, 0);
}
EXPORT_SYMBOL_NS_GPL(cxl_find_regblock, "CXL");

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

	while (1) {
		rc = cxl_find_regblock_instance(pdev, type, &map, count);
		if (rc)
			return count;
		count++;
	}
	return __cxl_find_regblock_instance(pdev, type, &map, CXL_INSTANCES_COUNT);
}
EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, "CXL");

+217 −42

File changed.

Preview size limit exceeded, changes collapsed.

+4 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading