From: Oliver Upton <oliver.upton@linux.dev>
To: Saurav Sachidanand <sauravsc@amazon.com>
Cc: Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RFC] KVM: arm64/vgic: Populate GICR_TYPER with Aff3
Date: Tue, 6 Feb 2024 10:28:30 +0000 [thread overview]
Message-ID: <ZcIJzn9KLR_bWdwc@linux.dev> (raw)
In-Reply-To: <20240205184326.78814-1-sauravsc@amazon.com>
Hi Saurav,
On Mon, Feb 05, 2024 at 06:43:26PM +0000, Saurav Sachidanand wrote:
[...]
> diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> index c15ee1df036a..26bc838ce14c 100644
> --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> @@ -324,6 +324,7 @@ static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu,
> u64 value;
>
> value = (u64)(mpidr & GENMASK(23, 0)) << 32;
> + value |= (u64)((mpidr >> 32) & GENMASK(7, 0)) << 56;
This looks suspiciously similar to what MPIDR_AFFINITY_LEVEL()
accomplishes. I think we can tolerate a few extra lines of code to make
the entire thing more self-documenting, like:
value = ((u64)MPIDR_AFFINITY_LEVEL(mpidr, 3) << 56 |
MPIDR_AFFINITY_LEVEL(mpidr, 2) << 48 |
MPIDR_AFFINITY_LEVEL(mpidr, 1) << 40 |
MPIDR_AFFINITY_LEVEL(mpidr, 0) << 32);
--
Thanks,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-02-06 10:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 18:43 [PATCH] [RFC] KVM: arm64/vgic: Populate GICR_TYPER with Aff3 Saurav Sachidanand
2024-02-06 10:28 ` Oliver Upton [this message]
2024-02-06 10:29 ` Marc Zyngier
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=ZcIJzn9KLR_bWdwc@linux.dev \
--to=oliver.upton@linux.dev \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=sauravsc@amazon.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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).