Skip to content

Commit d08d6f5

Browse files
Pierre MorelVasily Gorbik
authored andcommitted
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: Pierre Morel <[email protected]> Reviewed-by: Niklas Schnelle <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent e6ab749 commit d08d6f5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

arch/s390/include/asm/pci.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ static inline struct zpci_dev *to_zpci(struct pci_dev *pdev)
231231
return pdev->sysdata;
232232
}
233233

234+
static inline struct zpci_dev *to_zpci_dev(struct device *dev)
235+
{
236+
return to_zpci(to_pci_dev(dev));
237+
}
238+
234239
struct zpci_dev *get_zdev_by_fid(u32);
235240

236241
/* DMA */

drivers/iommu/s390-iommu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int s390_iommu_attach_device(struct iommu_domain *domain,
8787
struct device *dev)
8888
{
8989
struct s390_domain *s390_domain = to_s390_domain(domain);
90-
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata;
90+
struct zpci_dev *zdev = to_zpci_dev(dev);
9191
struct s390_domain_device *domain_device;
9292
unsigned long flags;
9393
int rc;
@@ -139,7 +139,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
139139
struct device *dev)
140140
{
141141
struct s390_domain *s390_domain = to_s390_domain(domain);
142-
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata;
142+
struct zpci_dev *zdev = to_zpci_dev(dev);
143143
struct s390_domain_device *domain_device, *tmp;
144144
unsigned long flags;
145145
int found = 0;
@@ -169,7 +169,7 @@ static void s390_iommu_detach_device(struct iommu_domain *domain,
169169
static int s390_iommu_add_device(struct device *dev)
170170
{
171171
struct iommu_group *group = iommu_group_get_for_dev(dev);
172-
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata;
172+
struct zpci_dev *zdev = to_zpci_dev(dev);
173173

174174
if (IS_ERR(group))
175175
return PTR_ERR(group);
@@ -182,7 +182,7 @@ static int s390_iommu_add_device(struct device *dev)
182182

183183
static void s390_iommu_remove_device(struct device *dev)
184184
{
185-
struct zpci_dev *zdev = to_pci_dev(dev)->sysdata;
185+
struct zpci_dev *zdev = to_zpci_dev(dev);
186186
struct iommu_domain *domain;
187187

188188
/*

0 commit comments

Comments
 (0)