Skip to content

Commit 5b906b3

Browse files
chenhuacaigregkh
authored andcommitted
LoongArch: Use per-root-bridge PCIH flag to skip mem resource fixup
commit 49f3384 upstream. When firmware enables 64-bit PCI host bridge support, some root bridges already provide valid 64-bit mem resource windows through ACPI. In this case, the LoongArch-specific mem resource high-bits fixup in acpi_prepare_root_resources() should not be applied unconditionally. Otherwise, the kernel may override the native resource layout derived from firmware, and later BAR assignment can fail to place device BARs into the intended 64-bit address space correctly. Add a per-root-bridge ACPI flag, PCIH, and evaluate it from the current root bridge device scope. When PCIH is set, skip the mem resource high- bits fixup path and let the kernel use the firmware-provided resource description directly. When PCIH is absent or cleared, keep the existing behavior and continue filling the high address bits from the host bridge address. This makes the behavior per-root-bridge configurable and avoids breaking valid 64-bit BAR space allocation on bridges whose 64-bit windows have already been fully described by firmware. Cc: stable@vger.kernel.org Suggested-by: Chao Li <lichao@loongson.cn> Tested-by: Dongyan Qian <qiandongyan@loongson.cn> Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dd0b628 commit 5b906b3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

arch/loongarch/pci/acpi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,16 @@ static void acpi_release_root_info(struct acpi_pci_root_info *ci)
6161
static int acpi_prepare_root_resources(struct acpi_pci_root_info *ci)
6262
{
6363
int status;
64+
unsigned long long pci_h = 0;
6465
struct resource_entry *entry, *tmp;
6566
struct acpi_device *device = ci->bridge;
6667

6768
status = acpi_pci_probe_root_resources(ci);
6869
if (status > 0) {
70+
acpi_evaluate_integer(device->handle, "PCIH", NULL, &pci_h);
71+
if (pci_h)
72+
return status;
73+
6974
resource_list_for_each_entry_safe(entry, tmp, &ci->resources) {
7075
if (entry->res->flags & IORESOURCE_MEM) {
7176
entry->offset = ci->root->mcfg_addr & GENMASK_ULL(63, 40);

0 commit comments

Comments
 (0)