Re: [PATCH] arm64: PCI: Add quirk for platforms running Windows

From: Thomas Weißschuh
Date: Sun Feb 26 2023 - 21:56:04 EST


Hi,

On Mon, Feb 27, 2023 at 10:12:21AM +0800, Shawn Guo wrote:
> diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> index 2276689b5411..896dbd028b67 100644
> --- a/arch/arm64/kernel/pci.c
> +++ b/arch/arm64/kernel/pci.c
> @@ -109,16 +109,42 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
> return 0;
> }
>
> +#define QCOM_DSDT_QUIRK "Host bridge windows in PNP0A03 _CRS"
> +
> +static struct acpi_platform_list qcom_platlist[] = {
^^^
const

> + /* Thinkpad X13s */
> + { "LENOVO", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK },
> + /* Microsoft Surface Pro 9 (5G) and Windows Dev Kit 2023 */
> + { "QCOMM ", "SDM8280 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK },
> + /* Microsoft Surface Pro X */
> + { "QCOMM ", "SDM8180 ", 0, ACPI_SIG_DSDT, all_versions, QCOM_DSDT_QUIRK },
> + { }
> +};
> +
> static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci)
> {
> struct resource_entry *entry, *tmp;
> int status;
> + int idx;
>
> status = acpi_pci_probe_root_resources(ci);
> +
> + /*
> + * Most arm64 platforms that do not run Windows describe host bridge
> + * registers in PNP0A03 _CRS resources, but some like Qualcomm
> + * Snapdragon Windows laptops describe host bridge windows in there.
> + * We do not want to destroy the resources for these platforms.
> + */
> + idx = acpi_match_platform_list(qcom_platlist);
> + if (idx >= 0)
> + goto done;
> +
> resource_list_for_each_entry_safe(entry, tmp, &ci->resources) {
> if (!(entry->res->flags & IORESOURCE_WINDOW))
> resource_list_destroy_entry(entry);
> }
> +
> +done:
> return status;
> }
>
> --
> 2.17.1
>