Re: [PATCH v4 5/9] KVM: arm64: vgic: move irq->get_input_level into an ops structure

Marc Zyngier
2021-06-22T15:55:37Z

On Tue, 15 Jun 2021 15:45:03 +0100,
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Hi Marc,
>
> On 6/1/21 11:40 AM, Marc Zyngier wrote:
> > We already have the option to attach a callback to an interrupt
> > to retrieve its pending state. As we are planning to expand this
> > facility, move this callback into its own data structure.
> >
> > This will limit the size of individual interrupts as the ops
> > structures can be shared across multiple interrupts.
>
> I can't figure out what you mean by that. If you are referring to
> struct vgic_irq, the change I am seeing is a pointer being replaced
> by another pointer, which shouldn't affect its size. Are you
> referring to something else?

Eventually, we have more than just a pointer (we also get flags in the
same structure), so this saves some space.

>
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> > arch/arm64/kvm/arch_timer.c | 8 ++++++--
> > arch/arm64/kvm/vgic/vgic.c | 14 +++++++-------
> > include/kvm/arm_vgic.h | 28 +++++++++++++++++-----------
> > 3 files changed, 30 insertions(+), 20 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c
> > index 74e0699661e9..e2288b6bf435 100644
> > --- a/arch/arm64/kvm/arch_timer.c
> > +++ b/arch/arm64/kvm/arch_timer.c
> > @@ -1116,6 +1116,10 @@ bool kvm_arch_timer_get_input_level(int vintid)
> > return kvm_timer_should_fire(timer);
> > }
> >
> > +static struct irq_ops arch_timer_irq_ops = {
> > + .get_input_level = kvm_arch_timer_get_input_level,
>
> Since kvm_arch_timer_get_input_level() is used only indirectly, through the
> get_input_level field of the static struct, I think we can make
> kvm_arch_timer_get_input_level() static and remove the declaration from
> include/kvm/arm_arch_timer.h.

Ah, good point. I'll stash a patch on top of the existing series (I'm
trying not to change what is currently queued in -next).

Thanks,

M.

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