From: Valentin Schneider <valentin.schneider@arm.com>
To: Suzuki Kuruppassery Poulose <suzuki.poulose@arm.com>,
Ionela Voinescu <ionela.voinescu@arm.com>,
catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
maz@kernel.org, sudeep.holla@arm.com, dietmar.eggemann@arm.com
Cc: peterz@infradead.org, mingo@redhat.com, ggherdovich@suse.cz,
vincent.guittot@linaro.org, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
James Morse <james.morse@arm.com>,
Julien Thierry <julien.thierry.kdev@gmail.com>
Subject: Re: [PATCH v2 3/6] arm64/kvm: disable access to AMU registers from kvm guests
Date: Tue, 28 Jan 2020 17:37:04 +0000 [thread overview]
Message-ID: <5de3d3c7-2d78-9d18-f3ca-7cb6cf9ce36c@arm.com> (raw)
In-Reply-To: <0690745f-fa38-f623-30a5-42d0eadfb668@arm.com>
Hi Suzuki,
On 28/01/2020 17:26, Suzuki Kuruppassery Poulose wrote:
>> So, providing I didn't get completely lost on the way, I have to ask:
>> why do we use CPACR_EL1 here? Couldn't we use CPTR_EL2 directly?
>
> Part of the reason is, CPTR_EL2 has different layout depending on
> whether HCR_EL2.E2H == 1. e.g, CPTR_EL2.TTA move from Bit[28] to Bit[20].
>
> So, to keep it simple, CPTR_EL2 is used for non-VHE code with the shifts
> as defined by the "CPTR_EL2 when E2H=0"
>
> if E2H == 1, CPTR_EL2 takes the layout of CPACR_EL1 and "overrides" some
> of the RES0 bits in CPACR_EL1 with EL2 controls (e.g: TAM, TCPAC).
> Thus we use CPACR_EL1 to keep the "shifts" non-conflicting (e.g, ZEN)
> and is the right thing to do.
>
> It is a bit confusing, but we are doing the right thing. May be we could improve the comment like :
>
> /*
> * With VHE (HCR.E2H == 1), CPTR_EL2 has the same layout as
> * CPACR_EL1, except for some missing controls, such as TAM.
> * And accesses to CPACR_EL1 are routed to CPTR_EL2.
> * Also CPTR_EL2.TAM has the same position with or without
> * HCR.E2H == 1. Therefore, use CPTR_EL2.TAM here for
> * trapping the AMU accesses.
> */
>
Thanks for clearing this up! I also bothered MarcZ in the meantime who
also cleared up some of my confusion (including which layout takes effect).
So yeah, I think what we want here is to keep using CPTR_EL2_TAM but have a
comment that explains why (which you just provided!).
> Suzuki
next prev parent reply other threads:[~2020-01-28 17:37 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 18:26 [PATCH v2 0/6] arm64: ARMv8.4 Activity Monitors support Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 1/6] arm64: add support for the AMU extension v1 Ionela Voinescu
2020-01-23 17:04 ` Valentin Schneider
2020-01-23 18:32 ` Ionela Voinescu
2020-01-24 12:00 ` Valentin Schneider
2020-01-28 11:00 ` Ionela Voinescu
2020-01-28 16:34 ` Suzuki Kuruppassery Poulose
2020-01-29 16:42 ` Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 2/6] arm64: trap to EL1 accesses to AMU counters from EL0 Ionela Voinescu
2020-01-23 17:04 ` Valentin Schneider
2020-01-23 17:34 ` Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 3/6] arm64/kvm: disable access to AMU registers from kvm guests Ionela Voinescu
2020-01-27 15:33 ` Valentin Schneider
2020-01-28 15:48 ` Ionela Voinescu
2020-01-28 17:26 ` Suzuki Kuruppassery Poulose
2020-01-28 17:37 ` Valentin Schneider [this message]
2020-01-28 17:52 ` Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 4/6] Documentation: arm64: document support for the AMU extension Ionela Voinescu
2020-01-27 16:47 ` Valentin Schneider
2020-01-28 16:53 ` Ionela Voinescu
2020-01-28 18:36 ` Valentin Schneider
2020-01-30 15:04 ` Suzuki Kuruppassery Poulose
2020-01-30 16:45 ` Ionela Voinescu
2020-01-30 18:26 ` Suzuki K Poulose
2020-01-31 9:54 ` Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 5/6] TEMP: sched: add interface for counter-based frequency invariance Ionela Voinescu
2020-01-29 19:37 ` Peter Zijlstra
2020-01-30 15:33 ` Ionela Voinescu
2019-12-18 18:26 ` [PATCH v2 6/6] arm64: use activity monitors for " Ionela Voinescu
2020-01-23 11:49 ` Lukasz Luba
2020-01-23 17:07 ` Ionela Voinescu
2020-01-24 1:19 ` Lukasz Luba
2020-01-24 13:12 ` Ionela Voinescu
2020-01-24 15:17 ` Lukasz Luba
2020-01-28 17:36 ` Ionela Voinescu
2020-01-29 17:13 ` Valentin Schneider
2020-01-29 17:52 ` Ionela Voinescu
2020-01-29 23:39 ` Valentin Schneider
2020-01-30 15:49 ` Ionela Voinescu
2020-01-30 16:11 ` Valentin Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5de3d3c7-2d78-9d18-f3ca-7cb6cf9ce36c@arm.com \
--to=valentin.schneider@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=ggherdovich@suse.cz \
--cc=ionela.voinescu@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sudeep.holla@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).