Commit 72161299 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/apic: Cleanup delivery mode defines

The enum ioapic_irq_destination_types and the enumerated constants starting
with 'dest_' are gross misnomers because they describe the delivery mode.

Rename then enum and the constants so they actually make sense.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-6-dwmw2@infradead.org
parent 2e730cb5
...@@ -309,7 +309,8 @@ struct apic { ...@@ -309,7 +309,8 @@ struct apic {
/* dest_logical is used by the IPI functions */ /* dest_logical is used by the IPI functions */
u32 dest_logical; u32 dest_logical;
u32 disable_esr; u32 disable_esr;
u32 irq_delivery_mode;
enum apic_delivery_modes delivery_mode;
u32 irq_dest_mode; u32 irq_dest_mode;
u32 (*calc_dest_apicid)(unsigned int cpu); u32 (*calc_dest_apicid)(unsigned int cpu);
......
...@@ -432,15 +432,13 @@ struct local_apic { ...@@ -432,15 +432,13 @@ struct local_apic {
#define BAD_APICID 0xFFFFu #define BAD_APICID 0xFFFFu
#endif #endif
enum ioapic_irq_destination_types { enum apic_delivery_modes {
dest_Fixed = 0, APIC_DELIVERY_MODE_FIXED = 0,
dest_LowestPrio = 1, APIC_DELIVERY_MODE_LOWESTPRIO = 1,
dest_SMI = 2, APIC_DELIVERY_MODE_SMI = 2,
dest__reserved_1 = 3, APIC_DELIVERY_MODE_NMI = 4,
dest_NMI = 4, APIC_DELIVERY_MODE_INIT = 5,
dest_INIT = 5, APIC_DELIVERY_MODE_EXTINT = 7,
dest__reserved_2 = 6,
dest_ExtINT = 7
}; };
#endif /* _ASM_X86_APICDEF_H */ #endif /* _ASM_X86_APICDEF_H */
...@@ -113,7 +113,7 @@ static struct apic apic_flat __ro_after_init = { ...@@ -113,7 +113,7 @@ static struct apic apic_flat __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = flat_apic_id_registered, .apic_id_registered = flat_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.disable_esr = 0, .disable_esr = 0,
...@@ -206,7 +206,7 @@ static struct apic apic_physflat __ro_after_init = { ...@@ -206,7 +206,7 @@ static struct apic apic_physflat __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = flat_apic_id_registered, .apic_id_registered = flat_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.disable_esr = 0, .disable_esr = 0,
......
...@@ -95,7 +95,7 @@ struct apic apic_noop __ro_after_init = { ...@@ -95,7 +95,7 @@ struct apic apic_noop __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = noop_apic_id_registered, .apic_id_registered = noop_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,
......
...@@ -246,7 +246,7 @@ static const struct apic apic_numachip1 __refconst = { ...@@ -246,7 +246,7 @@ static const struct apic apic_numachip1 __refconst = {
.apic_id_valid = numachip_apic_id_valid, .apic_id_valid = numachip_apic_id_valid,
.apic_id_registered = numachip_apic_id_registered, .apic_id_registered = numachip_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.disable_esr = 0, .disable_esr = 0,
...@@ -295,7 +295,7 @@ static const struct apic apic_numachip2 __refconst = { ...@@ -295,7 +295,7 @@ static const struct apic apic_numachip2 __refconst = {
.apic_id_valid = numachip_apic_id_valid, .apic_id_valid = numachip_apic_id_valid,
.apic_id_registered = numachip_apic_id_registered, .apic_id_registered = numachip_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.disable_esr = 0, .disable_esr = 0,
......
...@@ -127,7 +127,7 @@ static struct apic apic_bigsmp __ro_after_init = { ...@@ -127,7 +127,7 @@ static struct apic apic_bigsmp __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = bigsmp_apic_id_registered, .apic_id_registered = bigsmp_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
/* phys delivery to target CPU: */ /* phys delivery to target CPU: */
.irq_dest_mode = 0, .irq_dest_mode = 0,
......
...@@ -535,7 +535,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) ...@@ -535,7 +535,7 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
/* Check delivery_mode to be sure we're not clearing an SMI pin */ /* Check delivery_mode to be sure we're not clearing an SMI pin */
entry = ioapic_read_entry(apic, pin); entry = ioapic_read_entry(apic, pin);
if (entry.delivery_mode == dest_SMI) if (entry.delivery_mode == APIC_DELIVERY_MODE_SMI)
return; return;
/* /*
...@@ -1368,7 +1368,8 @@ void __init enable_IO_APIC(void) ...@@ -1368,7 +1368,8 @@ void __init enable_IO_APIC(void)
/* If the interrupt line is enabled and in ExtInt mode /* If the interrupt line is enabled and in ExtInt mode
* I have found the pin where the i8259 is connected. * I have found the pin where the i8259 is connected.
*/ */
if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) { if ((entry.mask == 0) &&
(entry.delivery_mode == APIC_DELIVERY_MODE_EXTINT)) {
ioapic_i8259.apic = apic; ioapic_i8259.apic = apic;
ioapic_i8259.pin = pin; ioapic_i8259.pin = pin;
goto found_i8259; goto found_i8259;
...@@ -1416,7 +1417,7 @@ void native_restore_boot_irq_mode(void) ...@@ -1416,7 +1417,7 @@ void native_restore_boot_irq_mode(void)
entry.trigger = IOAPIC_EDGE; entry.trigger = IOAPIC_EDGE;
entry.polarity = IOAPIC_POL_HIGH; entry.polarity = IOAPIC_POL_HIGH;
entry.dest_mode = IOAPIC_DEST_MODE_PHYSICAL; entry.dest_mode = IOAPIC_DEST_MODE_PHYSICAL;
entry.delivery_mode = dest_ExtINT; entry.delivery_mode = APIC_DELIVERY_MODE_EXTINT;
entry.dest = read_apic_id(); entry.dest = read_apic_id();
/* /*
...@@ -2047,7 +2048,7 @@ static inline void __init unlock_ExtINT_logic(void) ...@@ -2047,7 +2048,7 @@ static inline void __init unlock_ExtINT_logic(void)
entry1.dest_mode = IOAPIC_DEST_MODE_PHYSICAL; entry1.dest_mode = IOAPIC_DEST_MODE_PHYSICAL;
entry1.mask = IOAPIC_UNMASKED; entry1.mask = IOAPIC_UNMASKED;
entry1.dest = hard_smp_processor_id(); entry1.dest = hard_smp_processor_id();
entry1.delivery_mode = dest_ExtINT; entry1.delivery_mode = APIC_DELIVERY_MODE_EXTINT;
entry1.polarity = entry0.polarity; entry1.polarity = entry0.polarity;
entry1.trigger = IOAPIC_EDGE; entry1.trigger = IOAPIC_EDGE;
entry1.vector = 0; entry1.vector = 0;
...@@ -2948,7 +2949,7 @@ static void mp_setup_entry(struct irq_cfg *cfg, struct mp_chip_data *data, ...@@ -2948,7 +2949,7 @@ static void mp_setup_entry(struct irq_cfg *cfg, struct mp_chip_data *data,
struct IO_APIC_route_entry *entry) struct IO_APIC_route_entry *entry)
{ {
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
entry->delivery_mode = apic->irq_delivery_mode; entry->delivery_mode = apic->delivery_mode;
entry->dest_mode = apic->irq_dest_mode; entry->dest_mode = apic->irq_dest_mode;
entry->dest = cfg->dest_apicid; entry->dest = cfg->dest_apicid;
entry->vector = cfg->vector; entry->vector = cfg->vector;
......
...@@ -69,7 +69,7 @@ static struct apic apic_default __ro_after_init = { ...@@ -69,7 +69,7 @@ static struct apic apic_default __ro_after_init = {
.apic_id_valid = default_apic_id_valid, .apic_id_valid = default_apic_id_valid,
.apic_id_registered = default_apic_id_registered, .apic_id_registered = default_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,
......
...@@ -184,7 +184,7 @@ static struct apic apic_x2apic_cluster __ro_after_init = { ...@@ -184,7 +184,7 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
.apic_id_valid = x2apic_apic_id_valid, .apic_id_valid = x2apic_apic_id_valid,
.apic_id_registered = x2apic_apic_id_registered, .apic_id_registered = x2apic_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.disable_esr = 0, .disable_esr = 0,
......
...@@ -157,7 +157,7 @@ static struct apic apic_x2apic_phys __ro_after_init = { ...@@ -157,7 +157,7 @@ static struct apic apic_x2apic_phys __ro_after_init = {
.apic_id_valid = x2apic_apic_id_valid, .apic_id_valid = x2apic_apic_id_valid,
.apic_id_registered = x2apic_apic_id_registered, .apic_id_registered = x2apic_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.disable_esr = 0, .disable_esr = 0,
......
...@@ -703,9 +703,9 @@ static void uv_send_IPI_one(int cpu, int vector) ...@@ -703,9 +703,9 @@ static void uv_send_IPI_one(int cpu, int vector)
unsigned long dmode, val; unsigned long dmode, val;
if (vector == NMI_VECTOR) if (vector == NMI_VECTOR)
dmode = dest_NMI; dmode = APIC_DELIVERY_MODE_NMI;
else else
dmode = dest_Fixed; dmode = APIC_DELIVERY_MODE_FIXED;
val = (1UL << UVH_IPI_INT_SEND_SHFT) | val = (1UL << UVH_IPI_INT_SEND_SHFT) |
(apicid << UVH_IPI_INT_APIC_ID_SHFT) | (apicid << UVH_IPI_INT_APIC_ID_SHFT) |
...@@ -807,7 +807,7 @@ static struct apic apic_x2apic_uv_x __ro_after_init = { ...@@ -807,7 +807,7 @@ static struct apic apic_x2apic_uv_x __ro_after_init = {
.apic_id_valid = uv_apic_id_valid, .apic_id_valid = uv_apic_id_valid,
.apic_id_registered = uv_apic_id_registered, .apic_id_registered = uv_apic_id_registered,
.irq_delivery_mode = dest_Fixed, .delivery_mode = APIC_DELIVERY_MODE_FIXED,
.irq_dest_mode = 0, /* Physical */ .irq_dest_mode = 0, /* Physical */
.disable_esr = 0, .disable_esr = 0,
......
...@@ -35,7 +35,7 @@ static void uv_program_mmr(struct irq_cfg *cfg, struct uv_irq_2_mmr_pnode *info) ...@@ -35,7 +35,7 @@ static void uv_program_mmr(struct irq_cfg *cfg, struct uv_irq_2_mmr_pnode *info)
mmr_value = 0; mmr_value = 0;
entry = (struct uv_IO_APIC_route_entry *)&mmr_value; entry = (struct uv_IO_APIC_route_entry *)&mmr_value;
entry->vector = cfg->vector; entry->vector = cfg->vector;
entry->delivery_mode = apic->irq_delivery_mode; entry->delivery_mode = apic->delivery_mode;
entry->dest_mode = apic->irq_dest_mode; entry->dest_mode = apic->irq_dest_mode;
entry->polarity = 0; entry->polarity = 0;
entry->trigger = 0; entry->trigger = 0;
......
...@@ -3671,7 +3671,7 @@ static void irq_remapping_prepare_irte(struct amd_ir_data *data, ...@@ -3671,7 +3671,7 @@ static void irq_remapping_prepare_irte(struct amd_ir_data *data,
data->irq_2_irte.devid = devid; data->irq_2_irte.devid = devid;
data->irq_2_irte.index = index + sub_handle; data->irq_2_irte.index = index + sub_handle;
iommu->irte_ops->prepare(data->entry, apic->irq_delivery_mode, iommu->irte_ops->prepare(data->entry, apic->delivery_mode,
apic->irq_dest_mode, irq_cfg->vector, apic->irq_dest_mode, irq_cfg->vector,
irq_cfg->dest_apicid, devid); irq_cfg->dest_apicid, devid);
...@@ -3944,7 +3944,7 @@ int amd_iommu_deactivate_guest_mode(void *data) ...@@ -3944,7 +3944,7 @@ int amd_iommu_deactivate_guest_mode(void *data)
entry->lo.fields_remap.valid = valid; entry->lo.fields_remap.valid = valid;
entry->lo.fields_remap.dm = apic->irq_dest_mode; entry->lo.fields_remap.dm = apic->irq_dest_mode;
entry->lo.fields_remap.int_type = apic->irq_delivery_mode; entry->lo.fields_remap.int_type = apic->delivery_mode;
entry->hi.fields.vector = cfg->vector; entry->hi.fields.vector = cfg->vector;
entry->lo.fields_remap.destination = entry->lo.fields_remap.destination =
APICID_TO_IRTE_DEST_LO(cfg->dest_apicid); APICID_TO_IRTE_DEST_LO(cfg->dest_apicid);
......
...@@ -1122,7 +1122,7 @@ static void prepare_irte(struct irte *irte, int vector, unsigned int dest) ...@@ -1122,7 +1122,7 @@ static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
* irq migration in the presence of interrupt-remapping. * irq migration in the presence of interrupt-remapping.
*/ */
irte->trigger_mode = 0; irte->trigger_mode = 0;
irte->dlvry_mode = apic->irq_delivery_mode; irte->dlvry_mode = apic->delivery_mode;
irte->vector = vector; irte->vector = vector;
irte->dest_id = IRTE_DEST(dest); irte->dest_id = IRTE_DEST(dest);
irte->redir_hint = 1; irte->redir_hint = 1;
......
...@@ -1226,7 +1226,7 @@ static void hv_irq_unmask(struct irq_data *data) ...@@ -1226,7 +1226,7 @@ static void hv_irq_unmask(struct irq_data *data)
params->int_target.vector = cfg->vector; params->int_target.vector = cfg->vector;
/* /*
* Honoring apic->irq_delivery_mode set to dest_Fixed by * Honoring apic->delivery_mode set to APIC_DELIVERY_MODE_FIXED by
* setting the HV_DEVICE_INTERRUPT_TARGET_MULTICAST flag results in a * setting the HV_DEVICE_INTERRUPT_TARGET_MULTICAST flag results in a
* spurious interrupt storm. Not doing so does not seem to have a * spurious interrupt storm. Not doing so does not seem to have a
* negative effect (yet?). * negative effect (yet?).
...@@ -1324,7 +1324,7 @@ static u32 hv_compose_msi_req_v1( ...@@ -1324,7 +1324,7 @@ static u32 hv_compose_msi_req_v1(
int_pkt->wslot.slot = slot; int_pkt->wslot.slot = slot;
int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector = vector;
int_pkt->int_desc.vector_count = 1; int_pkt->int_desc.vector_count = 1;
int_pkt->int_desc.delivery_mode = dest_Fixed; int_pkt->int_desc.delivery_mode = APIC_DELIVERY_MODE_FIXED;
/* /*
* Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in
...@@ -1345,7 +1345,7 @@ static u32 hv_compose_msi_req_v2( ...@@ -1345,7 +1345,7 @@ static u32 hv_compose_msi_req_v2(
int_pkt->wslot.slot = slot; int_pkt->wslot.slot = slot;
int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector = vector;
int_pkt->int_desc.vector_count = 1; int_pkt->int_desc.vector_count = 1;
int_pkt->int_desc.delivery_mode = dest_Fixed; int_pkt->int_desc.delivery_mode = APIC_DELIVERY_MODE_FIXED;
/* /*
* Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment