[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170324175356.q2k7g64uqbk72y3y@pd.tnic>
Date: Fri, 24 Mar 2017 18:53:56 +0100
From: Borislav Petkov <bp@...en8.de>
To: Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc: linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
peterz@...radead.org, joro@...tes.org, mingo@...hat.com
Subject: Re: [PATCH v12 09/10] perf/amd/iommu: Introduce amd_iommu-specific
struct in struct hw_perf_event
On Wed, Mar 22, 2017 at 02:02:41AM -0500, Suravee Suthikulpanit wrote:
> From: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
>
> Current AMD IOMMU Perf PMU inappropriately uses hardware struct
> inside the union inside the struct hw_perf_event, mainly the use of
> extra_reg.
>
> Instead, introduce amd_iommu-specific struct with required
> parameters to be programmed onto the IOMMU performance counter
> control register.
>
> Also update the pasid field from 16 to 20 bits.
>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
> ---
> arch/x86/events/amd/iommu.c | 102 +++++++++++++++++++-------------------------
> include/linux/perf_event.h | 7 +++
> 2 files changed, 52 insertions(+), 57 deletions(-)
>
> diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
> index 7ac8138..915a20c 100644
> --- a/arch/x86/events/amd/iommu.c
> +++ b/arch/x86/events/amd/iommu.c
> @@ -23,17 +23,16 @@
>
> #define COUNTER_SHIFT 16
>
> -#define _GET_BANK(ev) ((u8)(ev->hw.extra_reg.reg >> 8))
> -#define _GET_CNTR(ev) ((u8)(ev->hw.extra_reg.reg))
> -
> -/* iommu pmu config masks */
> -#define _GET_CSOURCE(ev) ((ev->hw.config & 0xFFULL))
> -#define _GET_DEVID(ev) ((ev->hw.config >> 8) & 0xFFFFULL)
> -#define _GET_PASID(ev) ((ev->hw.config >> 24) & 0xFFFFULL)
> -#define _GET_DOMID(ev) ((ev->hw.config >> 40) & 0xFFFFULL)
> -#define _GET_DEVID_MASK(ev) ((ev->hw.extra_reg.config) & 0xFFFFULL)
> -#define _GET_PASID_MASK(ev) ((ev->hw.extra_reg.config >> 16) & 0xFFFFULL)
> -#define _GET_DOMID_MASK(ev) ((ev->hw.extra_reg.config >> 32) & 0xFFFFULL)
> +/* iommu pmu conf masks */
> +#define GET_CSOURCE(x) (x->conf & 0xFFULL)
You need to prevent the macro arg from potentially wrong precedence
rules/multiple eval:
#define GET_CSOURCE(x) ((x)->conf & 0xFFULL)
^^^
I fixed them up when applying.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Powered by blists - more mailing lists