From nobody Wed May 1 03:34:23 2024 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=1564479641; cv=none; d=zoho.com; s=zohoarc; b=JItc6HOiV3dncdt8EQj65hkNh9B1oURYgUP6N4JyOJ0HhGzd9ZqzG5PzQi6HMlHdk/YQgDdiGQ49kT1ukcxCKWRbXa/bRd+Eo04dXMT+zuZ0fP/k6/4lZ8gmwMNJJm7VVUXF02w+uSHR2GQVGb2aj8yXIVKKVa37Om1rT0ml7Qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564479641; 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=meZEkKJrG0eNKrchI5BzEQPBjmKKif3NoArgQU6XuRw=; b=NIMRMTeAUmrtvaY3thfCk8+umtVtkdza4c7NF91nrnUOuIqIckUj7/lHfOC7imbpNSIwLEaNgnPDLlwf89ZyofnO+awcV/WXS1XWTiTbQzFaGjxqN1mnUZ22u5rncdaJLpoKIkUvGl3uS0eNPtPCrK1/G29Oi1n5IPThU1A3WTQ= 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 156447964112443.81147140619521; Tue, 30 Jul 2019 02:40:41 -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 1hsObF-0008Mk-Lc; Tue, 30 Jul 2019 09:39:17 +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 1hsObE-0008MW-AJ for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 09:39:16 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e3245610-b2ad-11e9-9fc5-a32546597094; Tue, 30 Jul 2019 09:39:12 +0000 (UTC) X-Inumbo-ID: e3245610-b2ad-11e9-9fc5-a32546597094 Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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 (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 83KS6LcB3XH6vO1KM6N4MLpkR9nvKg5xUcjOlurPIHtu46C9T/i9hUf2jrwcJ+9SDdQCTFr3Th sjxlCIIUCzhdejgT6YETZFUhRLnWkXZzjpZ0ymjYsdDn3jO8/AAB/dv3I1mqAIZYIDu4Jw5Pnf 73fLgFvMRtIZxOAzczwe/6zGVA4MLCtsdgTdmIsCsWsjBzh5zUEtVciowhtWDps2KImXmaDyIU tovZiYJvHxesSMAFMfF/YOgNBEbMYFoug8CyyhxQEebLhmc6YD2k6jMZEPYS1HCumMHUExHzC0 R5s= X-SBRS: 2.7 X-MesageID: 3748699 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3748699" From: Paul Durrant To: Date: Tue, 30 Jul 2019 10:39:00 +0100 Message-ID: <20190730093904.1794-2-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730093904.1794-1-paul.durrant@citrix.com> References: <20190730093904.1794-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 1/5] domain: remove 'guest_type' field (and enum guest_type) 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Paul Durrant , 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" The enum guest_type was introduced in commit 6c6492780ea "pvh prep: introduce pv guest type and has_hvm_container macros" to allow a new guest type, distinct from either PV or HVM guest types, to be added in commit 8271d6522c6 "pvh: introduce PVH guest type". Subsequently, commit 33e5c32559e "x86: remove PVHv1 code" removed this third guest type. This patch removes the struct domain field and enumeration as the guest type can now be trivially determined from the 'options' field. Signed-off-by: Paul Durrant Reviewed-by: "Roger Pau Monn=C3=A9" Acked-by: George Dunlap Reviewed-by: Jan Beulich --- Cc: Andrew Cooper Cc: Ian Jackson Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu v3: - Change !evaluate_nospec(cond) to evaluate_nospec(!cond) --- xen/common/domain.c | 4 ---- xen/common/domctl.c | 10 +--------- xen/common/kernel.c | 9 ++------- xen/include/xen/sched.h | 14 ++++---------- 4 files changed, 7 insertions(+), 30 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 9aefc2a680..df523c9ce4 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -353,10 +353,6 @@ struct domain *domain_create(domid_t domid, hardware_domain =3D d; } =20 - /* Sort out our idea of is_{pv,hvm}_domain(). All system domains are = PV. */ - d->guest_type =3D ((d->options & XEN_DOMCTL_CDF_hvm_guest) - ? guest_type_hvm : guest_type_pv); - TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); =20 /* diff --git a/xen/common/domctl.c b/xen/common/domctl.c index fa260ce5fb..3d937434af 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -187,17 +187,9 @@ void getdomaininfo(struct domain *d, struct xen_domctl= _getdomaininfo *info) (d->controller_pause_count > 0 ? XEN_DOMINF_paused : 0) | (d->debugger_attached ? XEN_DOMINF_debugged : 0) | (d->is_xenstore ? XEN_DOMINF_xs_domain : 0) | + (is_hvm_domain(d) ? XEN_DOMINF_hvm_guest : 0) | d->shutdown_code << XEN_DOMINF_shutdownshift; =20 - switch ( d->guest_type ) - { - case guest_type_hvm: - info->flags |=3D XEN_DOMINF_hvm_guest; - break; - default: - break; - } - xsm_security_domaininfo(d, info); =20 info->tot_pages =3D d->tot_pages; diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 612575430f..f7628d73ce 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -474,19 +474,14 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void)= arg) fi.submap |=3D (1U << XENFEAT_ARM_SMCCC_supported); #endif #ifdef CONFIG_X86 - switch ( d->guest_type ) - { - case guest_type_pv: + if ( is_pv_domain(d) ) fi.submap |=3D (1U << XENFEAT_mmu_pt_update_preserve_ad) | (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); - break; - case guest_type_hvm: + else fi.submap |=3D (1U << XENFEAT_hvm_safe_pvclock) | (1U << XENFEAT_hvm_callback_vector) | (has_pirq(d) ? (1U << XENFEAT_hvm_pirqs) : 0); - break; - } #endif break; default: diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index ffb44f15a3..79eff418c4 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -302,10 +302,6 @@ struct vm_event_domain =20 struct evtchn_port_ops; =20 -enum guest_type { - guest_type_pv, guest_type_hvm -}; - struct domain { unsigned int options; /* copy of createdomain flags */ @@ -357,8 +353,6 @@ struct domain struct radix_tree_root pirq_tree; unsigned int nr_pirqs; =20 - enum guest_type guest_type; - /* Is this guest dying (i.e., a zombie)? */ enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying; =20 @@ -918,8 +912,8 @@ void watchdog_domain_destroy(struct domain *d); =20 static inline bool is_pv_domain(const struct domain *d) { - return IS_ENABLED(CONFIG_PV) - ? evaluate_nospec(d->guest_type =3D=3D guest_type_pv) : false; + return IS_ENABLED(CONFIG_PV) && + evaluate_nospec(!(d->options & XEN_DOMCTL_CDF_hvm_guest)); } =20 static inline bool is_pv_vcpu(const struct vcpu *v) @@ -950,8 +944,8 @@ static inline bool is_pv_64bit_vcpu(const struct vcpu *= v) #endif static inline bool is_hvm_domain(const struct domain *d) { - return IS_ENABLED(CONFIG_HVM) - ? evaluate_nospec(d->guest_type =3D=3D guest_type_hvm) : false; + return IS_ENABLED(CONFIG_HVM) && + evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest); } =20 static inline bool is_hvm_vcpu(const struct vcpu *v) --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Wed May 1 03:34:23 2024 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=1564479641; cv=none; d=zoho.com; s=zohoarc; b=aLl2fGyShcJfS2ebdVoUEu6DNuo80H3HkNTi0jvOi/THAPnFXhj+jfT6FjJKTUS9Yc11lhFt/e2fc/RPUtL86zUyMoQq+UNs/oVqfZUFWih4n381nNArwT5wAJRo5Aei89GRmEioSOz0SabUvZS70TdB1X4ZWUjBmdrP8pdQK4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564479641; 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=k9u2V7KgVmIPIhk3kPqYAPqW7WhLVT3sW2dChpZ9lIo=; b=UCQA88uhE//4CZkJX2aZxfu+ShBagFwopo35R8J2oUdhqkuE36qoArIlA67uHmw7InTnUxN4Fo1GKdkSS/KCHLt8tXPl1apXfU2hpZWy82tTIKxUAigGBABqHiyUoppoHctamkLc9hSuSUPSK3ULbOZ9osb+RVELNabw68UXv+k= 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 1564479641596829.4592672849491; Tue, 30 Jul 2019 02:40:41 -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 1hsOba-0008Up-BM; Tue, 30 Jul 2019 09:39:38 +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 1hsObY-0008U6-Bi for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 09:39:36 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id efbb9988-b2ad-11e9-bf07-9fb0354c80c9; Tue, 30 Jul 2019 09:39:33 +0000 (UTC) X-Inumbo-ID: efbb9988-b2ad-11e9-bf07-9fb0354c80c9 Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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 (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: x5oz3wht006ZyGu1grLqqzFDSM4cHfwbatA7zAc46Lsm0wHycjJ8RKXyFo2I2LgJs1KQ0EfO3X zYjKfpDH2l7GooiGg3/mTfF+k33mp7Ze47i6iaiZzo1PpLgD8UrXmKpLkYMUhoUBUoyvX8/Mmh a5pTt1y/y2AkkO+yl+tsNuoAffJQCqpRU9+QKInkG7e9JmtVbQYUh4/v7KX9TOxr7Pkcs/2p1g eQnZPCAZZDjHV7Ce7WbT0X5Rj0TxeGtE2/PXX2wiEQeG/zw6HDFyzjjTKDCMOcY1aSpxLa+3yL Ug0= X-SBRS: 2.7 X-MesageID: 3728532 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3728532" From: Paul Durrant To: Date: Tue, 30 Jul 2019 10:39:01 +0100 Message-ID: <20190730093904.1794-3-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730093904.1794-1-paul.durrant@citrix.com> References: <20190730093904.1794-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 2/5] x86/hvm/domain: remove the 'hap_enabled' flag 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Paul Durrant , 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" The hap_enabled() macro can determine whether the feature is available using the domain 'options'; there is no need for a separate flag. NOTE: Furthermore, by extending sanitiziing of the domain 'options', the macro can be transformed into an inline function and re-located to xen/sched.h. This also makes hap_enabled() common, thus allowing removal of an ugly ifdef CONFIG_X86 from the common iommu code. Signed-off-by: Paul Durrant --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monn=C3=A9" Cc: George Dunlap Cc: Ian Jackson Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: George Dunlap v3: - Re-worked as suggested by Jan - Not adding Roger's R-b as the patch has changed substantially v2: - Defer changes to shadow_domain_init() to patch #4 --- xen/arch/x86/domain.c | 13 +++++++------ xen/arch/x86/mm/paging.c | 4 ++-- xen/common/domain.c | 7 +++++++ xen/drivers/passthrough/iommu.c | 2 -- xen/include/asm-x86/hvm/domain.h | 7 ------- xen/include/asm-x86/paging.h | 2 +- xen/include/xen/sched.h | 5 +++++ 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 5933b3f51b..0f43da3b6a 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -460,6 +460,12 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } =20 + if ( config->flags & XEN_DOMCTL_CDF_hap && !hvm_hap_supported() ) + { + dprintk(XENLOG_INFO, "HAP enabled but not supported\n"); + return -EINVAL; + } + return 0; } =20 @@ -564,12 +570,7 @@ int arch_domain_create(struct domain *d, HYPERVISOR_COMPAT_VIRT_START(d) =3D is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u; =20 - /* Need to determine if HAP is enabled before initialising paging */ - if ( is_hvm_domain(d) ) - d->arch.hvm.hap_enabled =3D - hvm_hap_supported() && (config->flags & XEN_DOMCTL_CDF_hap); - - if ( (rc =3D paging_domain_init(d, config->flags)) !=3D 0 ) + if ( (rc =3D paging_domain_init(d)) !=3D 0 ) goto fail; paging_initialised =3D true; =20 diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 011089368a..097a27f608 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -632,7 +632,7 @@ void paging_log_dirty_init(struct domain *d, const stru= ct log_dirty_ops *ops) /* CODE FOR PAGING SUPPORT */ /************************************************/ /* Domain paging struct initialization. */ -int paging_domain_init(struct domain *d, unsigned int domcr_flags) +int paging_domain_init(struct domain *d) { int rc; =20 @@ -653,7 +653,7 @@ int paging_domain_init(struct domain *d, unsigned int d= omcr_flags) if ( hap_enabled(d) ) hap_domain_init(d); else - rc =3D shadow_domain_init(d, domcr_flags); + rc =3D shadow_domain_init(d, d->options); =20 return rc; } diff --git a/xen/common/domain.c b/xen/common/domain.c index df523c9ce4..53d0a62f82 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -313,6 +313,13 @@ static int sanitise_domain_config(struct xen_domctl_cr= eatedomain *config) return -EINVAL; } =20 + if ( !(config->flags & XEN_DOMCTL_CDF_hvm_guest) && + config->flags & XEN_DOMCTL_CDF_hap ) + { + dprintk(XENLOG_INFO, "HAP enabled for non-HVM guest\n"); + return -EINVAL; + } + return arch_sanitise_domain_config(config); } =20 diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index f8c3bf53bd..37eb0f7d01 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -573,9 +573,7 @@ int iommu_do_domctl( =20 void iommu_share_p2m_table(struct domain* d) { -#ifdef CONFIG_X86 ASSERT(hap_enabled(d)); -#endif /* * iommu_use_hap_pt(d) cannot be used here because during domain * construction need_iommu(d) will always return false here. diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/dom= ain.h index 6c7c4f5aa6..bcc5621797 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -156,7 +156,6 @@ struct hvm_domain { =20 struct viridian_domain *viridian; =20 - bool_t hap_enabled; bool_t mem_sharing_enabled; bool_t qemu_mapcache_invalidate; bool_t is_s3_suspended; @@ -195,12 +194,6 @@ struct hvm_domain { }; }; =20 -#ifdef CONFIG_HVM -#define hap_enabled(d) (is_hvm_domain(d) && (d)->arch.hvm.hap_enabled) -#else -#define hap_enabled(d) ({(void)(d); false;}) -#endif - #endif /* __ASM_X86_HVM_DOMAIN_H__ */ =20 /* diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h index cf57ca708d..ab7887f23c 100644 --- a/xen/include/asm-x86/paging.h +++ b/xen/include/asm-x86/paging.h @@ -207,7 +207,7 @@ void paging_vcpu_init(struct vcpu *v); =20 /* Set up the paging-assistance-specific parts of a domain struct at * start of day. Called for every domain from arch_domain_create() */ -int paging_domain_init(struct domain *d, unsigned int domcr_flags); +int paging_domain_init(struct domain *d); =20 /* Handler for paging-control ops: operations from user-space to enable * and disable ephemeral shadow modes (test mode and log-dirty mode) and diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 79eff418c4..e14540966f 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -948,6 +948,11 @@ static inline bool is_hvm_domain(const struct domain *= d) evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest); } =20 +static inline bool hap_enabled(const struct domain *d) +{ + return evaluate_nospec(d->options & XEN_DOMCTL_CDF_hap); +} + static inline bool is_hvm_vcpu(const struct vcpu *v) { return is_hvm_domain(v->domain); --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Wed May 1 03:34:23 2024 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=1564479623; cv=none; d=zoho.com; s=zohoarc; b=fkxKaL5qn7dnD7T08owSLCjlhsjrGCzPqxNYFTE0UDK/E59uU8OSw3Z8LwQjSFti0NI2Z2GPdUxIytw+gShuxrrK8ca7Cl6OdqtNWTvyFXlanXfdofrjHsam7qf/1uUhUTEuzXP9/9l8uSlC4PuNYJMMnji010vP/58zK5CFEuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564479623; 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=01ojPSSl+KDn6crV0g9mzJSCUvXD6VpU+ybFGVNgdvw=; b=ZgiKV5g7o2N70RyXAd7r9Asvh2xIK/bJYV/qZ1vk2NyykI2DAz/k9fVy2SNmo64+ij09X+M3Du3s5/KAX5y8wPLRnkSnpygPjokfDOfoe9SrhYFAyoiKD/eBBk94B/quSuCySluWnseVSZ93xKL+7J7rzodJaPpZZWk5LBaMs58= 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 1564479623108512.1698235616809; Tue, 30 Jul 2019 02:40:23 -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 1hsObH-0008Nb-VD; Tue, 30 Jul 2019 09:39:19 +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 1hsObG-0008N2-HK for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 09:39:18 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e547a1cc-b2ad-11e9-badd-db6d9afa5fb9; Tue, 30 Jul 2019 09:39:15 +0000 (UTC) X-Inumbo-ID: e547a1cc-b2ad-11e9-badd-db6d9afa5fb9 Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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 (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: KNsLszJUDRgtEqXctsKQZq853cc0sOytKQQJXL5xqaTbYSUI3DNk9z1PnM+M62Q6egnrzzGKkx UpSiSsur9odOdApozKQFQWeHi4MlpgHb2IMXYZdeJqelA6YXGwCMYSVd8zqid3Ot55OphIDF5z ZSNMKgg7SXR746shSgQuAm/Q6E4OYCaEXAZmj4tJU6U5fcCl+pkIF+My1OcRZlUClMNUwmA7MM FYXSLehrc1/ldIQbK6KVENEdQlV3/rq7HPoBePzgEmtxKbxGo4dtcvCvg0/0fq5lQqTOvmbbVD 8as= X-SBRS: 2.7 X-MesageID: 3748702 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3748702" From: Paul Durrant To: Date: Tue, 30 Jul 2019 10:39:02 +0100 Message-ID: <20190730093904.1794-4-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730093904.1794-1-paul.durrant@citrix.com> References: <20190730093904.1794-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 3/5] x86/domain: remove the 'oos_off' flag 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: Wei Liu , George Dunlap , Andrew Cooper , Tim Deegan , Paul Durrant , 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" The flag is not needed since the domain 'options' can now be tested directly. Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich --- Cc: Tim Deegan Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monn=C3=A9" v3: - Force 'oos_off' to be set for PV guests (to avoid call to is_hvm_domain() except in ASSERT) - Dropped Tim's A-b because of the change v2: - Move some of the hunks from patch #3 - Also update the definition of shadow_domain_init() in none.c --- xen/arch/x86/mm/paging.c | 2 +- xen/arch/x86/mm/shadow/common.c | 7 ++++--- xen/arch/x86/mm/shadow/none.c | 2 +- xen/common/domain.c | 16 ++++++++++++---- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/shadow.h | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 097a27f608..69aa228e46 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -653,7 +653,7 @@ int paging_domain_init(struct domain *d) if ( hap_enabled(d) ) hap_domain_init(d); else - rc =3D shadow_domain_init(d, d->options); + rc =3D shadow_domain_init(d); =20 return rc; } diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/commo= n.c index fa18de0bb6..1187176993 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -46,7 +46,7 @@ static void sh_clean_dirty_bitmap(struct domain *); =20 /* Set up the shadow-specific parts of a domain struct at start of day. * Called for every domain from arch_domain_create() */ -int shadow_domain_init(struct domain *d, unsigned int domcr_flags) +int shadow_domain_init(struct domain *d) { static const struct log_dirty_ops sh_ops =3D { .enable =3D sh_enable_log_dirty, @@ -62,7 +62,6 @@ int shadow_domain_init(struct domain *d, unsigned int dom= cr_flags) =20 #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) d->arch.paging.shadow.oos_active =3D 0; - d->arch.paging.shadow.oos_off =3D domcr_flags & XEN_DOMCTL_CDF_oos_off; #endif d->arch.paging.shadow.pagetable_dying_op =3D 0; =20 @@ -2523,11 +2522,13 @@ static void sh_update_paging_modes(struct vcpu *v) #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) /* We need to check that all the vcpus have paging enabled to * unsync PTs. */ - if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off ) + if ( !(d->options & XEN_DOMCTL_CDF_oos_off) ) { int pe =3D 1; struct vcpu *vptr; =20 + ASSERT(is_hvm_domain(d)); + for_each_vcpu(d, vptr) { if ( !hvm_paging_enabled(vptr) ) diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c index a70888bd98..2fddf4274c 100644 --- a/xen/arch/x86/mm/shadow/none.c +++ b/xen/arch/x86/mm/shadow/none.c @@ -18,7 +18,7 @@ static void _clean_dirty_bitmap(struct domain *d) ASSERT(is_pv_domain(d)); } =20 -int shadow_domain_init(struct domain *d, unsigned int domcr_flags) +int shadow_domain_init(struct domain *d) { static const struct log_dirty_ops sh_none_ops =3D { .enable =3D _enable_log_dirty, diff --git a/xen/common/domain.c b/xen/common/domain.c index 53d0a62f82..2df908285b 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -313,11 +313,19 @@ static int sanitise_domain_config(struct xen_domctl_c= reatedomain *config) return -EINVAL; } =20 - if ( !(config->flags & XEN_DOMCTL_CDF_hvm_guest) && - config->flags & XEN_DOMCTL_CDF_hap ) + if ( !(config->flags & XEN_DOMCTL_CDF_hvm_guest) ) { - dprintk(XENLOG_INFO, "HAP enabled for non-HVM guest\n"); - return -EINVAL; + if ( config->flags & XEN_DOMCTL_CDF_hap ) + { + dprintk(XENLOG_INFO, "HAP enabled for non-HVM guest\n"); + return -EINVAL; + } + + /* + * It is only meaningful for XEN_DOMCTL_CDF_oos_off to be clear + * for HVM guests. + */ + config->flags |=3D XEN_DOMCTL_CDF_oos_off; } =20 return arch_sanitise_domain_config(config); diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 933b85901f..5f9899469c 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -115,7 +115,6 @@ struct shadow_domain { =20 /* OOS */ bool_t oos_active; - bool_t oos_off; =20 /* Has this domain ever used HVMOP_pagetable_dying? */ bool_t pagetable_dying_op; diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index f29f0f652b..8ebb89c027 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -49,7 +49,7 @@ =20 /* Set up the shadow-specific parts of a domain struct at start of day. * Called from paging_domain_init(). */ -int shadow_domain_init(struct domain *d, unsigned int domcr_flags); +int shadow_domain_init(struct domain *d); =20 /* Setup the shadow-specific parts of a vcpu struct. It is called by * paging_vcpu_init() in paging.c */ --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Wed May 1 03:34:23 2024 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=1564479641; cv=none; d=zoho.com; s=zohoarc; b=Gu9dcPoyThrTrYveG9k7wMioEyEy7t69fjVJQwA8BuxQ0PGFsubvWrjZUnIKm0lcEo5y7co56XpNdTLRHLovMrCQsyIgsH7Te/bymdA3LBSdF0NsipcD1aQzsqb7f0pKLnbROjcvjN+3Rc7AthI4dUxlIQ/yBMSd9SiC7B2g0Bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564479641; 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=GxYWZQ4CHHr+u0cJLIxZL6Y1VC2M7n3g89do3mIQ+Vk=; b=Nqvtc9LFa5Ly603038RgtKFQaOQ9MNqKUpKIaWUsroiD3LpiFdY4U5bZwQ1+rEeJeVyx0HVVZ2lEVr5HvQypX3W9n1Tggb9c/Xh/NwT4ISpdgb2ksrW1CZrN4W7LMpOpk8Vi951fuwplAVtDiY5gVwLTNU/D+bMFqC/rYHM9HaI= 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 1564479641740547.1190548932672; Tue, 30 Jul 2019 02:40:41 -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 1hsObG-0008Mw-6e; Tue, 30 Jul 2019 09:39:18 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hsObE-0008Mf-IB for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 09:39:16 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id e53a5e87-b2ad-11e9-8980-bc764e045a96; Tue, 30 Jul 2019 09:39:15 +0000 (UTC) X-Inumbo-ID: e53a5e87-b2ad-11e9-8980-bc764e045a96 Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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 (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: fnLxQU7h7DPCKJLe2xqemlvUKlPZ33lBql4LkCz9qRdMmGuxQ1i9Ca/NHFavnA+M4/9Y7edwq1 NM+n6cvksO1mEMfLAwskWD7NRk6a62NpRIcS9N7ZKfTp7BsUxB8sNMJo8MFzEOHHdWZsm9yOjd UTU2lE/dvjJog9gUGkIul/t3jqYOdGUvURWJWGwLDI9YcXkYGRp2y1K11U5b9/TY+8Jpjn71Bi qzfErOiG4pfEvRrwJU2GkWF0LNw8qfbqoCrM/LeVvoDRjHBeMhHZDjhno0UeU6dF9p8vTWmRrP VRg= X-SBRS: 2.7 X-MesageID: 3748703 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3748703" From: Paul Durrant To: Date: Tue, 30 Jul 2019 10:39:03 +0100 Message-ID: <20190730093904.1794-5-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730093904.1794-1-paul.durrant@citrix.com> References: <20190730093904.1794-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 4/5] domain: remove the 'is_xenstore' flag 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: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Paul Durrant , Jan Beulich , Daniel De Graaf , =?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 patch introduces a convenience macro, is_xenstore_domain(), which tests the domain 'options' directly and then uses that in place of the 'is_xenstore' flag. Signed-off-by: Paul Durrant Reviewed-by: "Roger Pau Monn=C3=A9" Acked-by: George Dunlap --- Cc: Andrew Cooper Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu Cc: Daniel De Graaf v2: - Set 'disable_migrate' to true rather 1 --- xen/common/domain.c | 9 +++------ xen/common/domctl.c | 2 +- xen/include/xen/sched.h | 7 +++++-- xen/include/xsm/dummy.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 2df908285b..9b70626753 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -363,7 +363,7 @@ struct domain *domain_create(domid_t domid, if ( hardware_domid < 0 || hardware_domid >=3D DOMID_FIRST_RESERVE= D ) panic("The value of hardware_dom must be a valid domain ID\n"); =20 - d->disable_migrate =3D 1; + d->disable_migrate =3D true; old_hwdom =3D hardware_domain; hardware_domain =3D d; } @@ -442,11 +442,8 @@ struct domain *domain_create(domid_t domid, watchdog_domain_init(d); init_status |=3D INIT_watchdog; =20 - if ( d->options & XEN_DOMCTL_CDF_xs_domain ) - { - d->is_xenstore =3D 1; - d->disable_migrate =3D 1; - } + if ( is_xenstore_domain(d) ) + d->disable_migrate =3D true; =20 d->iomem_caps =3D rangeset_new(d, "I/O Memory", RANGESETF_prettypr= int_hex); d->irq_caps =3D rangeset_new(d, "Interrupts", 0); diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 3d937434af..6436f8b287 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -186,7 +186,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_= getdomaininfo *info) (d->is_shut_down ? XEN_DOMINF_shutdown : 0) | (d->controller_pause_count > 0 ? XEN_DOMINF_paused : 0) | (d->debugger_attached ? XEN_DOMINF_debugged : 0) | - (d->is_xenstore ? XEN_DOMINF_xs_domain : 0) | + (is_xenstore_domain(d) ? XEN_DOMINF_xs_domain : 0) | (is_hvm_domain(d) ? XEN_DOMINF_hvm_guest : 0) | d->shutdown_code << XEN_DOMINF_shutdownshift; =20 diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index e14540966f..5383ca4d1b 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -374,8 +374,6 @@ struct domain bool is_privileged; /* Can this guest access the Xen console? */ bool is_console; - /* Is this a xenstore domain (not dom0)? */ - bool is_xenstore; /* Non-migratable and non-restoreable? */ bool disable_migrate; /* Is this guest being debugged by dom0? */ @@ -977,6 +975,11 @@ static inline bool is_vcpu_online(const struct vcpu *v) return !test_bit(_VPF_down, &v->pause_flags); } =20 +static inline bool is_xenstore_domain(const struct domain *d) +{ + return d->options & XEN_DOMCTL_CDF_xs_domain; +} + extern bool sched_smt_power_savings; =20 extern enum cpufreq_controller { diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index ef52bb1764..b8e185e6fa 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -79,7 +79,7 @@ static always_inline int xsm_default_action( { return 0; case XSM_XS_PRIV: - if ( src->is_xenstore ) + if ( is_xenstore_domain(src) ) return 0; } /* fall through */ --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Wed May 1 03:34:23 2024 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=1564479623; cv=none; d=zoho.com; s=zohoarc; b=JXoQmqyQJAWyIzXkK5sVPhda2KY+sGvpF7Uuv7mhGiVc3QEC/+knjSkq6K86GTtE1AXJ0uk63VGGfX12pVTl9aBcmCmSJnwVwFe37Ahp+QXeXAZ3FDfQyMWvB/0cNMBigWt8H1geV6r7+lD/E5v/zIU2Hi9Q/1k61xMaCF9JwBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564479623; 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=Sqw76DFHu2p+7Rn8kmNlOIEoPiLlCgGHulbZFXlfrec=; b=RiUcj48r3kVSBVYs0fa89tz8EjRNhCj3H5M9UvCV5WgFBka2ztdEwCpRMLBaL+P+Yb/FiBXZOugxeuD1mysvN82uQFetXjaD3CSgNZav7iKoPPO5YVHXV/h97ED35+Hvs4hcxzIfAjpY0qk/7fCL4gJ7YlbqLwX8Z8cgynpYWoc= 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 1564479623444602.6873462415291; Tue, 30 Jul 2019 02:40:23 -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 1hsObH-0008NU-Ky; Tue, 30 Jul 2019 09:39:19 +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 1hsObG-0008N1-HD for xen-devel@lists.xenproject.org; Tue, 30 Jul 2019 09:39:18 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e537dbf2-b2ad-11e9-b6e1-5fb48bb40884; Tue, 30 Jul 2019 09:39:15 +0000 (UTC) X-Inumbo-ID: e537dbf2-b2ad-11e9-b6e1-5fb48bb40884 Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com 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 (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AnsnNj0yynucRqQAoHQlayD+IHCVFWtaDLhzRrdYunYTo0Vs2tSCBs3eOaL3wm0Du9/ib9Q17b T6FYkyWLnSpiYXEGkxXVNmRTkrgJBVzRZbhXXxuKzTnywWiCyOnMKMy+i3QZDhbmeohWRghrPo JZcxJYyRhsMawtt753VvAjjemtQoFIo8couR5mTl2G2lawx6z6JdkuYWbRhL7QPKvnaeaZtDQY q5UPn3l+t6u8Rxoo9LxNA6OdnwaqY3I+fv0H4KN/IDOBl9n9qeT9teeMpEOdlbqCOTpSHwXpc+ xDE= X-SBRS: 2.7 X-MesageID: 3748701 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,326,1559534400"; d="scan'208";a="3748701" From: Paul Durrant To: Date: Tue, 30 Jul 2019 10:39:04 +0100 Message-ID: <20190730093904.1794-6-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20190730093904.1794-1-paul.durrant@citrix.com> References: <20190730093904.1794-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 5/5] x86/domain: remove the 's3_integrity' flag 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 , Paul Durrant , 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" The flag is not needed since the domain 'options' can now be tested directly. Signed-off-by: Paul Durrant Reviewed-by: "Roger Pau Monn=C3=A9" Reviewed-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu v3: - Also sanitise the flag against CONFIG_TBOOT being set --- xen/arch/x86/domain.c | 9 +++++++-- xen/arch/x86/setup.c | 2 +- xen/arch/x86/tboot.c | 2 +- xen/include/asm-x86/domain.h | 2 -- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 0f43da3b6a..15ace7df70 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -466,6 +466,13 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } =20 + if ( (config->flags & XEN_DOMCTL_CDF_s3_integrity) && + !IS_ENABLED(TBOOT) ) + { + dprintk(XENLOG_INFO, "S3 integrity check not valid without CONFIG_= TBOOT\n"); + return -EINVAL; + } + return 0; } =20 @@ -544,8 +551,6 @@ int arch_domain_create(struct domain *d, d->domain_id); } =20 - d->arch.s3_integrity =3D config->flags & XEN_DOMCTL_CDF_s3_integrity; - emflags =3D config->arch.emulation_flags; =20 if ( is_hardware_domain(d) && is_pv_domain(d) ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d2011910fa..fdd1f2b489 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -689,7 +689,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) .stop_bits =3D 1 }; struct xen_domctl_createdomain dom0_cfg =3D { - .flags =3D XEN_DOMCTL_CDF_s3_integrity, + .flags =3D IS_ENABLED(TBOOT) ? XEN_DOMCTL_CDF_s3_integrity : 0, .max_evtchn_port =3D -1, .max_grant_frames =3D opt_max_grant_frames, .max_maptrack_frames =3D opt_max_maptrack_frames, diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index f3fdee4d39..3db8a8a8d8 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -212,7 +212,7 @@ static void tboot_gen_domain_integrity(const uint8_t ke= y[TB_KEY_SIZE], vmac_set_key((uint8_t *)key, &ctx); for_each_domain( d ) { - if ( !d->arch.s3_integrity ) + if ( !(d->options & XEN_DOMCTL_CDF_s3_integrity) ) continue; printk("MACing Domain %u\n", d->domain_id); =20 diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 5f9899469c..5c038a1065 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -295,8 +295,6 @@ struct arch_domain uint32_t pci_cf8; uint8_t cmos_idx; =20 - bool_t s3_integrity; - union { struct pv_domain pv; struct hvm_domain hvm; --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel