Commit d08d6f5d authored by Pierre Morel's avatar Pierre Morel Committed by Vasily Gorbik

s390/pci: adaptation of iommu to multifunction

In the future the bus sysdata may not directly point to the
zpci_dev.

In preparation of upcoming patches let us abstract the
access to the zpci_dev from the device inside the pci device.
Signed-off-by: default avatarPierre Morel <pmorel@linux.ibm.com>
Reviewed-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent e6ab7490
...@@ -231,6 +231,11 @@ static inline struct zpci_dev *to_zpci(struct pci_dev *pdev) ...@@ -231,6 +231,11 @@ static inline struct zpci_dev *to_zpci(struct pci_dev *pdev)
return pdev->sysdata; return pdev->sysdata;
} }
static inline struct zpci_dev *to_zpci_dev(struct device *dev)
{
return to_zpci(to_pci_dev(dev));
}
struct zpci_dev *get_zdev_by_fid(u32); struct zpci_dev *get_zdev_by_fid(u32);
/* DMA */ /* DMA */
......
...@@ -87,7 +87,7 @@ static int s390_iommu_attach_device(struct iommu_domain *domain, ...@@ -87,7 +87,7 @@ static int s390_iommu_attach_device(struct iommu_domain *domain,
struct device *dev) struct device *dev)
{ {
struct s390_domain *s390_domain = to_s390_domain(domain); struct s390_domain *s390_domain = to_s390_domain(domain);
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; struct zpci_dev *zdev = to_zpci_dev(dev);
struct s390_domain_device *domain_device; struct s390_domain_device *domain_device;
unsigned long flags; unsigned long flags;
int rc; int rc;
...@@ -139,7 +139,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain, ...@@ -139,7 +139,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
struct device *dev) struct device *dev)
{ {
struct s390_domain *s390_domain = to_s390_domain(domain); struct s390_domain *s390_domain = to_s390_domain(domain);
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; struct zpci_dev *zdev = to_zpci_dev(dev);
struct s390_domain_device *domain_device, *tmp; struct s390_domain_device *domain_device, *tmp;
unsigned long flags; unsigned long flags;
int found = 0; int found = 0;
...@@ -169,7 +169,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain, ...@@ -169,7 +169,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
static int s390_iommu_add_device(struct device *dev) static int s390_iommu_add_device(struct device *dev)
{ {
struct iommu_group *group = iommu_group_get_for_dev(dev); struct iommu_group *group = iommu_group_get_for_dev(dev);
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; struct zpci_dev *zdev = to_zpci_dev(dev);
if (IS_ERR(group)) if (IS_ERR(group))
return PTR_ERR(group); return PTR_ERR(group);
...@@ -182,7 +182,7 @@ static int s390_iommu_add_device(struct device *dev) ...@@ -182,7 +182,7 @@ static int s390_iommu_add_device(struct device *dev)
static void s390_iommu_remove_device(struct device *dev) static void s390_iommu_remove_device(struct device *dev)
{ {
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata; struct zpci_dev *zdev = to_zpci_dev(dev);
struct iommu_domain *domain; struct iommu_domain *domain;
/* /*
......
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