[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14b61a77-98ae-4285-a1e1-a61fe1221f9a@amazon.com>
Date: Tue, 3 Feb 2026 11:44:48 +0100
From: Alexander Graf <graf@...zon.com>
To: Thomas Gleixner <tglx@...nel.org>, <x86@...nel.org>
CC: <linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>, "Clemens
Ladisch" <clemens@...isch.de>, Arnd Bergmann <arnd@...db.de>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>, Dave Hansen
<dave.hansen@...ux.intel.com>, Borislav Petkov <bp@...en8.de>, Ingo Molnar
<mingo@...hat.com>, Jonathan Corbet <corbet@....net>, Paolo Bonzini
<pbonzini@...hat.com>, Pasha Tatashin <pasha.tatashin@...een.com>,
<nh-open-source@...zon.com>, Nicolas Saenz Julienne <nsaenz@...zon.es>,
Hendrik Borghorst <hborghor@...zon.de>, Filippo Sironi <sironi@...zon.de>,
David Woodhouse <dwmw@...zon.co.uk>, Jan Schönherr
<jschoenh@...zon.de>
Subject: Re: [PATCH 1/2] x86/ioapic: Add NMI delivery configuration helper
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
Powered by blists - more mailing lists