From patchwork Tue Sep 13 14:50:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9329475 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 D35B2607FD for ; Tue, 13 Sep 2016 16:54:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C27BA29574 for ; Tue, 13 Sep 2016 16:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B73902957E; Tue, 13 Sep 2016 16:54:37 +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=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 8213E29574 for ; Tue, 13 Sep 2016 16:54:36 +0000 (UTC) Received: from localhost ([::1]:50261 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjqyh-0005jB-MI for patchwork-qemu-devel@patchwork.kernel.org; Tue, 13 Sep 2016 12:54:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjqTT-0004P4-E7 for qemu-devel@nongnu.org; Tue, 13 Sep 2016 12:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjqTN-0005Ko-Ab for qemu-devel@nongnu.org; Tue, 13 Sep 2016 12:22:18 -0400 Received: from mail-co1nam03on0057.outbound.protection.outlook.com ([104.47.40.57]:9075 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjqTM-0005HZ-Vn for qemu-devel@nongnu.org; Tue, 13 Sep 2016 12:22:13 -0400 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=gPFjnuMygJ0XNfWZ3ybUVBy2doCcH7OklvTc4/Dx1iU=; b=WFr1H+QWBhLZ110x3AaKiKvFSJTYTE40Fa4QD9+KN960MhYevXor3tXeCkG7CQqbAyvIRSwgYRkqO1ImA8Z21iwmN9xO1X1FXa6zs/LT0IcFXah819S6x7szPEt6LnBPAgFm+J80Fl7HKGmyNYmivB9YvKOIGgJiWbM/SogisjU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [127.0.1.1] (165.204.77.1) by BLUPR12MB0660.namprd12.prod.outlook.com (10.163.217.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Tue, 13 Sep 2016 14:50:29 +0000 From: Brijesh Singh To: , , , , , , , , Date: Tue, 13 Sep 2016 10:50:24 -0400 Message-ID: <147377822450.11859.5845767550630184079.stgit@brijesh-build-machine> In-Reply-To: <147377800565.11859.4411044563640180545.stgit@brijesh-build-machine> References: <147377800565.11859.4411044563640180545.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN1PR01CA0042.prod.exchangelabs.com (10.165.224.52) To BLUPR12MB0660.namprd12.prod.outlook.com (10.163.217.30) X-MS-Office365-Filtering-Correlation-Id: 1e6ada2f-b8c1-4f9f-2b82-08d3dbe54e7a X-Microsoft-Exchange-Diagnostics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qg6e4itYHqUwfXvtO3A5bfzAJcCYyJdhHBAk683Y8WHcCWV7cBzvU76S66EkaHsP4gi9KajB8J17HmLCzz4ZpmAF4NaZoTnqdohW8p8o2aYS+6cIKrpu2w4hhJkqMz7JXqteJMnY+clZRdTOe4bhdhTsmY/w/w0zW197YqD6Z6J9k3MDisaxF81VKbLUwFvJybzz/qvl6ILa7LgiAmvLBaKRACV5CFHIkTjDn01o4F8YV0W6xuUN4HFdKl4v5LMYMyj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BLUPR12MB0660; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0660; X-Forefront-PRVS: 0064B3273C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(7846002)(586003)(47776003)(6116002)(7736002)(2201001)(66066001)(50466002)(92566002)(5660300001)(33716001)(575784001)(230700001)(2950100001)(2906002)(5001770100001)(189998001)(77096005)(4001350100001)(86362001)(81166006)(3846002)(23676002)(42186005)(97736004)(76176999)(19580395003)(103116003)(101416001)(8676002)(83506001)(81156014)(107886002)(33646002)(305945005)(54356999)(50986999)(19580405001)(68736007)(9686002)(106356001)(105586002)(229853001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0660; H:[127.0.1.1]; 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: =?utf-8?B?MTtCTFVQUjEyTUIwNjYwOzIzOlR3Tmg4Z0JDOVo4SXpEME9XVllmL2R6WERL?= =?utf-8?B?bi9uMG5lUE1XTk83UTZtMEhGYkNwQWRmbW9lREpMMUE2VVpZYWNqNTdocHp2?= =?utf-8?B?dDczU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utz8sWmUsGzohfnXC/IG3kQfahrwssKcdtlCwZ2kjxNxRNcCS6nGHSfCXD8LYmEHJJslxZxZ/Qia9BzaCGYRNTlozOjFUaQaPvhapJrViyaWRk0fmtX1IrAALKRPFWuX2G6Jjx/OUvxU8HRlJz9w==; 5:flwj2TX2N7l3j/jHg8za7JwtpJnf0+vTzyWD8t3l3tr1ScrmEECAD9xqlPjmdf/Y/lPqTH0mI6IbWp4xxolK33a0lJ5ewGZaW90spD3zbFjtcA5i/794Vvz/VMHbIKvvPRqlG9Zb/kMoku6jbbx3vQ==; 24:YcaNdEfMZ4hYMmdpDfcfhdNkpk/aCWNVCFK3IIk2hGTgiqRvvUWzL6g6B+U4bbYi99dwmH6x/Fe6qbwl8p8eHmZOzg7UxlZ/oPkGSMcIb24=; 7:kEhDltW5IXL9U/XhCUaLpE5+CqSGplyJ2qvbZ/l9mKZJ7t/wwnvm7ueWyMxEzwvNru1GbH2y/hHyP0MztsR3D7+kxn9tpF/Nk/gnvDvz0vHHRpB+WT0Bckgbs3IIEF3jGwU9PFuaAPTmnkeLHOzn6spYUfKvbyzelvLbv+nM12dOUk5zrfbG4kX18k+zdonPMCqMPxeqmQKQ47ESOcnpAOdk/xPalSEjruKO8iZf4LCGS2svEZpRo2KV7qOmdvkN SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0660; 20:kogEhBn8lzh0mUaSb2ZhFkt8oCBVlJMhASi8jMjxEwRK1Md+5YnVU/arVmTNCDgsLsca0GreEJSkhZU9rtboXGKlnhEwezgtgjCcjwo/riO5T4PSOEmYkYKuoxzHjiRJihPirsaSLsIWzPd0zeF4d1HskL742Is2DPv/DnQVs88XVyglUL4mpE7ZMRkLjDuWxec6/RlSpc4gNCaw3D6WV5xCd4Y4vRd99s9bj2TPUi9yqC0jTy0fbw6RnFJCqz0X X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2016 14:50:29.4970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0660 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.57 Subject: [Qemu-devel] [RFC PATCH v1 22/22] loader: reload bios image on ROM reset in SEV-enabled guest 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In SEV-enabled mode we need to reload the BIOS image on loader reset, this will ensure that BIOS image gets encrypted and included as part of launch meausrement on guest reset. Signed-off-by: Brijesh Singh --- hw/core/loader.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index 53e0e41..9b03bfe 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -55,6 +55,7 @@ #include "exec/address-spaces.h" #include "hw/boards.h" #include "qemu/cutils.h" +#include "sysemu/kvm.h" #include @@ -1011,7 +1012,11 @@ static void rom_reset(void *unused) cpu_physical_memory_write_rom(&address_space_memory, rom->addr, rom->data, rom->datasize); } - if (rom->isrom) { + + /* reload the rom on SEV-enabled guest so that it gets included into + * guest memory measurement on system reset. + */ + if (!kvm_sev_enabled() && rom->isrom) { /* rom needs to be written only once */ g_free(rom->data); rom->data = NULL;