From patchwork Wed May 1 19:39:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 10925531 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 EAD6114B6 for ; Wed, 1 May 2019 19:41:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD6ED28E59 for ; Wed, 1 May 2019 19:41:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBCF528ECA; Wed, 1 May 2019 19:41:30 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 78FF028E6F for ; Wed, 1 May 2019 19:41:30 +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 1hLv4k-0005Ku-1B; Wed, 01 May 2019 19:39:30 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLv4i-0005KP-Va for xen-devel@lists.xenproject.org; Wed, 01 May 2019 19:39:29 +0000 X-Inumbo-ID: d4743e4d-6c48-11e9-843c-bc764e045a96 Received: from bombadil.infradead.org (unknown [2607:7c80:54:e::133]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id d4743e4d-6c48-11e9-843c-bc764e045a96; Wed, 01 May 2019 19:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xTqppJJO44ZaH1CSK2rL7bt+4t8f2e1EOdJEDaQceok=; b=iVWb12xvWz423AX0U3+7WSZNh a4mKDJNLV9uzNiZZdcud5THc1o3WrrEz3upx3AiBMPH+JQ7cdFwKwd7HEwgbgKnECa0BB3Lwr1ZwG KW8Cfu51EEWNeoCYrE22Z5HKIAKixKFsSQtEdOx9IRTgVouZnN9r3PrVZ8tOs2F1ey7wcvYkhtdEb iMwQVJaVC8/L7XTim8HdQU7Lqf/5eX1PdgPR4zwpRBxxwlsz5EanW01ydPvk1rTpfgTR5aJf8XboH 0OA+M3EwWzmRwEAowbT8+fMxRoTmu/9nDEna2hN5dUZ5Mj7ISnc4x0aVfwxyvZw5d+9CQWoNKFFUC pfMleliJg==; Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLv4g-0007rl-K3 for xen-devel@lists.xenproject.org; Wed, 01 May 2019 19:39:26 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hLv4f-0032TQ-7b for xen-devel@lists.xenproject.org; Wed, 01 May 2019 20:39:25 +0100 From: David Woodhouse To: xen-devel@lists.xenproject.org Date: Wed, 1 May 2019 20:39:18 +0100 Message-Id: X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [RFC PATCH v2 0/7] Clean up x86_64 boot code 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: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some cleanups for the boot path, originally inspired by an attempt to avoid scribbling on arbitrarily-chosen low memory. In the no-real-mode case we don't need to bounce through low memory at all; we can run the 32-bit trampoline in-place in the Xen image. The variables containing information which is optionally discovered by the real-mode boot code can be put back in place in the Xen image and we can dispense with the bootsym() pointer gymnastics in C code which access them in low memory. Next up is killing reloc(), which AFAICT only exists to ensure that the various breadcrumbs left all over the place by the Multiboot bootloader aren't scribbled on when we copy the 16-bit boot trampoline into low memory. Except that it's copying it out of the way... into the top of low memory. Suspect if I tell kexec to put a segment there, it's going to fail quite horribly. Which leaves me with no valid reason for reloc() to be running this early, so I may well kill it with fire too. I just need to find a safe location for the 16-bit boot code. v2: Fix wake code. Thanks Andy for testing. David Woodhouse (7): x86/wakeup: Stop using %fs for lidt/lgdt x86/boot: Remove gratuitous call back into low-memory code x86/boot: Only jump into low trampoline code for real-mode boot x86/boot: Split bootsym() into four types of relocations x86/boot: Rename trampoline_{start,end} to boot_trampoline_{start,end} x86/boot: Copy 16-bit boot variables back up to Xen image x86/boot: Do not use trampoline for no-real-mode boot paths xen/arch/x86/acpi/power.c | 6 +- xen/arch/x86/boot/edd.S | 18 ++-- xen/arch/x86/boot/head.S | 89 ++++++++++++------ xen/arch/x86/boot/mem.S | 35 +++----- xen/arch/x86/boot/trampoline.S | 145 +++++++++++++++++++++++------- xen/arch/x86/boot/video.S | 36 ++++---- xen/arch/x86/boot/wakeup.S | 23 ++--- xen/arch/x86/cpu/common.c | 2 +- xen/arch/x86/cpu/intel.c | 2 +- xen/arch/x86/efi/efi-boot.h | 31 +------ xen/arch/x86/mm.c | 2 +- xen/arch/x86/platform_hypercall.c | 18 ++-- xen/arch/x86/setup.c | 72 ++++++++++++--- xen/arch/x86/smpboot.c | 6 +- xen/arch/x86/tboot.c | 6 +- xen/arch/x86/x86_64/mm.c | 2 +- xen/arch/x86/xen.lds.S | 27 ++++-- xen/include/asm-x86/acpi.h | 2 +- xen/include/asm-x86/config.h | 10 +-- xen/include/asm-x86/e820.h | 5 +- xen/include/asm-x86/edd.h | 1 - 21 files changed, 339 insertions(+), 199 deletions(-)