From patchwork Wed Feb 28 21:10:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10249841 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 B1FB560211 for ; Wed, 28 Feb 2018 21:22:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E5AA28DBE for ; Wed, 28 Feb 2018 21:22:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 922A128DC1; Wed, 28 Feb 2018 21:22:25 +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 1444228DBE for ; Wed, 28 Feb 2018 21:22:25 +0000 (UTC) Received: from localhost ([::1]:47014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er9BA-0002gY-72 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:22:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er90A-0001CO-In for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er907-0005ZU-2u for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:02 -0500 Received: from mail-sn1nam02on0055.outbound.protection.outlook.com ([104.47.36.55]:37280 helo=NAM02-SN1-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 1er906-0005WK-Gf for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:10:58 -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=aE4yNXMmUgjuIpIRT9y8gCB2iUHwV21ewqVDSWZRWyw=; b=VAe3MLarLHmhMIAfZ+p0J+GycCXb8BTaJCVTfiwUxr/7vmj42Xryitnm014r9/UEFD4O5HSgXBaE94vW58Jy7jXF6wIuZSmWctD0qwFTbDQyxwLvIq7M6Xv6dTAClUZ5ZNLj6D7jZhp7VOgRQpKpESYioqGOViNKlY/SJYcKZwk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 21:10:55 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:05 -0600 Message-Id: <20180228211028.83970-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228211028.83970-1-brijesh.singh@amd.com> References: <20180228211028.83970-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR10CA0008.namprd10.prod.outlook.com (2603:10b6:4:2::18) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b7baefbc-198d-4225-e78d-08d57eefc22c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:n1sibJ4T+7P4yVNPaz3N+NzLhxgvaWpGrsC6df60y1IZ+w6f8ipOlWeQgiwTY35rMWXaqHj8g4fpMPzlGThaBzJQ+g0ZcPB2aPNj66Eu2bDBwAH6wyHSepEg1v/+n0s43As+YbraVi3XdnrL7ME1S4UIunxxLDBQnxhToJok1KnGJ+t4XC7A0KnwHDyD+NL248EJAZIaKoSnbOUord4LUE42+I90FWfSHdFT+EG305pj31aTzwpJT1N6qxoMszdC; 25:dVfNvKKrxT/3ZEcJFLC6HtAoalsbCCqD/lMKgUZulKJhmEfhl1lWZ6n5us2uy63otX6T9ZC/row7h+8hF4Wj3xo6TsdHJa4yAU12MuuNUL2gN/tD916Kx25/tWSGjHliRNs+H6lYE89eUcelRa46AG27pJHNbkHA3I/fxmrSAb9CoEyAZcYMJMSvQeWBxG/AZ1l5BDCLtFjEgLVn3FZbdKXJ1LbhsvXY/X8Q5Af8WUA1IlCHlHB0z6oez6WN3IqKRJ1+ZHWmLnAHGaaLm4QE3OteMpn3+1By5CmPYGKK68oI2tPyUJdp73i66CMWSxaVWVuagAdigXtvKcOTHrKGWA==; 31:1nWVvwTT6DUN7GSrgvtDiBsORn4BN+hXLJzC6c4gf1McKyx1U1h/JNBN122suTFdfIdEt4PSaXXtRWLMhA+fS+xPCLC1c/b7RY8cmcZEQDS7H3pvYd3C4sg8DDKWqv6G8hKoe/WaJMXo7cAXM1s/C3f34s8/EbTS9jCUUoTS/bbtPROruGdekKSijleWAJh3g2NliHGl9cEHNRyZZrIJ9LEib7iMsj+7EGwLhh+y2P0= X-MS-TrafficTypeDiagnostic: DM2PR12MB0155: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:fEZYOwcEgAIloKWbMJlaW2yvEdyTvUkyGjqru59N00pf1jBRrri/N+x05dyIO+xdsbBy2t2h0UkGQox/lAUzdz9d4X9w20YrGxpsCGbIfchiSVqOVdIEhMAJbG1t20uYM5rSji4U45loT82lZZrP5W0v+LvNDhHYtsavccf4SoSFoH8ZiXRRoEvaYledkvwyI5bfyLHadJWIS6UvNR5gmPagTdLsf/JW42/FwK9ylLWPgvv+j4DiH4wmKl66edHtkDNc0tqKx0tvAXqsoevTo3Em9Lujj493rfscWfCodQ3WZFD6b7gpjbebCaypbsVr9OJg4KWRm78Yc+zWv8MayruipFoA5wUTEul2MZrXNyAxwsf2usLF3fvzIzmdJSWlBlEb5G/bXuh5qWu6kTmnEqfrl5oW6XnOhmV3hz93CWl/fn/XecRxHCApp4blKx6Us6Dj4e0gMBI5OJ+z/V6kpaCC5Vv0G+JVFJxUsdLCunjIrBQ5HKqDDGoaweVr1XxE; 4:HVZZlTZvACgHG+nTooan0UmTpvS6p6CscaLRqY60SdA+i3843kzqVjaN2iK2nP0x8bA21lgtdMjGi9V35oXeqWMxqMh30bikI/OpzkiBO5wCwOZXE0EKNMGgdiemZoCGKr4Ywm7VIqVY+16jwb2i5a5Exz1CE25sOI6nDbjcpBXF4dSFfkyAAPgS2KZzhFsQ4BkuXtuy8/9+mnJWZex9KhjRc+ed1e/8QurEX8rO3NPYv0zdXTY5VoTZl/UrIqZNQ8KkndSkZ3xVh3X8PjXto1iFIPFA7WnjWT2W7Pq5reYyiNJGoscSZPzed4ndLwyauaii50dj57ZsoVz7u/RiSg== 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)(8121501046)(5005006)(3231220)(944501219)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0597911EE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(346002)(366004)(376002)(189003)(199004)(6486002)(6116002)(1076002)(2351001)(36756003)(16526019)(16586007)(54906003)(53416004)(26005)(53936002)(66066001)(186003)(47776003)(59450400001)(2361001)(478600001)(8666007)(316002)(81166006)(50226002)(8676002)(8936002)(386003)(106356001)(97736004)(5660300001)(2950100002)(6666003)(305945005)(4326008)(76176011)(7736002)(39060400002)(8656006)(105586002)(68736007)(50466002)(575784001)(7696005)(51416003)(25786009)(48376002)(52116002)(3846002)(2906002)(86362001)(81156014)(7416002)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; 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; DM2PR12MB0155; 23:oa724p5GgQ9BTOHWFNvskKZf/EgrViTvNIJYM/emp?= =?us-ascii?Q?AyQ/wPVU+aLWIvwC8OpEg3XxB7/VVU9IqY8doDe3hxdwQAC2DQERsWLNhLb9?= =?us-ascii?Q?36gbxWPjTGpP52ydU8sG2BUm8+PtCg5n5QL/mJ1w8Gz0sBpwhICCOaGkJJBN?= =?us-ascii?Q?6hpiezApWgd2srSN12bZnyXiLSqRj+u/4npw9G8Yac/c2OvfMN4WoLfxyvB7?= =?us-ascii?Q?Lj8XdpobiqOMwEmSQaNFWYGbBbfoDQtL0kiV7eCY+hEx0bgufL0RKtpo9ery?= =?us-ascii?Q?i4Mnv36CYkm6lZUnvnkz8zxJoB8l9zIVNK2l8Y+5Sp4vN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U5JXd5zJmlOSYKA4kCumR8zd9prHBWWTDAh4S4w/EeGfl5toN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:ULsCOIzlwiDubBJu8yEmr9252yAnkKfWEJpweDiYgoe1nVy9+p10i8Q36QVyB4C576vSc3JQdpEkb2JNIvbTwsXVK+y3Y06KGupLtmYtPSgDUTVg2camvjGjac2Lnqz9WeQvxq88qr+cg2m7UBKZBP57FRkA005PEgA2z8h1yXdg7jHpejKgz48EmaOw+OSnMPdSpI7AgSzbBfBWnpZmAV5pAKPkhkCncKX0s9yjRTonmTLU4UIuEASEn8TfAzTT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:10:55.5768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7baefbc-198d-4225-e78d-08d57eefc22c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.55 Subject: [Qemu-devel] [PATCH v10 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 5d445839e89e..414e6e71092d 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 8ccd5dcaa61d..a6648ca073f2 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