Skip to content

Commit 9e058c2

Browse files
committed
Merge tag 'pci-v6.2-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull pci fixes from Bjorn Helgaas: - Work around apparent firmware issue that made Linux reject MMCONFIG space, which broke PCI extended config space (Bjorn Helgaas) - Fix CONFIG_PCIE_BT1 dependency due to mid-air collision between a PCI_MSI_IRQ_DOMAIN -> PCI_MSI change and addition of PCIE_BT1 (Lukas Bulwahn) * tag 'pci-v6.2-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: x86/pci: Treat EfiMemoryMappedIO as reservation of ECAM space x86/pci: Simplify is_mmconf_reserved() messages PCI: dwc: Adjust to recent removal of PCI_MSI_IRQ_DOMAIN
2 parents 92783a9 + fd3a8cf commit 9e058c2

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

arch/x86/pci/mmconfig-shared.c

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
#include <linux/acpi.h>
15+
#include <linux/efi.h>
1516
#include <linux/pci.h>
1617
#include <linux/init.h>
1718
#include <linux/bitmap.h>
@@ -442,17 +443,42 @@ static bool is_acpi_reserved(u64 start, u64 end, enum e820_type not_used)
442443
return mcfg_res.flags;
443444
}
444445

446+
static bool is_efi_mmio(u64 start, u64 end, enum e820_type not_used)
447+
{
448+
#ifdef CONFIG_EFI
449+
efi_memory_desc_t *md;
450+
u64 size, mmio_start, mmio_end;
451+
452+
for_each_efi_memory_desc(md) {
453+
if (md->type == EFI_MEMORY_MAPPED_IO) {
454+
size = md->num_pages << EFI_PAGE_SHIFT;
455+
mmio_start = md->phys_addr;
456+
mmio_end = mmio_start + size;
457+
458+
/*
459+
* N.B. Caller supplies (start, start + size),
460+
* so to match, mmio_end is the first address
461+
* *past* the EFI_MEMORY_MAPPED_IO area.
462+
*/
463+
if (mmio_start <= start && end <= mmio_end)
464+
return true;
465+
}
466+
}
467+
#endif
468+
469+
return false;
470+
}
471+
445472
typedef bool (*check_reserved_t)(u64 start, u64 end, enum e820_type type);
446473

447474
static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
448475
struct pci_mmcfg_region *cfg,
449-
struct device *dev, int with_e820)
476+
struct device *dev, const char *method)
450477
{
451478
u64 addr = cfg->res.start;
452479
u64 size = resource_size(&cfg->res);
453480
u64 old_size = size;
454481
int num_buses;
455-
char *method = with_e820 ? "E820" : "ACPI motherboard resources";
456482

457483
while (!is_reserved(addr, addr + size, E820_TYPE_RESERVED)) {
458484
size >>= 1;
@@ -464,10 +490,10 @@ static bool __ref is_mmconf_reserved(check_reserved_t is_reserved,
464490
return false;
465491

466492
if (dev)
467-
dev_info(dev, "MMCONFIG at %pR reserved in %s\n",
493+
dev_info(dev, "MMCONFIG at %pR reserved as %s\n",
468494
&cfg->res, method);
469495
else
470-
pr_info(PREFIX "MMCONFIG at %pR reserved in %s\n",
496+
pr_info(PREFIX "MMCONFIG at %pR reserved as %s\n",
471497
&cfg->res, method);
472498

473499
if (old_size != size) {
@@ -500,7 +526,8 @@ static bool __ref
500526
pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int early)
501527
{
502528
if (!early && !acpi_disabled) {
503-
if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, 0))
529+
if (is_mmconf_reserved(is_acpi_reserved, cfg, dev,
530+
"ACPI motherboard resource"))
504531
return true;
505532

506533
if (dev)
@@ -513,6 +540,10 @@ pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int e
513540
"MMCONFIG at %pR not reserved in "
514541
"ACPI motherboard resources\n",
515542
&cfg->res);
543+
544+
if (is_mmconf_reserved(is_efi_mmio, cfg, dev,
545+
"EfiMemoryMappedIO"))
546+
return true;
516547
}
517548

518549
/*
@@ -527,7 +558,8 @@ pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int e
527558
/* Don't try to do this check unless configuration
528559
type 1 is available. how about type 2 ?*/
529560
if (raw_pci_ops)
530-
return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1);
561+
return is_mmconf_reserved(e820__mapped_all, cfg, dev,
562+
"E820 entry");
531563

532564
return false;
533565
}

drivers/pci/controller/dwc/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ config PCIE_ARTPEC6_EP
225225
config PCIE_BT1
226226
tristate "Baikal-T1 PCIe controller"
227227
depends on MIPS_BAIKAL_T1 || COMPILE_TEST
228-
depends on PCI_MSI_IRQ_DOMAIN
228+
depends on PCI_MSI
229229
select PCIE_DW_HOST
230230
help
231231
Enables support for the PCIe controller in the Baikal-T1 SoC to work

0 commit comments

Comments
 (0)