From nobody Fri Dec 19 07:31:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2B4EC61D90 for ; Tue, 21 Nov 2023 18:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234467AbjKUShN (ORCPT ); Tue, 21 Nov 2023 13:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234504AbjKUShJ (ORCPT ); Tue, 21 Nov 2023 13:37:09 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B73191 for ; Tue, 21 Nov 2023 10:36:58 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D99EC433CA; Tue, 21 Nov 2023 18:36:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700591817; bh=vo3MZDqW+Z3xew+bZ0yVaVgoQ/ZSfXW64VxgJtdChKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cenByNCBwKHrvz+iinowjOOjdRGjIHajEmb7Nj5WgFVAiS43K7P4MpCbVAcxFwe9A f4brBXwCCZ98rErjjq8oFPBg+ESciok/x4I0trA9blXfXG4PPCLLHPFV18G+9/DF/D D1d59X1zoxE5JVQrbf5MUS2twG7qAuq7o/f6weDKP0sCCzPOxg1yNgJ+3pcz3bf4xB 9HCmoUQi+A76gsnvYfbgPXahXp8X3SbbozZE+vbEPWzmJu47ZXa+vgkvHNmLVlkmwD 9dP5eHYbXy0Jy3Hca55FSLykt2i0ogukTURtptbmn2kVyi2KYIqHRDjOE7aBjaEjeM grM8SkQz04iEA== From: Bjorn Helgaas To: linux-pci@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , "Rafael J . Wysocki" , Dan Williams , Kan Liang , Tony Luck , Giovanni Cabiddu , Yunying Sun , Tomasz Pala , Sebastian Manciulea , linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH 4/9] x86/pci: Rename 'MMCONFIG' to 'ECAM', use pr_fmt Date: Tue, 21 Nov 2023 12:36:38 -0600 Message-Id: <20231121183643.249006-5-helgaas@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121183643.249006-1-helgaas@kernel.org> References: <20231121183643.249006-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Helgaas The "MMCONFIG" term is not used in PCI/PCIe specs. Replace it with "ECAM", the term used in PCIe r6.0, sec 7.2.2. Define pr_fmt() instead of repeating PREFIX in every log message. Signed-off-by: Bjorn Helgaas --- arch/x86/pci/mmconfig-shared.c | 111 ++++++++++++++------------------- arch/x86/pci/mmconfig_32.c | 2 +- arch/x86/pci/mmconfig_64.c | 6 +- 3 files changed, 52 insertions(+), 67 deletions(-) diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index bc1312d920da..896cc11013bd 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* - * mmconfig-shared.c - Low-level direct PCI config space access via - * MMCONFIG - common code between i386 and x86-64. + * Low-level direct PCI config space access via ECAM - common code between + * i386 and x86-64. * * This code does: * - known chipset handling @@ -11,6 +11,8 @@ * themselves. */ =20 +#define pr_fmt(fmt) "PCI: " fmt + #include #include #include @@ -24,9 +26,7 @@ #include #include =20 -#define PREFIX "PCI: " - -/* Indicate if the mmcfg resources have been placed into the resource tabl= e. */ +/* Indicate if the ECAM resources have been placed into the resource table= */ static bool pci_mmcfg_running_state; static bool pci_mmcfg_arch_init_failed; static DEFINE_MUTEX(pci_mmcfg_lock); @@ -90,7 +90,7 @@ static struct pci_mmcfg_region *pci_mmconfig_alloc(int se= gment, int start, res->end =3D addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1; res->flags =3D IORESOURCE_MEM | IORESOURCE_BUSY; snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN, - "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end); + "PCI ECAM %04x [bus %02x-%02x]", segment, start, end); res->name =3D new->name; =20 return new; @@ -107,10 +107,8 @@ struct pci_mmcfg_region *__init pci_mmconfig_add(int s= egment, int start, list_add_sorted(new); mutex_unlock(&pci_mmcfg_lock); =20 - pr_info(PREFIX - "MMCONFIG for domain %04x [bus %02x-%02x] at %pR " - "(base %#lx)\n", - segment, start, end, &new->res, (unsigned long)addr); + pr_info("ECAM %pR (base %#lx) for domain %04x [bus %02x-%02x]\n", + &new->res, (unsigned long)addr, segment, start, end); } =20 return new; @@ -205,7 +203,7 @@ static const char *__init pci_mmcfg_amd_fam10h(void) msr <<=3D 32; msr |=3D low; =20 - /* mmconfig is not enable */ + /* ECAM is not enabled */ if (!(msr & FAM10H_MMIO_CONF_ENABLE)) return NULL; =20 @@ -367,7 +365,7 @@ static int __init pci_mmcfg_check_hostbridge(void) name =3D pci_mmcfg_probes[i].probe(); =20 if (name) - pr_info(PREFIX "%s with MMCONFIG support\n", name); + pr_info("%s with ECAM support\n", name); } =20 /* some end_bus_number is crazy, fix it */ @@ -487,11 +485,10 @@ static bool __ref is_mmconf_reserved(check_reserved_t= is_reserved, return false; =20 if (dev) - dev_info(dev, "MMCONFIG at %pR reserved as %s\n", + dev_info(dev, "ECAM %pR reserved as %s\n", &cfg->res, method); else - pr_info(PREFIX "MMCONFIG at %pR reserved as %s\n", - &cfg->res, method); + pr_info("ECAM %pR reserved as %s\n", &cfg->res, method); =20 if (old_size !=3D size) { /* update end_bus */ @@ -500,20 +497,16 @@ static bool __ref is_mmconf_reserved(check_reserved_t= is_reserved, cfg->res.end =3D cfg->res.start + PCI_MMCFG_BUS_OFFSET(num_buses) - 1; snprintf(cfg->name, PCI_MMCFG_RESOURCE_NAME_LEN, - "PCI MMCONFIG %04x [bus %02x-%02x]", + "PCI ECAM %04x [bus %02x-%02x]", cfg->segment, cfg->start_bus, cfg->end_bus); =20 if (dev) - dev_info(dev, - "MMCONFIG " - "at %pR (base %#lx) (size reduced!)\n", - &cfg->res, (unsigned long) cfg->address); + dev_info(dev, "ECAM %pR (base %#lx) (size reduced!)\n", + &cfg->res, (unsigned long) cfg->address); else - pr_info(PREFIX - "MMCONFIG for %04x [bus%02x-%02x] " - "at %pR (base %#lx) (size reduced!)\n", - cfg->segment, cfg->start_bus, cfg->end_bus, - &cfg->res, (unsigned long) cfg->address); + pr_info("ECAM %pR (base %#lx) for %04x [bus%02x-%02x] (size reduced!)\n= ", + &cfg->res, (unsigned long) cfg->address, + cfg->segment, cfg->start_bus, cfg->end_bus); } =20 return true; @@ -530,15 +523,11 @@ pci_mmcfg_check_reserved(struct device *dev, struct p= ci_mmcfg_region *cfg, int e return true; =20 if (dev) - dev_info(dev, FW_INFO - "MMCONFIG at %pR not reserved in " - "ACPI motherboard resources\n", + dev_info(dev, FW_INFO "ECAM %pR not reserved in ACPI motherboard resour= ces\n", &cfg->res); else - pr_info(FW_INFO PREFIX - "MMCONFIG at %pR not reserved in " - "ACPI motherboard resources\n", - &cfg->res); + pr_info(FW_INFO "ECAM %pR not reserved in ACPI motherboard resources\n", + &cfg->res); =20 if (is_efi_mmio(&cfg->res)) { pr_info("ECAM %pR is EfiMemoryMappedIO; assuming valid\n", @@ -546,10 +535,10 @@ pci_mmcfg_check_reserved(struct device *dev, struct p= ci_mmcfg_region *cfg, int e conflict =3D insert_resource_conflict(&iomem_resource, &cfg->res); if (conflict) - pr_warn("MMCONFIG %pR conflicts with %s %pR\n", + pr_warn("ECAM %pR conflicts with %s %pR\n", &cfg->res, conflict->name, conflict); else - pr_info("MMCONFIG %pR reserved to work around lack of ACPI motherboard= _CRS\n", + pr_info("ECAM %pR reserved to work around lack of ACPI motherboard _CR= S\n", &cfg->res); return true; } @@ -579,7 +568,7 @@ static void __init pci_mmcfg_reject_broken(int early) =20 list_for_each_entry(cfg, &pci_mmcfg_list, list) { if (pci_mmcfg_check_reserved(NULL, cfg, early) =3D=3D 0) { - pr_info(PREFIX "not using MMCONFIG (%pR not reserved)\n", + pr_info("not using ECAM (%pR not reserved)\n", &cfg->res); free_all_mmcfg(); return; @@ -599,9 +588,9 @@ static int __init acpi_mcfg_check_entry(struct acpi_tab= le_mcfg *mcfg, if ((mcfg->header.revision >=3D 1) && (dmi_get_bios_year() >=3D 2010)) return 0; =20 - pr_err(PREFIX "MCFG region for %04x [bus %02x-%02x] at %#llx " - "is above 4GB, ignored\n", cfg->pci_segment, - cfg->start_bus_number, cfg->end_bus_number, cfg->address); + pr_err("ECAM at %#llx for %04x [bus %02x-%02x] is above 4GB, ignored\n", + cfg->address, cfg->pci_segment, cfg->start_bus_number, + cfg->end_bus_number); return -EINVAL; } =20 @@ -626,7 +615,7 @@ static int __init pci_parse_mcfg(struct acpi_table_head= er *header) i -=3D sizeof(struct acpi_mcfg_allocation); } if (entries =3D=3D 0) { - pr_err(PREFIX "MMCONFIG has no entries\n"); + pr_err("MCFG has no entries\n"); return -ENODEV; } =20 @@ -640,7 +629,7 @@ static int __init pci_parse_mcfg(struct acpi_table_head= er *header) =20 if (pci_mmconfig_add(cfg->pci_segment, cfg->start_bus_number, cfg->end_bus_number, cfg->address) =3D=3D NULL) { - pr_warn(PREFIX "no memory for MCFG entries\n"); + pr_warn("no memory for MCFG entries\n"); free_all_mmcfg(); return -ENOMEM; } @@ -677,7 +666,7 @@ static int pci_mmcfg_for_each_region(int (*func)(__u64 = start, __u64 size, =20 static void __init __pci_mmcfg_init(int early) { - pr_debug(PREFIX "%s(%s)\n", __func__, early ? "early" : "late"); + pr_debug("%s(%s)\n", __func__, early ? "early" : "late"); =20 pci_mmcfg_reject_broken(early); if (list_empty(&pci_mmcfg_list)) @@ -705,7 +694,7 @@ static int __initdata known_bridge; =20 void __init pci_mmcfg_early_init(void) { - pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe); + pr_debug("%s() pci_probe %#x\n", __func__, pci_probe); =20 if (pci_probe & PCI_PROBE_MMCONF) { if (pci_mmcfg_check_hostbridge()) @@ -720,16 +709,16 @@ void __init pci_mmcfg_early_init(void) =20 void __init pci_mmcfg_late_init(void) { - pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe); + pr_debug("%s() pci_probe %#x\n", __func__, pci_probe); =20 - /* MMCONFIG disabled */ + /* ECAM disabled */ if ((pci_probe & PCI_PROBE_MMCONF) =3D=3D 0) return; =20 if (known_bridge) return; =20 - /* MMCONFIG hasn't been enabled yet, try again */ + /* ECAM hasn't been enabled yet, try again */ if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) { acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); __pci_mmcfg_init(0); @@ -742,9 +731,9 @@ static int __init pci_mmcfg_late_insert_resources(void) =20 pci_mmcfg_running_state =3D true; =20 - pr_debug(PREFIX "%s() pci_probe %#x\n", __func__, pci_probe); + pr_debug("%s() pci_probe %#x\n", __func__, pci_probe); =20 - /* If we are not using MMCONFIG, don't insert the resources. */ + /* If we are not using ECAM, don't insert the resources. */ if ((pci_probe & PCI_PROBE_MMCONF) =3D=3D 0) return 1; =20 @@ -755,7 +744,7 @@ static int __init pci_mmcfg_late_insert_resources(void) */ list_for_each_entry(cfg, &pci_mmcfg_list, list) { if (!cfg->res.parent) { - pr_debug(PREFIX "%s() insert %pR\n", __func__, &cfg->res); + pr_debug("%s() insert %pR\n", __func__, &cfg->res); insert_resource(&iomem_resource, &cfg->res); } } @@ -764,13 +753,13 @@ static int __init pci_mmcfg_late_insert_resources(voi= d) } =20 /* - * Perform MMCONFIG resource insertion after PCI initialization to allow f= or + * Perform ECAM resource insertion after PCI initialization to allow for * misprogrammed MCFG tables that state larger sizes but actually conflict * with other system resources. */ late_initcall(pci_mmcfg_late_insert_resources); =20 -/* Add MMCFG information for host bridges */ +/* Add ECAM information for host bridges */ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end, phys_addr_t addr) { @@ -790,11 +779,9 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u= 8 start, u8 end, cfg =3D pci_mmconfig_lookup(seg, start); if (cfg) { if (cfg->end_bus < end) - dev_info(dev, FW_INFO - "MMCONFIG for " - "domain %04x [bus %02x-%02x] " - "only partially covers this bridge\n", - cfg->segment, cfg->start_bus, cfg->end_bus); + dev_info(dev, FW_INFO "ECAM %pR for domain %04x [bus %02x-%02x] only pa= rtially covers this bridge\n", + &cfg->res, cfg->segment, cfg->start_bus, + cfg->end_bus); mutex_unlock(&pci_mmcfg_lock); return -EEXIST; } @@ -807,10 +794,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, = u8 start, u8 end, rc =3D -EBUSY; cfg =3D pci_mmconfig_alloc(seg, start, end, addr); if (cfg =3D=3D NULL) { - dev_warn(dev, "fail to add MMCONFIG (out of memory)\n"); + dev_warn(dev, "fail to add ECAM (out of memory)\n"); rc =3D -ENOMEM; } else if (!pci_mmcfg_check_reserved(dev, cfg, 0)) { - dev_warn(dev, FW_BUG "MMCONFIG %pR isn't reserved\n", + dev_warn(dev, FW_BUG "ECAM %pR isn't reserved\n", &cfg->res); } else { /* Insert resource if it's not in boot stage */ @@ -819,15 +806,13 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, = u8 start, u8 end, &cfg->res); =20 if (tmp) { - dev_warn(dev, - "MMCONFIG %pR conflicts with " - "%s %pR\n", + dev_warn(dev, "ECAM %pR conflicts with %s %pR\n", &cfg->res, tmp->name, tmp); } else if (pci_mmcfg_arch_map(cfg)) { - dev_warn(dev, "fail to map MMCONFIG %pR\n", &cfg->res); + dev_warn(dev, "fail to map ECAM %pR\n", &cfg->res); } else { list_add_sorted(cfg); - dev_info(dev, "MMCONFIG at %pR (base %#lx)\n", + dev_info(dev, "ECAM %pR (base %#lx)\n", &cfg->res, (unsigned long)addr); cfg =3D NULL; rc =3D 0; @@ -845,7 +830,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8= start, u8 end, return rc; } =20 -/* Delete MMCFG information for host bridges */ +/* Delete ECAM information for host bridges */ int pci_mmconfig_delete(u16 seg, u8 start, u8 end) { struct pci_mmcfg_region *cfg; diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c index bfa789875322..f9ef97c593cf 100644 --- a/arch/x86/pci/mmconfig_32.c +++ b/arch/x86/pci/mmconfig_32.c @@ -131,7 +131,7 @@ const struct pci_raw_ops pci_mmcfg =3D { =20 int __init pci_mmcfg_arch_init(void) { - printk(KERN_INFO "PCI: Using MMCONFIG for extended config space\n"); + printk(KERN_INFO "PCI: Using ECAM for extended config space\n"); raw_pci_ext_ops =3D &pci_mmcfg; return 1; } diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c index 0c7b6e66c644..dfdeac0a7571 100644 --- a/arch/x86/pci/mmconfig_64.c +++ b/arch/x86/pci/mmconfig_64.c @@ -6,6 +6,8 @@ * space mapped. This allows lockless config space operation. */ =20 +#define pr_fmt(fmt) "PCI: " fmt + #include #include #include @@ -14,8 +16,6 @@ #include #include =20 -#define PREFIX "PCI: " - static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsi= gned int devfn) { struct pci_mmcfg_region *cfg =3D pci_mmconfig_lookup(seg, bus); @@ -138,7 +138,7 @@ int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg) { cfg->virt =3D mcfg_ioremap(cfg); if (!cfg->virt) { - pr_err(PREFIX "can't map MMCONFIG at %pR\n", &cfg->res); + pr_err("can't map ECAM at %pR\n", &cfg->res); return -ENOMEM; } =20 --=20 2.34.1