Commit 57f9842e authored by Joerg Roedel's avatar Joerg Roedel

iommu/amd: Remove dev_data->passthrough

Make use of generic IOMMU infrastructure to gather the same information
carried in dev_data->passthrough and remove the struct member.
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20200429133712.31431-15-joro@8bytes.orgSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 5012c396
...@@ -2047,8 +2047,8 @@ static int pdev_iommuv2_enable(struct pci_dev *pdev) ...@@ -2047,8 +2047,8 @@ static int pdev_iommuv2_enable(struct pci_dev *pdev)
static int attach_device(struct device *dev, static int attach_device(struct device *dev,
struct protection_domain *domain) struct protection_domain *domain)
{ {
struct pci_dev *pdev;
struct iommu_dev_data *dev_data; struct iommu_dev_data *dev_data;
struct pci_dev *pdev;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -2067,8 +2067,10 @@ static int attach_device(struct device *dev, ...@@ -2067,8 +2067,10 @@ static int attach_device(struct device *dev,
pdev = to_pci_dev(dev); pdev = to_pci_dev(dev);
if (domain->flags & PD_IOMMUV2_MASK) { if (domain->flags & PD_IOMMUV2_MASK) {
struct iommu_domain *def_domain = iommu_get_dma_domain(dev);
ret = -EINVAL; ret = -EINVAL;
if (!dev_data->passthrough) if (def_domain->type != IOMMU_DOMAIN_IDENTITY)
goto out; goto out;
if (dev_data->iommu_v2) { if (dev_data->iommu_v2) {
...@@ -2189,9 +2191,7 @@ static int amd_iommu_add_device(struct device *dev) ...@@ -2189,9 +2191,7 @@ static int amd_iommu_add_device(struct device *dev)
/* Domains are initialized for this device - have a look what we ended up with */ /* Domains are initialized for this device - have a look what we ended up with */
domain = iommu_get_domain_for_dev(dev); domain = iommu_get_domain_for_dev(dev);
if (domain->type == IOMMU_DOMAIN_IDENTITY) if (domain->type == IOMMU_DOMAIN_DMA)
dev_data->passthrough = true;
else if (domain->type == IOMMU_DOMAIN_DMA)
iommu_setup_dma_ops(dev, IOVA_START_PFN << PAGE_SHIFT, 0); iommu_setup_dma_ops(dev, IOVA_START_PFN << PAGE_SHIFT, 0);
out: out:
......
...@@ -640,7 +640,6 @@ struct iommu_dev_data { ...@@ -640,7 +640,6 @@ struct iommu_dev_data {
struct pci_dev *pdev; struct pci_dev *pdev;
u16 devid; /* PCI Device ID */ u16 devid; /* PCI Device ID */
bool iommu_v2; /* Device can make use of IOMMUv2 */ bool iommu_v2; /* Device can make use of IOMMUv2 */
bool passthrough; /* Device is identity mapped */
struct { struct {
bool enabled; bool enabled;
int qdep; int qdep;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment