Message ID | 20180228211028.83970-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 468DE60211 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 28 Feb 2018 21:24:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32E6528DBF for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 28 Feb 2018 21:24:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2754928DC3; Wed, 28 Feb 2018 21:24:18 +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 859F928DBF for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 28 Feb 2018 21:24:17 +0000 (UTC) Received: from localhost ([::1]:47025 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 1er9Cy-0004U2-8y for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 16:24:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1er90Q-0001Qh-0o for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1er90M-0005vV-BZ for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:17 -0500 Received: from mail-sn1nam02on0081.outbound.protection.outlook.com ([104.47.36.81]:17351 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 <brijesh.singh@amd.com>) id 1er90M-0005tr-14 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 16:11:14 -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=2DFtgqwVUgcxVVo6D8Y4SyRXve2OmdSb12VfhrX6DHc=; b=EcqJf8ax9Gfr1/CQYCdlW4itZEspVMRqKTaADR4pbuuHoIHqniFR44FAjBhPzI8QNRlIE/nhJlP8ee3onFCEY4BFnlLrRpgi06V2hrQV9r9g/rm3RPe0j6LPYau+04Qw32rUyS1hjp9Yl7wgWelT2uV9JtPxX2+Ey9PZ/0RChII= 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:11:11 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 15:10:20 -0600 Message-Id: <20180228211028.83970-21-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 Content-Type: text/plain 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: d6b3798b-c898-4921-0c3f-08d57eefcbf9 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:FGMjAjBal7X5ftLUO7H7cZnZbVx7dP+LYPQu0x5JhztK/cTBs1AnFnCjnkiX0d7D8uZcf6etw7+vLeGyWJAi0AAmZ+7RA1JWzLSnl5uQFT/UDPOqP+1qosO3HoPPYzSl1Ra74HwCb7QEm0g7Q7qNymMpRHnw5K1YAGHdVfZPkIYy30BmfMBZ8qY0ZGmcqPOg5G9KdwbkKG4982zLprJaVxmIGdHbfH/FEDxr9kr5Jfg+o0dSUE2Ev1m4RF9K3EmA; 25:U5B2RC3KEZzzz7LSTQVxRSuBBu0xW47cHATkaXhIz9+DHlNXa9wnn4JhZHHDX+N4cePCpk7Hh/BWxwGRHOmWtm4PteZSLrs3qIukEB8j+Mbkn1TlxJDKRAGLBxpYmaUnPFafZV3Cyv3L3fQviMdPlXBvt4kVUhEMzhgP8+Rd84x1cVQcBhL0q428ajKdDHqGnctla6PwDWwXNTzO3qHgGlHbiWFKJAyqy6m19SyBmHyLHOEVWZ81q5HPQTkBucoxSODR37TVU+Fuar5riKBnMUPjFI3T1o006J6Jor5d8JaxJ0UtW2bLs5ueohL+XP4ffG1QpT9atponHFUlIqfUmw==; 31:VNp7aFRpHJ41iFL0UXxKYr5fIFYPknELJGTYy54U/L+Vqkc7ZyQ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gZOGV7D1rCv7tfmm7 X-Microsoft-Antispam-PRVS: <DM2PR12MB01556972081FE18B130B9919E5C70@DM2PR12MB0155.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(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)(1496009)(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)(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:tQTzEebpmZiF2s3fbgV2Eq90p03U8L0mRO3a/OyHb?= =?us-ascii?Q?KQrFywTXzI2klBKLyL/zMIZQDeN1SgAI7qqR6HbYKV/AkOPm1plMz4mRcAwE?= =?us-ascii?Q?Gol7HfMNFt163guBvuPW/hfjURs1faKWNWS9AhLNXF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H5NtX3ZMEfyW04upVC9LxPa3UwTP5whbuOU2zY87f0kIqJ4lSuLQS6OphainMgFm7Ejy/h5P4tSP4OVnBXShuuqBNqe3v+DTmcBvX6qKvWutS4Yx3LqzZuenOnE869dW3XM3H7dGuet8EJUtA3hDjs1Qw7x7gap78bn61NK5TIU4n/k887fjHbWsK9QNNtdSCAmkipwfMClhOzDvWDOUV96rL5JvebA4AN0pl2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:yCUdXhunuGZdQugtIN6qmU1gqzTTgwahO0TapeuHtLxAOYMzc/LQHjBqIalNkOBjh0/263W++rzhWSmYc/ZGOZWBqVTFIYoB/0T7zMwResBkqphSvUGPQV7nRRLzLYIWm40oyFfCatzZHlBKNTYLkxEhLyVJj+6zbKRFhqSwRsf8v2zGcUmhX3RfW0gporxcbNHQLiv9G8d3TyPEdZo5ATgHvDUa4BN4hRZ3+D+W63OI2CfptkYWJFV+ckKiLfHb X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 21:11:11.9204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6b3798b-c898-4921-0c3f-08d57eefcbf9 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.81 Subject: [Qemu-devel] [PATCH v10 20/28] 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: Peter Maydell <peter.maydell@linaro.org>, Brijesh Singh <brijesh.singh@amd.com>, kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>, Stefan Hajnoczi <stefanha@gmail.com>, Alexander Graf <agraf@suse.de>, "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>, Markus Armbruster <armbru@redhat.com>, Bruce Rogers <brogers@suse.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Marcel Apfelbaum <marcel@redhat.com>, Borislav Petkov <bp@suse.de>, Thomas Lendacky <Thomas.Lendacky@amd.com>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Alistair Francis <alistair.francis@xilinx.com>, Cornelia Huck <cornelia.huck@de.ibm.com>, Richard Henderson <rth@twiddle.net>, Peter Crosthwaite <crosthwaite.peter@gmail.com>, Paolo Bonzini <pbonzini@redhat.com> 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 55e69d66fe6f..53ddecef369c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1360,6 +1360,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 73ac783f2055..845240f97293 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -181,6 +181,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(+)