From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DD48C00140 for ; Wed, 10 Aug 2022 17:23:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A89764DBA9; Wed, 10 Aug 2022 13:23:42 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@linux.dev Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X-CxHj+w1FYd; Wed, 10 Aug 2022 13:23:41 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 85AEA4DBAA; Wed, 10 Aug 2022 13:23:41 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 886DE4DBA8 for ; Wed, 10 Aug 2022 13:23:40 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bQWJmD6FF6sd for ; Wed, 10 Aug 2022 13:23:39 -0400 (EDT) Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 50A9D4DBA7 for ; Wed, 10 Aug 2022 13:23:39 -0400 (EDT) Date: Wed, 10 Aug 2022 12:23:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660152218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=63Gw+QB8vRS1+zYg8ibY6LGRmceSmZAbiOInDTS2pJo=; b=fLhuFpjBq/Aj72N9srr+JxCLmQlfAhvoommxDwsCiGyQrcjEv9sa2/IhNJgqnPYWGHscaE FHEgBi+DNTT1zkIzBtMIsAQpaFewHMbypa5ScBM6ExQRlkgsnPw81EvyA55+AKbzY/TG0G 5TkHmoZ+EVJ4AnDHcqMiQvL0FlYv5VU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Subject: Re: [PATCH 4/9] KVM: arm64: PMU: Add counter_index_to_*reg() helpers Message-ID: References: <20220805135813.2102034-1-maz@kernel.org> <20220805135813.2102034-5-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Wed, Aug 10, 2022 at 02:17:52AM -0500, Oliver Upton wrote: > On Fri, Aug 05, 2022 at 02:58:08PM +0100, Marc Zyngier wrote: > > In order to reduce the boilerplate code, add two helpers returning > > the counter register index (resp. the event register) in the vcpu > > register file from the counter index. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Oliver Upton > > > --- > > arch/arm64/kvm/pmu-emul.c | 27 +++++++++++++++------------ > > 1 file changed, 15 insertions(+), 12 deletions(-) > > > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > > index 0ab6f59f433c..9be485d23416 100644 > > --- a/arch/arm64/kvm/pmu-emul.c > > +++ b/arch/arm64/kvm/pmu-emul.c > > @@ -75,6 +75,16 @@ static struct kvm_vcpu *kvm_pmc_to_vcpu(struct kvm_pmc *pmc) > > return container_of(vcpu_arch, struct kvm_vcpu, arch); > > } > > > > +static u32 counter_index_to_reg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCNTR_EL0 : PMEVCNTR0_EL0 + idx; > > +} > > + > > +static u32 counter_index_to_evtreg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCFILTR_EL0 : PMEVTYPER0_EL0 + idx; > > +} > > + After reading the series, do you think these helpers could be applied to kvm_pmu_counter_increment() as well? -- Thanks, Oliver _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58576C00140 for ; Wed, 10 Aug 2022 17:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nLCwETatAUvBBb7Q4mtkLYLNIfwCOnJGLDbmmYKA9ag=; b=uT52zqlRFLV0PA VfkaCKh0so4EwASB6c9AKDVdW+Hr4TU26Bw4BWaYo9B+0j9gOVuRka1wu6xH40citifZ9V82t4bhf pi6Aulu6wCHvHdOLUiljNf1fuGYSTJkZAoOwa6RVo/k8tvB2WGSDHsHx6vD+ZVQgNjCliuFP/VaIf 4GMDcHlj2WN9YaUsB0OgFD+bZ5UiMq0VDR8crk8TEwmgE3tHzy+t6gZpXiP1tvAiqlxRuIjNsIVQq 7y/yKGfSVS7X4Yg304FmWuFSpbxxnfH7CewgNXXXZRhvyYVUKvu2KpMF5PnjpLhbVe+gVsHnNPryJ kBpiwIgEabj3aJE5HaZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLpQt-00DJCy-Nv; Wed, 10 Aug 2022 17:23:51 +0000 Received: from out0.migadu.com ([2001:41d0:2:267::]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLpQp-00DJ7e-TY for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2022 17:23:49 +0000 Date: Wed, 10 Aug 2022 12:23:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660152218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=63Gw+QB8vRS1+zYg8ibY6LGRmceSmZAbiOInDTS2pJo=; b=fLhuFpjBq/Aj72N9srr+JxCLmQlfAhvoommxDwsCiGyQrcjEv9sa2/IhNJgqnPYWGHscaE FHEgBi+DNTT1zkIzBtMIsAQpaFewHMbypa5ScBM6ExQRlkgsnPw81EvyA55+AKbzY/TG0G 5TkHmoZ+EVJ4AnDHcqMiQvL0FlYv5VU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvm@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 4/9] KVM: arm64: PMU: Add counter_index_to_*reg() helpers Message-ID: References: <20220805135813.2102034-1-maz@kernel.org> <20220805135813.2102034-5-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_102348_609077_5A7611E1 X-CRM114-Status: GOOD ( 16.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 10, 2022 at 02:17:52AM -0500, Oliver Upton wrote: > On Fri, Aug 05, 2022 at 02:58:08PM +0100, Marc Zyngier wrote: > > In order to reduce the boilerplate code, add two helpers returning > > the counter register index (resp. the event register) in the vcpu > > register file from the counter index. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Oliver Upton > > > --- > > arch/arm64/kvm/pmu-emul.c | 27 +++++++++++++++------------ > > 1 file changed, 15 insertions(+), 12 deletions(-) > > > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > > index 0ab6f59f433c..9be485d23416 100644 > > --- a/arch/arm64/kvm/pmu-emul.c > > +++ b/arch/arm64/kvm/pmu-emul.c > > @@ -75,6 +75,16 @@ static struct kvm_vcpu *kvm_pmc_to_vcpu(struct kvm_pmc *pmc) > > return container_of(vcpu_arch, struct kvm_vcpu, arch); > > } > > > > +static u32 counter_index_to_reg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCNTR_EL0 : PMEVCNTR0_EL0 + idx; > > +} > > + > > +static u32 counter_index_to_evtreg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCFILTR_EL0 : PMEVTYPER0_EL0 + idx; > > +} > > + After reading the series, do you think these helpers could be applied to kvm_pmu_counter_increment() as well? -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93251C25B07 for ; Wed, 10 Aug 2022 17:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233533AbiHJRXn (ORCPT ); Wed, 10 Aug 2022 13:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233557AbiHJRXm (ORCPT ); Wed, 10 Aug 2022 13:23:42 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413DA7C776 for ; Wed, 10 Aug 2022 10:23:40 -0700 (PDT) Date: Wed, 10 Aug 2022 12:23:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660152218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=63Gw+QB8vRS1+zYg8ibY6LGRmceSmZAbiOInDTS2pJo=; b=fLhuFpjBq/Aj72N9srr+JxCLmQlfAhvoommxDwsCiGyQrcjEv9sa2/IhNJgqnPYWGHscaE FHEgBi+DNTT1zkIzBtMIsAQpaFewHMbypa5ScBM6ExQRlkgsnPw81EvyA55+AKbzY/TG0G 5TkHmoZ+EVJ4AnDHcqMiQvL0FlYv5VU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvm@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 4/9] KVM: arm64: PMU: Add counter_index_to_*reg() helpers Message-ID: References: <20220805135813.2102034-1-maz@kernel.org> <20220805135813.2102034-5-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Aug 10, 2022 at 02:17:52AM -0500, Oliver Upton wrote: > On Fri, Aug 05, 2022 at 02:58:08PM +0100, Marc Zyngier wrote: > > In order to reduce the boilerplate code, add two helpers returning > > the counter register index (resp. the event register) in the vcpu > > register file from the counter index. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Oliver Upton > > > --- > > arch/arm64/kvm/pmu-emul.c | 27 +++++++++++++++------------ > > 1 file changed, 15 insertions(+), 12 deletions(-) > > > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > > index 0ab6f59f433c..9be485d23416 100644 > > --- a/arch/arm64/kvm/pmu-emul.c > > +++ b/arch/arm64/kvm/pmu-emul.c > > @@ -75,6 +75,16 @@ static struct kvm_vcpu *kvm_pmc_to_vcpu(struct kvm_pmc *pmc) > > return container_of(vcpu_arch, struct kvm_vcpu, arch); > > } > > > > +static u32 counter_index_to_reg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCNTR_EL0 : PMEVCNTR0_EL0 + idx; > > +} > > + > > +static u32 counter_index_to_evtreg(u64 idx) > > +{ > > + return (idx == ARMV8_PMU_CYCLE_IDX) ? PMCCFILTR_EL0 : PMEVTYPER0_EL0 + idx; > > +} > > + After reading the series, do you think these helpers could be applied to kvm_pmu_counter_increment() as well? -- Thanks, Oliver