* [PATCH 1/3] KVM: arm64: Make ID_PFR1_EL1.GIC writable
[not found] <20251013083207.518998-1-maz@kernel.org>
@ 2025-10-13 8:32 ` Marc Zyngier
2025-10-22 7:00 ` Oliver Upton
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2025-10-13 8:32 UTC (permalink / raw)
To: kvmarm, linux-arm-kernel, kvm
Cc: Joey Gouly, Suzuki K Poulose, Oliver Upton, Zenghui Yu,
Peter Maydell, stable
Similarly to ID_AA64PFR0_EL1.GIC, relax ID_PFR1_EL1.GIC to be writable.
Fixes: 5cb57a1aff755 ("KVM: arm64: Zero ID_AA64PFR0_EL1.GIC when no GICv3 is presented to the guest")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
---
arch/arm64/kvm/sys_regs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index b29f72478a50d..73dcefe51a3e7 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -2528,6 +2528,12 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu,
.val = mask, \
}
+#define AA32_ID_WRITABLE(name, mask) { \
+ ID_DESC(name), \
+ .visibility = aa32_id_visibility, \
+ .val = mask, \
+}
+
/* sys_reg_desc initialiser for cpufeature ID registers that need filtering */
#define ID_FILTERED(sysreg, name, mask) { \
ID_DESC(sysreg), \
@@ -3040,7 +3046,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
/* AArch64 mappings of the AArch32 ID registers */
/* CRm=1 */
AA32_ID_SANITISED(ID_PFR0_EL1),
- AA32_ID_SANITISED(ID_PFR1_EL1),
+ AA32_ID_WRITABLE(ID_PFR1_EL1, ID_PFR1_EL1_GIC),
{ SYS_DESC(SYS_ID_DFR0_EL1),
.access = access_id_reg,
.get_user = get_id_reg,
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] KVM: arm64: Make ID_PFR1_EL1.GIC writable
2025-10-13 8:32 ` [PATCH 1/3] KVM: arm64: Make ID_PFR1_EL1.GIC writable Marc Zyngier
@ 2025-10-22 7:00 ` Oliver Upton
2025-10-30 11:25 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Upton @ 2025-10-22 7:00 UTC (permalink / raw)
To: Marc Zyngier
Cc: kvmarm, linux-arm-kernel, kvm, Joey Gouly, Suzuki K Poulose,
Zenghui Yu, Peter Maydell, stable
Hey,
On Mon, Oct 13, 2025 at 09:32:05AM +0100, Marc Zyngier wrote:
> Similarly to ID_AA64PFR0_EL1.GIC, relax ID_PFR1_EL1.GIC to be writable.
This looks fine to me, although I do wonder if we should just allow
userspace to write whatever value it wants to the 32-bit ID registers
and be done with it.
Nowhere do we use a 32-bit ID register value as a condition for trap
configuration / emulation, so even if the VMM lies to the guest it
shouldn't trip up KVM.
Thanks,
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] KVM: arm64: Make ID_PFR1_EL1.GIC writable
2025-10-22 7:00 ` Oliver Upton
@ 2025-10-30 11:25 ` Marc Zyngier
0 siblings, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2025-10-30 11:25 UTC (permalink / raw)
To: Oliver Upton
Cc: kvmarm, linux-arm-kernel, kvm, Joey Gouly, Suzuki K Poulose,
Zenghui Yu, Peter Maydell, stable
On Wed, 22 Oct 2025 08:00:47 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Hey,
>
> On Mon, Oct 13, 2025 at 09:32:05AM +0100, Marc Zyngier wrote:
> > Similarly to ID_AA64PFR0_EL1.GIC, relax ID_PFR1_EL1.GIC to be writable.
>
> This looks fine to me, although I do wonder if we should just allow
> userspace to write whatever value it wants to the 32-bit ID registers
> and be done with it.
That's a good point. Nobody really cares about 32bit anyway, and I'd
be happy to just let the VMM write whatever it wants. Might be a bit
harder to backport, but whoever is interested in AArch32 will be able
to do it.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-30 11:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20251013083207.518998-1-maz@kernel.org>
2025-10-13 8:32 ` [PATCH 1/3] KVM: arm64: Make ID_PFR1_EL1.GIC writable Marc Zyngier
2025-10-22 7:00 ` Oliver Upton
2025-10-30 11:25 ` Marc Zyngier
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).