From patchwork Fri Sep 21 08:20:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10609333 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 37CBD1390 for ; Fri, 21 Sep 2018 08:45:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27CB02DDA3 for ; Fri, 21 Sep 2018 08:45:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B35E2DDAA; Fri, 21 Sep 2018 08:45:27 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E4FE2DDA3 for ; Fri, 21 Sep 2018 08:45:26 +0000 (UTC) Received: from localhost ([::1]:54524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3H41-0004SG-5d for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 04:45:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3GgM-0005Hz-VO for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3GgK-0006Fw-KC for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:20:58 -0400 Received: from mail-am5eur02on0705.outbound.protection.outlook.com ([2a01:111:f400:fe07::705]:42144 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g3GgK-0005vY-9J for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:20:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VAcPmYlbIui+mP7lMdC0Xv9ICmBIO9uBWk3PosVSB3c=; b=HzJkSAKUPIEfIRVDBAaAWRT2M/B3xZ4J1NYgsGCdVFkYciQmbsUV+N8I7prGaRlW4kcPjmeYhGxZT62V0EerTTdRa8Wk5buBDxBlK6l6VM4JNGYDh9VcAVlhyvkMj0QL54JT0NclAySPZtOQTx3OFwbNCAlJm1z34L51jKEHuLI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:e1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 08:20:50 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:20:37 +0300 Message-Id: <20180921082041.29380-2-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921082041.29380-1-rkagan@virtuozzo.com> References: <20180921082041.29380-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P18901CA0005.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::15) To AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:e1::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c60dd376-7ea2-4173-6589-08d61f9b24b6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3585; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 3:kBiKSQPO2eCLL0yTNJrxzsRUo4lhVcYvoSUllgH6/tJJwircSjKnBJCKQkzMqSuq6Zuv///zEFr9kFR0/vRj7UmdBMDFVjNF3TBWQhaEXFF8KtSc94EDNrNnCPvDFVQajLDJcuFOJ2BPT4N9mXfvZr+7+nKqyCY8ybhu7FuSgyMpPxB7Dox84G+QfbjIWVbpdnrmFPsBueSLymhoqOOq+tTGvOFnB2myMe+IMX9EhJ7hhqczGwG/sBTS/xcFQML0; 25:y7DO8fbTsU6MHt9wyFi3ozABtPFbXqR30i24uJDFo1wmtC5PXJtZoOzSLR194+FS0OPm2/n2Yd5nRBxcGf60FLhuSlgOc7cVH7CJ80RBQUnAfKLzf0MDeLcLfO2C3dV/r8JqdDP1dIztI18nopj4gwjuCgQect90EID3WvfpERkGcKoJFyz28E7MjtT0p7BLrlv4pBKYdzfm4NaGqXQuIUhLfpRcNHafLotGk6nLKUftEWcFzxLzKJTavT2U0vQ89wxkHtJBa5FDepjnYRElVJZ3+eiu66JyN2+dOa5shRqpfiZgVjVtSY3aWHMp55Rp4qAZfwWvleeJ1TbEB0OocQ==; 31:/MEvbkTS0akFDd/e06yGm+KzHyrB2yZ6U/MWkKMr8477A5auiCdUBgGe4lh2cV5yamPHLl4qx9LKgKDfVJz0k8yotpEYFIhmS/j3V94r+GUalJx0BFX8Zx8+10W4VyVElv9M1IIgi/UXc9pgmGZYfsH5N9xcIYwfZrDtkO3NkGdze64FPula89apd7KiePTufmD/IFVibrcaYDLPNHvmEOd2atHfoYlEQ7G1Xz7RfMU= X-MS-TrafficTypeDiagnostic: AM0PR08MB3585: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 20:lQ8Ro5z4ImEu7T3QaBPQvjW4uice6x9hdaSQeeCfcBnvoS9YpoE8KfyC8srwmueQ4hmvxwDCEoQTsrGUwcRT3HCXvQWMIzJ6d+RkR6ygNqp0Vch/ZmeA8m7eydcMihKtxN79QD7M607YGng/56EUaCjQPASbgrQ+3fwko1t7kUaeRbsFiOmaSzjoz2fjtwHOvnwuQbfj1RrDB3vCYQSwQhts0EfkFJhZqqwCBUtXVsmxGAJJZExEZRhjTE9sbfgMLsLX+D9QCjaTS+MPzkYXB9Aw7SDfc7nZKftTrOmLSQESICwLOdTPgn7zbMrIaubW1EOBp0isD17+B1+xBg/LhMhlM5B2tzxwWwXhww4UGHM0T1/o1Xfnzrb1AfDd86gE+0nglodg6PYII/jdiGghB49pX/HhpLIpExCdz+UNnLFYlmvLKdPKD9LnU4G+MO5Ks673fTYIlxzOozBTg7iGPsCDqrgrZ9RhpJW/tJ+RjxzRG0Q/2s0FGeZAu/WnKkB/; 4:9HTm0mnjpsS+RfecgVrjkUlYsB4sqbdXXLnCUtqewgCua1w1iRuhaq8i+saXrvJdiPqBF7s/JuzvZfA27ppvkfq/DlmIcODRRMmcWBWRtyP/R6L0yuJNgbZ/wDXi+cVBObIh68gpK+JTFfppL5ePh2bZHtqTWkU8ZF9OO9LoenZuP2wXoIVur95P3pwNeDWY9yKB3ras22Y6yhi0yXpDLwp8jRxzUUWlzHmpFxfC5HLspGoVBV4loRr7SmCfR94ZSnKTddI4ZgzjFkDtMiFXdA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699051); SRVR:AM0PR08MB3585; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3585; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(366004)(396003)(136003)(39850400004)(189003)(199004)(86362001)(6666003)(4326008)(2906002)(16586007)(7736002)(305945005)(50466002)(50226002)(16526019)(52116002)(51416003)(478600001)(6506007)(956004)(2616005)(8676002)(186003)(476003)(6916009)(54906003)(3846002)(48376002)(25786009)(6116002)(26005)(2351001)(386003)(316002)(47776003)(14444005)(53936002)(5660300001)(36756003)(7416002)(105586002)(11346002)(66066001)(446003)(486006)(1076002)(6512007)(6486002)(68736007)(53416004)(81166006)(2361001)(97736004)(76176011)(8936002)(106356001)(81156014)(69596002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3585; H:rkaganb.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3585; 23:2ciHSmdJR0r4zvPHMdyRUzck0Epmy4IimM26oCxuq?= /fk9caOMIkTRk/62/mxyXP+WhkoICDHb8ZmMUuQYJg/YRKprOWH6gh/pVfYZYk88VOs15Z23RHpouwB4s7bmjI83PrYcfd49jLI84SNdUUldcMdgHOtqXlbYo7GlVikBj0V1eIJFjBWFBsspMU9LQPSAwA2HCPO1GCZt9+PuwXp16FJG5uesOmIGSAmhYSl2QaJdcq5cOhniHVOYMs9xbz7420PvyAeuXHLQJWO93M1ow+f0z2L5sH6k6hO6J8izUIFkos/3uaTwX5DMR5mdYDmS0EVkW2EMyIqbzGcInP9zUfpzrxk0GGvOK2hlFMU+xoODb3Mxl/il3sCpgSRbX5cUH9NHZCuMAZGg1v4imqHeei/jjP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K2FdRyg20LIq/FwISliPA9dhry2H40M2WY/H9BGDGwNQBOerjWrtLVDc7Fgrhq8LUxYmg3yPzVH9Ty+kmpT6ADYRwh9ElXSKgcNCTa5CMgcltug4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 20:CZpbxxDGxs9qlkspew5EfaIlSRDuuGJz00veIGh5RKMVKFm4kwFT8pzVdO3eS3e+dC80EMDcfwnPcTHexREidT8UNck2Av7JTzCHYxUoZJePpZnZGX8uwbmwG4jzZ43qqgS9RvQFJoeeaLw5JQ0342EbhxH1Uimy4dduLX5YagM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:20:50.4951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c60dd376-7ea2-4173-6589-08d61f9b24b6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3585 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::705 Subject: [Qemu-devel] [PATCH 1/5] hyperv: split hyperv-proto.h into x86 and arch-independent parts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vijayabhaskar Balakrishna , Eduardo Habkost , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Igor Mammedov , Boris Ostrovsky , Karl Heubaum Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some parts of the Hyper-V hypervisor-guest interface appear to be target-independent, so move them into a proper header. Not that Hyper-V ARM64 emulation is around the corner but it seems more conveninent to have most of Hyper-V and VMBus target-independent, and allows to avoid conflicts with inclusion of arch-specific headers down the road in VMBus implementation. Signed-off-by: Roman Kagan --- include/hw/hyperv/hyperv-proto.h | 129 +++++++++++++++++++++++++++++++ target/i386/hyperv-proto.h | 115 +-------------------------- 2 files changed, 132 insertions(+), 112 deletions(-) create mode 100644 include/hw/hyperv/hyperv-proto.h diff --git a/include/hw/hyperv/hyperv-proto.h b/include/hw/hyperv/hyperv-proto.h new file mode 100644 index 0000000000..2dc78eeafb --- /dev/null +++ b/include/hw/hyperv/hyperv-proto.h @@ -0,0 +1,129 @@ +/* + * Definitions for Hyper-V guest/hypervisor interaction + * + * Copyright (c) 2017-2018 Virtuozzo International GmbH. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef HW_HYPERV_HYPERV_PROTO_H +#define HW_HYPERV_HYPERV_PROTO_H + +#include "qemu/bitmap.h" + +/* + * Hypercall status code + */ +#define HV_STATUS_SUCCESS 0 +#define HV_STATUS_INVALID_HYPERCALL_CODE 2 +#define HV_STATUS_INVALID_HYPERCALL_INPUT 3 +#define HV_STATUS_INVALID_ALIGNMENT 4 +#define HV_STATUS_INVALID_PARAMETER 5 +#define HV_STATUS_INSUFFICIENT_MEMORY 11 +#define HV_STATUS_INVALID_CONNECTION_ID 18 +#define HV_STATUS_INSUFFICIENT_BUFFERS 19 + +/* + * Hypercall numbers + */ +#define HV_POST_MESSAGE 0x005c +#define HV_SIGNAL_EVENT 0x005d +#define HV_HYPERCALL_FAST (1u << 16) + +/* + * Message size + */ +#define HV_MESSAGE_PAYLOAD_SIZE 240 + +/* + * Message types + */ +#define HV_MESSAGE_NONE 0x00000000 +#define HV_MESSAGE_VMBUS 0x00000001 +#define HV_MESSAGE_UNMAPPED_GPA 0x80000000 +#define HV_MESSAGE_GPA_INTERCEPT 0x80000001 +#define HV_MESSAGE_TIMER_EXPIRED 0x80000010 +#define HV_MESSAGE_INVALID_VP_REGISTER_VALUE 0x80000020 +#define HV_MESSAGE_UNRECOVERABLE_EXCEPTION 0x80000021 +#define HV_MESSAGE_UNSUPPORTED_FEATURE 0x80000022 +#define HV_MESSAGE_EVENTLOG_BUFFERCOMPLETE 0x80000040 +#define HV_MESSAGE_X64_IOPORT_INTERCEPT 0x80010000 +#define HV_MESSAGE_X64_MSR_INTERCEPT 0x80010001 +#define HV_MESSAGE_X64_CPUID_INTERCEPT 0x80010002 +#define HV_MESSAGE_X64_EXCEPTION_INTERCEPT 0x80010003 +#define HV_MESSAGE_X64_APIC_EOI 0x80010004 +#define HV_MESSAGE_X64_LEGACY_FP_ERROR 0x80010005 + +/* + * Message flags + */ +#define HV_MESSAGE_FLAG_PENDING 0x1 + +/* + * Number of synthetic interrupts + */ +#define HV_SINT_COUNT 16 + +/* + * Event flags number per SINT + */ +#define HV_EVENT_FLAGS_COUNT (256 * 8) + +/* + * Connection id valid bits + */ +#define HV_CONNECTION_ID_MASK 0x00ffffff + +/* + * Input structure for POST_MESSAGE hypercall + */ +struct hyperv_post_message_input { + uint32_t connection_id; + uint32_t _reserved; + uint32_t message_type; + uint32_t payload_size; + uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE]; +}; + +/* + * Input structure for SIGNAL_EVENT hypercall + */ +struct hyperv_signal_event_input { + uint32_t connection_id; + uint16_t flag_number; + uint16_t _reserved_zero; +}; + +/* + * SynIC message structures + */ +struct hyperv_message_header { + uint32_t message_type; + uint8_t payload_size; + uint8_t message_flags; /* HV_MESSAGE_FLAG_XX */ + uint8_t _reserved[2]; + uint64_t sender; +}; + +struct hyperv_message { + struct hyperv_message_header header; + uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE]; +}; + +struct hyperv_message_page { + struct hyperv_message slot[HV_SINT_COUNT]; +}; + +/* + * SynIC event flags structures + */ +struct hyperv_event_flags { + DECLARE_BITMAP(flags, HV_EVENT_FLAGS_COUNT); +}; + +struct hyperv_event_flags_page { + struct hyperv_event_flags slot[HV_SINT_COUNT]; +}; + +#endif diff --git a/target/i386/hyperv-proto.h b/target/i386/hyperv-proto.h index d6d5a79293..e204ca93ee 100644 --- a/target/i386/hyperv-proto.h +++ b/target/i386/hyperv-proto.h @@ -1,7 +1,7 @@ /* - * Definitions for Hyper-V guest/hypervisor interaction + * Definitions for Hyper-V guest/hypervisor interaction - x86-specific part * - * Copyright (C) 2017 Parallels International GmbH + * Copyright (c) 2017-2018 Virtuozzo International GmbH. * * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. @@ -10,7 +10,7 @@ #ifndef TARGET_I386_HYPERV_PROTO_H #define TARGET_I386_HYPERV_PROTO_H -#include "qemu/bitmap.h" +#include "hw/hyperv/hyperv-proto.h" #define HV_CPUID_VENDOR_AND_MAX_FUNCTIONS 0x40000000 #define HV_CPUID_INTERFACE 0x40000001 @@ -137,25 +137,6 @@ #define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107 #define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108 -/* - * Hypercall status code - */ -#define HV_STATUS_SUCCESS 0 -#define HV_STATUS_INVALID_HYPERCALL_CODE 2 -#define HV_STATUS_INVALID_HYPERCALL_INPUT 3 -#define HV_STATUS_INVALID_ALIGNMENT 4 -#define HV_STATUS_INVALID_PARAMETER 5 -#define HV_STATUS_INSUFFICIENT_MEMORY 11 -#define HV_STATUS_INVALID_CONNECTION_ID 18 -#define HV_STATUS_INSUFFICIENT_BUFFERS 19 - -/* - * Hypercall numbers - */ -#define HV_POST_MESSAGE 0x005c -#define HV_SIGNAL_EVENT 0x005d -#define HV_HYPERCALL_FAST (1u << 16) - /* * Hypercall MSR bits */ @@ -165,7 +146,6 @@ * Synthetic interrupt controller definitions */ #define HV_SYNIC_VERSION 1 -#define HV_SINT_COUNT 16 #define HV_SYNIC_ENABLE (1u << 0) #define HV_SIMP_ENABLE (1u << 0) #define HV_SIEFP_ENABLE (1u << 0) @@ -175,94 +155,5 @@ #define HV_STIMER_COUNT 4 -/* - * Message size - */ -#define HV_MESSAGE_PAYLOAD_SIZE 240 - -/* - * Message types - */ -#define HV_MESSAGE_NONE 0x00000000 -#define HV_MESSAGE_VMBUS 0x00000001 -#define HV_MESSAGE_UNMAPPED_GPA 0x80000000 -#define HV_MESSAGE_GPA_INTERCEPT 0x80000001 -#define HV_MESSAGE_TIMER_EXPIRED 0x80000010 -#define HV_MESSAGE_INVALID_VP_REGISTER_VALUE 0x80000020 -#define HV_MESSAGE_UNRECOVERABLE_EXCEPTION 0x80000021 -#define HV_MESSAGE_UNSUPPORTED_FEATURE 0x80000022 -#define HV_MESSAGE_EVENTLOG_BUFFERCOMPLETE 0x80000040 -#define HV_MESSAGE_X64_IOPORT_INTERCEPT 0x80010000 -#define HV_MESSAGE_X64_MSR_INTERCEPT 0x80010001 -#define HV_MESSAGE_X64_CPUID_INTERCEPT 0x80010002 -#define HV_MESSAGE_X64_EXCEPTION_INTERCEPT 0x80010003 -#define HV_MESSAGE_X64_APIC_EOI 0x80010004 -#define HV_MESSAGE_X64_LEGACY_FP_ERROR 0x80010005 - -/* - * Message flags - */ -#define HV_MESSAGE_FLAG_PENDING 0x1 - -/* - * Event flags number per SINT - */ -#define HV_EVENT_FLAGS_COUNT (256 * 8) - -/* - * Connection id valid bits - */ -#define HV_CONNECTION_ID_MASK 0x00ffffff - -/* - * Input structure for POST_MESSAGE hypercall - */ -struct hyperv_post_message_input { - uint32_t connection_id; - uint32_t _reserved; - uint32_t message_type; - uint32_t payload_size; - uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE]; -}; - -/* - * Input structure for SIGNAL_EVENT hypercall - */ -struct hyperv_signal_event_input { - uint32_t connection_id; - uint16_t flag_number; - uint16_t _reserved_zero; -}; - -/* - * SynIC message structures - */ -struct hyperv_message_header { - uint32_t message_type; - uint8_t payload_size; - uint8_t message_flags; /* HV_MESSAGE_FLAG_XX */ - uint8_t _reserved[2]; - uint64_t sender; -}; - -struct hyperv_message { - struct hyperv_message_header header; - uint8_t payload[HV_MESSAGE_PAYLOAD_SIZE]; -}; - -struct hyperv_message_page { - struct hyperv_message slot[HV_SINT_COUNT]; -}; - -/* - * SynIC event flags structures - */ -struct hyperv_event_flags { - DECLARE_BITMAP(flags, HV_EVENT_FLAGS_COUNT); -}; - -struct hyperv_event_flags_page { - struct hyperv_event_flags slot[HV_SINT_COUNT]; -}; #endif