Re: [PATCH v8 9/9] perf/amd/iommu: Enable support for multiple IOMMUs

From: Suravee Suthikulpanit
Date: Mon Feb 06 2017 - 20:58:58 EST


Boris,

On 1/25/17 16:55, Borislav Petkov wrote:
On Wed, Jan 25, 2017 at 10:46:53AM +0100, Peter Zijlstra wrote:
Which is absolutely insane.

Right,

IMO, the simplest thing to do for your purposes is to embed a struct
amd_iommu pointer into struct perf_amd_iommu at init time so that you
don't have to do all that crazy dance in the PMU functions and iterate
over the iommus in get_amd_iommu() each time.

Which would then simplify all your other functions. For example:

int amd_iommu_pc_get_reg(unsigned int idx, u8 bank, u8 cntr, u8 fxn, u64 *value)

should be

int amd_iommu_pc_get_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, u8 fxn, u64 *value)

and you can save yourself a lot of glue code and get rid of that
get_amd_iommu() thing.


That's a good idea. Thanks. I'll do this in V9.

Suravee