Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933450AbdCXRyj (ORCPT ); Fri, 24 Mar 2017 13:54:39 -0400 Received: from mail.skyhub.de ([5.9.137.197]:36234 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933244AbdCXRyV (ORCPT ); Fri, 24 Mar 2017 13:54:21 -0400 Date: Fri, 24 Mar 2017 18:53:56 +0100 From: Borislav Petkov To: Suravee Suthikulpanit Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, peterz@infradead.org, joro@8bytes.org, mingo@redhat.com Subject: Re: [PATCH v12 09/10] perf/amd/iommu: Introduce amd_iommu-specific struct in struct hw_perf_event Message-ID: <20170324175356.q2k7g64uqbk72y3y@pd.tnic> References: <1490166162-10002-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1490166162-10002-10-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1490166162-10002-10-git-send-email-Suravee.Suthikulpanit@amd.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2076 Lines: 56 On Wed, Mar 22, 2017 at 02:02:41AM -0500, Suravee Suthikulpanit wrote: > From: Suravee Suthikulpanit > > 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 > Cc: Borislav Petkov > Signed-off-by: Suravee Suthikulpanit > --- > 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.