It is not obvious at first glance, but this is dead logic.

On Intel, xAPIC (which is what modern_apic() is really checking for) predates
64bit support, while the Family 0xf check on AMD is the K8 processor.

Simply drop the logic, rather than trying to adjust vendor/family logic.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Jan Beulich <jbeul...@suse.com>
CC: Roger Pau Monné <roger....@citrix.com>

  add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-166 (-166)
  Function                                     old     new   delta
  setup_IO_APIC                               2992    2987      -5
  sync_Arb_IDs                                 161       -    -161
---
 xen/arch/x86/apic.c             | 32 --------------------------------
 xen/arch/x86/include/asm/apic.h |  1 -
 xen/arch/x86/io_apic.c          |  2 +-
 3 files changed, 1 insertion(+), 34 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 70636b0bb585..774771860002 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -91,23 +91,6 @@ static enum apic_mode apic_boot_mode = APIC_MODE_INVALID;
 bool __read_mostly x2apic_enabled;
 bool __read_mostly directed_eoi_enabled;
 
-static int modern_apic(void)
-{
-    unsigned int lvr, version;
-    /* AMD systems use old APIC versions, so check the CPU */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-        boot_cpu_data.x86 >= 0xf)
-        return 1;
-
-    /* Hygon systems use modern APIC */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
-        return 1;
-
-    lvr = apic_read(APIC_LVR);
-    version = GET_APIC_VERSION(lvr);
-    return version >= 0x14;
-}
-
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
@@ -396,21 +379,6 @@ int __init verify_local_APIC(void)
     return 1;
 }
 
-void __init sync_Arb_IDs(void)
-{
-    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
-       And not needed on AMD */
-    if (modern_apic())
-        return;
-    /*
-     * Wait for idle.
-     */
-    apic_wait_icr_idle();
-
-    apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-    apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT);
-}
-
 /*
  * An initial setup of the virtual wire mode.
  */
diff --git a/xen/arch/x86/include/asm/apic.h b/xen/arch/x86/include/asm/apic.h
index d22854953689..918f1cee3567 100644
--- a/xen/arch/x86/include/asm/apic.h
+++ b/xen/arch/x86/include/asm/apic.h
@@ -166,7 +166,6 @@ extern void disconnect_bsp_APIC (int virt_wire_setup);
 extern void disable_local_APIC (void);
 extern int verify_local_APIC (void);
 extern void cache_APIC_registers (void);
-extern void sync_Arb_IDs (void);
 extern void init_bsp_APIC (void);
 extern void setup_local_APIC(bool bsp);
 extern void init_apic_mappings (void);
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 42a9b653d397..17e6827f4bb3 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2163,7 +2163,7 @@ void __init setup_IO_APIC(void)
      */
     if (!acpi_ioapic)
         setup_ioapic_ids_from_mpc();
-    sync_Arb_IDs();
+
     setup_IO_APIC_irqs();
     init_IO_APIC_traps();
     check_timer();
-- 
2.39.5


Reply via email to