AMD IOMMU cleanups and dead code removal
Subsystems (7)
Hi,
this series cleans up a few random bits in the AMD IOMMU driver.
Diffstat:
arch/x86/events/amd/iommu.c | 1 arch/x86/events/amd/iommu.h | 19 ------ drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 4 - drivers/iommu/amd/amd_iommu.h | 2 drivers/iommu/amd/amd_iommu_types.h | 1 drivers/iommu/amd/init.c | 5 - drivers/iommu/amd/iommu.c | 90 +-------------------------------- include/linux/amd-iommu.h | 30 ++++------- 8 files changed, 16 insertions(+), 136 deletions(-)
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 1/4 iommu/amd: remove the unused device errata code
The device errata mechism is entirely unused, so remove it.
--- drivers/iommu/amd/amd_iommu_types.h | 1 - drivers/iommu/amd/iommu.c | 56 ++--------------------------- include/linux/amd-iommu.h | 18 ---------- 3 files changed, 3 insertions(+), 72 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +0 -1
@@ -693,7 +693,6 @@ struct iommu_dev_data { } ats;/* ATS state */ bool pri_tlp;/* PASID TLB required for PPR completions */ -u32 errata;/* Bitmap for errata to apply */ bool use_vapic;/* Enable device to use vapic mode */ bool defer_attach;
drivers/iommu/amd/iommu.c +3 -53
85 lines not on this page · raw message
include/linux/amd-iommu.h +0 -18
@@ -32,24 +32,6 @@ struct pci_dev;extern int amd_iommu_detect (void );extern int amd_iommu_init_hardware (void ); -/** -* amd_iommu_enable_device_erratum() - Enable erratum workaround for device -* in the IOMMUv2 driver -* @pdev: The PCI device the workaround is necessary for -* @erratum: The erratum workaround to enable -* -* The function needs to be called before amd_iommu_init_device(). -* Possible values for the erratum number are for now: -* - AMD_PRI_DEV_ERRATUM_ENABLE_RESET - Reset PRI capability when PRI -* is enabled -* - AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE - Limit number of outstanding PRI -* requests to one -*/ -#define AMD_PRI_DEV_ERRATUM_ENABLE_RESET 0 -#define AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE 1 - -extern void amd_iommu_enable_device_erratum (struct pci_dev *pdev,u32 erratum); -/** * amd_iommu_init_device() - Init device for use with IOMMUv2 driver * @pdev: The PCI device to initialize
Signature · 6 lines
2.30.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 2/4 iommu/amd: remove the unused amd_iommu_get_v2_domain function
In reply to Christoph Hellwig--- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/iommu.c | 34 ---------------------------------- 2 files changed, 35 deletions(-)
drivers/iommu/amd/amd_iommu.h +0 -1
@@ -65,7 +65,6 @@ extern int amd_iommu_flush_tlb(struct iommu_domain *dom, u32 pasid);extern int amd_iommu_domain_set_gcr3 (struct iommu_domain *dom,u32 pasid,unsigned long cr3);extern int amd_iommu_domain_clear_gcr3 (struct iommu_domain *dom,u32 pasid); -extern struct iommu_domain *amd_iommu_get_v2_domain (struct pci_dev *pdev);#ifdef CONFIG_IRQ_REMAP extern int amd_iommu_create_irq_domain (struct amd_iommu *iommu);
drivers/iommu/amd/iommu.c +0 -34
@@ -2525,40 +2525,6 @@ int amd_iommu_complete_ppr(struct pci_dev *pdev, u32 pasid, }EXPORT_SYMBOL (amd_iommu_complete_ppr); -struct iommu_domain *amd_iommu_get_v2_domain (struct pci_dev *pdev) -{ -struct protection_domain *pdomain; -struct iommu_dev_data *dev_data; -struct device *dev = &pdev->dev; -struct iommu_domain *io_domain; - -if (!check_device (dev)) -return NULL ; - - dev_data =dev_iommu_priv_get (&pdev->dev); - pdomain = dev_data->domain; - io_domain =iommu_get_domain_for_dev (dev); - -if (pdomain ==NULL && dev_data->defer_attach) { - dev_data->defer_attach = false; - pdomain =to_pdomain (io_domain); -attach_device (dev, pdomain); - } - -if (pdomain ==NULL ) -return NULL ; - -if (io_domain->type !=IOMMU_DOMAIN_DMA ) -return NULL ; - -/* Only return IOMMUv2 domains */ -if (!(pdomain->flags &PD_IOMMUV2_MASK )) -return NULL ; - -return &pdomain->domain; -} -EXPORT_SYMBOL (amd_iommu_get_v2_domain); -int amd_iommu_device_info (struct pci_dev *pdev,struct amd_iommu_device_info *info) {
Signature · 6 lines
2.30.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 3/4 iommu/amd: remove a few unused exports
In reply to Christoph HellwigRemove exports for functions that are only used in the AMD IOMMU driver itself, or the also always builtin perf events support.
--- drivers/iommu/amd/init.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/iommu/amd/init.c +0 -5
@@ -208,7 +208,6 @@ u16 *amd_iommu_alias_table;* for a specific device. It is also indexed by the PCI device id. */ struct amd_iommu **amd_iommu_rlookup_table; -EXPORT_SYMBOL (amd_iommu_rlookup_table);/* * This table is used to find the irq remapping table for a given device id
@@ -268,7 +267,6 @@ bool translation_pre_enabled(struct amd_iommu *iommu) {return (iommu->flags &AMD_IOMMU_FLAG_TRANS_PRE_ENABLED ); } -EXPORT_SYMBOL (translation_pre_enabled);static void clear_translation_pre_enabled (struct amd_iommu *iommu) {
@@ -3277,7 +3275,6 @@ struct amd_iommu *get_amd_iommu(unsigned int idx)return iommu;return NULL ; } -EXPORT_SYMBOL (get_amd_iommu);/**************************************************************************** *
@@ -3359,7 +3356,6 @@ int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64return iommu_pc_get_set_reg (iommu, bank, cntr, fxn, value, false); } -EXPORT_SYMBOL (amd_iommu_pc_get_reg);int amd_iommu_pc_set_reg (struct amd_iommu *iommu,u8 bank,u8 cntr,u8 fxn,u64 *value) {
@@ -3368,4 +3364,3 @@ int amd_iommu_pc_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64return iommu_pc_get_set_reg (iommu, bank, cntr, fxn, value, true); } -EXPORT_SYMBOL (amd_iommu_pc_set_reg);
Signature · 6 lines
2.30.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 4/4 iommu/amd: move a few prototypes to include/linux/amd-iommu.h
In reply to Christoph HellwigA few functions that were intentended for the perf events support are currently declared in arch/x86/events/amd/iommu.h, which mens they are not in scope for the actual function definition. Also amdkfd has started using a few of them using externs in a .c file. End that misery by moving the prototypes to the proper header.
--- arch/x86/events/amd/iommu.c | 1 + arch/x86/events/amd/iommu.h | 19 ------------------- drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 4 ---- drivers/iommu/amd/amd_iommu.h | 1 - include/linux/amd-iommu.h | 12 ++++++++++++ 5 files changed, 13 insertions(+), 24 deletions(-)
arch/x86/events/amd/iommu.c +1 -0
@@ -14,6 +14,7 @@#include <linux/init.h> #include <linux/cpumask.h> #include <linux/slab.h> +#include <linux/amd-iommu.h> #include "../perf_event.h" #include "iommu.h"
arch/x86/events/amd/iommu.h +0 -19
@@ -21,23 +21,4 @@#define PC_MAX_SPEC_BNKS 64#define PC_MAX_SPEC_CNTRS 16 -struct amd_iommu ; - -/* amd_iommu_init.c external support functions */ -extern int amd_iommu_get_num_iommus (void ); - -extern bool amd_iommu_pc_supported (void ); - -extern u8 amd_iommu_pc_get_max_banks (unsigned int idx); - -extern u8 amd_iommu_pc_get_max_counters (unsigned int idx); - -extern int amd_iommu_pc_set_reg (struct amd_iommu *iommu,u8 bank,u8 cntr, -u8 fxn,u64 *value); - -extern int amd_iommu_pc_get_reg (struct amd_iommu *iommu,u8 bank,u8 cntr, -u8 fxn,u64 *value); - -extern struct amd_iommu *get_amd_iommu (int idx); -#endif /*_PERF_EVENT_AMD_IOMMU_H_*/
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +0 -4
@@ -329,10 +329,6 @@ int kfd_iommu_resume(struct kfd_dev *kfd)return 0 ; } -extern bool amd_iommu_pc_supported (void ); -extern u8 amd_iommu_pc_get_max_banks (u16 devid); -extern u8 amd_iommu_pc_get_max_counters (u16 devid); -/** kfd_iommu_add_perf_counters - Add IOMMU performance counters to topology */ int kfd_iommu_add_perf_counters (struct kfd_topology_device *kdev)
drivers/iommu/amd/amd_iommu.h +0 -1
@@ -11,7 +11,6 @@#include "amd_iommu_types.h" -extern int amd_iommu_get_num_iommus (void );extern int amd_iommu_init_dma_ops (void );extern int amd_iommu_init_passthrough (void );extern irqreturn_t amd_iommu_int_thread (int irq,void *data);
include/linux/amd-iommu.h +12 -0
@@ -10,6 +10,8 @@#include <linux/types.h> +struct amd_iommu ; +/* * This is mainly used to communicate information back-and-forth * between SVM and IOMMU for setting up and tearing down posted
@@ -194,4 +196,14 @@ static inline int amd_iommu_deactivate_guest_mode(void *data) }#endif /* defined(CONFIG_AMD_IOMMU) && defined(CONFIG_IRQ_REMAP) */ +int amd_iommu_get_num_iommus (void ); +bool amd_iommu_pc_supported (void ); +u8 amd_iommu_pc_get_max_banks (unsigned int idx); +u8 amd_iommu_pc_get_max_counters (unsigned int idx); +int amd_iommu_pc_set_reg (struct amd_iommu *iommu,u8 bank,u8 cntr,u8 fxn, +u64 *value); +int amd_iommu_pc_get_reg (struct amd_iommu *iommu,u8 bank,u8 cntr,u8 fxn, +u64 *value); +struct amd_iommu *get_amd_iommu (unsigned int idx); +#endif /* _ASM_X86_AMD_IOMMU_H */
Signature · 6 lines
2.30.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Joerg Roedel
maintainerQuoted 5 lines · Christoph Hellwig
Hi,
this series cleans up a few random bits in the AMD IOMMU driver.
Diffstat:
Quoted 9 lines
arch/x86/events/amd/iommu.c | 1 arch/x86/events/amd/iommu.h | 19 ------ drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 4 - drivers/iommu/amd/amd_iommu.h | 2 drivers/iommu/amd/amd_iommu_types.h | 1 drivers/iommu/amd/init.c | 5 - drivers/iommu/amd/iommu.c | 90 +-------------------------------- include/linux/amd-iommu.h | 30 ++++------- 8 files changed, 16 insertions(+), 136 deletions(-)
Applied, thanks.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu