Re: [PATCH v3 02/23] KVM: arm64: Extract number of sys_reg_desc into a constant
From: Joey Gouly
Date: Thu Nov 26 2026 - 06:13:06 EST
On Wed, Nov 25, 2026 at 04:30:27PM +0100, Steffen Eiden wrote:
> On Wed, Nov 25, 2026 at 02:29:48PM +0000, Joey Gouly wrote:
> > On Fri, Nov 06, 2026 at 05:07:35PM +0100, Steffen Eiden wrote:
> > > Define the constant `num_sys_reg_descs` which stores the number of
> > > elements in the sys_reg_descs array. Replace all occurrences of
> > > ARRAY_SIZE(sys_reg_descs) with the new constant.
> > >
> > > This refactoring eases the integration of handling system registers for
> > > arm on s390. s390 needs code from the shared code to define the
> > > sys_reg_descs. But also the shared code needs the definition of the
> > > sys_reg_array and we cannot forward declare arrays and use their size
> > > before it is properly defined. This patch solves this chicken or egg
> > > problem. For the time being s390 cannot process the full arm64 defined
> > > sys_reg_descs array.
> > >
> > > No functional changes.
> > >
> > > Co-developed-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
> > > Signed-off-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
> > > Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
> >
> > I see later in the series, the include of sys_regs.c into s390 is done
> > before the s390 sys_reg_descs array is defined.
> >
>
> Are you referring to [PATCH v3 08/23] KVM: arm64: Share system register code with s390
I was talking about arch/s390/kvm/arm64/sys_regs.c in
[PATCH v3 16/23] KVM: s390: arm64: Implement arm sysreg managing infrastructure.
+static const size_t num_sys_reg_descs;
..
+#include "generated/sys_regs.inc"
..
+static const size_t num_sys_reg_descs = ARRAY_SIZE(sys_reg_descs);
>
> There, the sharing is done from the arm64 side.
>
> As this is a new file for s390 the sharing only gets effective with
> [PATCH v3 16/23] KVM: s390: arm64: Implement arm sysreg managing infrastructure
>
> There, in arch/s390/kvm/arm64/Makefile.gen I add the sys_reg.c as shared
> file. Before it will not be processed (nor included) by s390.
>
> And there in our sys_regs.c I'll define that array.
>
> Or did I miss something?
Sorry, I wasn't saying anything was wrong, just reading the code and
writing why it makes sense to make this change!
Thanks,
Joey
>
> > Reviewed-by: Joey Gouly <joey.gouly@xxxxxxx>
> >
> > Thanks,
> > Joey
> >
>
> Thank you!
>
> Steffen
>