From nobody Mon Feb 9 05:11:16 2026 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=1618940516; cv=none; d=zohomail.com; s=zohoarc; b=iwMuikr/OTnRh2hHkmBEFTzePfenAZHRhGA8vXl6VcF/afDZpiZUC/k5BG23/KPGbDvKnHSCSkl4nm2f0U0ml8pqCx1zUL1hYo2f3CbpPI3mj9GN1X+OU2YJtVSYkGWXjHQc8AJpwUVHCqntWw1WVruv2b66UZIQ+S7b+VKHRZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618940516; 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; bh=nL98uw0B/3GhF3HJnTtJUCUglP1653Kaiv6v1kLt0tg=; b=bFX7D9W/wlEWZEW7jWwD8wbAlHkm6UghtMjlEgCfmTYItjPBtdTU7ovgc4hKpgOALUBgDJ2csDbrXJ2NAQVNDm9JDg06FctmD8lF2bN90hht1ZxL2GsXvMWt65rwAncY8Ajn68YpFS5tBoh8KG/3Y/LJt22ikRfyXegUMQ3duiM= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1618940516794225.2247228740572; Tue, 20 Apr 2021 10:41:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.113966.217111 (Exim 4.92) (envelope-from ) id 1lYuNY-0006pi-1B; Tue, 20 Apr 2021 17:41:40 +0000 Received: by outflank-mailman (output) from mailman id 113966.217111; Tue, 20 Apr 2021 17:41:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lYuNX-0006pb-UE; Tue, 20 Apr 2021 17:41:39 +0000 Received: by outflank-mailman (input) for mailman id 113966; Tue, 20 Apr 2021 17:41:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lYuNX-0006pW-BW for xen-devel@lists.xenproject.org; Tue, 20 Apr 2021 17:41:39 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6fc69427-8ea6-4997-9185-eba36c67290c; Tue, 20 Apr 2021 17:41:38 +0000 (UTC) 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: 6fc69427-8ea6-4997-9185-eba36c67290c DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1618940498; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=q5uyq9I9RXtPb4NM4q7ITiFLsZVSwuRIAlxVd5e6Jjg=; b=A2MMKw/juuD2DbIvec2ElUrH+MYKTip4ygQWWu5dMsnZG8oabRSZEoc3 OqbixB2O/cr7D7tqZcYlrT3CQQOi5y5vrjnCj3ksRzwxuhOpF7CWSxLkh 9sxPiH8eLTD7WjXc1T90kMIt0z1zmKWTnfZqDy0lzy2eBMPAvPVkaSY+h k=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: iWyu2oC31fXjV2yajVp4uFhM6DHO70oy3AsCk3j88mzQXjV8uz3KTlixV3CM8ad8mMd+oSS7WE biEQLDWIUVS+zmTwc0NUYz32vD7hWGOb7WXchSn6LGcjg8DYl6FsmTvRnBc1k082sS0S4XEBHB xxCxDjqXQ6NjYT+8DYhMW4TWiiPrCJxj+yh7vv9ltja1cg7ms3pJ+CemvbTfPnz9N508tDSWsj kw4+obTzVPK3L2XDwidpV4tn3w+hzt7IIvo+Z3zNkqmReEqoWLZmFDceilLPZ5BFsyH+YrFaBI FFM= X-SBRS: 5.1 X-MesageID: 41843399 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:v9Zi4qlPQRPwOBDlDxCFe1oKDcPpDfLK3DAbvn1ZSRFFG/Gwve rGppUm/DXzjyscX2xlpMuJP7OOTWiZ2Zl+54QQOrnKZniBhEKDKoZ+4Yz+hwDxAiGWzJ876Y 5Me7VzYeeAbmRSot395GCDfOoI5Pmi3OSWifzFz3FrJDsaD51IywtiEA6UHglXaWB9dPgEPa GR7MZGuDasEE5/Bq/QaxU4dtPOusHRk9beaQMGbiRXkTWmty+i67LxDnGjvis2bjUn+9kf2F mAtwT446m52svLryPh6w== X-IronPort-AV: E=Sophos;i="5.82,237,1613451600"; d="scan'208";a="41843399" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH v2] x86/shim: Simplify compat handling in write_start_info() Date: Tue, 20 Apr 2021 18:41:18 +0100 Message-ID: <20210420174118.2731-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Factor out a compat boolean to remove the lfence overhead from multiple is_pv_32bit_domain() calls. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu v2: * Reinstate the conditional for the start info pointer, in case Intel/AMD can't be persuaded to adjust the architectural guarentees for upper bits= in compatibility mode transitions. --- xen/arch/x86/pv/shim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index d16c0048c0..4c6f442274 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -280,12 +280,12 @@ void __init pv_shim_setup_dom(struct domain *d, l4_pg= entry_t *l4start, static void write_start_info(struct domain *d) { struct cpu_user_regs *regs =3D guest_cpu_user_regs(); - start_info_t *si =3D map_domain_page(_mfn(is_pv_32bit_domain(d) ? regs= ->edx - : regs->= rdx)); + bool compat =3D is_pv_32bit_domain(d); + start_info_t *si =3D map_domain_page(_mfn(compat ? regs->edx : regs->r= dx)); uint64_t param; =20 snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%s", - is_pv_32bit_domain(d) ? "32p" : "64"); + compat ? "32p" : "64"); si->nr_pages =3D domain_tot_pages(d); si->shared_info =3D virt_to_maddr(d->shared_info); si->flags =3D 0; @@ -300,7 +300,7 @@ static void write_start_info(struct domain *d) &si->console.domU.mfn) ) BUG(); =20 - if ( is_pv_32bit_domain(d) ) + if ( compat ) xlat_start_info(si, XLAT_start_info_console_domU); =20 unmap_domain_page(si); --=20 2.11.0