Skip to content

Commit 37b282f

Browse files
hegdevasantjoergroedel
authored andcommitted
iommu/amd: Remove amd_iommu_device_info()
No one is using this function. Hence remove it. Also move PCI device feature detection flags to amd_iommu_types.h as its only used inside AMD IOMMU driver. Signed-off-by: Vasant Hegde <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Tested-by: Alex Deucher <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent d55b0d2 commit 37b282f

File tree

3 files changed

+8
-68
lines changed

3 files changed

+8
-68
lines changed

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,14 @@ struct devid_map {
786786
bool cmd_line;
787787
};
788788

789+
#define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */
790+
#define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */
791+
#define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */
792+
/* Device may request execution on memory pages */
793+
#define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8
794+
/* Device may request super-user privileges */
795+
#define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10
796+
789797
/*
790798
* This struct contains device specific data for the IOMMU
791799
*/

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,48 +2741,6 @@ int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid,
27412741
}
27422742
EXPORT_SYMBOL(amd_iommu_complete_ppr);
27432743

2744-
int amd_iommu_device_info(struct pci_dev *pdev,
2745-
struct amd_iommu_device_info *info)
2746-
{
2747-
int max_pasids;
2748-
int pos;
2749-
2750-
if (pdev == NULL || info == NULL)
2751-
return -EINVAL;
2752-
2753-
if (!amd_iommu_v2_supported())
2754-
return -EINVAL;
2755-
2756-
memset(info, 0, sizeof(*info));
2757-
2758-
if (pci_ats_supported(pdev))
2759-
info->flags |= AMD_IOMMU_DEVICE_FLAG_ATS_SUP;
2760-
2761-
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
2762-
if (pos)
2763-
info->flags |= AMD_IOMMU_DEVICE_FLAG_PRI_SUP;
2764-
2765-
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PASID);
2766-
if (pos) {
2767-
int features;
2768-
2769-
max_pasids = 1 << (9 * (amd_iommu_max_glx_val + 1));
2770-
max_pasids = min(max_pasids, (1 << 20));
2771-
2772-
info->flags |= AMD_IOMMU_DEVICE_FLAG_PASID_SUP;
2773-
info->max_pasids = min(pci_max_pasids(pdev), max_pasids);
2774-
2775-
features = pci_pasid_features(pdev);
2776-
if (features & PCI_PASID_CAP_EXEC)
2777-
info->flags |= AMD_IOMMU_DEVICE_FLAG_EXEC_SUP;
2778-
if (features & PCI_PASID_CAP_PRIV)
2779-
info->flags |= AMD_IOMMU_DEVICE_FLAG_PRIV_SUP;
2780-
}
2781-
2782-
return 0;
2783-
}
2784-
EXPORT_SYMBOL(amd_iommu_device_info);
2785-
27862744
#ifdef CONFIG_IRQ_REMAP
27872745

27882746
/*****************************************************************************

include/linux/amd-iommu.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,6 @@ struct pci_dev;
3333

3434
extern int amd_iommu_detect(void);
3535

36-
/**
37-
* amd_iommu_device_info() - Get information about IOMMUv2 support of a
38-
* PCI device
39-
* @pdev: PCI device to query information from
40-
* @info: A pointer to an amd_iommu_device_info structure which will contain
41-
* the information about the PCI device
42-
*
43-
* Returns 0 on success, negative value on error
44-
*/
45-
46-
#define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */
47-
#define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */
48-
#define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */
49-
#define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8 /* Device may request execution
50-
on memory pages */
51-
#define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10 /* Device may request
52-
super-user privileges */
53-
54-
struct amd_iommu_device_info {
55-
int max_pasids;
56-
u32 flags;
57-
};
58-
59-
extern int amd_iommu_device_info(struct pci_dev *pdev,
60-
struct amd_iommu_device_info *info);
61-
6236
#else /* CONFIG_AMD_IOMMU */
6337

6438
static inline int amd_iommu_detect(void) { return -ENODEV; }

0 commit comments

Comments
 (0)