cxl/acpi: Improve debug messages in cxl_acpi_probe()
authorRobert Richter <rrichter@amd.com>
Tue, 18 Oct 2022 13:23:33 +0000 (15:23 +0200)
committerDan Williams <dan.j.williams@intel.com>
Mon, 14 Nov 2022 20:11:27 +0000 (12:11 -0800)
In cxl_acpi_probe() the iterator bus_for_each_dev() walks through all
CXL hosts. Since all dev_*() debug messages point to the ACPI0017
device which is the CXL root for all hosts, the device information is
pointless as it is always the same device. Change this to use the host
device for this instead.

Also, add additional host specific information such as CXL support,
UID and CHBCR.

This is an example log:

 acpi ACPI0016:00: UID found: 4
 acpi ACPI0016:00: CHBCR found: 0x28090000000
 acpi ACPI0016:00: dport added to root0
 acpi ACPI0016:00: host-bridge: ACPI0016:00
  pci0000:7f: host supports CXL

Signed-off-by: Robert Richter <rrichter@amd.com>
Link: https://lore.kernel.org/r/20221018132341.76259-6-rrichter@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/acpi.c

index 31e104f0210ffc386f22f2642caa068ad38e374e..fb9f72813067cca1eb33162b5487751572bc149c 100644 (file)
@@ -221,6 +221,8 @@ static int add_host_bridge_uport(struct device *match, void *arg)
        if (IS_ERR(port))
                return PTR_ERR(port);
 
+       dev_info(pci_root->bus->bridge, "host supports CXL\n");
+
        return 0;
 }
 
@@ -264,11 +266,12 @@ static int add_host_bridge_dport(struct device *match, void *arg)
        status = acpi_evaluate_integer(bridge->handle, METHOD_NAME__UID, NULL,
                                       &uid);
        if (status != AE_OK) {
-               dev_err(host, "unable to retrieve _UID of %s\n",
-                       dev_name(match));
+               dev_err(match, "unable to retrieve _UID\n");
                return -ENODEV;
        }
 
+       dev_dbg(match, "UID found: %lld\n", uid);
+
        ctx = (struct cxl_chbs_context) {
                .dev = host,
                .uid = uid,
@@ -276,11 +279,12 @@ static int add_host_bridge_dport(struct device *match, void *arg)
        acpi_table_parse_cedt(ACPI_CEDT_TYPE_CHBS, cxl_get_chbcr, &ctx);
 
        if (ctx.chbcr == 0) {
-               dev_warn(host, "No CHBS found for Host Bridge: %s\n",
-                        dev_name(match));
+               dev_warn(match, "No CHBS found for Host Bridge (UID %lld)\n", uid);
                return 0;
        }
 
+       dev_dbg(match, "CHBCR found: 0x%08llx\n", (u64)ctx.chbcr);
+
        dport = devm_cxl_add_dport(root_port, match, uid, ctx.chbcr);
        if (IS_ERR(dport))
                return PTR_ERR(dport);