From patchwork Mon Jan 29 17:41: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: 10190231 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 6006D60388 for ; Mon, 29 Jan 2018 17:46:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AEA3251F9 for ; Mon, 29 Jan 2018 17:46:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F54A287E3; Mon, 29 Jan 2018 17:46:34 +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 BDC15251F9 for ; Mon, 29 Jan 2018 17:46:32 +0000 (UTC) Received: from localhost ([::1]:53667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDVo-000105-03 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jan 2018 12:46:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egDRS-0005Zl-C7 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egDRO-0003MB-6W for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:42:02 -0500 Received: from mail-dm3nam03on0055.outbound.protection.outlook.com ([104.47.41.55]:53115 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 1egDRN-0003LQ-W4 for qemu-devel@nongnu.org; Mon, 29 Jan 2018 12:41: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=gfCqisrsrsTY0pt8aBwDEHypK5iwrDb61Xp3GAfOYkI=; b=SnudTwSgiC6ohEYUdUEs8aiyH1oZhPhZGuQ0gTDu6uVFDmWXsgx7XhAj4pxcfT8f8wg8aAw5F2dgEbsddVgua/tnqTMMww7mtFAXl12hGV4G0DNHcg9aJML7oVd/bL8ReH3CyelnpAe2ofBOkoMrZXVr4/KmGAARRyTdJDKtQUg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 17:41:54 +0000 From: Brijesh Singh To: qemu-devel@nongnu.org Date: Mon, 29 Jan 2018 11:41:15 -0600 Message-Id: <20180129174132.108925-7-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180129174132.108925-1-brijesh.singh@amd.com> References: <20180129174132.108925-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR17CA0018.namprd17.prod.outlook.com (2603:10b6:404:65::28) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 763bc64e-b0de-47f5-4165-08d5673f9759 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 3:vniT9g2RZ2hDoITetYE9hO4yqLq2M8OqUE/uwnoCtFOZtoZHFRhTJl1Px/DLkgtLklyGWsLgwzcD0XqkbJcqvLcOg63YWBJZRPvgstVLttIZ50ww07vHJfbaTH1249TL3xRIJXd4wYJ1we3hj/67bti3RkDdDvOiA76dSQ+z6LGqxUhuVcQq+VugZJ3PcP63krLCDlUZvB93gpN0b3Z5vwugB8qfSc4vMhJPPdRMN+ggYb+2qpuLgK3nYSnhiYCQ; 25:ETfvvkEiY1i14TkWVYLSwTMVBV90uLehmYUSGF94fdbVD7E5UWG6WzSD3dzqtsqT5LYpNGzS5QJfJTwn9XH/tc6hE/zQAzw9tEndkTO1LC4ylmLv/f1Ondj/kq46i+or23GFRb2A5YIpIJ0zuuGunqzcZuQOtjVFDJjv090ToChGJtQHHawUvrvKsS8q4wWxlNEq9LeqDh7gtoQPuYOZIqzkCD6iiZZMwK9M7ATPxY8m2AGubjB4l60AODqIfStK38fWUxgT0iP64T8/tuuE1ePh27sopkuSEUc9uo65O8tD7zHd2vKGPmYnevaf66+YSmphiXeSsBWEpU9xgJOWmA==; 31:wQFljx4sWiJG3CWagQJqxXKMl7zRbfRs15tyjHf56vA+uCZW6Q3VKPF4SbgmsknXfepP9r/FLT0dZR6lUCDGwG6cmXiCYRiokhXpZErTi8Z/yBD2fd0pEEWLkOXcttZOL0oWQ1N/s57F3NgZoS7OHyHw+vJskDl7TqQlHz/YD0biJor2M7Acqb+r1CjdNGgBc3EFOPk25W69NxK6NLtpfvOLvircJNygMEg3zBl6hXU= X-MS-TrafficTypeDiagnostic: DM2PR12MB0154: X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:o1FdfDO7GT0oHHgLAyNRXjiwz5eh+JlG0VkWAVUExh8syqbpdVVXrVaxBtBUUHU6dj046zXvULVXiBWeIpVHuAz2hPzQt0KCN7kfWSrIyFhXoZyJwE4SAhvEY/xLvDsG4rxZg1Rn1vaMetC/B5f9QEAjjTW8oZV/rk+ou2cSAhnXwzrRKXfgD6SyrbrlZojfhVAk0ffk7E64N5g7HRZ5txWtzrzNeQuumT3j2cMCAkY2fzFQYdkGWG1ofUfYW8vqXEC4SSq9C/1kGBTyPMNZvbS6rgZUMyMYlsd7T3ZR6SnZF1r/OyFIr5Xw+3WSFTpHvfmZKWb6kjdEozKmYXYrRmZHkxoe8Twi/zdPY/dByFKq95gMS8X+LR0cRiX7Xk/tqt1O2CVqLbkvqTWQRPfmN9xlUMgwvrjP4Qm2c/brZJ9aqgAFZ4vOsNfLIh0k9tqZbFDfV2GQroT7UYKTk+gdaFl6mZF0bRA07K71u2Ifv6VZJYsJP8DtpSeNQpfyXjJk; 4:TqPmp8aZHjYy7Qr+dG6hfnNRYTztHONowX6XuWZRxlcIOuxX0xJKOTEtDL9nPtMhpLW5o+uTb+fV6hcheeMTrgG6ywu7S0gOT8ZWzPClPLkQzMA1ywdROFXezyRH/K50uqibuqtpHfkQZFZBPRLRPFwyLD8PSHJdciU8HNWpht66Y8caJbCcFmz1hp7bwl26Hzfuz6TnaRLvlIYCNve2nlErXMUy4oIDjsMDpV7qoCKLYCqOuwprJHLCkZ1rhH9N/Qd0yr9P09qjCeyyhy/9xme2Dqgf0mL3UygfFwpOOg6vQbX9CggtB3p7RQ37GbGBm6D0xI+UyTgH32fkfP9/BA== 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)(8121501046)(5005006)(10201501046)(3231101)(944501161)(93006095)(93001095)(3002001)(6055026)(6041288)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR12MB0154; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0154; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(39380400002)(396003)(366004)(346002)(199004)(189003)(48376002)(8656006)(39060400002)(4326008)(6486002)(68736007)(36756003)(478600001)(26005)(97736004)(16526019)(53936002)(386003)(50466002)(86362001)(575784001)(25786009)(8666007)(16586007)(54906003)(186003)(47776003)(316002)(7416002)(305945005)(7696005)(105586002)(106356001)(76176011)(51416003)(2906002)(81156014)(66066001)(81166006)(8676002)(2361001)(53416004)(3846002)(50226002)(52116002)(6116002)(2351001)(1076002)(8936002)(7736002)(6666003)(6916009)(5660300001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0154; 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; DM2PR12MB0154; 23:fx4BKCe9ylVOBE5hcWu8xhcuec3/l1rFnKtFdSwaT?= =?us-ascii?Q?sMdTg1wW9b+smut03DmzLEz5Iwer0fpP7NB/WB7cfiZsu2hPsC0XSFOl7Xgj?= =?us-ascii?Q?+PF0TWhlHkX4a59dRDOAzWZhxJYbZA2ZdENXfoHNaQ+K4aBB6iRDd7anoiGx?= =?us-ascii?Q?urV3an5X6uljyfPbkZeE6o9T+Dh9GcQjCvTwt7T4fsmCt+A7nTA3F89eoWtn?= =?us-ascii?Q?oa1gmiV4rFIEyJUuVMuv//XD6ng+cPdDsFt+0VLyTiOnZR5HwvmtqoQ6cLNs?= =?us-ascii?Q?AyjjgybOzyVFl2AKtLupJGhLYooDOnP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+EEEI0FjeqAoD6MmTj1h3S6QGz4Vet/3vCi0TKAYsZf4FEddZx+NJOro SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:Jn3TdA6VdipsXtTru5IBoTuanlKaUK4nW5yVHg4e8R2WWtk/RC+vWO5WmLuYqV5e8ny46FcSukWX9VN6YYeDFAuyu7FiJqhxnvaOuXgD5H0l5B1PVzRYZBag4xE3YmB4wRrR5n/+IWkXMbz7uEru6lC//ibTjoa5grcrAhkfdkIAShtZvkenYmxjDUYBGPSKoRn+bHDFFFnuKsRwWD9dQPQJi3MNB5bGfLC3tkcPA9SH4ZUOCO9LIkd0xUbTvC8i X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 17:41:54.9009 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 763bc64e-b0de-47f5-4165-08d5673f9759 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.55 Subject: [Qemu-devel] [PATCH v6 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 , Eduardo Habkost , kvm@vger.kernel.org, Tom Lendacky , Stefan Hajnoczi , "Michael S. Tsirkin" , Richard Henderson , "Dr. David Alan Gilbert" , Brijesh Singh , Marcel Apfelbaum , 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 | 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 1d73fb151d87..bec3490d7b8d 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