From patchwork Wed Mar 7 16:50:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10264467 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 8A215602BD for ; Wed, 7 Mar 2018 16:55:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 787C929617 for ; Wed, 7 Mar 2018 16:55:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C5EF29710; Wed, 7 Mar 2018 16:55:23 +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=unavailable 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 A9EA329617 for ; Wed, 7 Mar 2018 16:55:22 +0000 (UTC) Received: from localhost ([::1]:34361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcLZ-0000AP-PC for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Mar 2018 11:55:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etcHa-0004dH-Ui for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etcHW-0008DJ-Q2 for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:15 -0500 Received: from mail-bl2nam02on0050.outbound.protection.outlook.com ([104.47.38.50]:40768 helo=NAM02-BL2-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 1etcHW-0008Cd-Jg for qemu-devel@nongnu.org; Wed, 07 Mar 2018 11:51:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wyrZhyA4X1CazrMvtsxT4WaSKhmznA1BBtZlSeFWgCI=; b=hJhd0cUS2gkxpyOB1m449rkrCS2QdLYvU+K7CJIYxMK5FMFvtcSl+AxsLyIFJBjd2I2tvAA+Ym6DMyU0z5p4i89LrV3U0QFEPuhSD0xak9w7nIxtXtJBT+uaw6qzc6NeUel8gQp9vpa7wRQtNE7QaFVTZzhOL86iU3QNjM/KbLI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (2a01:111:e400:5144::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Wed, 7 Mar 2018 16:51:04 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 7 Mar 2018 10:50:15 -0600 Message-Id: <20180307165038.88640-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180307165038.88640-1-brijesh.singh@amd.com> References: <20180307165038.88640-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0501CA0095.namprd05.prod.outlook.com (2603:10b6:803:22::33) To SN1PR12MB0158.namprd12.prod.outlook.com (2a01:111:e400:5144::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 82f609c8-62e5-4226-3a54-08d5844b9e4f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:6e/0vZJjQYCmGjK6/k6oc4wR9zplGgSuxnTovBC+5BC/QEzpdIRfGWq2Col2j1yoV9LIVO0bI7q1k+9o4+L477lFuxa2WfQIzATBshFI7MalNo/9bLNOm5BAuu9lX0w0c4qPMDKOGAi5NQtNk5+M3QksL7jwn1ci4cpX7pwHRkh5zOmdvxG+GHgLbBuO5rGObfagusJnnkwOcIrG4Yfath2L0Fz2T2bV4I9++6KleCUdfHg+1sb3ocCbGcqrN/57; 25:UwzC+J9BHk7oL5Z3H4QFn7iQfuWIhDjXZ2b6Q8B9bfdPDClDv4JilZwYdjfW2yHn0OzjNpjK2N4wS8sZx9L1ztSi8cuunW/WUOk2fdYhbj2CZ5vjxwJL/Ga4EFsFFpETm/W+c97KZCS5xi1skS9w12jQ9mUeFQB9gF5CbMTcz44LivvLDDRRyZw6LD3gqPllRukNZyjOC0ux9spCDpGLqhVYmrZqeSNJT2TjGWTIlpAD6Z5eChUUEZOVMZX0LjfgRGmgoez4lrhRdxORQM9Q+K4DKniejC1FG453ZmvyRBiTODmgPoXYKQ9Pf6N7j5Ykhmuu4abMIshaKdDNjSglqw==; 31:WnBIgXeqtt95PTfwmu0A/7q9TTIfoDXAtMyMIPayH220JhOaAHkK1WsNJSC6dJhAqArdHep7+gbEdtms2WCe+OyHpvwLLIZ3b4OlyU7X1ym8V42M/HYRLMs6m2GDJlrQYP0DTXnv8syaNePhOmO4WgX78cKsnRB4EoyIuXwmUhRhiGJ9xlFG623lM64bYpvgsoWcfGTRJOqZu11L5UTpxIA7xSJ6zH0mS14f5G6jlGI= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:szDdtSIkLyOF67xAlmoVbdET98b2adIjw/MUqoj9NaS8BNHfQ0g8eltjFRK9dOy+MdfGrt/wzV/6o+NjbToufZe+AABdrHmHjBVKE8FPjJonRZx+T3erh9irCi+Ju6KUkF8ZU98I6KuFAiXRpbzDKiq6aZu13tZtCXOrHnP4abPkRDgOrVBJqQcvbHgV5ASRuoTiVhLIFl/xjnDFBQAE8jnltlkd/iw8nKG07ODO216bBFLiphAUlrdxEPLKJhwbd+XHvOwKyLF35fW3bpvNgZsWo+deodW0UNWwSPsc5VpLZ3xJuIPWvnFp3PGcN42ZSd62+MMtqJ01APX+zzmGKgKIeuoDIFxmoLJxDX91hB+Rbv+0HsAbID+Qfzt1K+jbLyG2XdUNatcnuWoSjo4LqVLaZkxtEEVVzwKkXvD+3NsS/qQwwyiILBcfYW/cfUwsywnGTZVlFa+xGUmRsAwM7K09/ZOIfdZjlg11ntzWXzT25HMoQ8L8hXWuyVWPF7ZV; 4:JW+yWBRCkjg7cIftoxir5bHVxTdgYN3UlP1kyRTu4cMg7sPiLzIW091E1M0aMPaP4L7+0BSFTpVsXzZerQ0uLdWVFgDf6NfZgzj2Ij/fW0USiar9tQub+CBjDIwP0aA67VYhVpRVLBm8uvFRf81QPCssNkzHlAV9Dg39MPo++0D9RH8ZUuorq837iDdvdcMLGR6pGPQMsoAqTrbzrpt0ApJJ68qBORw8kgJCultAGc01ctzY/NmjlA0Xp/sf8HBrpmGjoemaLFu3Idomt0bnwQB5n3+J8529V0hzcxjkn5ZJutfTcSwx/8XhNV+5G12ofEjXOwJgpUVJDsvV9niePpnaYOQCqXTZdpHAlP7gEvs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(3002001)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0158; X-Forefront-PRVS: 0604AFA86B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(346002)(396003)(366004)(189003)(199004)(53936002)(8666007)(2950100002)(6486002)(6666003)(6916009)(53416004)(3846002)(1076002)(6116002)(4326008)(54906003)(8656006)(2906002)(25786009)(59450400001)(386003)(68736007)(478600001)(48376002)(50466002)(105586002)(2361001)(2351001)(575784001)(86362001)(66066001)(106356001)(47776003)(186003)(16526019)(51416003)(76176011)(52116002)(7696005)(26005)(16586007)(316002)(50226002)(8936002)(8676002)(81156014)(81166006)(36756003)(7416002)(97736004)(305945005)(7736002)(39060400002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0158; 23:PcYt5I+JPDUYdF5zE507CmjUU3QA4H6dXMOmD0yP/?= =?us-ascii?Q?5VPhHosYKjkhG11HK/h6DZOunf9CU4lVQLBp0g/B5o+NmW3BJxCiZv3VyPKi?= =?us-ascii?Q?UFf0g1Nxcmkj3hAsValXYeNvU02Qc1eFL5leFOAuDh/oVSGuEHjy1BSuQetR?= =?us-ascii?Q?I41ccqnvn4WN6/q4CL+1CFnAH6N8LAp9y6VSf0bk+MAPfezb5zMr+G1r9bbJ?= =?us-ascii?Q?gzYlXFb+wYRX/DDy6CNUOMmnb+Pm+5mrRdC6O1vKHNRwekgSBLA5k1JrkDWd?= =?us-ascii?Q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ZbJjgdy4Nj/?= =?us-ascii?Q?053LzoTmdlFVzLCIgno3idVghAhCCzJbk7B8d7HfCzOKWu7BDLh+Fzghze1I?= =?us-ascii?Q?lKgS8wbQolXl1jGPs+/rWStViN7lQgBkRA6ysJ3dxdxp3spVXHKd12dzdykO?= =?us-ascii?Q?Ae1ZmWtgeAYRcXID7wmv9M=3D?= X-Microsoft-Antispam-Message-Info: SoQMAWaYelS3oNl4TMUe29jnLLi0wzx1orN94igxAEqO4vUzVGOS+z2SNcOOG6UJiltqX0JRp6hmG8rc76Zq+foHXDSPZ1mUpphR/p+n0IlcJ8WrYZjocK08YaBpTEVuFK42iAjCxttbuL+fPfHDXBd97wMkwnAaJ9giLU9DQfLD9S5S+iRT/WyVNsrATkLV X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 6:fFQ3tCkRMEJCX2hVgzhdir/JEGJ4p4dAd518EBWYythxKC8FL0N45cCyejGn1nZmNMJX1hn1y+BMAdEblc1fZkm92wUUj7vBILxnZg7OmR/52pQhbgUGvr1yktvNGqAcoANTDT37bxv8DaVzDIeGeUKIZgFUSu1kUQrcWTCk+IKAIj1ieBzEBEkwq8ANANik+5v299N8e6MFAt/VHn4J9XLMsTyu/Tyk4mNWawrT8WCcvW5nR5GgBAKJfIRho2RgNol829Igwb2EhloB5r/pmgHwaV93ABfVdawUhoqVKozHcHsSVjN3cHhmIZ0w3v2YPrXxc9MHrgJPU2u0/wRMO3igePy13O9ZQJ/5HBfgVpg=; 5:/YuKoMDSo5TNiNp5XtikC31BFfyQQ9DFfltBOFsdvMkEV4fO0v596xl/E6UTABrNZ0SrTcVBHdE2bOoJuc2I5bu5TGP+62NFqJ2ve47nAwdaUYvt5Wi8XmB4qefAkACJBM5jth4jCH9qDkRO923CkyUV940zGHtisBjpuNdbCM0=; 24:w7/9UqZwu1WHBNjoupMgP5yw6kd6BI2yUUU5hgs3DWxYlFqPdR7lfs5n+m55B2f6q0G/oIWGM7yBL5p/VLYZUarn0+bdtOXwePQn2k9YLxk=; 7:cpxLsX0Fd6vG0Sgl+MFiovTGJu135oOLW3qBXWGurrIefxzn91/oxKU+mJ34xXS2rVPEEMICKZJzvJh7ZiSogCi0txXn2+2mP2pBXYfWc0Ypfwb/RaFqRUtSjhZFSMyfM9IHxNAdRTBwyTd48HuVa+/wrQi0nHITs6r/JUZB5VC8n+uKiYA/h88RNP2TsIZB7mMDys1t1/+6bbe1FxUV6pPN83IlU09+0EvuVu5zI6WJDB8YjJRrgf/haJf9NDqZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:9ZjkLxxHZYvfceEGqhqY3ddZ78W8PIZnm/3GNPTW3hO1VnuvnGKKBRl+ssgUZFvjJWYupCfou6kQ6bDdyF0V79OL0m9c5sqZ2rrbfsK02wt8Cf+n9Cs5XP7XiQyXDt/FxCJlhyFlqW/r5rW78XN9h9u5/k5+eDjrI1FkTB96m959nYi/KC54Kfqz7RyNYf0+rDyfDiGF4hgDLwKnfGsphORJLYOVHe8Nwz5qcSBU8fWWhqNpT243twxqCS5mgl2j X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2018 16:51:04.8074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82f609c8-62e5-4226-3a54-08d5844b9e4f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.50 Subject: [Qemu-devel] [PATCH v11 05/28] machine: add -memory-encryption 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: Peter Maydell , Brijesh Singh , kvm@vger.kernel.org, "Michael S. Tsirkin" , Stefan Hajnoczi , Alexander Graf , "Edgar E. Iglesias" , Markus Armbruster , Bruce Rogers , Christian Borntraeger , Marcel Apfelbaum , Borislav Petkov , Thomas Lendacky , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Cornelia Huck , Peter Crosthwaite , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When CPU supports memory encryption feature, the property can be used to specify the encryption object to use when launching an encrypted guest. Cc: Paolo Bonzini Cc: Eduardo Habkost Cc: Marcel Apfelbaum Cc: Stefan Hajnoczi Signed-off-by: Brijesh Singh --- hw/core/machine.c | 22 ++++++++++++++++++++++ include/hw/boards.h | 1 + qemu-options.hx | 5 ++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 5e2bbcdacedb..2040177664d5 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -334,6 +334,22 @@ static bool machine_get_enforce_config_section(Object *obj, Error **errp) return ms->enforce_config_section; } +static char *machine_get_memory_encryption(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return g_strdup(ms->memory_encryption); +} + +static void machine_set_memory_encryption(Object *obj, const char *value, + Error **errp) +{ + MachineState *ms = MACHINE(obj); + + g_free(ms->memory_encryption); + ms->memory_encryption = g_strdup(value); +} + void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type) { strList *item = g_new0(strList, 1); @@ -612,6 +628,12 @@ static void machine_class_init(ObjectClass *oc, void *data) &error_abort); object_class_property_set_description(oc, "enforce-config-section", "Set on to enforce configuration section migration", &error_abort); + + object_class_property_add_str(oc, "memory-encryption", + machine_get_memory_encryption, machine_set_memory_encryption, + &error_abort); + object_class_property_set_description(oc, "memory-encryption", + "Set memory encyption object to use", &error_abort); } static void machine_class_base_init(ObjectClass *oc, void *data) diff --git a/include/hw/boards.h b/include/hw/boards.h index efb0a9edfdf1..8ce9a7a21d3d 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -243,6 +243,7 @@ struct MachineState { bool suppress_vmdesc; bool enforce_config_section; bool enable_graphics; + char *memory_encryption; ram_addr_t ram_size; ram_addr_t maxram_size; diff --git a/qemu-options.hx b/qemu-options.hx index 2a22a62f743b..c157946af308 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -43,7 +43,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " suppress-vmdesc=on|off disables self-describing migration (default=off)\n" " nvdimm=on|off controls NVDIMM support (default=off)\n" " enforce-config-section=on|off enforce configuration section migration (default=off)\n" - " s390-squash-mcss=on|off (deprecated) controls support for squashing into default css (default=off)\n", + " s390-squash-mcss=on|off (deprecated) controls support for squashing into default css (default=off)\n" + " memory-encryption=@var{} memory encryption object to use (default=none)\n", QEMU_ARCH_ALL) STEXI @item -machine [type=]@var{name}[,prop=@var{value}[,...]] @@ -110,6 +111,8 @@ code to send configuration section even if the machine-type sets the @option{migration.send-configuration} property to @var{off}. NOTE: this parameter is deprecated. Please use @option{-global} @option{migration.send-configuration}=@var{on|off} instead. +@item memory-encryption=@var{} +Memory encryption object to use. The default is none. @end table ETEXI