From patchwork Wed Dec 6 20:03:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10097107 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 32C73602BF for ; Wed, 6 Dec 2017 20:22:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 198F029C1F for ; Wed, 6 Dec 2017 20:22:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CE8829D95; Wed, 6 Dec 2017 20:22:46 +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 51E7329C1F for ; Wed, 6 Dec 2017 20:22:45 +0000 (UTC) Received: from localhost ([::1]:57629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMgDM-0000ch-3j for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:22:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMfvi-0005r6-BX for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMfvf-0002Ri-5S for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:30 -0500 Received: from mail-dm3nam03on0084.outbound.protection.outlook.com ([104.47.41.84]:45015 helo=NAM03-DM3-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 1eMfve-0002RD-V3 for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:27 -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=i9SjOLwvNESO6woDFXMKL8R8lJh+PJZcRAOo/sSQg0U=; b=ACylgiO4j/kfjT1C7Gtl8HhK1nFCNyfXdQqHPR8QxeMeUuBockAAd4ZXCc512GzqM5ihXthou4MX315/TTZvkqJwk6YlgkGFfeglKZ+uOcyCg56Fs9Gg3YiugLzyFAAK0ofpjZYLvU5euLVJxjJ2JpV4M5/lECqDLtAQ2zbWaGI= 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 (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Wed, 6 Dec 2017 20:04:22 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:29 -0600 Message-Id: <20171206200346.116537-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171206200346.116537-1-brijesh.singh@amd.com> References: <20171206200346.116537-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0035.namprd14.prod.outlook.com (10.171.172.149) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7298eea1-4906-4543-f80f-08d53ce48bd1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:WJB6UY/NmfuFO5BEcAkOElgnnhg835PYWeulBwqSYA16I+yVQYA8xkOQAK6nztcp2jDtNt6PHdAKcohEpr0SZlLT8ZCVM96N3cAaBtYJ5Sfd0I8gwzarl8ngY1gGzphkcIKxNJ+TExmWJct56rZ8xQyGFIJsq00ELOfc/bU+JAXycdpvRz4mlxJw5R1cwjqIc1cXzBy06gEJUvE6RU+/PX0MieQ1ZYiSAdKFRmsD/aK2sgAhWoK+GNhj1tXNX52v; 25:Gqs7Mb+LYy7ByGgl72mevyo2dElWAsjLgCrQH9/wgMWCx/Yam7S369SLy2hicU3JFEkUNtYWPRIUU7IEc1m2/JTpqZi8xTEdJE5DEoxyHgWrFmp/IEbCfHpyB1i9EV/94xjmHeRrwWAPvoqD0M8bK/Roj9P/fEsaLCFxrCmxq09N+99KfIVp5XnPB6V7FHrPson7Tk3/A/d3OiaDim8F6CgtnfKttA0BJYT8NqvsjOna5+rGyjwBuWvjF9Iu/jU66Bkt3HRaLOyK/Fc5zJHIKxk5J+3jUlYS/0vDVH8TJJv6XfvoPtL2v45Hxe0BF4hh3vSRt8ydz/wAsBYiYIeIvw==; 31:XCwHPQ2o3JR6U2TkywQIYz2vJ01HGBRehPCDdwZUbgpeCOWBmrbiMUOMyhP9orTlQDe6jGAAmJbPHoBPBVwcnVUAfsiXBrUV7Q1eyeDuVac+RELfCJwE2fFjnhzYUx1wFBkbDqtYs9y802heaH3ZNZpe7gNz6VsN0Z8Au6E5gSkavahXi5DXYN0p7xWz/iVGhL4LSVWjJVNL6vhpL4Jlx33FizLLfMRGj4iP8o6kQ0M= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:z7M3rVsrRZ4iFLULum+MQnIdUgbStZVKd2W/xKahlzoYwFWDxDvIpDjlRpFIUEHvQnjNUd/zg392yQLwrnxbjR3jBiFfkbJr4pwdv1+/S6H4/k0d6IYag28jtXVT5WU9oLqYLEGsRFQ1u8T3q99+l6lrt7q4dRo3PvvCMbWAx8WSeUSb/vhCcbM9hHOuFZjt/RHD6Nq2kboVq9+6E0MfMvhcwt8FwiboBZKW0k0Qn0omU5gr4EZKGMvwXKGRzKhXd4wZ6xYZkKozwu2yVFY3Uu8cn8+JbgOthm7IzZxrGffQcUUQNfdxIptw/vs/pWcWt37ObwljhYq4A2tuTAIc2LNjYDRcgR1+i6lQKDy47Uq9NlzUd47kXJJlyL73HFwb4ZZ4+D+HtmUWMx82QE1adQ7wnhmerNYyiwf7JG1SEXn5a0uVJfYnKVB9f3KkWLqBBeYoBrJM8o51v4wHA7MtulqCwno9PGGmghyNBpUbmF6Q0h2nKSD3M+w3bfrdchvb; 4:RL0KzTyP1cYc5u4A3PkQmec1Nol8XNeBrKvV91STyU8cAw78Z2m68rddbcc5QwporoN8WU+d9p7MGLFO1awdLj08cisJGFJ/zydGv0/JT1LY4iyCBKPA2qRIGh6oPwL2lprNQEUsmGXOaz7DbztbguZUoI0Dry+m9vTOvkl67/rsEvSxjFYyLiGFaaQxcWN7fmKhWDhTgtwk7Kx+BmYbA3bAgTrUCyTI1DgtQRJQjSlQJ8HDgLbC80N8kXNG94YDT+8O/uU5AikedzAvcmyMNVFwgE5wXGBf/VezvrYXgpZ7iezF2n7CAL9QRa0y9cvV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(6072148)(201708071742011); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(366004)(199004)(189003)(16526018)(16586007)(33646002)(53416004)(105586002)(39060400002)(4326008)(305945005)(2351001)(106356001)(2361001)(7736002)(7696005)(86362001)(52116002)(8936002)(316002)(53936002)(97736004)(76176011)(51416003)(36756003)(66066001)(1076002)(3846002)(25786009)(6116002)(47776003)(50226002)(68736007)(54906003)(6916009)(2950100002)(478600001)(8666007)(5660300001)(8656006)(8676002)(101416001)(81156014)(81166006)(2906002)(7416002)(48376002)(6486002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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:4s0EUPsIgSHuUrTp5a9KjCzn+ZsOBFX7fnnhBMbaq?= =?us-ascii?Q?kNzhhXAVO1e1Tb22Vj58a6TjfM+oW5WAGMoyprpGnYlwwINsaTssAD8ZOsDF?= =?us-ascii?Q?UI0H1ZIs6PFsnsSNhJ8UKbCN4kEOECOrkE1CJ1d0FlgX13WebWTh+GrBJ60u?= =?us-ascii?Q?vkpNzqm2UxuN8Zb+tiE+Naw2aLqfapsxxmn69dZicdVYTF8eDk41MI4xFNQi?= =?us-ascii?Q?0cPzNnUz+ay/AkbuLDuPcmhPhURdH6XpRBZBw6B6XbRPqEv7Ga4obGF2oK1L?= =?us-ascii?Q?lWHgNgwkLV3dFpz2T9+3Lb9JAl9RHYC63ibIGJ3mLv45y8UD7JEHgKstLBTo?= =?us-ascii?Q?aNVZgx+OR95Gn8TS14UCXNwNJjXYOYVaB2uya546BH7XQq4F0kxHYRdR4GzC?= =?us-ascii?Q?8FnFsyAMZwQ9mAC+B4n2caLhHIhBEaa/+z7IKKtk6d9x69SJMOX2vFxqgHrj?= =?us-ascii?Q?8vJfyPR2Wd2hZdDTmRlhd0JBtcMuwM88qwj2gUXWE2RM2mDFfxioxwN0SgF9?= =?us-ascii?Q?/RUffax8McisPhb57bL6/IPFmgNyz4FFNY3QAlqUOFaUFUHi568cBQYstS9s?= =?us-ascii?Q?UtyCUg1iozqSAbSJq5pbCvT6+aJKlpUf2T2L9IUVgSCJuaIAIgbEgtAQpS0I?= =?us-ascii?Q?1x5f4I48rEnkFJoX/TWYTnHNuQGM2ruWwSLJ4uU+cANr/081tJsJIYESIQsA?= =?us-ascii?Q?k4aXQwhKt8u8D2oeGR4CIzoSrEmnIGM43z7FoIIJABBQKP4utgH1kOG4NsjP?= =?us-ascii?Q?PsQisAkJKZPJ3tydK4fJB+lx1HkfX4K4FMd7YXlk0NYdt4SPTctcChiV4rST?= =?us-ascii?Q?VOzR/B36eApO/8EonTm3v9PQYFJFTRSwNJsCUGWqIl1AdK/FLPUhBGMJkEtd?= =?us-ascii?Q?TQ8meN94rm33hRE8blAPkHJ6mAe2DFCW9snlleQcqsBWWqZ/MNGHPZXLkGHd?= =?us-ascii?Q?BMpBaFjNbl73VMWi8AdeCKsKhj1tNoNa5p+1s+XG8D+HmJ6zFuxnyDxRD9V2?= =?us-ascii?Q?CKYsN2ZOXgwj8seydAhnJwFqeO2e+2UER+Sa0ZYaA6E72b64EmJoermN6k+0?= =?us-ascii?Q?n4DvUnXbZpIYZKccxDYPPcl0UjTdEvGwQyN2ZX/cjBqwpukF6CUs713vUXbt?= =?us-ascii?Q?UElzYqUTNlXSGmANmpV0kh+7ajIAgDwyWoS71UDYS+ilh4ctMCpdO74E/ovZ?= =?us-ascii?Q?1db+jRHbo91MW12HUXtip38s+b29emO8OMT?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 6:pstIeARByUbtQmVmBaAV9Y372O+hQImidUlSskmlUrfe/C0dWFTHd7W3r+PURDP+ka6p7A+v4Dr/DlYEd2e1ZsvInfxjYmp5pZch9camC9ZNlTInXHlQII9rqvTzhRxA+9xYtwhICR0FWHyJyApPei5ZNHhV/SfpJaA8VveF3V3Ylc07hp7hhIysQ6L3MtEzKjfNEDhuN2qqUtqGT3AdiR/+jY1vfaResYAx1qICGTVodknCMLYUSVoEkT5IAKMseHj3YeXQjtMzWfx7x0021Gwma3wkz0qrEbpDzy16cqQl+hC41D2aLuW8khGGIADtR3HuuExAdglrwSXWXsOzYBicdHv7KuqYcHfA55xlSaA=; 5:b4qYUyimN/K7qffK76aGJuzLnf6twnFFCDSp85JFcG+VMbOkVl7czmmcpjHfI6HW+SulkjWTN8fU4Bie52yl+5MYimZ7zwjufELsqOta8ihVjzff9ekyVv1MhhHI3XtiPwAUiP+ZiHaFGgoRuUf4oZRcp29I2lM6EWeq7+KQ9NA=; 24:OHoUW95SJYjF0RbBnsmzOVeMHy3wzjGc9At5ZUKiOnHc9KgcEwKGe5ikJz2yDVZerlONiDByVbTXGIUNBp65Nygcke7snojtUfI8xPJGDBY=; 7:jE1zKWR/iD/TIMYMNjxrqw7ikSwwICysKAZ3Tj2H3pCB35YNf4S2en33MV6SuIUDzJf1ifxZFGG/J0uFNhyTTZJKqot9Kv8VYbP9JZWkRawRSWOE9zkF/17QtT9LPwbnutJVUc5GiXJlcpNtowImn6l5jv2ylDVpTyZ4CJAGnvhk/Xyr3ooiqbtmQJQFT8TTYmNrasZlgMM5IREzjvTuMmYtWcvi5oZZecyAHyUbc9umSWN5ffpxa/3KdOd5uiwG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:KwAQPIDocbL1YBzfn/dp+LOJMiR+gXkTVvvbUokwu50zSxepWeESMZqmvh/IsGaEmVZkvyW+2zN7wFQpkmI//SXFKx1LeDAGrFrlP0OCldmvb0ZusXXzIH5JqrTqsIjl5IYfvJ4Rqw1n4b4EvQvS4vqvkKUJkh7sD9+OTNRBjTltNAZyQp2vYcqFurlZfulsnozJaSdaoCqI22O+gJM0V30X0xfn9e7nhrWdCcUHAtH/xsz+t3vePtY4C3CO63kj X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:22.1765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7298eea1-4906-4543-f80f-08d53ce48bd1 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.41.84 Subject: [Qemu-devel] [PATCH v5 06/23] 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: "Edgar E . Iglesias " , Peter Maydell , Peter Crosthwaite , Eduardo Habkost , kvm@vger.kernel.org, Marcel Apfelbaum , Markus Armbruster , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Christian Borntraeger , Brijesh Singh , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , Thomas Lendacky , Borislav Petkov , Richard Henderson 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 | 2 ++ 3 files changed, 25 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 36c2fb069c01..132c57bc5124 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -335,6 +335,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); +} + static void error_on_sysbus_device(SysBusDevice *sbdev, void *opaque) { error_report("Option '-device %s' cannot be handled by this machine", @@ -598,6 +614,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 156b16f7a6b5..41fa5779557c 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -238,6 +238,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 f11c4ac960ff..5385832707e0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -104,6 +104,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