Re: [PATCH 07/43] KVM: arm64: gic-v5: Create & manage VM and VPE tables

Sascha Bischoff
2026-05-01T16:43:33Z

On Tue, 2026-04-28 at 15:54 +0100, Vladimir Murzin wrote:
> Hi Sascha,
>
> On 4/27/26 17:08, Sascha Bischoff wrote:
> > +
> > + if (virt_to_phys(l2_table) & ~GICV5_VMTEL1E_L2_ADDR) {
> > + kfree(l2_table);
> > + return -EINVAL;
> > + }
> > +
> > + vmt_info->l2.l2ptrs[l1_index] = l2_table;
> > +
> > + /* Alignment issue! */
> > + if (virt_to_phys(l2_table) & ~GICV5_VMTEL1E_L2_ADDR) {
> > + kfree(l2_table);
> > + return -EFAULT;
> > + }
> > +
> > + tmp = virt_to_phys(l2_table) & GICV5_VMTEL1E_L2_ADDR;
> > + WRITE_ONCE(vmt_info->l2.vmt_base[l1_index],
> > cpu_to_le64(tmp));
>
> It seems the same l2_table alignment calculated (and checked)
> multiple times...

Hi Vladimir,

Yeah, you are correct. I've dropped that. Given the comments on this
change in general, I'm going through and dropping much of the paranoia.
We should trust the allocator to give us sane alignments, so there's no
point in checking, masking, then writing. Same goes for the CMO side of
this - will go and re-work that to be more sane.

Thanks,
Sascha

>
> Cheers
> Vladimir