Message ID | 20180207160638.98872-20-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 54E5E602D8 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 7 Feb 2018 16:39:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4206928BF1 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 7 Feb 2018 16:39:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3506228C93; Wed, 7 Feb 2018 16:39:48 +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 9983828BF1 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 7 Feb 2018 16:39:47 +0000 (UTC) Received: from localhost ([::1]:57061 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 1ejSl8-0007By-PM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 07 Feb 2018 11:39:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1ejSFw-00065f-TI for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1ejSFt-0006zM-TO for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:32 -0500 Received: from mail-by2nam01on0079.outbound.protection.outlook.com ([104.47.34.79]:51968 helo=NAM01-BY2-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 1ejSFt-0006yU-DV for qemu-devel@nongnu.org; Wed, 07 Feb 2018 11:07:29 -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=+6M63//2D5V5ukYk4+rYQrN4+KnIUqM5/Q/aWfqWD+4=; b=gM2yp+bumaXHyxhrYyqPoDFUHf2gRp68oD3Ziy9N3e8nYqJBLm0IvSQ6QM8DLAlidWSqMZby/foPNuP9eQZqPT8ptfdkWymZCFNFtWnYKBO2oM3We4diOGMhCgC9erFlARGuKLW4yTdjuYRIXp04muCpHoCoCttyjHOAVXnolW0= 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:26 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Wed, 7 Feb 2018 10:06:32 -0600 Message-Id: <20180207160638.98872-20-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 Content-Type: text/plain 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: a6387184-6de3-4e65-dc8d-08d56e44e243 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:5ZwwkmhB6xawN+jqg74JcMa/BOp925QYcC6XwxrQjEyTEfzMNdmJCZZDeMAsyTXCWv7GoSyoaWtwEit9B8p0ZfNXBCkiTeHX8iDF8BAK1pGHu3ryp1sZeLKegzJq4//npkMVIAgIOy0QdoyLFNFi4PGkn6GS3GfN9hawhC/IukWRiJWvcc0lcX4y5T/hIFrCGUYyLgyKWosPDWL31q68Sm97dXCaKn+tP/eedqeOfs30R+KxVRC05ajJiQurXfyZ; 25:+kZqwH19TBmkyy3GH4H9eN8pJuUxKrn56h7zhF9PRlQVdd2Wx4JV4SeeBzjF/LY0RyxZU32Sen7GX+dXifGCjvdCtTdXpD6lYt/xt+MKwLEOcEogJotez9cKnWFiyN+2oYx9HT7lq4Cxvh5/PoM+i2BysfAMxjNHJAEapcbrbyr/lnAQwcJbYL7YdQ2Rgg4bTY6SsUA9jM42r4EMYS/rP59lFc7WgFWPhbOrNlE9b/VazKml6b2ws50kATOzgnUUzTEDsX1nfuU3rqXlMNi6h16g8zvH4ejnb5b/c0qim0Ot9TdcqdGwCa+Q/j7XJwR4PyaKFnyrKkQ5LCE9+2oRSg==; 31:PssMENTUvgVXc1fYdQIiW4zWvdqe1/Rq5wZSRsvz37V/0lERqe9agcJex2DGoPOt44mg1TGn+r4nhkQKnw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-Antispam-PRVS: <CY1PR12MB01528540F81AA0449C93FB63E5FC0@CY1PR12MB0152.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(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)(1496009)(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)(59450400001)(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:RpTfCUYfh3PoRAXxrQg25U4A4HnIzAn8+1LzG+fw8?= =?us-ascii?Q?rgpidXKs2ixcsoh5FK235Vlrn1BKzoZRsWHizItC1SZG8PRaIeBhv66uAi8V?= =?us-ascii?Q?phCZoDSkJp2+jfCdMKFJ66G1/kPbru8lz1QpEl4+VLTgn6smDoBfVmeITvfF?= =?us-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/6LP6tYQ89oL09fQkOU9R1Y/DKJtS7Q+5BpXjJxN13yOf297WEyyfUHiFHKvKD0rE7qMrlc/+4hQOg+JMME6NYUrJX8LGy16+j1e6RIX98Rnzah2VbkRnwT2LHm6soOXlB3Aj0Hp1PuPmLeHy1/mVXjCSy9s+wvdP1UmyTf+cE4uaiNtRWkaJrf3BgQIabXlqtzg9LxqMXnYuAKbVxvurC4ROwa+5hFnRUt9z0OO+Qf+eLFiAz5CqFJk94woWxkm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0152; 20:1Ob2J+qQqdbTuI/fg/W2qDoxWQqZMURUhDha+Du41kM8qJqzEG2Xiq3ebYFFDalXAkzb8JJNcOjCMgFoxxKCCfm2JEPV2N+g6U/txqYmRa218xsjF8S+Pagme+2DKlA5ICPFRiONooB0S1SLyUkFera27Zh7E2VQGyxh8/1UzTdd/E3Csd8QEtTnEhK7XPfEdmRQLpwiirhSkngy4PWs1nbHZDeDe/sNHT39e658joQWGxHNLG3YosTG5XteofTH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2018 16:07:26.5878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6387184-6de3-4e65-dc8d-08d56e44e243 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.34.79 Subject: [Qemu-devel] [PATCH v7 20/26] 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>, Eduardo Habkost <ehabkost@redhat.com>, kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Crosthwaite <crosthwaite.peter@gmail.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 ccc50baa85e0..ba451c0dc520 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1357,6 +1357,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(+)