From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.86]) by mx.groups.io with SMTP id smtpd.web11.296.1628196153424961839 for ; Thu, 05 Aug 2021 13:42:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=AGLiN7TV; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.223.86, mailfrom: brijesh.singh@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oX9wKJkyWgwZOx0ka3ibM8D8j/OznNT1rthWidKdnheZ2fSBaeOIje0tLDgniqC+oEy4g0gkgWi+PIx0qDrTpctV5tZ+33yxq+hUhGhTbC2c9+bIN0hiRXuj2+k0kLJIx1rQrL0RpNn+qhJnvTbQ5oKR+RZ2s8rMBpSu67ay6DCGkvI+62L1BfdNPunDVlBvljG5ZqJQ3c5ab0WLHiwfYEOkmrHhzcOlYoIKeIUFTbb4egWwM26FBp3cZCTLSqryxrupTDGWwGnguuhwB+LCaRF1YJRu0KG/aIAd0g3/51ZfWMJUbHXatc0nP/OQdaGtTu/emWi7V7kajPIzgprzfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Im9qU4yoKR26+MIcKtPusY33aJmca3ffhWD0tu5fD4s=; b=hYXDDp9y8VjD3TdfCk3TjHfxs2EJz3qf/xTSNwF6F7Ehs8D8Ye2aaDNp3baH6NpePBjHpKlXKMQU20RuRXXy2/vm/ydTunsBbczsAN49hpHwsJ0a7J0GEDRrceAm3Qsl4pDbRh9Qh2SMGm8PzbCUfE8NO9exBdv7bPp7Tm3CY1Cke74HvaEArgr3Vs4LtiS9IUPKe1sLKJ3vvlfOoAJBgv3Mhr0xw2EknSoN7ixRWF0aRsx00bEh1fZXOW4D5qpOCm9NI9idEZPorz9zywK2j6XlJve581fXNoUw61T2oo9PliPOUXH5X1d4TcId0po5GbI44bRf1uNxcp3AQSkuDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Im9qU4yoKR26+MIcKtPusY33aJmca3ffhWD0tu5fD4s=; b=AGLiN7TV6VOUPmR2+NE0jfMDwWDS6HqlCxADTyQZnP36fM49FvR463b3RPri0vj+x6+z9/N4NrLVOxYIRxyEzaBj+UtMApA4OCyT2Ouh/+4FtwqX1BfgiYmFDOfwTc7sPGhEZXJsjECDMeor5EbcVy16UGImsurCbVQ4Vri7cIU= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN6PR12MB4751.namprd12.prod.outlook.com (2603:10b6:805:df::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15; Thu, 5 Aug 2021 20:42:28 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa%3]) with mapi id 15.20.4394.017; Thu, 5 Aug 2021 20:42:28 +0000 From: "Brijesh Singh" To: devel@edk2.groups.io CC: James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas , Michael Roth , Brijesh Singh Subject: [PATCH v2 0/3] reuse the SevEsWork area Date: Thu, 5 Aug 2021 15:42:11 -0500 Message-ID: <20210805204214.27792-1-brijesh.singh@amd.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SN4PR0501CA0001.namprd05.prod.outlook.com (2603:10b6:803:40::14) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) Return-Path: brijesh.singh@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sbrijesh-desktop.amd.com (165.204.77.1) by SN4PR0501CA0001.namprd05.prod.outlook.com (2603:10b6:803:40::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.5 via Frontend Transport; Thu, 5 Aug 2021 20:42:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f5298fe-4514-4260-8e8e-08d958518a35 X-MS-TrafficTypeDiagnostic: SN6PR12MB4751: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gKsY4dEmIClWwo+DfmVM9Wb56tuX4pEYig5bWFH2hJYk3j4OfON/qOE7aT6PvS6edi1ndIwwrBWqUUlnNXzjDAvt0k52hZbaFBxjoRSTJj6oc7Jn3HY+jdUlJWLCIV9wqhaanK7GlV8H98WtJ6qWSy/LPPMWEECNuceV0RBj3Khskt8hl2a2YuqFIcHSCN7sb5Z2m9BoOq8fypmRvk/ltb472FH8hEKyLGJJNK3rqcPsLIVXzDEuW9I/tHfTYFafY+qSXfV34hvf5B4h0QNKXQ0SIPcMdVJUXxpBTBhhfWOt+4D9THCDQre63CkRxwZD8q/sjTGojZuD/pui73TXyg4EMa0YkP0Uez1oYDA3bswusPEJevdsWa9M1VHYWxgx2pdqsiQ3Vap9Twg0sXsghL1UJ4SiNDzUDtMZCAPWya7R3Pkcosr2rjH2XZfcqib9aoCFsFwr/FglXhhtlbn3Pi9b1zJBLkAwDSRrPsBrW4XYIVr0WORjTxkr7gtvP9fhjcSpAQjXMX228MOuFmDQro063TCzvqrtLUKIuSStLY99GxSOf8KoKrCyvwejEpA5g/QLxao8zXh9Q0MHIXQt6DDW6Dk35Sn8gM2RW8koBnhzr13klXyHmY971dG5Oxpi6febnyRRXHpRd0jABgy/ctT5TFNzV68V4KggHw8BMTPG21hQU0OuaCXqok7gByF6QxV9150Cxz96C4r+dLG8ZUYD6oJ44JZYxkSMJyRFQIO3uJYruLATHb1hnWWtOt4p7R1Woju68WDy4ZvcUkTehQaTe8kji0WsKlWSenHMZto= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(36756003)(186003)(8676002)(956004)(2616005)(5660300002)(6486002)(6666004)(2906002)(316002)(54906003)(83380400001)(26005)(86362001)(66556008)(52116002)(38350700002)(7696005)(6916009)(4326008)(38100700002)(44832011)(66946007)(478600001)(8936002)(1076003)(19627235002)(966005)(66476007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CjPT1TxqemWZ/jXRZonDZCghWgfBvizlCkv6Slm/3B+9t46XSkmwnBRgsBYz?= =?us-ascii?Q?VUTqU+HIAMb2inRDeMQvpdYAMgvmnuSvQVRnbWiKb8b0dIE3KbsPV9XY0+uL?= =?us-ascii?Q?aQCDKO8i8L6fB3ZNmID7pKuyOOYm2MwPQuycP5ogDr/G3C7cu7M3VPnenRt3?= =?us-ascii?Q?Le/XNNFiNWvFFCuGML+K9pJ2TpV3NA4ZMkKA7wJlDZjZZPPr6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Vl58J5G5oCrP5CTNH6g6shRd/PvDEJ4bKIlY3fxT2e?= =?us-ascii?Q?4y5tCZNO6r/VyuIJqj9AV03YEWH9X3Z8V/u9EuzcoEVSk+a2WB4cdGaXkwq9?= =?us-ascii?Q?cibXHrJKMT1WP1FxlDhYaeNF5tYnLyAKFEaQHLHRmgsApdapzAR56aCpBLu8?= =?us-ascii?Q?13YEiDunqehe/Ys4ypmKVBUwMWXycbhdFr5KEQqFJo++4xbMsoQL2zvzBYtX?= =?us-ascii?Q?BAaH8ix74na1rBJMpumjGSpA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f5298fe-4514-4260-8e8e-08d958518a35 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2021 20:42:28.5196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dqjnvXcoFmh1GJZIkoor9ZvNo0TIsquNJVIN+PDa/f1hbKYRZQobZyY78uFfXsFQUsmMCQN8JcA2W8ocr6tqhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4751 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Based on the discussion on the mailing list, we agreed that instead of wasting extra page in the MEMFD, we can reuse the SevEsWorkArea buffer for the TDX. To avoid any confusion, lets introduce a OvmfWorkArea that will contains 32 bytes of header followed by the actual workarea. While at it, move the code to clear the GHCB page from PageTable build to AmdSev.asm. I have used the existing TDX BZ for it because the request came during the TDX patch review. if anyone have concern please let me know and I will happily create a new BZ. Full tree is at: https://github.com/AMDESE/ovmf/tree/sev-new-work-area Brijesh Singh (3): OvmfPkg: introduce a common work area OvmfPkg/ResetVector: update SEV support to use new work area format OvmfPkg/ResetVector: move the GHCB page setup in AmdSev.asm Cc: James Bottomley Cc: Min Xu Cc: Jiewen Yao Cc: Tom Lendacky Cc: Jordan Justen Cc: Ard Biesheuvel Cc: Erdem Aktas Changes since v1: - address Jiewen's feedback. Brijesh Singh (3): OvmfPkg: introduce a common work area OvmfPkg/ResetVector: update SEV support to use new work area format OvmfPkg/ResetVector: move the GHCB page setup in AmdSev.asm OvmfPkg/OvmfPkg.dec | 12 +++ OvmfPkg/OvmfPkgX64.fdf | 9 +- OvmfPkg/PlatformPei/PlatformPei.inf | 4 +- OvmfPkg/ResetVector/ResetVector.inf | 1 + OvmfPkg/Sec/SecMain.inf | 2 + OvmfPkg/Include/Library/MemEncryptSevLib.h | 21 +--- OvmfPkg/Include/WorkArea.h | 67 +++++++++++++ OvmfPkg/PlatformPei/MemDetect.c | 32 +++--- OvmfPkg/Sec/SecMain.c | 32 +++++- OvmfPkg/OvmfPkgDefines.fdf.inc | 6 ++ OvmfPkg/ResetVector/Ia32/AmdSev.asm | 111 +++++++++++++++++---- OvmfPkg/ResetVector/Ia32/PageTables64.asm | 57 ++--------- OvmfPkg/ResetVector/ResetVector.nasmb | 1 + 13 files changed, 247 insertions(+), 108 deletions(-) create mode 100644 OvmfPkg/Include/WorkArea.h --=20 2.17.1