From: Marc Zyngier <maz@kernel.org>
To: Sascha Bischoff <Sascha.Bischoff@arm.com>
Cc: Andre Przywara <Andre.Przywara@arm.com>,
"will@kernel.org" <will@kernel.org>,
"julien.thierry.kdev@gmail.com" <julien.thierry.kdev@gmail.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
Alexandru Elisei <Alexandru.Elisei@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH kvmtool v4 3/7] arm64: nested: Add support for setting maintenance IRQ
Date: Mon, 19 Jan 2026 09:13:51 +0000 [thread overview]
Message-ID: <868qduc6cw.wl-maz@kernel.org> (raw)
In-Reply-To: <3d2a364595956d06624102684418bdad2a9d20b6.camel@arm.com>
On Fri, 16 Jan 2026 18:10:11 +0000,
Sascha Bischoff <Sascha.Bischoff@arm.com> wrote:
>
> On Wed, 2025-09-24 at 14:45 +0100, Andre Przywara wrote:
> > Uses the new VGIC KVM device attribute to set the maintenance IRQ.
> > This is fixed to use PPI 9, as a platform decision made by kvmtool,
> > matching the SBSA recommendation.
> > Use the opportunity to pass the kvm pointer to
> > gic__generate_fdt_nodes(),
> > as this simplifies the call and allows us access to the nested_virt
> > on
> > the way.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> > arm64/arm-cpu.c | 2 +-
> > arm64/gic.c | 26 ++++++++++++++++++++++++--
> > arm64/include/kvm/gic.h | 2 +-
> > 3 files changed, 26 insertions(+), 4 deletions(-)
> >
> > diff --git a/arm64/arm-cpu.c b/arm64/arm-cpu.c
> > index 69bb2cb2c..0843ac051 100644
> > --- a/arm64/arm-cpu.c
> > +++ b/arm64/arm-cpu.c
> > @@ -14,7 +14,7 @@ static void generate_fdt_nodes(void *fdt, struct
> > kvm *kvm)
> > {
> > int timer_interrupts[4] = {13, 14, 11, 10};
> >
> > - gic__generate_fdt_nodes(fdt, kvm->cfg.arch.irqchip);
> > + gic__generate_fdt_nodes(fdt, kvm);
> > timer__generate_fdt_nodes(fdt, kvm, timer_interrupts);
> > pmu__generate_fdt_nodes(fdt, kvm);
> > }
> > diff --git a/arm64/gic.c b/arm64/gic.c
> > index b0d3a1abb..e35986c06 100644
> > --- a/arm64/gic.c
> > +++ b/arm64/gic.c
> > @@ -11,6 +11,8 @@
> >
> > #define IRQCHIP_GIC 0
> >
> > +#define GIC_MAINT_IRQ 9
> > +
> > static int gic_fd = -1;
> > static u64 gic_redists_base;
> > static u64 gic_redists_size;
> > @@ -302,10 +304,15 @@ static int gic__init_gic(struct kvm *kvm)
> >
> > int lines = irq__get_nr_allocated_lines();
> > u32 nr_irqs = ALIGN(lines, 32) + GIC_SPI_IRQ_BASE;
> > + u32 maint_irq = GIC_PPI_IRQ_BASE + GIC_MAINT_IRQ;
> > struct kvm_device_attr nr_irqs_attr = {
> > .group = KVM_DEV_ARM_VGIC_GRP_NR_IRQS,
> > .addr = (u64)(unsigned long)&nr_irqs,
> > };
> > + struct kvm_device_attr maint_irq_attr = {
> > + .group = KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ,
> > + .addr = (u64)(unsigned long)&maint_irq,
> > + };
> > struct kvm_device_attr vgic_init_attr = {
> > .group = KVM_DEV_ARM_VGIC_GRP_CTRL,
> > .attr = KVM_DEV_ARM_VGIC_CTRL_INIT,
> > @@ -325,6 +332,13 @@ static int gic__init_gic(struct kvm *kvm)
> > return ret;
> > }
> >
> > + if (kvm->cfg.arch.nested_virt &&
> > + !ioctl(gic_fd, KVM_HAS_DEVICE_ATTR, &maint_irq_attr)) {
> > + ret = ioctl(gic_fd, KVM_SET_DEVICE_ATTR,
> > &maint_irq_attr);
> > + if (ret)
> > + return ret;
> > + }
>
> With GICv3 are things not a little broken if we're trying to do nested
> but don't have the ability to set the maint IRQ? It feels to me as if
> an error should be returned if the attr doesn't exist.
>
> Also, the way that the FDT is generated means that we'd still generate
> the property for the maint IRQ, even if we can't set it here.
Yup, this definitely need fixing. Thanks for catching this.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2026-01-19 9:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 13:45 [PATCH kvmtool v4 0/7] arm64: Nested virtualization support Andre Przywara
2025-09-24 13:45 ` [PATCH kvmtool v4 1/7] Sync kernel UAPI headers with v6.16 Andre Przywara
2025-09-24 13:45 ` [PATCH kvmtool v4 2/7] arm64: Initial nested virt support Andre Przywara
2026-01-16 18:07 ` Sascha Bischoff
2025-09-24 13:45 ` [PATCH kvmtool v4 3/7] arm64: nested: Add support for setting maintenance IRQ Andre Przywara
2026-01-16 18:10 ` Sascha Bischoff
2026-01-19 9:13 ` Marc Zyngier [this message]
2026-01-22 15:54 ` Andre Przywara
2026-01-22 16:45 ` Sascha Bischoff
2025-09-24 13:45 ` [PATCH kvmtool v4 4/7] arm64: Add counter offset control Andre Przywara
2026-01-16 18:13 ` Sascha Bischoff
2025-09-24 13:45 ` [PATCH kvmtool v4 5/7] arm64: Add FEAT_E2H0 support Andre Przywara
2026-01-16 18:12 ` Sascha Bischoff
2026-01-19 9:38 ` Marc Zyngier
2025-09-24 13:45 ` [PATCH kvmtool v4 6/7] arm64: Generate HYP timer interrupt specifiers Andre Przywara
2026-01-16 18:14 ` Sascha Bischoff
2025-09-24 13:45 ` [PATCH kvmtool v4 7/7] arm64: Handle virtio endianness reset when running nested Andre Przywara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=868qduc6cw.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=Alexandru.Elisei@arm.com \
--cc=Andre.Przywara@arm.com \
--cc=Sascha.Bischoff@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=nd@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.