From nobody Mon Apr 29 03:55:43 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1556803732; cv=none; d=zoho.com; s=zohoarc; b=Zmr61FbDN9k0UYhP3Zm2nQurH1NL6PyUs2QbPvn9lUcmxjCNmDsNNGMtFvTzPWZSthFQvEM6/CqFdrcsuid64a+0U4rfrWImGLynyQebMRb6ELBji2e0XwK86Z48gqq761Ku6LRtd23O4PUPbAyIFe0yBuFIX9TrDH47lrctVfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556803732; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=WCGD7C6acmfCtI85b+BVdaHG59SpWzpmlEhLGbpEsr8=; b=MiByWiuNuR1Y7AwF8qY/EsUQc1Ev29Z8fzY3i4y+Dcg+OlMt4+Z2TFD86QQvRKSCI4SXeJkizoGksjo91HdOx7sUR4EFq5dlQTsMaVFG2OKBZMVJ2NJoZfHlC/S0OB8k5vl9eW/88ufaOpLrt6KVnzOQCTkluy97Blq87wR+hMo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1556803732201289.77636352624825; Thu, 2 May 2019 06:28:52 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMBkP-0004I6-EZ; Thu, 02 May 2019 13:27:37 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMBkN-0004Hy-Qi for xen-devel@lists.xenproject.org; Thu, 02 May 2019 13:27:35 +0000 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 010794d2-6cde-11e9-b96d-1f5d2cddec18; Thu, 02 May 2019 13:27:17 +0000 (UTC) X-Inumbo-ID: 010794d2-6cde-11e9-b96d-1f5d2cddec18 X-IronPort-AV: E=Sophos;i="5.60,421,1549929600"; d="scan'208";a="84946941" From: Andrew Cooper To: Xen-devel Date: Thu, 2 May 2019 14:27:07 +0100 Message-ID: <1556803627-22855-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: Annotate the Real Mode entry points 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 , Wei Liu , David Woodhouse , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ... because its already hard enough to follow. Cross reference the locatio= ns in C which set the entrypoints up, and state the alignment requirements and entry conditions. Drop a redundant .align 16, and panic() in do_boot_cpu() if the AP trampoli= ne isn't set up properly rather than blindly continuing an letting the APs execute junk, or shifting part of the address into unrelated fields in ICR. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: David Woodhouse --- xen/arch/x86/boot/trampoline.S | 6 ++++++ xen/arch/x86/boot/wakeup.S | 10 +++++++++- xen/arch/x86/smpboot.c | 5 ++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index 125bdb5..cac0f3e1 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -38,6 +38,12 @@ =20 .code16 =20 +/* + * do_boot_cpu() programs the Startup-IPI to point here. Due to the SIPI + * format, the relocated entrypoint must be 4k aligned. + * + * It is entered in Real Mode, with %cs =3D wakeup_start >> 4 and %ip =3D = 0. + */ GLOBAL(trampoline_realmode_entry) mov %cs,%ax mov %ax,%ds diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S index 89df261..e3cb9e0 100644 --- a/xen/arch/x86/boot/wakeup.S +++ b/xen/arch/x86/boot/wakeup.S @@ -2,7 +2,15 @@ =20 #define wakesym(sym) (sym - wakeup_start) =20 - .align 16 +/* + * acpi_sleep_prepare() programs the S3 wakeup vector to point here. + * + * The ACPI spec says that we shall be entered in Real Mode with: + * %cs =3D wakeup_start >> 4 + * %ip =3D wakeup_start & 0xf + * + * As wakeup_start is 16-byte aligned, %ip is 0 in practice. + */ ENTRY(wakeup_start) cli cld diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index b7a0a4a..4f65c8d 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -548,9 +548,12 @@ static int do_boot_cpu(int apicid, int cpu) =20 booting_cpu =3D cpu; =20 - /* start_eip had better be page-aligned! */ start_eip =3D setup_trampoline(); =20 + /* start_eip needs be page aligned, and below the 1M boundary. */ + if ( start_eip & ~0xff000 ) + panic("AP trampoline %#lx not suitably positioned\n", start_eip); + /* So we see what's up */ if ( opt_cpu_info ) printk("Booting processor %d/%d eip %lx\n", --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel