Skip to content

Commit

Permalink
iommu/amd: Move a few prototypes to include/linux/amd-iommu.h
Browse files Browse the repository at this point in the history
A 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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210402143312.372386-5-hch@lst.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Christoph Hellwig authored and Joerg Roedel committed Apr 7, 2021
1 parent b29a1fc commit fc1b662
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 24 deletions.
1 change: 1 addition & 0 deletions arch/x86/events/amd/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
19 changes: 0 additions & 19 deletions arch/x86/events/amd/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_*/
4 changes: 0 additions & 4 deletions drivers/gpu/drm/amd/amdkfd/kfd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion drivers/iommu/amd/amd_iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions include/linux/amd-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */

0 comments on commit fc1b662

Please sign in to comment.