[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-769ccf2c-6962-4e27-8a78-619cd16fab25-1604327243865@3c-app-gmx-bap57>
Date: Mon, 2 Nov 2020 15:27:23 +0100
From: Frank Wunderlich <frank-w@...lic-files.de>
To: Marc Zyngier <maz@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ryder Lee <ryder.lee@...iatek.com>,
linux-mediatek@...ts.infradead.org,
Frank Wunderlich <linux@...web.de>,
linux-kernel@...r.kernel.org,
Matthias Brugger <matthias.bgg@...il.com>,
linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Aw: Re: Re: Re: [PATCH] pci: mediatek: fix warning in msi.h
> Gesendet: Montag, 02. November 2020 um 14:58 Uhr
> Von: "Marc Zyngier" <maz@...nel.org>
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index d15c881e2e7e..5bb1306162c7 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -387,10 +387,20 @@ static ssize_t msi_bus_store(struct device *dev,
> struct device_attribute *attr,
> return count;
> }
>
> - if (val)
> + if (val) {
> + /*
> + * If there is no possibility for this bus to deal with
> + * MSIs, then allowing them to be requested would lead to
> + * the kernel complaining loudly. In this situation, don't
> + * let userspace mess things up.
> + */
> + if (!pci_bus_is_msi_capable(subordinate))
> + return -EINVAL;
> +
> subordinate->bus_flags &= ~PCI_BUS_FLAGS_NO_MSI;
> - else
> + } else {
> subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
> + }
>
> dev_info(&subordinate->dev, "MSI/MSI-X %s for future drivers of
> devices on this bus\n",
> val ? "allowed" : "disallowed");
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 4289030b0fff..28861cc6435a 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -871,6 +871,8 @@ static void pci_set_bus_msi_domain(struct pci_bus
> *bus)
> d = pci_host_bridge_msi_domain(b);
>
> dev_set_msi_domain(&bus->dev, d);
> + if (!pci_bus_is_msi_capable(bus))
> + bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
> }
>
> static int pci_register_host_bridge(struct pci_host_bridge *bridge)
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 22207a79762c..6aadb863dff4 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -2333,6 +2333,12 @@ pci_host_bridge_acpi_msi_domain(struct pci_bus
> *bus) { return NULL; }
> static inline bool pci_pr3_present(struct pci_dev *pdev) { return
> false; }
> #endif
>
> +static inline bool pci_bus_is_msi_capable(struct pci_bus *bus)
> +{
> + return (IS_ENABLED(CONFIG_PCI_MSI_ARCH_FALLBACKS) ||
> + dev_get_msi_domain(&bus->dev));
> +}
> +
> #ifdef CONFIG_EEH
> static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
> {
Hi,
this Patch seems to work well too...no warning, pcie-card and hdd recognized
regards Frank
Powered by blists - more mailing lists