From nobody Mon Feb 9 08:09:58 2026 Delivered-To: importer@patchew.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=1558347582; cv=none; d=zoho.com; s=zohoarc; b=Xok2qg2s43bJqnA8e0f507C2a02GEfakMMgy/EoIlalMqNCd4F8KRVMv8ztK2fV4P0akXuE5b2o3Sk1XfLfhTO4XaKtnETfpmtRsbbPt19nWGo8xuuleiZr2I4MBTid0TFpi10Sgo+HGr5oZdKlq4CIrQ1+5EJX/VBVGRuh5L9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558347582; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3mSO07NaaJ6xifk7TltOUefqlKb1eIlPr9cVfp+oIWc=; b=lfrHKQAqeVWtohCNiAWCur7hmJgSB49zmgMF+GOUjp0UV2Xg8KxyXuwibkm9MMRVqLQM4fwp0OeJ166ikG6K9/Wqyn72xgLIQ42pS4A2mGA1a5XN1pWmhCIa7i7mr7S4I6Z/qGgzIn2msPPR7WIN7Z143yoMtw11KSF1HT9znDQ= 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 1558347582325145.25815955913413; Mon, 20 May 2019 03:19:42 -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 1hSfN8-00084q-EO; Mon, 20 May 2019 10:18:22 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hSfN6-00084S-Ps for xen-devel@lists.xenproject.org; Mon, 20 May 2019 10:18:20 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 96d40ae5-7ae8-11e9-8980-bc764e045a96; Mon, 20 May 2019 10:18:19 +0000 (UTC) X-Inumbo-ID: 96d40ae5-7ae8-11e9-8980-bc764e045a96 Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=SoftFail smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@MIAPEX02MSOL02.citrite.net 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; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: SoftFail (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com is inclined to not designate 23.29.105.83 as permitted sender) identity=mailfrom; client-ip=23.29.105.83; receiver=esa1.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 include:spf.citrix.com include:spf2.citrix.com include:ironport.citrix.com exists:%{i}._spf.mta.salesforce.com ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@MIAPEX02MSOL02.citrite.net) identity=helo; client-ip=23.29.105.83; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@MIAPEX02MSOL02.citrite.net"; x-conformance=sidf_compatible IronPort-SDR: Qaq2mWysxf/SSS8UIpPHCAjxk7c2SN61H34G49UFI4fZOrg4ryl8X9dkRX6BbsDnWYItn2LAkr 9Jg56tvrcGPwUpMsh2OieD7JCvzrHi/lTZOSeq5FRIhb5S1FVjcn+FRv7Cw3jBnwKTJMc8USth /7kuxmhyw4PLD3uCfdEeBvAS/3YtqknFo1rx6e023qbGNtSpDojEJSpxWai4vu8bmEHAkBJfTz SRiXgAkjopPdENTvIbYnOa2F/C3Qi4BtI5f4OI1JlZy03nyeicUsYR6U+v+01nQuGg+BT18x1B NDk= X-SBRS: 2.7 X-MesageID: 641030 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 23.29.105.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.60,491,1549947600"; d="scan'208";a="641030" From: Andrew Cooper To: Xen-devel Date: Mon, 20 May 2019 11:18:13 +0100 Message-ID: <1558347494-21640-4-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1558347494-21640-1-git-send-email-andrew.cooper3@citrix.com> References: <1558347494-21640-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/4] x86/boot: Wire up dom0=shadow for PV dom0 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 , 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" This would have been very handy when debugging some pv-l1tf issues. As the= re is no cost to supporting it, wire it up. Due to the way dom0 is constructed, switching into shadow mode must be done after the pagetables are written, and because of partially being in dom0 context, shadow_enable() doesn't like the state it finds. Reuse the pv_l1tf tasklet for convenience, which will switch dom0 into shad= ow mode just before it starts executing. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- docs/misc/xen-command-line.pandoc | 14 +++++++++----- xen/arch/x86/dom0_build.c | 8 -------- xen/arch/x86/pv/dom0_build.c | 9 +++++++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 1fc1802..e6d241e 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -675,12 +675,16 @@ Controls for how dom0 is constructed on x86 systems. selected mode. * For a PVH dom0, the hardware must have VT-x/SVM extensions availab= le. =20 -* The `shadow` boolean is only applicable when dom0 is constructed as a = PVH - guest, and controls whether dom0 uses hardware assisted paging, or sha= dow - paging. The default is HAP when available, and shadow otherwise. +* The `shadow` boolean allows dom0 to be explicitly constructed using sh= adow + paging. This option is unavailable when `CONFIG_SHADOW_PAGING` is + disabled. =20 - This option is unavailable when `CONFIG_SHADOW_PAGING` is disabled. S= uch - builds of Xen require HAP-capable hardware to use a PVH dom0. + For PVH, dom0 defaults to using HAP on capable hardware, and falls bac= k to + shadow paging otherwise. A PVH dom0 cannot be used if Xen is compiled + without paging support, and the hardware lacks HAP support. + + For PV, the use of dom0 shadow mode is only for development purposes. = PV + guests do no require any paging support by default. =20 * The `verbose` boolean is intended for diagnostics, and prints out extra information during the dom0 build. It defaults to false. diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 27315d5..93e5531 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -588,14 +588,6 @@ int __init construct_dom0(struct domain *d, const modu= le_t *image, =20 process_pending_softirqs(); =20 -#ifdef CONFIG_SHADOW_PAGING - if ( opt_dom0_shadow && !dom0_pvh ) - { - opt_dom0_shadow =3D false; - printk(XENLOG_WARNING "Shadow Dom0 requires PVH. Option ignored.\n= "); - } -#endif - if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(d, image, image_headroom, initrd, cmdlin= e); else if ( is_pv_domain(d) ) diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 064a10e..4a1526a 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -906,6 +906,15 @@ int __init dom0_construct_pv(struct domain *d, if ( d->domain_id =3D=3D hardware_domid ) iommu_hwdom_init(d); =20 + /* Activate shadow mode, if requested. Reuse the pv_l1tf tasklet. */ +#ifdef CONFIG_SHADOW_PAGING + if ( opt_dom0_shadow ) + { + printk("Switching dom0 to using shadow paging\n"); + tasklet_schedule(&d->arch.paging.shadow.pv_l1tf_tasklet); + } +#endif + v->is_initialised =3D 1; clear_bit(_VPF_down, &v->pause_flags); =20 --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel