From patchwork Mon Sep 9 10:44:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11137675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED80414DB for ; Mon, 9 Sep 2019 10:46:11 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C828921479 for ; Mon, 9 Sep 2019 10:46:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Owh/Tp70" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C828921479 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7H9Y-00054e-V0; Mon, 09 Sep 2019 10:44:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7H9X-00054U-KY for xen-devel@lists.xenproject.org; Mon, 09 Sep 2019 10:44:11 +0000 X-Inumbo-ID: c1a85386-d2ee-11e9-b76c-bc764e2007e4 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c1a85386-d2ee-11e9-b76c-bc764e2007e4; Mon, 09 Sep 2019 10:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568025851; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pbzWSKaX+Wm3RY+4CLESZ4ZMerCguRXM3oPuyvc0cdM=; b=Owh/Tp700t+/ju2tkjFSLU+q5p7zqPxupm7Y8WH/ckr8fZ4yhoCBpUGC TwFgov6RwznJtZ7g8Lo4FIcQkHvxnPITM44FLzX+TnjDliw/I8f/GGx3k M3x5q1wi2gtH+DGMUo5o5qbU5N4pbxLzruAmlZzwBwVWfJkvcOaV85Nnf c=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: jSImWnGeiga63TUO9HlVbQ7MTI83V3aEEWY5U465QQk9RvvW/JDZWFNZcXMVNrysM87M9bLWl2 5bhmFOWoUWiDaERtk6XAgr0l6pzJf0Tv14FEr1aK9tZuQ6V87+K9O3tZPfAYSDc0dGAOKbeAxl Yprs5w8oeOHV+bLjfDnTFGDN/ta6Gq1ljH/HZviE7+LDDujzzl6/pWqgohM1y/rSaXUK4edKzN 6qfONE2axwJKfnQK2FfR7WOxZxxWmFaPN2wMS+9B1vqcea4mdfC1cPNH6aiKtvCdCqvzOUkFSU 9OQ= X-SBRS: 2.7 X-MesageID: 5307168 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,484,1559534400"; d="scan'208";a="5307168" From: Andrew Cooper To: Xen-devel Date: Mon, 9 Sep 2019 11:44:07 +0100 Message-ID: <20190909104407.13666-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86: Misc trivial cleanup of bootsym_phys() 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 , Lukasz Hawrylko , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In smpboot, there is no need to abstract setup_trampoline() away. Drop the define and use bootsym_phys() directly. In tboot, the 3 size calculations are invariant of their bootsym_phys()/__pa() transformations, but the compiler can't tell this. Drop the tranformations, which simplifies the compiled function. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-134 (-134) Function old new delta tboot_shutdown 620 486 -134 Total: Before=3337042, After=3336908, chg -0.00% Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné CC: Lukasz Hawrylko --- xen/arch/x86/smpboot.c | 4 +--- xen/arch/x86/tboot.c | 9 +++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 911416c1e1..6904ef5771 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -46,8 +46,6 @@ #include #include -#define setup_trampoline() (bootsym_phys(trampoline_realmode_entry)) - unsigned long __read_mostly trampoline_phys; /* representing HT siblings of each logical CPU */ @@ -545,7 +543,7 @@ static int do_boot_cpu(int apicid, int cpu) booting_cpu = cpu; - start_eip = setup_trampoline(); + start_eip = bootsym_phys(trampoline_realmode_entry); /* start_eip needs be page aligned, and below the 1M boundary. */ if ( start_eip & ~0xff000 ) diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index 8263f24009..3e828fe204 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -370,16 +370,13 @@ void tboot_shutdown(uint32_t shutdown_type) g_tboot_shared->num_mac_regions = 3; /* S3 resume code (and other real mode trampoline code) */ g_tboot_shared->mac_regions[0].start = bootsym_phys(trampoline_start); - g_tboot_shared->mac_regions[0].size = bootsym_phys(trampoline_end) - - bootsym_phys(trampoline_start); + g_tboot_shared->mac_regions[0].size = trampoline_end - trampoline_start; /* hypervisor .text + .rodata */ g_tboot_shared->mac_regions[1].start = (uint64_t)__pa(&_stext); - g_tboot_shared->mac_regions[1].size = __pa(&__2M_rodata_end) - - __pa(&_stext); + g_tboot_shared->mac_regions[1].size = __2M_rodata_end - _stext; /* hypervisor .data + .bss */ g_tboot_shared->mac_regions[2].start = (uint64_t)__pa(&__2M_rwdata_start); - g_tboot_shared->mac_regions[2].size = __pa(&__2M_rwdata_end) - - __pa(&__2M_rwdata_start); + g_tboot_shared->mac_regions[2].size = __2M_rwdata_end - __2M_rwdata_start; /* * MAC domains and other Xen memory