Message ID | 20171206200346.116537-17-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 888FD602BF for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:30:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B422A0F4 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:30:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B1992A11D; Wed, 6 Dec 2017 20:30:36 +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 DCE902A0F4 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 6 Dec 2017 20:30:35 +0000 (UTC) Received: from localhost ([::1]:57676 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 1eMgKx-0000JZ-5l for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Dec 2017 15:30:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfw4-0006Me-M7 for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <brijesh.singh@amd.com>) id 1eMfw1-0002l3-Fh for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:52 -0500 Received: from mail-sn1nam01on0054.outbound.protection.outlook.com ([104.47.32.54]:46470 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 1eMfw1-0002kO-8W for qemu-devel@nongnu.org; Wed, 06 Dec 2017 15:04:49 -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=wfcGUbLLIoam8HMkyWvshq5YncZmKREAD+x3M7gdYac=; b=Yr+0KdXWeTkP4MvGoEhvLpHTDcLXvN2kSsMNUYm44Ps1vblH8uFaMUm7cQyJ6qEwO7ZqoeMAl9lwID81ygQwCV0/EF6ibB2G13ocGGZtK1az3v53iDBUdSOoP8ylMeKLvDrFdsjqKzbFm/0a0AUd8TYPjKaomhfCJM/hJCiTG64= 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:44 +0000 From: Brijesh Singh <brijesh.singh@amd.com> To: qemu-devel@nongnu.org Date: Wed, 6 Dec 2017 14:03:39 -0600 Message-Id: <20171206200346.116537-17-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: 8bbc604e-1025-45ca-8399-08d53ce4993d 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:ijIq98HSbB1TpirjLrQKYynpS9lof+vrlb1zRaWWnSa3hxFvMTFr8J2i8S/1aGmVUmzUzT0o+DDcJSyTSq4YBG4cNjT36hpnu4hwoNJizOUq7GcHj5PvDHvsXAtjy0VpF92zUUe51iRyQoCjs6RETNq0wrXVqlfj7NuPZ5oHHYUvMV9Q/lii2dtddYH1BaAaWtBxsV6rezWtAI4363/MFMkui/c5L9idl4Zt488mHpT3R+Gzh6lKgstKTXWj7KTQ; 25:aUQRE5ppIGMtV1iU3BZynBTXdFE6SCxq1y1TJUuKNKA6nP95pmGHOdWqiaJ+JnGoyG5XstXltTsxxK7l9FYTIMbcK5Jn7gf/V8MDsHoI/CS39FtadqkhiBg0QZ4aAuz7A765HbZWRVhYY7cE+RwsfBRPZMqe+EdVj5zgzPlgNwxkr2i0RfJ+VqvCvFNBF5DOPv0NJ1YGOmLtTqmuM75DAcfTg2cgT4Swt6rZDmuHvQZ2TgZAzNhdurjk1RKil7hyZ7XxLI6ZuzhwV1xLF0YIV17G8SAkxJr/tCxvxqWir2aCJB3A7eaEkS4YzRG1TJThMe0nzTs/Epvk+KR1OB6HDQ==; 31:VSOxO1uglJj6lIHz340cuwuRxKGCt0eJ9nesVjmpapy1rzTPF937xu4fRuKTfBEUVzj/EnTwgYmC8upNxf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PR12MB01582E944B563CE11F42B79EE5320@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:1XKjLDhri1B19MZPSC6UMlqzy2RdfUYMgEu188pwY?= =?us-ascii?Q?dL5pqx/kH8tAGS+oK5drCArCfrQrFnl3UX6+0hTObr96QpRgKnOXLeRsRhrl?= =?us-ascii?Q?dCKC6v+22U86EPMrSpr1HyHbHbV+SgUyhtiKoq1dklu2sotAVfdoRG/lqHMG?= =?us-ascii?Q?0VCJZEtXVUqb2SCHMnnnkGJo7nUhVJ8rh+KNJ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vS3K88/UKctKFnLpYT/CCnfmoFG7oGzKkYqTgmR1bzsCVIbre1KAvIUMLZcwi1Q+Aic8+Nli1sfWzDy21J4ikuzdg8yeJYCAZXxksQgSxQZCn7JM9+bB3roz9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:lt1hNU78S2mbDrecQqoi6GF+YVVP6qeCQZVvzJM6mDrqeu/02Xl/8HYRAn/cO3+dsZCnwbvg7HoX5r2jv/raLuwvk5wAhhBZ1lMvbXelZYe2+0vY4FqQy+j2hO2no0uedIxv0SQ8nyPZQKjhNd/OpDnuzf7wjWrUhVFTk+smJ3uwtPCtUskpzRP4z/q+zbDubjkfVyQHZn244as/Xus32zNEOSNVPj0wQgWpWXKyskJY6h+MV26B7GVfL+d/R98n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 20:04:44.6917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8bbc604e-1025-45ca-8399-08d53ce4993d 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.54 Subject: [Qemu-devel] [PATCH v5 16/23] target/i386: encrypt bios rom 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_sysfw.c b/hw/i386/pc_sysfw.c index 6b183747fcea..8ddbbf74d330 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -112,6 +112,8 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) pflash_t *system_flash; MemoryRegion *flash_mem; char name[64]; + void *flash_ptr; + int ret, flash_size; sector_bits = 12; sector_size = 1 << sector_bits; @@ -168,6 +170,17 @@ static void pc_system_flash_init(MemoryRegion *rom_memory) if (unit == 0) { flash_mem = pflash_cfi01_get_memory(system_flash); pc_isa_bios_init(rom_memory, flash_mem, size); + + /* Encrypt the pflash boot ROM */ + if (kvm_memcrypt_enabled()) { + flash_ptr = memory_region_get_ram_ptr(flash_mem); + flash_size = memory_region_size(flash_mem); + ret = kvm_memcrypt_encrypt_data(flash_ptr, flash_size); + if (ret) { + error_report("failed to encrypt pflash rom"); + exit(1); + } + } } } }
SEV requires that guest bios must be encrypted before booting the guest. Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> --- hw/i386/pc_sysfw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)