Skip to content

Commit fb1b695

Browse files
committed
iommu/amd: Unexport get_dev_data()
This function is internal to the AMD IOMMU driver and only exported because the amd_iommu_v2 modules calls it. But the reason it is called from there could better be handled by amd_iommu_is_attach_deferred(). So unexport get_dev_data() and use amd_iommu_is_attach_deferred() instead. Signed-off-by: Joerg Roedel <[email protected]> Reviewed-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4c201d5 commit fb1b695

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,10 @@ static struct iommu_dev_data *find_dev_data(u16 devid)
280280
return dev_data;
281281
}
282282

283-
struct iommu_dev_data *get_dev_data(struct device *dev)
283+
static struct iommu_dev_data *get_dev_data(struct device *dev)
284284
{
285285
return dev->archdata.iommu;
286286
}
287-
EXPORT_SYMBOL(get_dev_data);
288287

289288
/*
290289
* Find or create an IOMMU group for a acpihid device.
@@ -2706,12 +2705,14 @@ static void amd_iommu_get_resv_regions(struct device *dev,
27062705
list_add_tail(&region->list, head);
27072706
}
27082707

2709-
static bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
2710-
struct device *dev)
2708+
bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
2709+
struct device *dev)
27112710
{
27122711
struct iommu_dev_data *dev_data = dev->archdata.iommu;
2712+
27132713
return dev_data->defer_attach;
27142714
}
2715+
EXPORT_SYMBOL_GPL(amd_iommu_is_attach_deferred);
27152716

27162717
static void amd_iommu_flush_iotlb_all(struct iommu_domain *domain)
27172718
{

drivers/iommu/amd_iommu_proto.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ static inline void *iommu_phys_to_virt(unsigned long paddr)
9292
}
9393

9494
extern bool translation_pre_enabled(struct amd_iommu *iommu);
95-
extern struct iommu_dev_data *get_dev_data(struct device *dev);
95+
extern bool amd_iommu_is_attach_deferred(struct iommu_domain *domain,
96+
struct device *dev);
9697
#endif /* _ASM_X86_AMD_IOMMU_PROTO_H */

drivers/iommu/amd_iommu_v2.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,12 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)
517517
struct amd_iommu_fault *iommu_fault;
518518
struct pasid_state *pasid_state;
519519
struct device_state *dev_state;
520+
struct pci_dev *pdev = NULL;
520521
unsigned long flags;
521522
struct fault *fault;
522523
bool finish;
523524
u16 tag, devid;
524525
int ret;
525-
struct iommu_dev_data *dev_data;
526-
struct pci_dev *pdev = NULL;
527526

528527
iommu_fault = data;
529528
tag = iommu_fault->tag & 0x1ff;
@@ -534,12 +533,11 @@ static int ppr_notifier(struct notifier_block *nb, unsigned long e, void *data)
534533
devid & 0xff);
535534
if (!pdev)
536535
return -ENODEV;
537-
dev_data = get_dev_data(&pdev->dev);
538536

539-
/* In kdump kernel pci dev is not initialized yet -> send INVALID */
540537
ret = NOTIFY_DONE;
541-
if (translation_pre_enabled(amd_iommu_rlookup_table[devid])
542-
&& dev_data->defer_attach) {
538+
539+
/* In kdump kernel pci dev is not initialized yet -> send INVALID */
540+
if (amd_iommu_is_attach_deferred(NULL, &pdev->dev)) {
543541
amd_iommu_complete_ppr(pdev, iommu_fault->pasid,
544542
PPR_INVALID, tag);
545543
goto out;

0 commit comments

Comments
 (0)