[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcIJzn9KLR_bWdwc@linux.dev>
Date: Tue, 6 Feb 2024 10:28:30 +0000
From: Oliver Upton <oliver.upton@...ux.dev>
To: Saurav Sachidanand <sauravsc@...zon.com>
Cc: Marc Zyngier <maz@...nel.org>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [RFC] KVM: arm64/vgic: Populate GICR_TYPER with Aff3
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
Powered by blists - more mailing lists