From patchwork Tue Jul 30 09:39:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11065395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6714C13AC for ; Tue, 30 Jul 2019 09:41:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52D0528613 for ; Tue, 30 Jul 2019 09:41:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44DEE286B5; Tue, 30 Jul 2019 09:41:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B46C228613 for ; Tue, 30 Jul 2019 09:41:08 +0000 (UTC) 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 X-Inumbo-ID: e3245610-b2ad-11e9-9fc5-a32546597094 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) 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 (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_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é" 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 = d; } - /* Sort out our idea of is_{pv,hvm}_domain(). All system domains are PV. */ - d->guest_type = ((d->options & XEN_DOMCTL_CDF_hvm_guest) - ? guest_type_hvm : guest_type_pv); - TRACE_1D(TRC_DOM0_DOM_ADD, d->domain_id); /* 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; - switch ( d->guest_type ) - { - case guest_type_hvm: - info->flags |= XEN_DOMINF_hvm_guest; - break; - default: - break; - } - xsm_security_domaininfo(d, info); info->tot_pages = 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 |= (1U << XENFEAT_ARM_SMCCC_supported); #endif #ifdef CONFIG_X86 - switch ( d->guest_type ) - { - case guest_type_pv: + if ( is_pv_domain(d) ) fi.submap |= (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 |= (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 struct evtchn_port_ops; -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; - enum guest_type guest_type; - /* Is this guest dying (i.e., a zombie)? */ enum { DOMDYING_alive, DOMDYING_dying, DOMDYING_dead } is_dying; @@ -918,8 +912,8 @@ void watchdog_domain_destroy(struct domain *d); static inline bool is_pv_domain(const struct domain *d) { - return IS_ENABLED(CONFIG_PV) - ? evaluate_nospec(d->guest_type == guest_type_pv) : false; + return IS_ENABLED(CONFIG_PV) && + evaluate_nospec(!(d->options & XEN_DOMCTL_CDF_hvm_guest)); } 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 == guest_type_hvm) : false; + return IS_ENABLED(CONFIG_HVM) && + evaluate_nospec(d->options & XEN_DOMCTL_CDF_hvm_guest); } static inline bool is_hvm_vcpu(const struct vcpu *v)