From patchwork Tue Feb 6 20:30: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: 10204079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 850FF601A1 for ; Tue, 6 Feb 2018 20:53:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A97228BB1 for ; Tue, 6 Feb 2018 20:53:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E93228C8F; Tue, 6 Feb 2018 20:53:29 +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=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 AC83C28BB1 for ; Tue, 6 Feb 2018 20:53:28 +0000 (UTC) Received: from localhost ([::1]:60711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejAF5-0006au-Pw for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Feb 2018 15:53:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej9uD-0001D1-Vn for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej9uA-0003J1-MR for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:54 -0500 Received: from mail-eopbgr00125.outbound.protection.outlook.com ([40.107.0.125]:6512 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 1ej9uA-0003Ia-Cj for qemu-devel@nongnu.org; Tue, 06 Feb 2018 15:31:50 -0500 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; bh=10wR7YKcZ+e56JyADh7bx9WStDVikRQe3+6IJhZck4g=; b=EjJRnrbKd47iHXnB3/f7401gULapTc+pFxig3gcRXqcoyBR2q+oXVf9TwUilAaqrtNHPWCVlJ6+afY9xAhsM37PIjuFG/UkLzm7T5TTZCCSNAIOLK19hoiC+aFsP3xBJYeVJzCv0FeaGA1iEv6d+mqmfv+ZIQ0PEpM0XAzyxeso= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (195.214.232.6) by VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Tue, 6 Feb 2018 20:31:46 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Tue, 6 Feb 2018 23:30:37 +0300 Message-Id: <20180206203048.11096-24-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206203048.11096-1-rkagan@virtuozzo.com> References: <20180206203048.11096-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0301CA0008.eurprd03.prod.outlook.com (2603:10a6:3:76::18) To VI1PR0801MB1983.eurprd08.prod.outlook.com (2603:10a6:800:8a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 778496a9-a7ba-423a-3751-08d56da0a518 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0801MB1983; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 3:kWDQptguG4qXqjfLyYR3D//6jw5R3KPkNrHGQ5Lzmx7olY8DTjeWRk3rNPZDUCUeRUJnZ1xuZqFBpMvnZMk+FPCG9XBJzktxf0OKhMOM56pQfMVGqkYOzPPHplbTNnDc3F36Av2+L3euD1+3YJZgpMFq6EClR4vkxmpfhTRVGj9QY9s82W89jc+SyqzV7Rd21kGklzdCxfZ0YLSHZ56oGW7ffJ99uwIdjSk4zlpar9uQBuGyTn+Hb9xR9vU4fH7o; 25:f0EUXrhEKVH7jSo4r0U3OgGFBmhf2wsNJweXSpXjsZGHS3FCT6vlJfsBzBxnEyyvh/tmMWutXaOIk+QWbeSUPzMTGgiGqbXqtU1e+22fuvCW5dRNN0OOw8iSHPngyplgbFfSkVZJz2uvYyDCMWK76ohUKD1R0xEkHHgw08VAmTK+jKF9P4bPhBcEMrzdd5cT2bRjznkeY0sLt6KcLrSYVvDAX97AbLZ8n+l4KgSi5B0QY0vRwIwcWVpk1R+IUybTk44p8SaZ8gs74kxVeygaOvzwve0jNZtpenvDw25WJCAYwGQ9206fXVPZozHGMMAf13LyQrgufw8hYZGbJIPfqw==; 31:uaMkEs5pNaR0fyBZWO9piJy6vT/D04xQJsQ6bctYZGjr1YEjEvzHJNj6X3QqS1mmqCTRyKN3LZcoZh1bqAolu1AAlppZTCffwQ4rF9kwQ0AGvVyYs6xiTPZVFPImstlvCqSQUGaEKiLql3DVP32bid14zehMzLmxhU86JmWUSaNarH6P+iCz83sx+883lty24cHcnCiMCGqWCegYd4E+4sYFKgWKT5WTbk4xVINGHSY= X-MS-TrafficTypeDiagnostic: VI1PR0801MB1983: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1983; 20:en0EtT9hT2V5tmyrxixUbgHltQjrsMxs0CYYACZ/sZGoGJvbteIWNr9zTMMXTrXHcteWcDLJSNXnVUGLQPg+VVQd5HkbaK1a1g0KmaAlAX6DQBkeF+RXBERb2dOeJpAXMY0p65eWDdXVoCX1mIoOMT7krkoxora8tXM6pzttfWmEsY+dio+CR6R5+LHqUgKxEhzcAbBKIRzLruYFk73qGihpliDjmBv213Pb6jErVfukDJIYFeBYwx9xz4SuGKD4AwryoNgy9GlsXp4kDa0TIiEfJZji5OhzPZ3NvhkaKA7S9QYZvFhaUaynRTD1jJ8cMMXX/c55l4zG88+w2db21DV0/Tbdyw9V3i5O9QJ/Z8VHTXkrUV2tNvA+9uOAUnTqyiPoGuzX+jwieLT970tX8kVDdrQHoIm8DbkK7BNyIPg=; 4:P4TuSvcK7vhBeYwEeLkR6K0oksIgg4K66h0q/APVzXClt8FE/lAxK0z59oo5LxHx57CJchXMt4zdQfMg8Js0IpSnfcbWKswJeRUc3p83coEnf9CGEKZ0EVgPtNqW2M0VJT1cw8eXXEAnPJtWHuEegEwy4OxO+m6Wmn2foBiVR8Nfd0jKDkEPZpoZzouHzb4c4vW09Tiv0nC4+TkF8/4dN2p1wZ3o+FesN7lKfWr098PPKvbNIg6kv9DU4OSXMlcMcAIhtJEmSmCrm1qzNFu5XA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231101)(2400082)(944501161)(10201501046)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0801MB1983; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1983; X-Forefront-PRVS: 0575F81B58 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(1496009)(396003)(366004)(376002)(39380400002)(39850400004)(346002)(189003)(199004)(16586007)(53936002)(305945005)(54906003)(7736002)(3846002)(316002)(105586002)(2361001)(106356001)(2351001)(6116002)(1076002)(50226002)(8936002)(81156014)(5660300001)(8676002)(81166006)(7416002)(2950100002)(6666003)(6916009)(76176011)(575784001)(86362001)(68736007)(66066001)(16526019)(47776003)(50466002)(4326008)(97736004)(26005)(6512007)(51416003)(2906002)(52116002)(386003)(6506007)(48376002)(55236004)(36756003)(53416004)(69596002)(6486002)(478600001)(186003)(25786009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1983; H:rkaganb.sw.ru; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1983; 23:plr4ficDIWqd48qFzz+pYmPQu//CIuENebuX3e+?= =?us-ascii?Q?BgS7sdAlN1FD81ASI+gvGvBEQTQAJQdSTYCpAz9/064q5vTymDbTPBbA+LXu?= =?us-ascii?Q?ayBiAKLe4nATX9ESCgZe/H6Zh1g2vna+QRlpiGDxl6OgK3ZedVk+qqSLciff?= =?us-ascii?Q?TdwgIcolvVp0luHW2t/3I5nbEjYNsGtH38s4JFXyhMu6uHEpDeEIsnKv4eaf?= =?us-ascii?Q?pR835j155WLg5Vq4PWAS85Kc7gLW4q3WzgTwbUlO328aVXcnUvk8zNf1J6v4?= =?us-ascii?Q?V5jAxqJmHspWJEvUXJJOx6fafMe5yUIPPiMkMmOzFi+vPwcSxUC2JJlSTCp5?= =?us-ascii?Q?6vGH3IyUE6c0WOk1AvKBh9CWdu4QY1FeV4JD39HkfKGF/2zayiZhoHm7ZAug?= =?us-ascii?Q?Kzj/vfFp3FtCZIGodjlJ1DHzbikx5hBIPNClLLlFJtbk9o1D1P/SJoPZvL81?= =?us-ascii?Q?mkaldOAguLCCEWHGxPw/BbuqnUdz31ORubkLL1ED4wIXLbdhxfOX0ES1lfBS?= =?us-ascii?Q?FVPMteAy/dSJSX0N8U7cebmrdGDxsBhXg72IzsbDnjljDxqXkkWEBUnQpjzi?= =?us-ascii?Q?eeWYJd7ayyQHrh8vr++1ygKdNYZ3YUXkw0EvZZqTyHchE6MXFWwdnwv+C8dh?= =?us-ascii?Q?bq+Z9qGKPw5wYzz0oOxgwYq3Y7ziHn2Xz0+1gO902E7mEPdVVmq6ZwwNxO6Z?= =?us-ascii?Q?4Y9qdthhrFJy1KD+VMWwjHhdu3OV8EYN3SX0zBt2lS4NqvsaoKYYKOraBYtY?= =?us-ascii?Q?BWvpcZucahQBgcOhcx4aN3ZYKps/EQjNSvdGs672cRO753IKa6SoX82i915g?= =?us-ascii?Q?JJQhgVcCcIFByEWzgVybsVBfrIn7U/Zx/Kamc4PonkzKQv4fstNwyYI0Gf1p?= =?us-ascii?Q?jeiaiobRuYFFat/+lXktlKjnUg5fIN127ZmkxAd1l7BdQeKw3JogckplikNk?= =?us-ascii?Q?IT4LCj5hd5n05w472GfUICb1HW2fb0MQVSlh6Ag/aseB90Mys8ej9B90Z724?= =?us-ascii?Q?u7oBx5FN68yDtDPnnBTvIUvZaG5CmIvtYJphlGz3VIcCPD6P6bmfbX2kwloE?= =?us-ascii?Q?CG8r6QVoKLllFbdWMM60gmjQFySe6hqwTifIlVhlmTbslGeor7nvVwgEZGsa?= =?us-ascii?Q?OLFN2c8c2KjdU5Z3u3+rnh58uyE9G6vZILcOwSnhZthg6aZATN8rMNo2HG9S?= =?us-ascii?Q?PWYwC4VQlBYk0GUd0D2MmNXkG/abQIVTUicS/57ehQd8t823iLpzyiZ8Bt8o?= =?us-ascii?Q?CUCSE33KnWfB6xfDm6DMqKicH+Ofr59FC+xF1r/FZVhbLH102b9aog0FN1f+?= =?us-ascii?Q?g2Lul4dpJkwcac/fUscP8BNQPBpWZlrFwDJTAqoxyJoaX?= X-Microsoft-Exchange-Diagnostics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QAilWOp1p2E5bR13W07NxbeEHwSFizbUoTpIRpYTUuzcup11sbAJXktNhVz3ZpwYieuyoCsDxvYC72cIFTnxGE8FhfeD2X17Wya2TI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2018 20:31:46.5440 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 778496a9-a7ba-423a-3751-08d56da0a518 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1983 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.0.125 Subject: [Qemu-devel] [RFC PATCH 23/34] i386: en/disable vmbus by a machine property 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: Ben Warren , Konrad Rzeszutek Wilk , Krish Sadhukhan , "Marcos E. Matsunaga" , Jan Dakinevich , Vadim Rozenfeld , "Denis V. Lunev" , si-wei liu , Paolo Bonzini , Vitaly Kuznetsov , Cathy Avery Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hyper-V VMBus logically belongs to the machine, so make its presence be controlled by a boolean property of the machine. TODO: consider doing this through adding the vmbus-bridge device instead Signed-off-by: Roman Kagan --- include/hw/i386/pc.h | 3 +++ hw/i386/pc.c | 34 ++++++++++++++++++++++++++++++++++ hw/i386/pc_piix.c | 5 +++++ hw/i386/pc_q35.c | 5 +++++ util/qemu-config.c | 4 ++++ 5 files changed, 51 insertions(+) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 744f6a20d2..62b67cd927 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -46,6 +46,7 @@ struct PCMachineState { uint64_t max_ram_below_4g; OnOffAuto vmport; OnOffAuto smm; + bool vmbus; AcpiNVDIMMState acpi_nvdimm_state; @@ -80,6 +81,7 @@ struct PCMachineState { #define PC_MACHINE_SMBUS "smbus" #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" +#define PC_MACHINE_VMBUS "vmbus" /** * PCMachineClass: @@ -209,6 +211,7 @@ void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); extern int fd_bootchk; bool pc_machine_is_smm_enabled(PCMachineState *pcms); +bool pc_machine_is_vmbus_enabled(PCMachineState *pcms); void pc_register_ferr_irq(qemu_irq irq); void pc_acpi_smi_interrupt(void *opaque, int irq, int level); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ccc50baa85..d37072b575 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2178,6 +2178,34 @@ static void pc_machine_set_smm(Object *obj, Visitor *v, const char *name, visit_type_OnOffAuto(v, name, &pcms->smm, errp); } +bool pc_machine_is_vmbus_enabled(PCMachineState *pcms) +{ + if (!pcms->vmbus) { + return false; + } + + if (!kvm_enabled()) { + error_report("VMBus requires KVM"); + exit(1); + } + + return true; +} + +static bool pc_machine_get_vmbus(Object *obj, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + + return pcms->vmbus; +} + +static void pc_machine_set_vmbus(Object *obj, bool vmbus, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + + pcms->vmbus = vmbus; +} + static bool pc_machine_get_nvdimm(Object *obj, Error **errp) { PCMachineState *pcms = PC_MACHINE(obj); @@ -2413,6 +2441,12 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_bool(oc, PC_MACHINE_PIT, pc_machine_get_pit, pc_machine_set_pit, &error_abort); + + /* no vmbus by default */ + object_class_property_add_bool(oc, PC_MACHINE_VMBUS, + pc_machine_get_vmbus, pc_machine_set_vmbus, &error_abort); + object_class_property_set_description(oc, PC_MACHINE_VMBUS, + "Enable Hyper-V VMBus", &error_abort); } static const TypeInfo pc_machine_info = { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a25619dfbf..4a3cb406d5 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -56,6 +56,7 @@ #include "migration/misc.h" #include "kvm_i386.h" #include "sysemu/numa.h" +#include "hw/vmbus/vmbus.h" #define MAX_IDE_BUS 2 @@ -302,6 +303,10 @@ static void pc_init1(MachineState *machine, nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, pcms->fw_cfg, OBJECT(pcms)); } + + if (pc_machine_is_vmbus_enabled(pcms)) { + vmbus_create(); + } } /* Looking for a pc_compat_2_4() function? It doesn't exist. diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index ed3a0b8ff7..9e5ce429b4 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -50,6 +50,7 @@ #include "hw/usb.h" #include "qemu/error-report.h" #include "sysemu/numa.h" +#include "hw/vmbus/vmbus.h" /* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 @@ -279,6 +280,10 @@ static void pc_q35_init(MachineState *machine) nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, pcms->fw_cfg, OBJECT(pcms)); } + + if (pc_machine_is_vmbus_enabled(pcms)) { + vmbus_create(); + } } #define DEFINE_Q35_MACHINE(suffix, name, compatfn, optionfn) \ diff --git a/util/qemu-config.c b/util/qemu-config.c index 029fec53a9..951a6360a0 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -234,6 +234,10 @@ static QemuOptsList machine_opts = { .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars" " converted to upper case) to pass to machine" " loader, boot manager, and guest kernel", + },{ + .name = "vmbus", + .type = QEMU_OPT_BOOL, + .help = "enable Hyper-V VMBus", }, { /* End of list */ } }