From patchwork Wed Dec 18 14:42:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11300889 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEB886C1 for ; Wed, 18 Dec 2019 14:43:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9DC121582 for ; Wed, 18 Dec 2019 14:43:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bTedDF85" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9DC121582 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihaXS-0004UB-L2; Wed, 18 Dec 2019 14:42:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ihaXR-0004Tt-QA for xen-devel@lists.xenproject.org; Wed, 18 Dec 2019 14:42:57 +0000 X-Inumbo-ID: a3d792fe-21a4-11ea-a914-bc764e2007e4 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a3d792fe-21a4-11ea-a914-bc764e2007e4; Wed, 18 Dec 2019 14:42:40 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id f129so2175879wmf.2 for ; Wed, 18 Dec 2019 06:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HzHXwmX1THqnPZ4zD46lRMhs898RczITxfDztH4aKiw=; b=bTedDF851cMfk++51N2+wcMHN33dmbBEh6BDhSdVAi7EQB6JL7wh8qbQZEU2NQB58x wMweboGXg85GmktYzjmLQI2Qesc/85xqEVs3S4XcxE4GfPJX4DuYVD+nQaXrtkuYkD/X vKXu1eknaK17y+14zhsBCi3PEjna1XOKTmjaUXe1XTPPb4EytiWUO3HLx4z45tuA3uOf TVGQG+rH+vttAtaqgFzbT/RO3B/zzeIVWJ05JNPS4f+Hn2/CCUtSEdYH1iZIZCN2mr+6 czczRuMcqWw31vaoPuNMSvKj7wT4eBbsDX/xpYRUvkLfzhojZRwvhtRAspycEoHwqZLh f6rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HzHXwmX1THqnPZ4zD46lRMhs898RczITxfDztH4aKiw=; b=HKo1CDxHeUsvi6Az/OEchcLKq2uzGF7vdR3qf5333xgNKYfCdqFB137T50HrsQYunw Q+iiz7eBOEJWp6NtHGkp5GRrFCNcwVYX9HlJPKROExY229DkqzS4MsmdvNs9MdTRd9gy 2ShlW4IPR31EmtCv2lGNGLkl34kYk5w5uAA+Oz4l1VdiCAiSzhfKUsRa3+d0yyx/B95m cFlym02Pu4r+JefmwVnCW+cZRG4bajvDBRu2pahQQ4G/xk+TwQeA+r9PIDr89MIm1l6P Vr2zJv7gqY6Di4x4PJQWNCdcqBbPSG2Fss4LIlqq4CwRT/mYfZt+JOZkfhCURgfz5Yri bKWg== X-Gm-Message-State: APjAAAWHonacbu4QwGW33rKsvkYsc48K2E24KCuX9VfL8MK/vA/SieXa Ltw92m7YRkN3hiQUaS8bxffETW4Z X-Google-Smtp-Source: APXvYqzEv+XZyl/Wz4WHVku7KNco41qRGT2Kf0kV8WFJcUyXKRCp9MldJ0q5bk3k7d8VZHw8Lcthmg== X-Received: by 2002:a1c:1bc3:: with SMTP id b186mr3698995wmb.79.1576680159046; Wed, 18 Dec 2019 06:42:39 -0800 (PST) Received: from debian.mshome.net (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id p17sm2724894wmk.30.2019.12.18.06.42.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 06:42:38 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Wed, 18 Dec 2019 14:42:30 +0000 Message-Id: <20191218144233.15372-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191218144233.15372-1-liuwe@microsoft.com> References: <20191218144233.15372-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 3/6] x86/viridian: drop private copy of definitions from synic.c 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 , Wei Liu , Paul Durrant , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Use hyperv-tlfs.h instead. No functional change intended. Signed-off-by: Wei Liu Reviewed-by: Paul Durrant --- xen/arch/x86/hvm/viridian/synic.c | 68 ++++++++----------------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c index 2791021bcc..54c62f843f 100644 --- a/xen/arch/x86/hvm/viridian/synic.c +++ b/xen/arch/x86/hvm/viridian/synic.c @@ -12,58 +12,22 @@ #include #include +#include #include #include #include "private.h" -typedef struct _HV_VIRTUAL_APIC_ASSIST -{ - uint32_t no_eoi:1; - uint32_t reserved_zero:31; -} HV_VIRTUAL_APIC_ASSIST; - -typedef union _HV_VP_ASSIST_PAGE -{ - HV_VIRTUAL_APIC_ASSIST ApicAssist; - uint8_t ReservedZBytePadding[PAGE_SIZE]; -} HV_VP_ASSIST_PAGE; - -typedef enum HV_MESSAGE_TYPE { - HvMessageTypeNone, - HvMessageTimerExpired = 0x80000010, -} HV_MESSAGE_TYPE; - -typedef struct HV_MESSAGE_FLAGS { - uint8_t MessagePending:1; - uint8_t Reserved:7; -} HV_MESSAGE_FLAGS; - -typedef struct HV_MESSAGE_HEADER { - HV_MESSAGE_TYPE MessageType; - uint16_t Reserved1; - HV_MESSAGE_FLAGS MessageFlags; - uint8_t PayloadSize; - uint64_t Reserved2; -} HV_MESSAGE_HEADER; - -#define HV_MESSAGE_SIZE 256 -#define HV_MESSAGE_MAX_PAYLOAD_QWORD_COUNT 30 - -typedef struct HV_MESSAGE { - HV_MESSAGE_HEADER Header; - uint64_t Payload[HV_MESSAGE_MAX_PAYLOAD_QWORD_COUNT]; -} HV_MESSAGE; void __init __maybe_unused build_assertions(void) { - BUILD_BUG_ON(sizeof(HV_MESSAGE) != HV_MESSAGE_SIZE); + BUILD_BUG_ON(sizeof(struct hv_message) != HV_MESSAGE_SIZE); } void viridian_apic_assist_set(const struct vcpu *v) { struct viridian_vcpu *vv = v->arch.hvm.viridian; - HV_VP_ASSIST_PAGE *ptr = vv->vp_assist.ptr; + struct hv_vp_assist_page *ptr = vv->vp_assist.ptr; if ( !ptr ) return; @@ -77,18 +41,18 @@ void viridian_apic_assist_set(const struct vcpu *v) domain_crash(v->domain); vv->apic_assist_pending = true; - ptr->ApicAssist.no_eoi = 1; + ptr->apic_assist = 1; } bool viridian_apic_assist_completed(const struct vcpu *v) { struct viridian_vcpu *vv = v->arch.hvm.viridian; - HV_VP_ASSIST_PAGE *ptr = vv->vp_assist.ptr; + struct hv_vp_assist_page *ptr = vv->vp_assist.ptr; if ( !ptr ) return false; - if ( vv->apic_assist_pending && !ptr->ApicAssist.no_eoi ) + if ( vv->apic_assist_pending && !ptr->apic_assist ) { /* An EOI has been avoided */ vv->apic_assist_pending = false; @@ -101,12 +65,12 @@ bool viridian_apic_assist_completed(const struct vcpu *v) void viridian_apic_assist_clear(const struct vcpu *v) { struct viridian_vcpu *vv = v->arch.hvm.viridian; - HV_VP_ASSIST_PAGE *ptr = vv->vp_assist.ptr; + struct hv_vp_assist_page *ptr = vv->vp_assist.ptr; if ( !ptr ) return; - ptr->ApicAssist.no_eoi = 0; + ptr->apic_assist = 0; vv->apic_assist_pending = false; } @@ -358,7 +322,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx, { struct viridian_vcpu *vv = v->arch.hvm.viridian; const union viridian_sint_msr *vs = &vv->sint[sintx]; - HV_MESSAGE *msg = vv->simp.ptr; + struct hv_message *msg = vv->simp.ptr; struct { uint32_t TimerIndex; uint32_t Reserved; @@ -382,19 +346,19 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, unsigned int sintx, msg += sintx; - if ( msg->Header.MessageType != HvMessageTypeNone ) + if ( msg->header.message_type != HVMSG_NONE ) { - msg->Header.MessageFlags.MessagePending = 1; + msg->header.message_flags.msg_pending = 1; __set_bit(sintx, &vv->msg_pending); return false; } - msg->Header.MessageType = HvMessageTimerExpired; - msg->Header.MessageFlags.MessagePending = 0; - msg->Header.PayloadSize = sizeof(payload); + msg->header.message_type = HVMSG_TIMER_EXPIRED; + msg->header.message_flags.msg_pending = 0; + msg->header.payload_size = sizeof(payload); - BUILD_BUG_ON(sizeof(payload) > sizeof(msg->Payload)); - memcpy(msg->Payload, &payload, sizeof(payload)); + BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload)); + memcpy(msg->u.payload, &payload, sizeof(payload)); if ( !vs->mask ) vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0);