From patchwork Mon Mar 18 11:20:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 10857407 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 7DAD91708 for ; Mon, 18 Mar 2019 11:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6238E2937E for ; Mon, 18 Mar 2019 11:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5672D29380; Mon, 18 Mar 2019 11:23:15 +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 C2E4E2937E for ; Mon, 18 Mar 2019 11:23:14 +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 1h5qKM-0004G5-El; Mon, 18 Mar 2019 11:21:10 +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 1h5qKK-0004FL-QS for xen-devel@lists.xenproject.org; Mon, 18 Mar 2019 11:21:08 +0000 X-Inumbo-ID: ec1e74aa-496f-11e9-bbf8-135e942494ef Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ec1e74aa-496f-11e9-bbf8-135e942494ef; Mon, 18 Mar 2019 11:21:06 +0000 (UTC) IronPort-Data: A9a23:6W+wdK1ay3EhzdQ/qPbDix16xWK7qk9dZSB6A8VEDSB0RE9Odbcrpx KurzSVy6cG28CNQrZC0tmqA8YeK8IiABxOslxLRWRNh/vHDTueqv/g41JfkmkfiBsCCVYHMj gImn57YCY+oDP7KPvoUomZdHFQH/Bx0shTUd9iV1p2SEObcQzrtQ/HJMq9f5H9WEZNsrFOQu +rUjaTwTNS/E7qAxGVvhEhM0VBJ7gkjhP8hYcz+MbVig4NtyDjxeMu668NxBngIOQsmTwE1t RxCWsjYeLIjbCnZnxyjetgWYjmftJbcOqWYJr6GzXX2UVF65vz8iy7QOW6qm7SRgfDfnFgbT KbTohYrRfYrARV5oxglEwD5h+GT/O85Dhx6XCG0gRcPhccnOZPWaU+4cwsXytpI0rsQJ25wR vx9Y80fCp2UxRIH1nVdIVJL1MfzlG/6s2+vRXrISOKO3Cu2mX1dZkgR3nBlLJYl/yU7b3uUf 7nDu8dYEFe0d4Y+XykK8wKXC0f2j885HfRuXq3H4GMyLOA4XKw341/vXkq08C9kV0IISQ+AL ZNLEydBhzxznr98R7FyzEPc4aq9B4gEw7g23gEEFLrBeZUVZtU6KmiABHvKvvZ3kGAPb6bQG EdpoGXyWM+GjPIljpngm5XDpu6mixvlcbFrb5R7tWCAVxBk5Vvt+G3IqMQgwgftjMOJB4gCr uDTvPc0lGkcP7vtfdJglpHr37JsWtwbFjEE4ZjcqaQfBo5CNF9jxPJUUp6jY6CbNbuzWBElp YzGZOblyqYAlDCAybMX6NCmOQanVOcWxSGickgKFovzdY/F10MoJIzT73lcVdHWyKc8VWi+G 7UHn0fYniRFJzM7QO0IaYJjZeszraESWIZghSPhPOaM2SXwfgPXlmbcUNXwGq0i4xDHJoXgH GvPwQ1O5z85rajXMwmUcHVtQMT7KA3aqlY/EamnDVaHqE6ABecuGZJncnchekFW4OV/zvAsn sMqxjotgCCl25lOZr4E8zeu17vfgW2Vrmagni0q4wAjTJbNoD0898SyVz6mn+Rc5i4DSNZW4 H0fA7UO2RdOVpHndQcn/LTpYd7pX+qbIRcyUQ2HX5jLwfBfd3WzKJRWJrimntsDpjS/nSnmG EJpDdPwtL078oPRuA0IehMoUWhb3sPhvbqfGR7yfEX9PAwtR4SsOXNb8232vue0f6Y00lIin c4D0cHw/UoHqd8nLQ6bPF62LPJLYhEuM+AsLGKaCNTKz0FIZGv9YrPqTQdedoHrNWSIKVoDl QKCWNO4GQU2wVKfcD+DziEWLJZSV2dNU8FllxM77nOXNFlZm6ZW648RsguKwkjItQ2XngC8D gSKdAtPU9B7A96E2fxohFtefIOcVTqrV0BjpD/eXmk3///mOXGpJ120gXj6ksYOAFlVBnVYN RIQa5Jl8IuG5d8K6H8ZC5qmvLPc6x92CsxOi3jnPFs55tqPXsPgeEPYBU0wMrSXbUuK2xksv VGTE0k0qppYGpy5/YOX5o6mhAWtWR+zDbFdy8idi/sTEShr1puZkbbIIg4fBQX96HhDf4XMV 120JFglsOIVHet9TDjD+iDkG/36/mVwF0+beWco7KoSKH1anL67YKgvSiMFiQF5cYopHldFf zk0aYx4a5BXFlWxQKvqs+CCv+7Z6oCH7OZu8cneUePbCUScOlBWhuH58ku/J9TJpRbJjQsIN SJ6Pr98F817xzpSxR8deZhjc+8c4n9cIruTAPimzVaR/m6JtmNSar05b4DfkaZZDFv1Qsf4h N0hwvTZlPBDgx473Ik2keNFIsoOVVok+o3HC0t9Lu/vY5SStYyuovODQI= X-IronPort-AV: E=Sophos;i="5.58,493,1544486400"; d="scan'208";a="80850935" From: Paul Durrant To: Date: Mon, 18 Mar 2019 11:20:52 +0000 Message-ID: <20190318112059.21910-5-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190318112059.21910-1-paul.durrant@citrix.com> References: <20190318112059.21910-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v8 04/11] viridian: make 'fields' struct anonymous... 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_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP ...inside viridian_page_msr and viridian_guest_os_id_msr unions. There's no need to name it and the code is shortened by not doing so. No functional change. Signed-off-by: Paul Durrant Reviewed-by: Jan Beulich --- Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monné" v4: - New in v4 --- xen/arch/x86/hvm/viridian/synic.c | 4 ++-- xen/arch/x86/hvm/viridian/time.c | 10 +++++----- xen/arch/x86/hvm/viridian/viridian.c | 20 +++++++++----------- xen/include/asm-x86/hvm/viridian.h | 4 ++-- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c index f3d9f7ae74..05d971b365 100644 --- a/xen/arch/x86/hvm/viridian/synic.c +++ b/xen/arch/x86/hvm/viridian/synic.c @@ -102,7 +102,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val) viridian_unmap_guest_page(&vv->vp_assist); vv->vp_assist.msr.raw = val; viridian_dump_guest_page(v, "VP_ASSIST", &vv->vp_assist); - if ( vv->vp_assist.msr.fields.enabled ) + if ( vv->vp_assist.msr.enabled ) viridian_map_guest_page(v, &vv->vp_assist); break; @@ -161,7 +161,7 @@ void viridian_synic_load_vcpu_ctxt( struct viridian_vcpu *vv = v->arch.hvm.viridian; vv->vp_assist.msr.raw = ctxt->vp_assist_msr; - if ( vv->vp_assist.msr.fields.enabled ) + if ( vv->vp_assist.msr.enabled ) viridian_map_guest_page(v, &vv->vp_assist); vv->apic_assist_pending = ctxt->apic_assist_pending; diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c index 76f9612001..909a3fb9e3 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -29,16 +29,16 @@ static void dump_reference_tsc(const struct domain *d) { const union viridian_page_msr *rt = &d->arch.hvm.viridian->reference_tsc; - if ( !rt->fields.enabled ) + if ( !rt->enabled ) return; printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: pfn: %lx\n", - d->domain_id, (unsigned long)rt->fields.pfn); + d->domain_id, (unsigned long)rt->pfn); } static void update_reference_tsc(struct domain *d, bool initialize) { - unsigned long gmfn = d->arch.hvm.viridian->reference_tsc.fields.pfn; + unsigned long gmfn = d->arch.hvm.viridian->reference_tsc.pfn; struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC); HV_REFERENCE_TSC_PAGE *p; @@ -151,7 +151,7 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val) vd->reference_tsc.raw = val; dump_reference_tsc(d); - if ( vd->reference_tsc.fields.enabled ) + if ( vd->reference_tsc.enabled ) update_reference_tsc(d, true); break; @@ -232,7 +232,7 @@ void viridian_time_load_domain_ctxt( vd->time_ref_count.val = ctxt->time_ref_count; vd->reference_tsc.raw = ctxt->reference_tsc; - if ( vd->reference_tsc.fields.enabled ) + if ( vd->reference_tsc.enabled ) update_reference_tsc(d, false); } diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c index 710470fed7..1a20d68aaf 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -192,7 +192,7 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf, case 4: /* Recommended hypercall usage. */ - if ( vd->guest_os_id.raw == 0 || vd->guest_os_id.fields.os < 4 ) + if ( vd->guest_os_id.raw == 0 || vd->guest_os_id.os < 4 ) break; res->a = CPUID4A_RELAX_TIMER_INT; if ( viridian_feature_mask(d) & HVMPV_hcall_remote_tlb_flush ) @@ -228,10 +228,8 @@ static void dump_guest_os_id(const struct domain *d) printk(XENLOG_G_INFO "d%d: VIRIDIAN GUEST_OS_ID: vendor: %x os: %x major: %x minor: %x sp: %x build: %x\n", - d->domain_id, - goi->fields.vendor, goi->fields.os, - goi->fields.major, goi->fields.minor, - goi->fields.service_pack, goi->fields.build_number); + d->domain_id, goi->vendor, goi->os, goi->major, goi->minor, + goi->service_pack, goi->build_number); } static void dump_hypercall(const struct domain *d) @@ -242,12 +240,12 @@ static void dump_hypercall(const struct domain *d) printk(XENLOG_G_INFO "d%d: VIRIDIAN HYPERCALL: enabled: %x pfn: %lx\n", d->domain_id, - hg->fields.enabled, (unsigned long)hg->fields.pfn); + hg->enabled, (unsigned long)hg->pfn); } static void enable_hypercall_page(struct domain *d) { - unsigned long gmfn = d->arch.hvm.viridian->hypercall_gpa.fields.pfn; + unsigned long gmfn = d->arch.hvm.viridian->hypercall_gpa.pfn; struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC); uint8_t *p; @@ -297,7 +295,7 @@ int guest_wrmsr_viridian(struct vcpu *v, uint32_t idx, uint64_t val) case HV_X64_MSR_HYPERCALL: vd->hypercall_gpa.raw = val; dump_hypercall(d); - if ( vd->hypercall_gpa.fields.enabled ) + if ( vd->hypercall_gpa.enabled ) enable_hypercall_page(d); break; @@ -606,17 +604,17 @@ out: void viridian_dump_guest_page(const struct vcpu *v, const char *name, const struct viridian_page *vp) { - if ( !vp->msr.fields.enabled ) + if ( !vp->msr.enabled ) return; printk(XENLOG_G_INFO "%pv: VIRIDIAN %s: pfn: %lx\n", - v, name, (unsigned long)vp->msr.fields.pfn); + v, name, (unsigned long)vp->msr.pfn); } void viridian_map_guest_page(const struct vcpu *v, struct viridian_page *vp) { struct domain *d = v->domain; - unsigned long gmfn = vp->msr.fields.pfn; + unsigned long gmfn = vp->msr.pfn; struct page_info *page; if ( vp->ptr ) diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/viridian.h index c562424332..abbbb36092 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -17,7 +17,7 @@ union viridian_page_msr uint64_t enabled:1; uint64_t reserved_preserved:11; uint64_t pfn:48; - } fields; + }; }; struct viridian_page @@ -44,7 +44,7 @@ union viridian_guest_os_id_msr uint64_t major:8; uint64_t os:8; uint64_t vendor:16; - } fields; + }; }; struct viridian_time_ref_count