From patchwork Wed Feb 7 16:06:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10205587 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 7122C6020F for ; Wed, 7 Feb 2018 16:18:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FFB228F93 for ; Wed, 7 Feb 2018 16:18:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52EB628FE0; Wed, 7 Feb 2018 16:18: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 5977028F93 for ; Wed, 7 Feb 2018 16:18:23 +0000 (UTC) Received: from localhost ([::1]:55937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSQQ-0007Uw-EC for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Feb 2018 11:18:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ejSFe-0005nh-Js for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ejSFa-0006sJ-LV for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:14 -0500 Received: from mail-bl2nam02on0079.outbound.protection.outlook.com ([104.47.38.79]:60144 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 1ejSFa-0006rc-Dg for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07: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=555lSrrEiVnUfqC5aC6VzJbcpHn/dMZi56EuAXLTmKc=; b=C5vhR/gXizAzNU+ScPuVSyckjRzROuQnoS4vlnb2ElbrAHqVon4j5gEqyrU3n/Ms1aVeBSWm/4j0g/VlyZzoEGaRpkRCQt5mhIgK1WRLUxYiuJvhn9TeASn3V4RrvH4iBurTB80IUMRLefHEZs5W8ZhN7qIotQeGIiHVshThobs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by CY1PR12MB0152.namprd12.prod.outlook.com (10.161.173.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Wed, 7 Feb 2018 16:07:06 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Wed, 7 Feb 2018 10:06:18 -0600 Message-Id: <20180207160638.98872-6-brijesh.singh@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180207160638.98872-1-brijesh.singh@amd.com> References: <20180207160638.98872-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0071.namprd12.prod.outlook.com (10.161.151.143) To CY1PR12MB0152.namprd12.prod.outlook.com (10.161.173.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bd606c61-aabf-4119-060e-08d56e44d658 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:CY1PR12MB0152; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 3:YfRcPa3QD1C/oXqEj1RfP9zErRvz2iv0IJKB5xFiWL6QzeIjDl3QD8EolYiuYIEK9Kg9XNoYzP/UOxM1ElLXIi1pix+4z8tALfMoI4MV0X5FOP6NQiIU6ujZsUYCYw86iQscAfr76OJlpD2YYq2lmX1+huL0XEYXfuSd4+jvt/72F4UKTI2yA5Ut/iYDcBnb0TPmKPHa9XtBGNktjJeU5CF7UsBCmyZwTiAQDGrHZQW0lPHzL1I9ZFgxvRFJibpw; 25:diYtKkApJ7/Pcb9154nWNvRn5YxObN9hVZ48GCBLRyvbVmdAsJlzujPpNGtugKq4qqm79PXYCW6VkA8uLpeJRk2Tkj34eQgi04a8jy9Srdhob83tnKOMEHz1sYvb4GQsi/cTLXUM55s9Lrd4k8wLYXNvfu5Sf3ej9gXIsLYd1XDHHyJ7cByMzwsqpuKZIXcZ26utcAGe4bHhw/kAZ6/d6Qts7yRj2OJWzKmc07PAmRso3uSgNpOtIib4h8TDcBIFBBB6l6sH/e6Ck9igvD5PtW46dGocLHN5auesnnaQUo/gR8B/PVDE4655wjo/+ao+yewfuzhMoMduiSWM7PVXmw==; 31:x8wBLFD0o3BYyK1auSx/Nz3/Js90Y6okViVn5CEohe0ajE4iWI6Waffx0Esov9FCj5+nNdTq/UGugqnsBFIjwZXK5rcbpk1/8IZ0w6jv05xEMeCon+nadMgXvK4Frp9AUBONpNf1HUwWwqFR0MAyCY5oeqLEiIrrhCfC5dMu/XOwnxYt+Ux8ySu1JOrQQ/UsJBilEGJ44/UyFGOqkOnXb9cfC20CJt00nej3H3v7wAE= X-MS-TrafficTypeDiagnostic: CY1PR12MB0152: X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 20:AuB6ki+va4pUYfrcLBq/E2P7SdtryxwWjS/7NM4ZzIDTbsVMjyOuypkHksnBAxNEa/7qER46IqYG834myX6NuvOf+vNQeEuqEKcTlAoVXl8lEVVQ0hP2lBw8cJf9n9dhO0C+zTH3aiJ03ve/qyBqSeL/3UYQbWGZVv+SMDaxLZJpMvMAlN5lMyjsER6vgoQbUYkLOCmGIJ2+NyRXs/9lRmp7JbSa7tWxlzAiThlL1HSmSC5aZ8tIIqFGk0l8RSMsNbWv5hInm3FhkX22gRjBTklqgNEnVa4sJtNp5gsPAUDecr5GH/SzRdDPHnYCZMWUBgJkQ5OKcbBTJIHaFrVJseRFY4TIXqHMLImlI0gg9qjCwxZGRpkIr4uj79xDl59xUG0KTsGTRSVfMzAR5OkWyZu+M7RmYz7LU8aPoiaOifzyjNm2eltkuwMZKq8yqTT/00IIt6ULWJNjIYeB2j/PJwY2eIKoROBZwEEGYXxO+Tqq+J4AZ6JXVezphevtJbSV; 4:/uY03LswaiFHYHtm9bLf7S1Hsvrd2LjxM2d6vpDLHoiE4YQajSThHXAlqU9sIEAKpWVD+P2ELNrWxJzdEOgkSLesSTCqcwtAOtkGkFudj3sgeXcrl07qdmftCgRXMuidYrnEqzfVMTH4OWIQqABYDcTHQCSNdKWxTukUh4T2Zzfek9J7lMHn3pKMF76cmHJ2Un40vHx+bYFvFi2FBr8vY/gEjvrixr0/U8C7Ov6BG2uXTBhZNqyRt2PPZM176D91kF/OWoLAk5HKFZvaT++r7zCAqmfbM9/ZknInpgOO9X3N/aPSYT/NzHVuMLM77XqSJfXRtzdgPYKvNL6xapQA/w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231101)(2400082)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:CY1PR12MB0152; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0152; X-Forefront-PRVS: 0576145E86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(39380400002)(346002)(396003)(376002)(199004)(189003)(50226002)(68736007)(8666007)(51416003)(6916009)(7696005)(16526019)(1076002)(50466002)(6486002)(53416004)(7736002)(575784001)(305945005)(53936002)(8656006)(8936002)(8676002)(7416002)(86362001)(4326008)(81156014)(81166006)(52116002)(6666003)(2950100002)(478600001)(2351001)(66066001)(16586007)(2906002)(54906003)(5660300001)(106356001)(2361001)(47776003)(48376002)(105586002)(3846002)(6116002)(36756003)(386003)(316002)(39060400002)(26005)(97736004)(186003)(76176011)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0152; 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; CY1PR12MB0152; 23:mEJT8juRCDluOQc2tkO86v1KSpX4nvMlVYHXvPEi2?= =?us-ascii?Q?NfxXTsPQGlF0wVI+PpCiQfE5QzOKpD3FrSzpCSbTzq0nfkZjZBIrB7yNCc7W?= =?us-ascii?Q?yR9vZjPjROSvMJ11bhX00Aec6rJqKLnYG9hODngl3rFD9b4h3t/C2sCBm4oc?= =?us-ascii?Q?55CZ0Kf1hZGeK9VY9Dr4Sj8wOc5GpFvcdCp0FhFncuZftLiLZ7B3JPZYh+UN?= =?us-ascii?Q?a7K76C197Bcvq5MDQG++kIfbWcNQCaD59WMar7wwaxys3TiBQuXEfyQwz1fc?= =?us-ascii?Q?FEsZIltGD6VUgUvJkQ3NJMVaZdi+VLVb3sbBUH9Ix+oMEs/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DnI8ULUKFN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 20:WuNxdfF9cn+HthAq/VHyBAFufXlzD6qdHKDn2MuGvRrNXn4lWVqPbOLG3CpU4uD4fhmW/oa7xo/hYtjJ8XdhOnjuQm4so8MxydqR6Jx2mNhkHIHtEJQBlcLsWAtDxGrhj063w6lcX7NTFAMW5lrfjrovrpgtG015yebKjBwb/4qe8c+ZNaJyKOYiuMkJ1WDxUGax5lGSkh95jXXOkWp7gVHHfkfK9RG0VHhcHSyqzMCm7ibkooOxeJE31VO5XtuO X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 16:07:06.4779 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd606c61-aabf-4119-060e-08d56e44d658 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0152 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.79 Subject: [Qemu-devel] [PATCH v7 06/26] 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 , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcel Apfelbaum , Markus Armbruster , Peter Crosthwaite , Richard Henderson , "Dr. David Alan Gilbert" , Alistair Francis , Christian Borntraeger , Brijesh Singh , Stefan Hajnoczi , Cornelia Huck , Paolo Bonzini , Thomas Lendacky , Borislav Petkov 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 cdc1163dc6fb..e9940e58ad65 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 8ce427da7880..7defd929caa4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -110,6 +110,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