From nobody Sat Nov 23 10:28:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725541658; cv=none; d=zohomail.com; s=zohoarc; b=jx+/OVsVnAIsRzw3BZoZiTGVCEl2ADgVWex+TjqtJZygaU1Uhjfb39ZnvPa7bcUIiBWq9t8zusIB7Ui/ayLatKBtcKDBG5xbYq1CtIafe7aRKiq8GRgt4FLuaKGDXcZDXXCvnPgJmvb2tsy+70ZfuL2hdw1CpFXkGl4IDrvHP88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725541658; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yRQ/Y9M/lKY6HdyDs0B8hohBH4bNX10dLhD71BnUZXc=; b=merGA6B7NvImCSPAHeK03xNbxelx1nX9ZH/lHnx1gl6zdg/etiKlh0RSOjDxE2wrqciJYVSktx3OCDFsXMH+6RaVHvyk+FskEppRGrKS13CFkO7ltqy72Ue4Ru6WBRCCOIG5VxoZVbyvmL/T6jxF3ftMClMR5tlYL7T4NeQgAAc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725541658216549.3297590060284; Thu, 5 Sep 2024 06:07:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.791093.1200875 (Exim 4.92) (envelope-from ) id 1smCCY-0002NL-Vr; Thu, 05 Sep 2024 13:07:06 +0000 Received: by outflank-mailman (output) from mailman id 791093.1200875; Thu, 05 Sep 2024 13:07:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCY-0002Mx-Sr; Thu, 05 Sep 2024 13:07:06 +0000 Received: by outflank-mailman (input) for mailman id 791093; Thu, 05 Sep 2024 13:07:06 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCY-00025l-5o for xen-devel@lists.xenproject.org; Thu, 05 Sep 2024 13:07:06 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bfda207d-6b87-11ef-a0b3-8be0dac302b0; Thu, 05 Sep 2024 15:07:05 +0200 (CEST) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a868d7f92feso113442566b.2 for ; Thu, 05 Sep 2024 06:07:05 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a61fbb093sm136972766b.11.2024.09.05.06.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:07:02 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bfda207d-6b87-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725541624; x=1726146424; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yRQ/Y9M/lKY6HdyDs0B8hohBH4bNX10dLhD71BnUZXc=; b=XVfarC+nF9abG/LydPpQOGTF6VYJQ9woso9JGR8FLdqN9dajCf8kXEknwI2L736eZr 9RiB7eQXuG6rj1F++iIR2lyPHAPgCEb9zCmLm+xIHXYGJxG/oRk+Cq0AjoHNB6GKtMVJ TGGnqHMsUQ5Pz5eAzMLz9FcSPM6+5lLp/bLWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541624; x=1726146424; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yRQ/Y9M/lKY6HdyDs0B8hohBH4bNX10dLhD71BnUZXc=; b=f1aYzbTw3dmqgA0MlgywMZltEwA4U6xRwFdy+aSNK94fER1ypYXwsknJIN85nduZuw ggrMAweeHdONn2LP31GM7JLssURzgfqZPvRG20J3cLbxKfbZeSohPMQHLIZEVlPQZGbW MWAfuHpoTXvw5xPtQLMJjMcyd15Rwz+J307AiWTv7rjRXp53kRlcWHkpxETSJ+NfWS0R XmL2nvPLCj1mcaXWJDUfq1PoTvJzoF83967Lrq6PkYVuPuf1HUpK/ysxnY04oqlyj8tS rLeXUQ/eVXqcT8NGoZocgro727jWuaExInvjRa7w+YpW8BKCB7RgNR2IvsJc9iSj1lbm g6PA== X-Gm-Message-State: AOJu0YzLAoOr9R035OrX6VOgEbw7knJWq+s7Ke/gZfVMxEhJ7Z0QBW7+ tDY4LEQFq9xmjL4SMBoonVivFTV4XUH4kIzTjZ9zH6yAu9/e/fWNeK2rv/NcrWJJlACu+WXtIrH 7 X-Google-Smtp-Source: AGHT+IEvQIFtVKcS9yKWiAo+g/1oR5rOaXxuuAKjoEFDzQURGSW56R2Nn0cMHAn+PqM8ElhZUdqWzQ== X-Received: by 2002:a17:907:869f:b0:a86:851e:3a2b with SMTP id a640c23a62f3a-a897f8bc9b9mr2101153066b.29.1725541622786; Thu, 05 Sep 2024 06:07:02 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Frediano Ziglio , Alejandro Vallejo Subject: [PATCH 1/3] x86/acpi: Drop acpi_video_flags and use bootsym(video_flags) directly Date: Thu, 5 Sep 2024 14:06:55 +0100 Message-Id: <20240905130657.4075906-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240905130657.4075906-1-andrew.cooper3@citrix.com> References: <20240905130657.4075906-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725541659001116600 This removes a level of indirection, as well as removing a somewhat mislead= ing name; the variable is really "S3 video quirks". More importantly however it makes it very clear that, right now, parsing the cmdline and quirks depends on having already placed the trampoline; a dependency which is going to be gnarly to untangle. That said, fixing the quirk is easy. The Toshiba Satellite 4030CDT has an Intel Celeron 300Mhz CPU (Pentium 2 era) from 1998 when MMX was the headline feature, sporting 64M of RAM. Being a 32-bit processor, it hasn't been able to run Xen for about a decade now, so drop the quirk entirely. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Frediano Ziglio CC: Alejandro Vallejo --- xen/arch/x86/acpi/power.c | 2 +- xen/arch/x86/dmi_scan.c | 12 ------------ xen/arch/x86/include/asm/acpi.h | 1 - 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 610937f42e95..557faf312b09 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -56,7 +56,7 @@ static int __init cf_check parse_acpi_sleep(const char *s) s =3D ss + 1; } while ( *ss ); =20 - acpi_video_flags |=3D flag; + bootsym(video_flags) |=3D flag; =20 return rc; } diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c index 81f80c053a7a..9257aee2ab97 100644 --- a/xen/arch/x86/dmi_scan.c +++ b/xen/arch/x86/dmi_scan.c @@ -499,13 +499,6 @@ static int __init cf_check ich10_bios_quirk(const stru= ct dmi_system_id *d) return 0; } =20 -static __init int cf_check reset_videomode_after_s3(const struct dmi_black= list *d) -{ - /* See wakeup.S */ - acpi_video_flags |=3D 2; - return 0; -} - static __init int cf_check dmi_disable_acpi(const struct dmi_blacklist *d) {=20 if (!acpi_force) {=20 @@ -546,11 +539,6 @@ static __init int cf_check force_acpi_ht(const struct = dmi_blacklist *d) =20 static const struct dmi_blacklist __initconstrel dmi_blacklist[] =3D { =20 - { reset_videomode_after_s3, "Toshiba Satellite 4030cdt", { /* Reset video= mode after returning from ACPI S3 sleep */ - MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"), - NO_MATCH, NO_MATCH, NO_MATCH - } }, - { ich10_bios_quirk, "Intel board & BIOS", /* * BIOS leaves legacy USB emulation enabled while diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acp= i.h index 3c47b216d0e0..217819dd619c 100644 --- a/xen/arch/x86/include/asm/acpi.h +++ b/xen/arch/x86/include/asm/acpi.h @@ -103,7 +103,6 @@ extern unsigned long acpi_wakeup_address; extern int8_t acpi_numa; =20 extern struct acpi_sleep_info acpi_sinfo; -#define acpi_video_flags bootsym(video_flags) struct xenpf_enter_acpi_sleep; extern int acpi_enter_sleep(const struct xenpf_enter_acpi_sleep *sleep); extern int acpi_enter_state(u32 state); --=20 2.39.2 From nobody Sat Nov 23 10:28:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725541656; cv=none; d=zohomail.com; s=zohoarc; b=HtyPvIWStq84duBuHAtEj9Sr1/gOB2m/Iq3V63Y2Ozldgpm7GUMngYN1tnbXXtwzBiKvnmWLh9RAe5W6HmxTlMAEtG4FD4pypfW58e1/6xsM70r+5yKuEvrrmouxvvJo+6KyGbuly51IRzKXsRITSMx8BOEdnJDZlGiEJOnp8yQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725541656; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=X1rk1SivgKsroKO5X3xfzliShecCf9u4hA4GiCVFO6s=; b=nBGLl6cqasCAzo3YK0e59hd7z//gjxWWZz8Z34qKx0+MyQGHE/sg+16BiqkAopL8JJsuNdlD8q+cZdhqJtnZNdGoHRrSJU7OFE5sH3IaL45eDFwKLXfKS3O+/E7M9mxj6RlZ0eTGTn08ueQfB+NHgvFczxroWHa7MGH1yfg8DVQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725541656793760.3240233968091; Thu, 5 Sep 2024 06:07:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.791094.1200885 (Exim 4.92) (envelope-from ) id 1smCCb-0002ci-5y; Thu, 05 Sep 2024 13:07:09 +0000 Received: by outflank-mailman (output) from mailman id 791094.1200885; Thu, 05 Sep 2024 13:07:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCb-0002ca-2e; Thu, 05 Sep 2024 13:07:09 +0000 Received: by outflank-mailman (input) for mailman id 791094; Thu, 05 Sep 2024 13:07:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCZ-0002Ra-GD for xen-devel@lists.xenproject.org; Thu, 05 Sep 2024 13:07:07 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bf8b3b3c-6b87-11ef-99a1-01e77a169b0f; Thu, 05 Sep 2024 15:07:05 +0200 (CEST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c3ca32971cso844746a12.0 for ; Thu, 05 Sep 2024 06:07:05 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a61fbb093sm136972766b.11.2024.09.05.06.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:07:03 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bf8b3b3c-6b87-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725541624; x=1726146424; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X1rk1SivgKsroKO5X3xfzliShecCf9u4hA4GiCVFO6s=; b=o6YthHEdlvV9YnSEwh42ij+lsv08FUmtbJm3693bn2F5UYSNiaHNSANb2ZvYZLrWP0 5QewoL/wDIEFsbvGa2t/RWSVgJpQJU471AZ0JhTKeOwWChl2QhOEik+y84BoUsRbba9U +XzliFsSjdsbfmMaN62EZW3s5bZ2u/y6Y/4gY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541624; x=1726146424; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=X1rk1SivgKsroKO5X3xfzliShecCf9u4hA4GiCVFO6s=; b=S5f3j5K5paIdgBHIKEc6rWF2S5zE4u/PJuNQyylKmYLIpqYYfbDbWL+TWibVRkYljl 57VP6mNEqBPfgxFrLYXmizTPEAQu461wMWzLCG3eJSv4bSS8f3nTfA84Co9UAp++Biz3 DQoeHa66hnNpOCp0mCjA+6FAnRavtqTIPgRWwo0sVGQOAGp1kZiz8oUqtXTedyOYUpSR y2WGKU9z7Vq/Gsgge4krBSsbaKB66xQwOYTEEUeqyVVejG3dhbhKMWjXTC1+szwvWqD2 rEmml+RgSuKWlXmKjsWma6QgyCc6JbbU+VsIyqf//jbdoJIwYcnAGkn73lWOLApQb5Ed zbBA== X-Gm-Message-State: AOJu0Yw0nIgEgESCYTWOHQlnSsFVng3EpRNXYTzbziJ4ssraxIUwSQEr gveD4bbnNIJ7dWWi4upc4qu5NH7H7fZHOUlsetApPWRPsIknFk6osV2zlgRg0oVI4vwuBZ285eM U X-Google-Smtp-Source: AGHT+IFBo/7+XGqS+J+fdbXDJc4jZ41o18nvzHb3//XzZ/9rgsbx/2ycpdTKlsCH2fMkbR7YR33lug== X-Received: by 2002:a17:907:918c:b0:a8a:8069:2633 with SMTP id a640c23a62f3a-a8a806927d9mr5967666b.1.1725541623884; Thu, 05 Sep 2024 06:07:03 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Frediano Ziglio , Alejandro Vallejo Subject: [PATCH 2/3] x86/trampoline: Move the trampoline declarations out of Date: Thu, 5 Sep 2024 14:06:56 +0100 Message-Id: <20240905130657.4075906-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240905130657.4075906-1-andrew.cooper3@citrix.com> References: <20240905130657.4075906-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725541657325116600 asm/config.h is included in every translation unit (via xen/config.h), while only a handful of functions actually interact with the trampoline. Move the infrastructure into its own header, and take the opportunity to document everything. Also change trampoline_realmode_entry() and wakeup_start() to be nocall functions, rather than char arrays. No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Frediano Ziglio CC: Alejandro Vallejo --- xen/arch/x86/acpi/power.c | 2 + xen/arch/x86/cpu/intel.c | 2 + xen/arch/x86/efi/efi-boot.h | 1 + xen/arch/x86/guest/xen/pvh-boot.c | 1 + xen/arch/x86/include/asm/config.h | 19 ------ xen/arch/x86/include/asm/trampoline.h | 98 +++++++++++++++++++++++++++ xen/arch/x86/mm.c | 1 + xen/arch/x86/platform_hypercall.c | 2 + xen/arch/x86/setup.c | 1 + xen/arch/x86/smpboot.c | 1 + xen/arch/x86/tboot.c | 2 + xen/arch/x86/x86_64/mm.c | 2 + 12 files changed, 113 insertions(+), 19 deletions(-) create mode 100644 xen/arch/x86/include/asm/trampoline.h diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 557faf312b09..08a7fc250800 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -31,6 +31,8 @@ #include #include #include +#include + #include =20 uint32_t system_reset_counter =3D 1; diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c index af56e57bd8ab..807b708217e9 100644 --- a/xen/arch/x86/cpu/intel.c +++ b/xen/arch/x86/cpu/intel.c @@ -12,6 +12,8 @@ #include #include #include +#include + #include =20 #include "cpu.h" diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index f282358435f1..23e510c77e2e 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -9,6 +9,7 @@ #include #include #include +#include =20 static struct file __initdata ucode; static multiboot_info_t __initdata mbi =3D { diff --git a/xen/arch/x86/guest/xen/pvh-boot.c b/xen/arch/x86/guest/xen/pvh= -boot.c index cc57ab2cbcde..e14d7e20e942 100644 --- a/xen/arch/x86/guest/xen/pvh-boot.c +++ b/xen/arch/x86/guest/xen/pvh-boot.c @@ -12,6 +12,7 @@ =20 #include #include +#include =20 #include =20 diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/c= onfig.h index 2a260a2581fd..1f828bfd52f4 100644 --- a/xen/arch/x86/include/asm/config.h +++ b/xen/arch/x86/include/asm/config.h @@ -83,25 +83,6 @@ #define LIST_POISON1 ((void *)0x0100100100100100UL) #define LIST_POISON2 ((void *)0x0200200200200200UL) =20 -#ifndef __ASSEMBLY__ -extern unsigned long trampoline_phys; -#define bootsym_phys(sym) \ - (((unsigned long)&(sym)-(unsigned long)&trampoline_start)+trampoline_p= hys) -#define bootsym(sym) \ - (*((typeof(sym) *)__va(bootsym_phys(sym)))) - -extern char trampoline_start[], trampoline_end[]; -extern char trampoline_realmode_entry[]; -extern unsigned int trampoline_xen_phys_start; -extern unsigned char trampoline_cpu_started; -extern char wakeup_start[]; - -extern unsigned char video_flags; - -extern unsigned short boot_edid_caps; -extern unsigned char boot_edid_info[128]; -#endif - #include =20 #define PML4_ENTRY_BITS 39 diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/a= sm/trampoline.h new file mode 100644 index 000000000000..cc3420ba3530 --- /dev/null +++ b/xen/arch/x86/include/asm/trampoline.h @@ -0,0 +1,98 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef XEN_ASM_TRAMPOLINE_H +#define XEN_ASM_TRAMPOLINE_H + +/* + * Data in or about the low memory trampoline. + * + * x86 systems software typically needs a block of logic below the 1M + * boundary, commonly called the trampoline, containing 16-bit logic. Xen= has + * a combined trampoline of all necessary 16-bit logic, formed of two part= s. + * + * 1) The permanent trampoline; a single 4k page containing: + * + * - The INIT-SIPI-SIPI entrypoint for APs, and + * - The S3 wakeup vector. + * + * Both of these are 16-bit entrypoints, responsible for activating pag= ing + * and getting into 64-bit mode. This requires the permanent trampolin= e to + * be identity mapped in idle_pg_table[]. + * + * The SIPI64 spec deprecates the 16-bit AP entrypoint, while S0ix (also + * called Low Power Idle or Connected Standby) deprecates S3. + * + * 2) The boot trampoline: + * + * This is used by the BSP to drop into 16-bit mode, make various BIOS + * calls to obtain E820/EDID/etc. It follows the permanent and exceeds= 4k, + * but is only used in 16-bit and 32-bit unpaged mode so does not need + * mapping in pagetables. + * + * When the BIOS calls are complete, execution does join back with the = AP + * path, and becomes subject to the same paging requirements. This pat= h is + * not needed for non-BIOS boots. + * + * The location of trampoline is not fixed. The layout of low memory vari= es + * greatly from platform to platform. Therefore, the trampoline is reloca= ted + * manually as part of placement. + */ + +#ifndef __ASSEMBLY__ + +#include +#include + +/* + * Start and end of the trampoline section, as linked into Xen. It is wit= hin + * the .init section and reclaimed after boot. + */ +/* SAF-0-safe */ +extern char trampoline_start[], trampoline_end[]; + +/* + * The physical address of trampoline_start[] in low memory. It must be b= elow + * the 1M boundary (as the trampoline contains 16-bit code), and must be 4k + * aligned (SIPI requirement for APs). + */ +extern unsigned long trampoline_phys; + +/* + * Calculate the physical address of a symbol in the trampoline. + * + * Should only be used on symbols declared later in this header. Specifyi= ng + * other symbols will compile but malfunction when used, as will using this + * helper before the trampoline is placed. + */ +#define bootsym_phys(sym) \ + (trampoline_phys + ((unsigned long)&(sym) - \ + (unsigned long)trampoline_start)) + +/* Given a trampoline symbol, construct a pointer to it in the directmap. = */ +#define bootsym(sym) (*((typeof(sym) *)__va(bootsym_phys(sym)))) + +/* The INIT-SIPI-SIPI entrypoint. 16-bit code. */ +void nocall trampoline_realmode_entry(void); + +/* The S3 wakeup vector. 16-bit code. */ +void nocall wakeup_start(void); + +/* + * A variable in the trampoline, containing Xen's physical address. Among= st + * other things, it is used to find idle_pg_table[] in order to enable pag= ing + * and activate 64-bit mode. This variable needs keeping in sync with + * xen_phys_start. + */ +extern uint32_t trampoline_xen_phys_start; + +/* A semaphore to indicate signs-of-life at the start of the AP boot path.= */ +extern uint8_t trampoline_cpu_started; + +/* Quirks about video mode-setting on S3 resume. */ +extern uint8_t video_flags; + +/* Extended Display Identification Data, gathered from the BIOS. */ +extern uint16_t boot_edid_caps; +extern uint8_t boot_edid_info[128]; + +#endif /* !__ASSEMBLY__ */ +#endif /* XEN_ASM_TRAMPOLINE_H */ diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 608583a1134e..c735aaf0e823 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -131,6 +131,7 @@ #include #include #include +#include =20 #ifdef CONFIG_PV #include "pv/mm.h" diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hype= rcall.c index 7e3278109300..67f851237def 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -32,6 +32,8 @@ #include #include #include +#include + #include "cpu/mcheck/mce.h" #include "cpu/mtrr/mtrr.h" #include diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index cd69198326da..a6e77c9ed9fc 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -59,6 +59,7 @@ #include #include #include +#include =20 /* opt_nosmp: If true, secondary processors are ignored. */ static bool __initdata opt_nosmp; diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 0a89f22a3980..9e79c1a6d6e6 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include =20 diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index ba0700d2d5da..d5db60d335e3 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -14,6 +14,8 @@ #include #include #include +#include + #include =20 /* tboot=3D */ diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index b2a280fba369..0d8e60252962 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -37,6 +37,8 @@ EMIT_FILE; #include #include #include +#include + #include =20 #ifdef CONFIG_PV32 --=20 2.39.2 From nobody Sat Nov 23 10:28:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725541657; cv=none; d=zohomail.com; s=zohoarc; b=cpPnQfgTl/OBCuhxaB+aJZnL6GIn34JKYmsp/pRfk1wXaHIOjtEdH0n8qTYHYwVyWRpl0La2qw7PGByximOR+zCCeoZEVKU2couKUTCmqllXOE4oS8ccFbaCGvkczWQ48t0jxFmi1La6JI89vbI4gJz8QrR+wc5U3K+o7mfG5+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725541657; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0bn1ALFAeLpl/ODrwK3JYlSPQ79apDKK1tuhbixfgHM=; b=j9ydsy1CtI7FIgOHsld80ofwASXcSCv2hGXIZAYtYsiTW5TXas+TsL9oSI52SvDha3JFO+AGq5gn1ZeMrMXdTU3YKmzLf/hy3YMAp1d0tkcnqLy2fO34QAv5wypfrGfF9DQShaZOCUigIgRY7xohxJac6WMiUfVIqJglAlwbdig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725541657336301.6201017900263; Thu, 5 Sep 2024 06:07:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.791095.1200890 (Exim 4.92) (envelope-from ) id 1smCCb-0002fI-FD; Thu, 05 Sep 2024 13:07:09 +0000 Received: by outflank-mailman (output) from mailman id 791095.1200890; Thu, 05 Sep 2024 13:07:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCb-0002eL-9g; Thu, 05 Sep 2024 13:07:09 +0000 Received: by outflank-mailman (input) for mailman id 791095; Thu, 05 Sep 2024 13:07:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1smCCZ-00025l-S5 for xen-devel@lists.xenproject.org; Thu, 05 Sep 2024 13:07:07 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c0c39f3f-6b87-11ef-a0b3-8be0dac302b0; Thu, 05 Sep 2024 15:07:07 +0200 (CEST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a868b739cd9so107703966b.2 for ; Thu, 05 Sep 2024 06:07:07 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a61fbb093sm136972766b.11.2024.09.05.06.07.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:07:04 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c0c39f3f-6b87-11ef-a0b3-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725541626; x=1726146426; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0bn1ALFAeLpl/ODrwK3JYlSPQ79apDKK1tuhbixfgHM=; b=VE3+Xehoq3nOdbCcXcAQQUr3tRWLjWs3JLsZmVE9gOeTL3Wpo77kf1HbiBmdiRTWku 7g0ASH+P2VDKCmKzX2pzrop0IrMAmTGhaa/Gbo9xLwEiylsqk6ShdFikVN4isb79i+p2 prFb9PWkk38rMDSQwvAxsEXg3Uyd0Szpy6TDw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541626; x=1726146426; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0bn1ALFAeLpl/ODrwK3JYlSPQ79apDKK1tuhbixfgHM=; b=WmKKmrook310+m65oPhUCKXcVNRScfrvp63W7HVJhG9Z4YetHYeCfHSwvf3Y7dkHHi Zhkqm2OPELYZUYEof4owO7gW3oeRft4gCY3kl6GiD0PvulsqcK/DQzm4qodcAgXKBJNA aBMIHIyNnmVAVNhFnqUbx2mtN1phvC2/eZTeZPcodH+bkbiHZmhxbXAaycw5Wkjl1Dkj cE14Y4J1RLbiYxCZrPuL97ylJ/lDLPbSQYL0nJ7xbrEDZA88FPwgs4wKCsopiNHTL4OG j6vekIyWLod4XnOIKbJpJLAAXXdJITlXxtku0oKaVgTNaLkBDq5c/HwB/UKODJBynOe9 tsXg== X-Gm-Message-State: AOJu0YwnhmpaE7JltpPqNmfHp7XHwZVnr7FiCAa2NFDC7qhrccixJmP4 /0VXsWEQq6kc+YOl38XFH+XkX6OQDVDWzqQ3Y67iDNO1xVjXXvayxwI3eNmsIsrSK7X/HFJK/rt W X-Google-Smtp-Source: AGHT+IHuISNz5DOuHF9CfOTBL56qMltKoJbmCKvWrK3lCJpPnCe6XUW/G1UOjkblDzAr10BVcicINQ== X-Received: by 2002:a17:906:6a18:b0:a77:deb2:8b01 with SMTP id a640c23a62f3a-a897f789470mr2082786766b.1.1725541626076; Thu, 05 Sep 2024 06:07:06 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Frediano Ziglio , Alejandro Vallejo Subject: [PATCH 3/3] x86/trampoline: Collect other scattered trampoline symbols Date: Thu, 5 Sep 2024 14:06:57 +0100 Message-Id: <20240905130657.4075906-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240905130657.4075906-1-andrew.cooper3@citrix.com> References: <20240905130657.4075906-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725541659043116600 ... and document them too. No functional change. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Frediano Ziglio CC: Alejandro Vallejo video.h, edd.h and e820.h also contain trampoline symbols, but they're pret= ty well contained headers already. kbd_shift_flags seems especially dubious. It's a snapshot of the keyboard state when Xen happened to pass through the trampoline, and surely cannot be useful for dom0 in the slightest... --- xen/arch/x86/efi/efi-boot.h | 3 --- xen/arch/x86/include/asm/processor.h | 2 -- xen/arch/x86/include/asm/setup.h | 2 -- xen/arch/x86/include/asm/trampoline.h | 22 ++++++++++++++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 23e510c77e2e..833e343a475e 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -102,9 +102,6 @@ static void __init efi_arch_relocate_image(unsigned lon= g delta) } } =20 -extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[]; -extern const s32 __trampoline_seg_start[], __trampoline_seg_stop[]; - static void __init relocate_trampoline(unsigned long phys) { const s32 *trampoline_ptr; diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/as= m/processor.h index e71dbb8d3fbf..b8d8127e2dc3 100644 --- a/xen/arch/x86/include/asm/processor.h +++ b/xen/arch/x86/include/asm/processor.h @@ -97,8 +97,6 @@ extern void ctxt_switch_levelling(const struct vcpu *next= ); extern void (*ctxt_switch_masking)(const struct vcpu *next); =20 extern bool opt_cpu_info; -extern u32 trampoline_efer; -extern u64 trampoline_misc_enable_off; =20 /* Maximum width of physical addresses supported by the hardware. */ extern unsigned int paddr_bits; diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index d75589178b91..4d88503fd2e6 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -40,8 +40,6 @@ int remove_xen_ranges(struct rangeset *r); =20 int cf_check stub_selftest(void); =20 -extern uint8_t kbd_shift_flags; - #ifdef NDEBUG # define highmem_start 0 #else diff --git a/xen/arch/x86/include/asm/trampoline.h b/xen/arch/x86/include/a= sm/trampoline.h index cc3420ba3530..dc2c47946be4 100644 --- a/xen/arch/x86/include/asm/trampoline.h +++ b/xen/arch/x86/include/asm/trampoline.h @@ -49,6 +49,13 @@ /* SAF-0-safe */ extern char trampoline_start[], trampoline_end[]; =20 +/* + * Relocations for the trampoline. Generated by the bootsym_{seg,}rel() + * macros, and collected by the linker. + */ +extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[]; +extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[]; + /* * The physical address of trampoline_start[] in low memory. It must be b= elow * the 1M boundary (as the trampoline contains 16-bit code), and must be 4k @@ -87,9 +94,24 @@ extern uint32_t trampoline_xen_phys_start; /* A semaphore to indicate signs-of-life at the start of the AP boot path.= */ extern uint8_t trampoline_cpu_started; =20 +/* + * Extra MSR_EFER settings when activating Long Mode. EFER_NXE is necessa= ry + * for APs to boot if the BSP found and activated support. + */ +extern uint32_t trampoline_efer; + +/* + * When nonzero, clear the specified bits in MSR_MISC_ENABLE. This is + * necessary to clobber XD_DISABLE before trying to set MSR_EFER.NXE. + */ +extern uint64_t trampoline_misc_enable_off; + /* Quirks about video mode-setting on S3 resume. */ extern uint8_t video_flags; =20 +/* BIOS Int 16h, Fn 02h. The keyboard shift status. */ +extern uint8_t kbd_shift_flags; + /* Extended Display Identification Data, gathered from the BIOS. */ extern uint16_t boot_edid_caps; extern uint8_t boot_edid_info[128]; --=20 2.39.2