From: Alexander Graf <graf@amazon.com>
To: Thomas Gleixner <tglx@kernel.org>, <x86@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
"Clemens Ladisch" <clemens@ladisch.de>,
"Arnd Bergmann" <arnd@arndb.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"Borislav Petkov" <bp@alien8.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
nh-open-source@amazon.com,
"Nicolas Saenz Julienne" <nsaenz@amazon.es>,
"Hendrik Borghorst" <hborghor@amazon.de>,
"Filippo Sironi" <sironi@amazon.de>,
"David Woodhouse" <dwmw@amazon.co.uk>,
"Jan Schönherr" <jschoenh@amazon.de>
Subject: Re: [PATCH 1/2] x86/ioapic: Add NMI delivery configuration helper
Date: Tue, 3 Feb 2026 11:44:48 +0100 [thread overview]
Message-ID: <14b61a77-98ae-4285-a1e1-a61fe1221f9a@amazon.com> (raw)
In-Reply-To: <87ldha3zs5.ffs@tglx>
On 03.02.26 11:08, Thomas Gleixner wrote:
> On Mon, Feb 02 2026 at 17:48, Alexander Graf wrote:
>> To implement an HPET based NMI watchdog, the HPET code will need to
>> reconfigure an IOAPIC pin to NMI mode. Add a function that allows driver
>> code to configure an IOAPIC pin for NMI delivery mode.
> A function which violates all layering of the interrupt hierarchy...
Yes, just like the device itself :). The HPET is magical.
Let me try and see whether I can just make the HPET logic require MSI
(FSB) mode, so it can generate the NMI MSI message itself and post it
without going through the IOAPIC in the first place. That's probably
cleaner, more self contained and hence creates less layering violations
and complexity in the long run.
>
>> +/**
>> + * ioapic_set_nmi - Configure an IOAPIC pin for NMI delivery
>> + * @gsi: Global System Interrupt number
>> + * @broadcast: true to broadcast to all CPUs, false to send to CPU 0 only
>> + *
>> + * Configures the specified GSI for NMI delivery mode.
>> + *
>> + * Returns 0 on success, negative error code on failure.
>> + */
>> +int ioapic_set_nmi(u32 gsi, bool broadcast)
>> +{
>> + struct IO_APIC_route_entry entry = { };
>> + int ioapic_idx, pin;
>> +
>> + ioapic_idx = mp_find_ioapic(gsi);
>> + if (ioapic_idx < 0)
>> + return -ENODEV;
>> +
>> + pin = mp_find_ioapic_pin(ioapic_idx, gsi);
>> + if (pin < 0)
>> + return -ENODEV;
>> +
>> + entry.delivery_mode = APIC_DELIVERY_MODE_NMI;
>> + entry.destid_0_7 = broadcast ? 0xFF : boot_cpu_physical_apicid;
>> + entry.dest_mode_logical = 0;
>> + entry.masked = 0;
>> +
>> + ioapic_write_entry(ioapic_idx, pin, entry);
> Q: How is that supposed to work with interrupt remapping?
> A: Not at all.
... and yes, hopefully also gets us support for INTR if I manage to find
the right abstraction.
Thanks a lot for the review!
Alex
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
next prev parent reply other threads:[~2026-02-03 10:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 17:48 [PATCH 0/2] Add HPET NMI Watchdog support Alexander Graf
2026-02-02 17:48 ` [PATCH 1/2] x86/ioapic: Add NMI delivery configuration helper Alexander Graf
2026-02-03 10:08 ` Thomas Gleixner
2026-02-03 10:44 ` Alexander Graf [this message]
2026-02-03 10:45 ` David Woodhouse
2026-02-02 17:48 ` [PATCH 2/2] hpet: Add HPET-based NMI watchdog support Alexander Graf
2026-02-03 10:32 ` Thomas Gleixner
2026-02-03 12:36 ` Alexander Graf
2026-02-03 15:28 ` Thomas Gleixner
2026-02-03 19:44 ` Ricardo Neri
2026-02-03 20:49 ` Thomas Gleixner
2026-02-04 5:05 ` Ricardo Neri
2026-02-03 16:24 ` Sasha Levin
2026-02-03 17:19 ` Alexander Graf
2026-02-03 17:43 ` David Woodhouse
2026-02-03 20:46 ` Thomas Gleixner
2026-02-03 23:13 ` David Woodhouse
2026-02-04 10:34 ` Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2026-02-02 17:43 [PATCH 0/2] Add HPET NMI Watchdog support Alexander Graf
2026-02-02 17:43 ` [PATCH 1/2] x86/ioapic: Add NMI delivery configuration helper Alexander Graf
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=14b61a77-98ae-4285-a1e1-a61fe1221f9a@amazon.com \
--to=graf@amazon.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=clemens@ladisch.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw@amazon.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hborghor@amazon.de \
--cc=jschoenh@amazon.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nh-open-source@amazon.com \
--cc=nsaenz@amazon.es \
--cc=pasha.tatashin@soleen.com \
--cc=pbonzini@redhat.com \
--cc=sironi@amazon.de \
--cc=tglx@kernel.org \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®