Message ID | 20230426082511.3621484-1-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | [v2] iommu/ipmmu-vmsa: Allow PCIe devices | expand |
On Wed, Apr 26, 2023 at 05:25:11PM +0900, Yoshihiro Shimoda wrote: > To allow PCIe devices, add a new condition whether the device is > a PCI device or not in the ipmmu_device_is_allowed(). This needs more explanation on why PCI devices are safe to be allowed. Without this context it looks just too dangerous. Regards, Joerg
Hello Joerg, > From: Joerg Roedel, Sent: Tuesday, May 23, 2023 12:31 AM > > On Wed, Apr 26, 2023 at 05:25:11PM +0900, Yoshihiro Shimoda wrote: > > To allow PCIe devices, add a new condition whether the device is > > a PCI device or not in the ipmmu_device_is_allowed(). > > This needs more explanation on why PCI devices are safe to be allowed. > Without this context it looks just too dangerous. Thank you for your review. I'll revise the description on v3. Best regards, Yoshihiro Shimoda > Regards, > > Joerg >
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 9f64c5c9f5b9..6efc99382edb 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -19,6 +19,7 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/of_platform.h> +#include <linux/pci.h> #include <linux/platform_device.h> #include <linux/sizes.h> #include <linux/slab.h> @@ -723,6 +724,10 @@ static bool ipmmu_device_is_allowed(struct device *dev) if (soc_device_match(soc_denylist)) return false; + /* Check whether this device is a PCI device */ + if (dev_is_pci(dev)) + return true; + /* Check whether this device can work with the IPMMU */ for (i = 0; i < ARRAY_SIZE(devices_allowlist); i++) { if (!strcmp(dev_name(dev), devices_allowlist[i]))
To allow PCIe devices, add a new condition whether the device is a PCI device or not in the ipmmu_device_is_allowed(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- Changes from v1: https://lore.kernel.org/all/20230421122538.3389336-1-yoshihiro.shimoda.uh@renesas.com/ - Drop a condition in the ipmmu_attach_device(). - Drop adding PCIe root devices into the devices_allowlist. - Use dev_is_pci() instead of using strcmp() in ipmmu_device_is_allowed(). drivers/iommu/ipmmu-vmsa.c | 5 +++++ 1 file changed, 5 insertions(+)