Commit 943af0e7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86-apic-2023-10-29-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 APIC updates from Thomas Gleixner:

 - Make the quirk for non-maskable MSI interrupts in the affinity setter
   functional again.

   It was broken by a MSI core code update, which restructured the code
   in a way that the quirk flag was not longer set correctly.

   Trying to restore the core logic caused a deeper inspection and it
   turned out that the extra quirk flag is not required at all because
   it's the inverse of the reservation mode bit, which only can be set
   when the MSI interrupt is maskable.

   So the trivial fix is to use the reservation mode check in the
   affinity setter function and remove almost 40 lines of code related
   to the no-mask quirk flag.

 - Cure a Kconfig dependency issue which causes compile failures by
   correcting the conditionals in the affected header files.

 - Clean up coding style in the UV APIC driver.

* tag 'x86-apic-2023-10-29-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic/msi: Fix misconfigured non-maskable MSI quirk
  x86/msi: Fix compile error caused by CONFIG_GENERIC_MSI_IRQ=y && !CONFIG_X86_LOCAL_APIC
  x86/platform/uv/apic: Clean up inconsistent indenting
parents 63a3f119 b56ebe7c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#include <asm/irq.h>
#include <asm/sections.h>

#ifdef	CONFIG_X86_LOCAL_APIC
#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
struct irq_data;
struct pci_dev;
struct msi_desc;
@@ -105,10 +105,10 @@ static inline void irq_complete_move(struct irq_cfg *c) { }
#endif

extern void apic_ack_edge(struct irq_data *data);
#else	/*  CONFIG_X86_LOCAL_APIC */
#else	/*  CONFIG_IRQ_DOMAIN_HIERARCHY */
static inline void lock_vector_lock(void) {}
static inline void unlock_vector_lock(void) {}
#endif	/* CONFIG_X86_LOCAL_APIC */
#endif	/* CONFIG_IRQ_DOMAIN_HIERARCHY */

/* Statistics */
extern atomic_t irq_err_count;
+3 −5
Original line number Diff line number Diff line
@@ -55,14 +55,14 @@ msi_set_affinity(struct irq_data *irqd, const struct cpumask *mask, bool force)
	 * caused by the non-atomic update of the address/data pair.
	 *
	 * Direct update is possible when:
	 * - The MSI is maskable (remapped MSI does not use this code path)).
	 *   The quirk bit is not set in this case.
	 * - The MSI is maskable (remapped MSI does not use this code path).
	 *   The reservation mode bit is set in this case.
	 * - The new vector is the same as the old vector
	 * - The old vector is MANAGED_IRQ_SHUTDOWN_VECTOR (interrupt starts up)
	 * - The interrupt is not yet started up
	 * - The new destination CPU is the same as the old destination CPU
	 */
	if (!irqd_msi_nomask_quirk(irqd) ||
	if (!irqd_can_reserve(irqd) ||
	    cfg->vector == old_cfg.vector ||
	    old_cfg.vector == MANAGED_IRQ_SHUTDOWN_VECTOR ||
	    !irqd_is_started(irqd) ||
@@ -215,8 +215,6 @@ static bool x86_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
		if (WARN_ON_ONCE(domain != real_parent))
			return false;
		info->chip->irq_set_affinity = msi_set_affinity;
		/* See msi_set_affinity() for the gory details */
		info->flags |= MSI_FLAG_NOMASK_QUIRK;
		break;
	case DOMAIN_BUS_DMAR:
	case DOMAIN_BUS_AMDVI:
+2 −2
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ unsigned long hpet_address;
u8					hpet_blockid; /* OS timer block num */
bool					hpet_msi_disable;

#ifdef CONFIG_GENERIC_MSI_IRQ
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel);
static struct irq_domain		*hpet_domain;
#endif
@@ -469,7 +469,7 @@ static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
/*
 * HPET MSI Support
 */
#ifdef CONFIG_GENERIC_MSI_IRQ
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
static void hpet_msi_unmask(struct irq_data *data)
{
	struct hpet_channel *hc = irq_data_get_irq_handler_data(data);
+4 −22
Original line number Diff line number Diff line
@@ -215,8 +215,6 @@ struct irq_data {
 * IRQD_SINGLE_TARGET		- IRQ allows only a single affinity target
 * IRQD_DEFAULT_TRIGGER_SET	- Expected trigger already been set
 * IRQD_CAN_RESERVE		- Can use reservation mode
 * IRQD_MSI_NOMASK_QUIRK	- Non-maskable MSI quirk for affinity change
 *				  required
 * IRQD_HANDLE_ENFORCE_IRQCTX	- Enforce that handle_irq_*() is only invoked
 *				  from actual interrupt context.
 * IRQD_AFFINITY_ON_ACTIVATE	- Affinity is set on activation. Don't call
@@ -247,11 +245,10 @@ enum {
	IRQD_SINGLE_TARGET		= BIT(24),
	IRQD_DEFAULT_TRIGGER_SET	= BIT(25),
	IRQD_CAN_RESERVE		= BIT(26),
	IRQD_MSI_NOMASK_QUIRK		= BIT(27),
	IRQD_HANDLE_ENFORCE_IRQCTX	= BIT(28),
	IRQD_AFFINITY_ON_ACTIVATE	= BIT(29),
	IRQD_IRQ_ENABLED_ON_SUSPEND	= BIT(30),
	IRQD_RESEND_WHEN_IN_PROGRESS    = BIT(31),
	IRQD_HANDLE_ENFORCE_IRQCTX	= BIT(27),
	IRQD_AFFINITY_ON_ACTIVATE	= BIT(28),
	IRQD_IRQ_ENABLED_ON_SUSPEND	= BIT(29),
	IRQD_RESEND_WHEN_IN_PROGRESS    = BIT(30),
};

#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
@@ -426,21 +423,6 @@ static inline bool irqd_can_reserve(struct irq_data *d)
	return __irqd_to_state(d) & IRQD_CAN_RESERVE;
}

static inline void irqd_set_msi_nomask_quirk(struct irq_data *d)
{
	__irqd_to_state(d) |= IRQD_MSI_NOMASK_QUIRK;
}

static inline void irqd_clr_msi_nomask_quirk(struct irq_data *d)
{
	__irqd_to_state(d) &= ~IRQD_MSI_NOMASK_QUIRK;
}

static inline bool irqd_msi_nomask_quirk(struct irq_data *d)
{
	return __irqd_to_state(d) & IRQD_MSI_NOMASK_QUIRK;
}

static inline void irqd_set_affinity_on_activate(struct irq_data *d)
{
	__irqd_to_state(d) |= IRQD_AFFINITY_ON_ACTIVATE;
+0 −6
Original line number Diff line number Diff line
@@ -547,12 +547,6 @@ enum {
	MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS	= (1 << 5),
	/* Free MSI descriptors */
	MSI_FLAG_FREE_MSI_DESCS		= (1 << 6),
	/*
	 * Quirk to handle MSI implementations which do not provide
	 * masking. Currently known to affect x86, but has to be partially
	 * handled in the core MSI code.
	 */
	MSI_FLAG_NOMASK_QUIRK		= (1 << 7),

	/* Mask for the generic functionality */
	MSI_GENERIC_FLAGS_MASK		= GENMASK(15, 0),
Loading