[PATCH] KVM: arm64: vgic: fix GICR_STATUSR in vgic_v3_rd_registers

Marc Zyngier maz at kernel.org
Mon Sep 30 07:45:17 PDT 2024


On Mon, 30 Sep 2024 07:20:35 +0100,
Jia Qingtong <jiaqingtong97 at gmail.com> wrote:
> 
> On 29 Sep 10:38, Marc Zyngier wrote:
> > On Sun, 29 Sep 2024 05:39:35 +0100,
> > jiaqingtong97 at gmail.com wrote:
> > > 
> > > From: Jia Qingtong <jiaqingtong at huawei.com>
> > > 
> > > vgic_uaccess use bsearch search regs in vgic_io_device.regions, but the
> > > GICR_STATUSR have wrong order in vgic_v3_rd_registers.
> > > When check all vgic_register_region, it turned out that only
> > > vgic_v3_rd_registers has this problem.
> > > 
> > > It's harmless since vgic_uaccess behaves as RAZ&WI when it can't find the
> > > specified reg. This is exactly the same as the behavior of the GICR_STATUSR
> > > register.
> > >
> > > So just move GICR_STATUSR to the right place.
> > 
> > That looks correct, but I think we should have some code that ensures
> > that these tables are correct at boot time, just like we're doing for
> > the system registers. Or completely remove our reliance on bsearch().
> > 
> struct vgic_register_region was defined in vgic-{its,mmio-v2,mmio-v3},
> do you think it's appropriate to extern and check tables's item order in
> vgic-init.c's kvm_vgic_hyp_init?.

I'd rather we have local functions performing the check, one in each
of the GIC "modules", calling a global helper taking a pointer to the
register array as a parameter.

> 
> > Another thing is that GICD_STATUSR looks pretty wrong. It is handled
> > as RAO, but we never clear any "error" (it is WI). This has been buggy
> > since GICv3 save/restore was added, 7 years ago.
> > 
> Let's change it to RAZ? We will implement the complete logic when someone
> really needs this feature.

Exactly. Which is probably *never*.

> 
> > Do you mind spinning a series fixing this up?
> > 
> Sure. 

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list