From patchwork Wed Jun 12 11:05:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 10989447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4619C76 for ; Wed, 12 Jun 2019 11:06:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FC231FFB2 for ; Wed, 12 Jun 2019 11:06:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E43726E49; Wed, 12 Jun 2019 11:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92F1D1FFB2 for ; Wed, 12 Jun 2019 11:06:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb14B-0005EJ-5K; Wed, 12 Jun 2019 11:05:19 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb14A-0005EE-Bp for xen-devel@lists.xenproject.org; Wed, 12 Jun 2019 11:05:18 +0000 X-Inumbo-ID: f54b229a-8d01-11e9-8980-bc764e045a96 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f54b229a-8d01-11e9-8980-bc764e045a96; Wed, 12 Jun 2019 11:05:16 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 8pY/9z/w/t5F9VEZ4EWJ3QS/Qy7+Slthcfe+AH7LUadMI1YbFEQNFjdn6/549aYpfa5zj4dTYW GkQkitqJE4lcOrt+NZqPoTx4u0trQM0hJJe5jE2BDu+pCqj0Yy9mMV+Os0C2W2NEAK9MnbfpLA xs8iGgxpMkUUI3ND/to+C8B4yVGIjPW+npB+qRHqzAETx1k9VDigV5zGXmNYnSLI5pePVAJPTZ 4v2BjqQ85UAG1dHAugBpN6Zkx78qxbkW2y9NV+NkkLCxjTQDRjzkkkqOXXJCAPmwgamEcKhE3Y d3k= X-SBRS: 2.7 X-MesageID: 1641817 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,365,1557201600"; d="scan'208";a="1641817" From: Andrew Cooper To: Xen-devel Date: Wed, 12 Jun 2019 12:05:13 +0100 Message-ID: <1560337513-6958-1-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/boot: Drop vestigial support for pre-SIPI APICs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , David Woodhouse , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current code in do_boot_cpu() makes a CMOS write (even in the case of an FADT reduced hardware configuration) and two writes into the BDA for the start_eip segment and offset. BDA 0x67 and 0x69 hail from the days of the DOS and the 286, when IBM put together the fast way to return from Protected mode back to Real mode (via a deliberate triple fault). This vector, when set, redirects the early boot logic back into OS control. It is also used by early MP systems, before the Startup IPI message became standard, which in practice was before Local APICs became integrated into CPU cores. Support for non-integrated APICs was dropped in c/s 7b0007af "xen/x86: Remove APIC_INTEGRATED() checks" because there are no 64-bit capable systems without them. Therefore, drop smpboot_{setup,restore}_warm_reset_vector(). Dropping smpboot_setup_warm_reset_vector() also lets us drop TRAMPOLINE_{HIGH,LOW}, which lets us drop mach_wakecpu.h entirely. The final function in smpboot_hooks.h is smpboot_setup_io_apic() and has a single caller, so expand it inline and delete smpboot_hooks.h as well. This removes all reliance on CMOS and the BDA from the AP boot path, which is especially of interest on reduced_hardware boots and EFI systems. Reported-by: David Woodhouse Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné CC: David Woodhouse This has involved several months of on-and-off code archeology. It turns out that details of how the 486-era MP systems booted are feindishly difficult to locate. --- xen/arch/x86/smpboot.c | 11 +----- xen/include/asm-x86/mach-default/mach_wakecpu.h | 12 ------ xen/include/asm-x86/mach-default/smpboot_hooks.h | 47 ------------------------ 3 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 xen/include/asm-x86/mach-default/mach_wakecpu.h delete mode 100644 xen/include/asm-x86/mach-default/smpboot_hooks.h diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 274865a..730fe14 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -46,8 +46,6 @@ #include #include #include -#include -#include #define setup_trampoline() (bootsym_phys(trampoline_realmode_entry)) @@ -565,10 +563,6 @@ static int do_boot_cpu(int apicid, int cpu) set_cpu_state(CPU_STATE_INIT); - Dprintk("Setting warm reset code and vector.\n"); - - smpboot_setup_warm_reset_vector(start_eip); - /* Starting actual IPI sequence... */ if ( !tboot_in_measured_env() || tboot_wake_ap(apicid, start_eip) ) boot_error = wakeup_secondary_cpu(apicid, start_eip); @@ -623,8 +617,6 @@ static int do_boot_cpu(int apicid, int cpu) bootsym(trampoline_cpu_started) = 0; smp_mb(); - smpboot_restore_warm_reset_vector(); - return rc; } @@ -1162,7 +1154,8 @@ void __init smp_prepare_cpus(void) connect_bsp_APIC(); setup_local_APIC(); - smpboot_setup_io_apic(); + if ( !skip_ioapic_setup && nr_ioapics ) + setup_IO_APIC(); setup_boot_APIC_clock(); } diff --git a/xen/include/asm-x86/mach-default/mach_wakecpu.h b/xen/include/asm-x86/mach-default/mach_wakecpu.h deleted file mode 100644 index 32555e1..0000000 --- a/xen/include/asm-x86/mach-default/mach_wakecpu.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __ASM_MACH_WAKECPU_H -#define __ASM_MACH_WAKECPU_H - -/* - * This file copes with machines that wakeup secondary CPUs by the - * INIT, INIT, STARTUP sequence. - */ - -#define TRAMPOLINE_LOW maddr_to_virt(0x467) -#define TRAMPOLINE_HIGH maddr_to_virt(0x469) - -#endif /* __ASM_MACH_WAKECPU_H */ diff --git a/xen/include/asm-x86/mach-default/smpboot_hooks.h b/xen/include/asm-x86/mach-default/smpboot_hooks.h deleted file mode 100644 index 14e1ee5..0000000 --- a/xen/include/asm-x86/mach-default/smpboot_hooks.h +++ /dev/null @@ -1,47 +0,0 @@ -/* two abstractions specific to kernel/smpboot.c, mainly to cater to visws - * which needs to alter them. */ - -static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) -{ - unsigned long flags; - - spin_lock_irqsave(&rtc_lock, flags); - CMOS_WRITE(0xa, 0xf); - spin_unlock_irqrestore(&rtc_lock, flags); - flush_tlb_local(); - Dprintk("1.\n"); - *((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4; - Dprintk("2.\n"); - *((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf; - Dprintk("3.\n"); -} - -static inline void smpboot_restore_warm_reset_vector(void) -{ - unsigned long flags; - - /* - * Install writable page 0 entry to set BIOS data area. - */ - flush_tlb_local(); - - /* - * Paranoid: Set warm reset code and vector here back - * to default values. - */ - spin_lock_irqsave(&rtc_lock, flags); - CMOS_WRITE(0, 0xf); - spin_unlock_irqrestore(&rtc_lock, flags); - - *((volatile int *) maddr_to_virt(0x467)) = 0; -} - -static inline void smpboot_setup_io_apic(void) -{ - /* - * Here we can be sure that there is an IO-APIC in the system. Let's - * go and set it up: - */ - if (!skip_ioapic_setup && nr_ioapics) - setup_IO_APIC(); -}