From patchwork Wed May 1 11:17:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 10924963 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 9C75E1398 for ; Wed, 1 May 2019 11:19:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8926428A93 for ; Wed, 1 May 2019 11:19:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D97828DC2; Wed, 1 May 2019 11:19:03 +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 1FF3628A93 for ; Wed, 1 May 2019 11:19:03 +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 1hLnFB-0001iE-Ir; Wed, 01 May 2019 11:17:45 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hLnF9-0001gW-O6 for xen-devel@lists.xenproject.org; Wed, 01 May 2019 11:17:43 +0000 X-Inumbo-ID: bbe137b5-6c02-11e9-843c-bc764e045a96 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id bbe137b5-6c02-11e9-843c-bc764e045a96; Wed, 01 May 2019 11:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=zOt1olUDZdf7hWx/DiulXgFT8LWqf1zrNDHAr9+WgxY=; b=tJaHzSAMF5cTUxGyOSw91eB93 dVm+fFnaMNrc6FyX2Xj8jpQAOIni6fWQp36pYag3ICTeKG4+DputRrRpUHqPpsVTA1rC1zK0l/Fpf DB0WiDfeJ7nI88E0UXXQ9B62gwabUrkrpNfx4PlhPavGBv+Th774sAq2LQfiapEW8nXYBgLUbIheL r613X/7XLHVGGqc8Nq3mVB7TsHtnoD282xp9r086TdpxmzFk3hZal9en4lt917/72Fanbtal2+oUu k6WuozpMYerExT7GZBSeoPMxR011peaIGrL2HIQlMTDXLUS8NFb3liENa8OtkeWJFqkFY2rQSrWEM F9FLgBX2Q==; Received: from [2001:8b0:10b:1::425] (helo=i7.infradead.org) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLnF6-0008Rq-4O for xen-devel@lists.xenproject.org; Wed, 01 May 2019 11:17:40 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hLnF5-0030Nk-8F for xen-devel@lists.xenproject.org; Wed, 01 May 2019 12:17:39 +0100 From: David Woodhouse To: xen-devel@lists.xenproject.org Date: Wed, 1 May 2019 12:17:32 +0100 Message-Id: X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [RFC PATCH 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. I haven't yet got to reloc(), which I think exists only 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. I'd quite like to kill reloc() and pass the original pointer up to 64-bit code to be handled in C. That would require finding a *safe* location to put the 16-bit boot trampoline though, which doesn't already contain anything that the bootloader created for us. In fact, isn't there already a chance that head.S will choose a location for the trampoline which is already part of a module or contains one of the Multiboot breadcrumbs? 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(-)