Commit 51723444 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/apic: Get rid of get_physical_broadcast()

There is no point for this function. The only case where this is used is
when there is no XAPIC available, which means the broadcast address is 0xF.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarMichael Kelley <mhklinux@outlook.com>
Tested-by: default avatarSohil Mehta <sohil.mehta@intel.com>
Link: https://lore.kernel.org/r/20240212154639.057209154@linutronix.de
parent 2ac9e529
...@@ -261,16 +261,6 @@ u64 native_apic_icr_read(void) ...@@ -261,16 +261,6 @@ u64 native_apic_icr_read(void)
return icr1 | ((u64)icr2 << 32); return icr1 | ((u64)icr2 << 32);
} }
#ifdef CONFIG_X86_32
/**
* get_physical_broadcast - Get number of physical broadcast IDs
*/
int get_physical_broadcast(void)
{
return modern_apic() ? 0xff : 0xf;
}
#endif
/** /**
* lapic_get_maxlvt - get the maximum number of local vector table entries * lapic_get_maxlvt - get the maximum number of local vector table entries
*/ */
......
...@@ -1460,12 +1460,12 @@ void restore_boot_irq_mode(void) ...@@ -1460,12 +1460,12 @@ void restore_boot_irq_mode(void)
*/ */
static void __init setup_ioapic_ids_from_mpc_nocheck(void) static void __init setup_ioapic_ids_from_mpc_nocheck(void)
{ {
union IO_APIC_reg_00 reg_00;
physid_mask_t phys_id_present_map; physid_mask_t phys_id_present_map;
int ioapic_idx; const u32 broadcast_id = 0xF;
int i; union IO_APIC_reg_00 reg_00;
unsigned char old_id; unsigned char old_id;
unsigned long flags; unsigned long flags;
int ioapic_idx, i;
/* /*
* This is broken; anything with a real cpu count has to * This is broken; anything with a real cpu count has to
...@@ -1484,11 +1484,10 @@ static void __init setup_ioapic_ids_from_mpc_nocheck(void) ...@@ -1484,11 +1484,10 @@ static void __init setup_ioapic_ids_from_mpc_nocheck(void)
old_id = mpc_ioapic_id(ioapic_idx); old_id = mpc_ioapic_id(ioapic_idx);
if (mpc_ioapic_id(ioapic_idx) >= get_physical_broadcast()) { if (mpc_ioapic_id(ioapic_idx) >= broadcast_id) {
printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", pr_err(FW_BUG "IO-APIC#%d ID is %d in the MPC table!...\n",
ioapic_idx, mpc_ioapic_id(ioapic_idx)); ioapic_idx, mpc_ioapic_id(ioapic_idx));
printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", pr_err("... fixing up to %d. (tell your hw vendor)\n", reg_00.bits.ID);
reg_00.bits.ID);
ioapics[ioapic_idx].mp_config.apicid = reg_00.bits.ID; ioapics[ioapic_idx].mp_config.apicid = reg_00.bits.ID;
} }
...@@ -1499,15 +1498,14 @@ static void __init setup_ioapic_ids_from_mpc_nocheck(void) ...@@ -1499,15 +1498,14 @@ static void __init setup_ioapic_ids_from_mpc_nocheck(void)
*/ */
if (apic->check_apicid_used(&phys_id_present_map, if (apic->check_apicid_used(&phys_id_present_map,
mpc_ioapic_id(ioapic_idx))) { mpc_ioapic_id(ioapic_idx))) {
printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", pr_err(FW_BUG "IO-APIC#%d ID %d is already used!...\n",
ioapic_idx, mpc_ioapic_id(ioapic_idx)); ioapic_idx, mpc_ioapic_id(ioapic_idx));
for (i = 0; i < get_physical_broadcast(); i++) for (i = 0; i < broadcast_id; i++)
if (!physid_isset(i, phys_id_present_map)) if (!physid_isset(i, phys_id_present_map))
break; break;
if (i >= get_physical_broadcast()) if (i >= broadcast_id)
panic("Max APIC ID exceeded!\n"); panic("Max APIC ID exceeded!\n");
printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", pr_err("... fixing up to %d. (tell your hw vendor)\n", i);
i);
physid_set(i, phys_id_present_map); physid_set(i, phys_id_present_map);
ioapics[ioapic_idx].mp_config.apicid = i; ioapics[ioapic_idx].mp_config.apicid = i;
} else { } else {
...@@ -2209,7 +2207,7 @@ static inline void __init check_timer(void) ...@@ -2209,7 +2207,7 @@ static inline void __init check_timer(void)
* 8259A. * 8259A.
*/ */
if (pin1 == -1) { if (pin1 == -1) {
panic_if_irq_remap("BIOS bug: timer not connected to IO-APIC"); panic_if_irq_remap(FW_BUG "Timer not connected to IO-APIC");
pin1 = pin2; pin1 = pin2;
apic1 = apic2; apic1 = apic2;
no_pin1 = 1; no_pin1 = 1;
...@@ -2495,6 +2493,7 @@ unsigned int arch_dynirq_lower_bound(unsigned int from) ...@@ -2495,6 +2493,7 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
static int io_apic_get_unique_id(int ioapic, int apic_id) static int io_apic_get_unique_id(int ioapic, int apic_id)
{ {
static physid_mask_t apic_id_map = PHYSID_MASK_NONE; static physid_mask_t apic_id_map = PHYSID_MASK_NONE;
const u32 broadcast_id = 0xF;
union IO_APIC_reg_00 reg_00; union IO_APIC_reg_00 reg_00;
unsigned long flags; unsigned long flags;
int i = 0; int i = 0;
...@@ -2515,9 +2514,9 @@ static int io_apic_get_unique_id(int ioapic, int apic_id) ...@@ -2515,9 +2514,9 @@ static int io_apic_get_unique_id(int ioapic, int apic_id)
reg_00.raw = io_apic_read(ioapic, 0); reg_00.raw = io_apic_read(ioapic, 0);
raw_spin_unlock_irqrestore(&ioapic_lock, flags); raw_spin_unlock_irqrestore(&ioapic_lock, flags);
if (apic_id >= get_physical_broadcast()) { if (apic_id >= broadcast_id) {
printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " pr_warn("IOAPIC[%d]: Invalid apic_id %d, trying %d\n",
"%d\n", ioapic, apic_id, reg_00.bits.ID); ioapic, apic_id, reg_00.bits.ID);
apic_id = reg_00.bits.ID; apic_id = reg_00.bits.ID;
} }
...@@ -2527,17 +2526,15 @@ static int io_apic_get_unique_id(int ioapic, int apic_id) ...@@ -2527,17 +2526,15 @@ static int io_apic_get_unique_id(int ioapic, int apic_id)
*/ */
if (apic->check_apicid_used(&apic_id_map, apic_id)) { if (apic->check_apicid_used(&apic_id_map, apic_id)) {
for (i = 0; i < get_physical_broadcast(); i++) { for (i = 0; i < broadcast_id; i++) {
if (!apic->check_apicid_used(&apic_id_map, i)) if (!apic->check_apicid_used(&apic_id_map, i))
break; break;
} }
if (i == get_physical_broadcast()) if (i == broadcast_id)
panic("Max apic_id exceeded!\n"); panic("Max apic_id exceeded!\n");
printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " pr_warn("IOAPIC[%d]: apic_id %d already used, trying %d\n", ioapic, apic_id, i);
"trying %d\n", ioapic, apic_id, i);
apic_id = i; apic_id = i;
} }
...@@ -2567,11 +2564,9 @@ static int io_apic_get_unique_id(int ioapic, int apic_id) ...@@ -2567,11 +2564,9 @@ static int io_apic_get_unique_id(int ioapic, int apic_id)
static u8 io_apic_unique_id(int idx, u8 id) static u8 io_apic_unique_id(int idx, u8 id)
{ {
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && !APIC_XAPIC(boot_cpu_apic_version))
!APIC_XAPIC(boot_cpu_apic_version))
return io_apic_get_unique_id(idx, id); return io_apic_get_unique_id(idx, id);
else return id;
return id;
} }
#else #else
static u8 io_apic_unique_id(int idx, u8 id) static u8 io_apic_unique_id(int idx, u8 id)
......
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