Message ID | 20171206200346.116537-21-brijesh.singh@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 41AD460327 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:33:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3256C2A11C for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:33:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 268CF2A11F; Wed, 6 Dec 2017 20:33:12 +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=ham 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 79D462A11C for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:33:11 +0000 (UTC) Received: from localhost ([::1]:57685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1eMgNS-0001sb-OS for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:33:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfwC-0006c2-SL for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfw9-0002qd-L2 for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:05:00 -0500 Received: from mail-sn1nam01on0047.outbound.protection.outlook.com ([104.47.32.47]:21328 helo=NAM01-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 <brijesh.singh@amd.com>) id 1eMfw9-0002q4-Ee for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:57 -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=Gy8TSc6rGx1QjQpnkIT4gHjb9lbLz3mP2yjoBKEQxnU=; b=GfmdREakmtnBrhMe6uz3ajc88Ht/D3HoP3rWMf3efE7FgkrkOeJNt0jwbN2mwhW5hlKxPeNRoSE73rwnQdQYUnhJX1221rwb3kH6ujO8dRBZGqw4oX8QdRd/IOAJdDoqlE+yeHDXOj19bJ2fPOMMz7mVU1DyzvSpSbptlWWJA98= 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:52 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:43 -0600 Message-Id: <20171206200346.116537-21-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 Content-Type: text/plain 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: 09907e66-8054-45d4-1ba7-08d53ce49e2d 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:bqoBUiMVyDNVIrG0ar7Rn1VUSuCZgLYLumTcTKFJD+VkqTIQXIOgh4vGCHpL4+dp1XVyPSxJCxLNMKe5DzUSi0kWnvtA2B1z3AqgHA516VWkNEzRvyh1LMMC+5PDaQP+pL/mQxhG939HPapl6JmVR0GIFHKD4444QOrWLPzmi7JruwyoWG4VhehD2mxo6emBBvV9nHSebaIGNHBmZsKF4MHcIUEZQyym78RU2yqmyzRW4ob8MfkjLXBWPIeAX/Ap; 25:OYbZwjPfdo/3xnPQnPUsLv6tHFRVZDQWrkWJKCHoOXt3LC/9qJZphZCRyUR9w2k8aymPBchXIAC7awvC6zMDrzjGmSuU7lVE0Uq4tMGuysqpXgbKYVR0/6z13D9o4E1T02ijTWRZ0htp0t8R72gdSmhv/cyNtE7VGey212Bk4kpADRZXWCjPUOWAtE0FCpY0iIjGDjOmOZgDWQ28B/Zv4RqKq/8tQcHxIQa2cts+Yfy+BJlnpBhYo7Np97fph+AojWvtHcrtXuLAxnMGUkPjyCMciGNrK/P0BNe8zcQ3SSZyTEGgh2Hm/uRCBikVrEjaT5ujeoJgF7zmUs0uMq0OHA==; 31:n4v5E9fZO2fFeA273u6DtIQnAlgGMUqzKAixaciTr/yGOwNButq1DciqAgJnG4F0+2DyLxhXQjns4CBhkSaz0vvHSx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-Antispam-PRVS: <SN1PR12MB015882D9890A0B2C51020656E5320@SN1PR12MB0158.namprd12.prod.outlook.com> 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)(6666003)(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:VtPEyhiMEX1PTriLQW8xqucftDIGkjxSrU+zWLso/?= =?us-ascii?Q?5w1AQGf1/24scB8VwNA70vb6DgHtZEQfepJ0prsRcLMyjKmrpoMWBKLx87H4?= =?us-ascii?Q?nOe+tV+mjVWof3BCyNPSbtxNsW3ry04pHnQYqJMmzLrjBnzmioDa42yYLIVU?= =?us-ascii?Q?LTEA11xQqq7oqwEALhbE+l0rY8z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CtezkVOjZnW8sIz9H0LIMMjQAbiovR5pN3C55Cl1GSkVBJawTJ7iuPJzhSEYQQX6chLgbscX/N/UvNyIatAThKkusV8ZLLXOF5FYXvTFZwnVDYZoL5vBNeA4Ibdp/EE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:G4MLkZ95ysoxfvpOBB5AqdSWVZheV4+R4Dk8Z/eSV5v0ZtJqSpZ78x+O4vk2NGhP5ymtES/9ocefRXLV2ZW59kd4N9eEbu0m678/WVey9ltmiwVGCUYCrI11E/gfECqOMRI+2T2l8mRGhdkDgyxnhmT5aZNWWgU/kzB3j7qRPgVOADgE0VUvQj1pDcURb8iVfrCgHDy2txXrb0+E23jAhg6bFujBiGWENv8Lfq9XRMBNgSI3yPqLeNKFI+0EATlv X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:52.9728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09907e66-8054-45d4-1ba7-08d53ce49e2d 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.32.47 Subject: [Qemu-devel] [PATCH v5 20/23] hw: i386: set ram_debug_ops when memory encryption is enabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: "Edgar E . Iglesias " <edgar.iglesias@xilinx.com>, Peter Maydell <peter.maydell@linaro.org>, Peter Crosthwaite <crosthwaite.peter@gmail.com>, Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org, Marcel Apfelbaum <marcel@redhat.com>, Markus Armbruster <armbru@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Alistair Francis <alistair.francis@xilinx.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Brijesh Singh <brijesh.singh@amd.com>, Stefan Hajnoczi <stefanha@gmail.com>, Cornelia Huck <cornelia.huck@de.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Lendacky <Thomas.Lendacky@amd.com>, Borislav Petkov <bp@suse.de>, Richard Henderson <rth@twiddle.net> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 186545d2a4e5..937cf75d5545 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1355,6 +1355,15 @@ void pc_memory_init(PCMachineState *pcms, e820_add_entry(0x100000000ULL, pcms->above_4g_mem_size, E820_RAM); } + /* + * When memory encryption is enabled, the guest RAM will be encrypted with + * a guest unique key. Set the debug ops so that any debug access to the + * guest RAM will go through the memory encryption APIs. + */ + if (kvm_memcrypt_enabled()) { + kvm_memcrypt_set_debug_ops(ram); + } + if (!pcmc->has_reserved_memory && (machine->ram_slots || (machine->maxram_size > machine->ram_size))) { diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 8ddbbf74d330..3d149b1c9f3c 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -180,6 +180,12 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) error_report("failed to encrypt pflash rom"); exit(1); } + + /* + * The pflash ROM is encrypted, set the debug ops so that any + * debug accesses will use memory encryption APIs. + */ + kvm_memcrypt_set_debug_ops(flash_mem); } } }
When memory encryption is enabled, the guest RAM and boot flash ROM will contain the encrypted data. By setting the debug ops allow us to invoke encryption APIs when accessing the memory for the debug purposes. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- hw/i386/pc.c | 9 +++++++++ hw/i386/pc_sysfw.c | 6 ++++++ 2 files changed, 15 insertions(+)