From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 227B1AC127C for ; Thu, 29 Feb 2024 15:47:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GboumSTa5dS+nTiUlJKBL3XExqWbORT0GT0F0bhWb/E=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Message-ID:Date:User-Agent:Subject:To:Cc:References:From:Autocrypt:In-Reply-To:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1709221671; v=1; b=OTsHHgrARpMF70u8RuQx3xyzFUsYpdIlM9Wh7RBYKHnld3SicqYMZkIt9UPImqU9c2lnGYSS zJHuYQB3DOAOZJGylfLfdlUJxDalrr76GuLxcySttbfId7RId6kMkNX21u+1P67PyQSFLYXFyHk lBLQfiFrrBH2DUa30DjLSwcw= X-Received: by 127.0.0.2 with SMTP id EnwRYY7687511xPiN1BUDF45; Thu, 29 Feb 2024 07:47:51 -0800 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.56]) by mx.groups.io with SMTP id smtpd.web11.28250.1709221670994811135 for ; Thu, 29 Feb 2024 07:47:51 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9rCCB5S+IubeY3naLquVdb3IfP53K9FWkJfJpC/CkEZQOA2+gAI39w2Ml4P1Xhw/+uOhVKEqP1tS5/2usi6SXjXwAS50nCrMVCVVApLkU28ceR/LBYUxrsZNDQBXcqxBJrpARiSw/klPkfrA6m7ZxABhMTlUPVGG8YGn/aVF/IeZVVHrF+UMMYzmbJUCGSqP36OfoFEDbitzVaIwyUKcK4rSz2o6mEDtWz0aoBMp/ecrJKjDiLxIiAQpU74n9GYRP+1e1ndcnlPpiSZV8wPjgEJwx0Jy5OYhzw6xLVGnqrUOZkVu9JNjg7VnmSCUo8buzBPCsnFpa1yBEpBEDbZRA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6oSgvW/gt0h/agCi5SvRly6FZWHcl+fAk7xecU3ZU8E=; b=jjANJkWfaDDONCy0SsWJXUA9Dy7VwLj7I3kDesyeEY++OV+DUym+5uSTFvlOL/rMV52Etyx35WdFSdOSIvKIwaXl6J2E5sXdEKe9ThBvULUpZ+h07yxKn1LfKj5AQAyz69a/NwT7HFEbNe2uTgGHbPKWC+ibbnK4wYzMHctBpNZqZWBjbmBJH3e7A40ZZA3Nh+JlWv1Dv4m5VKbc/bRhz4xm+z3QnKe2/lzEfZ6wjTKs7ZrouYuNOhWdYq+YnniZW/hTInX07hYh2y/vnpd6texpMKzFHEncinwk61wn1ENew8Rs2/hd1I8+9DuqQqpB5JqmwWRz8RpoRNCUN4xeNw== 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 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by LV8PR12MB9333.namprd12.prod.outlook.com (2603:10b6:408:1fa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 15:47:48 +0000 X-Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::4c26:40af:e1fd:849e]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::4c26:40af:e1fd:849e%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 15:47:48 +0000 Message-ID: <36fe7a48-6f54-479d-8261-be85f0c7f29d@amd.com> Date: Thu, 29 Feb 2024 09:47:46 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH 09/10] OvmfPkg/ResetVector: leave SEV VC handler installed longer To: Gerd Hoffmann , devel@edk2.groups.io Cc: Jiewen Yao , Oliver Steffen , Laszlo Ersek , Erdem Aktas , Michael Roth , Ard Biesheuvel , Min Xu References: <20240222115435.85794-1-kraxel@redhat.com> <20240222115435.85794-10-kraxel@redhat.com> From: "Lendacky, Thomas via groups.io" Autocrypt: addr=thomas.lendacky@amd.com; keydata= xsFNBFaNZYkBEADxg5OW/ajpUG7zgnUQPsMqWPjeAxtu4YH3lCUjWWcbUgc2qDGAijsLTFv1 kEbaJdblwYs28z3chM7QkfCGMSM29JWR1fSwPH18WyAA84YtxfPD8bfb1Exwo0CRw1RLRScn 6aJhsZJFLKyVeaPO1eequEsFQurRhLyAfgaH9iazmOVZZmxsGiNRJkQv4YnM2rZYi+4vWnxN 1ebHf4S1puN0xzQsULhG3rUyV2uIsqBFtlxZ8/r9MwOJ2mvyTXHzHdJBViOalZAUo7VFt3Fb aNkR5OR65eTL0ViQiRgFfPDBgkFCSlaxZvc7qSOcrhol160bK87qn0SbYLfplwiXZY/b/+ez 0zBtIt+uhZJ38HnOLWdda/8kuLX3qhGL5aNz1AeqcE5TW4D8v9ndYeAXFhQI7kbOhr0ruUpA udREH98EmVJsADuq0RBcIEkojnme4wVDoFt1EG93YOnqMuif76YGEl3iv9tYcESEeLNruDN6 LDbE8blkR3151tdg8IkgREJ+dK+q0p9UsGfdd+H7pni6Jjcxz8mjKCx6wAuzvArA0Ciq+Scg hfIgoiYQegZjh2vF2lCUzWWatXJoy7IzeAB5LDl/E9vz72cVD8CwQZoEx4PCsHslVpW6A/6U NRAz6ShU77jkoYoI4hoGC7qZcwy84mmJqRygFnb8dOjHI1KxqQARAQABzSZUb20gTGVuZG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wtPaShqnRIE7HhQPu8Xr9adirnDw1Wruafmyxnn5W3rhJy06etmP0pzL6frN y46PmDPicLjX/srgemvLtHoeVRplL9ATAkmQ7yxXc6wBSwf1BYs9gAiwXbU1vMod0AXXRBym 0qhojoaSdRP5XTShfvOYdDozraaKx5Wx8X+oZvvjbbHhHGPL2seq97fp3nZ9h8TIQXRhO+aY vFkWitqCJg== In-Reply-To: <20240222115435.85794-10-kraxel@redhat.com> X-ClientProxiedBy: DM6PR06CA0096.namprd06.prod.outlook.com (2603:10b6:5:336::29) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|LV8PR12MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 19b6751a-cba8-48b9-7bd3-08dc393dc789 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: qKl27RxuCizR0gTTQm0Z2bxVhj0ZZ4BSvEy6b+BNPc70F5Xske3qcDhdiUI+2MBuLxmwOmE1YPUk8HsCGRlQ1aPAaJCBj4Sml1rHHKzuyhxS+RdeKKA6t8XEUk+r05GlR3bH/A+apjdqkv2pOMeXZkrm9eXXnnryqoaFut9uMhGIAhQGi7K2JGU/j3Sw/uOzNn1qNkfSPtRv/1Uf6/uSgD60jIT+txDgaGbOvRVVdni1Adc4fojnZWpb5I4oRjMN3SELkpKjroYO78RQfFAW4ymRy4wLI0CDFF835ErJhhCChGh/OxtElMXanhpt4WUfx7gU7LLRTcnc0huKOYxlpzAurbELCbMX4ZvhlEOCDaql2qBSdF8HhNU6o7f5kTT5oxQ0Ukr7HmzIFxQIVpUOSGCF9FdNN95WBe4Fwfv125I/5tY+xaqZFf3cIwVywNLBDAt0HhacwPAjnPtJxM2NSIwePRQmlNYy7EvQIdDeJTkeKcmi8N+Ac6B+yn2x/gOzfKCi6KYnD73YfY37XgNL17Z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FQWJF?= =?utf-8?B?VXBIVStpM3F6SmpUYXJsbXZXQnFuODFwNkJPL3FpOFljdTJMT0tUNktQWnZn?= =?utf-8?B?WVgzTVhyS0dBM0s5SHdnS0hweU01czhKNitRRzRXWnNJZm5VRndlSDVkaFYr?= =?utf-8?B?L1djTGoxU05rZks4NjRVZndwbDJEcE51YnVOaVRJNldmY1k2dkpESWtPRWp1?= =?utf-8?B?STllWXNCbzNZOG9wa2dYK0FoaU15TzRxdmROZk5oSjlMVWVCZUpYSGw3V2tl?= =?utf-8?B?c2loZnNyUFl2akF6elJldUcxajhzcWpQZXNzUlFKZ1N6bTVyY2pKOHZWMFNm?= =?utf-8?B?NzhadXdpYWo4UmRTV1hwY2JhUkZNbVJQRzRiN2J2cVRvOVYzalE5TTZFTi8r?= =?utf-8?B?TUJxcGVYK2RUbUZ2aGpmcHh5KzRRa0ZHQVBwaGVya0w1UzBOSDBuN0ZLK0Vr?= =?utf-8?B?K0U3aGphRktwRGZraTZ1ZnI3bGJhRnN6bUUzZmxHcENGbVVrRnNHZ0dwVklK?= =?utf-8?Q?957WY0vJLZ99biS6dIJpvhYWZ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19b6751a-cba8-48b9-7bd3-08dc393dc789 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 15:47:48.4409 (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: 08mkdqEo0/eDNbUfcYvGUPf+AGMLUjBv+mA0rAEXTOJn9XT+9nHkBc58u2ERk2wlKAyVcE5x3REsvCeqJLoneA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9333 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,thomas.lendacky@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: dmpU5dSKXe1YbOrdguzEddsdx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=OTsHHgrA; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/22/24 05:54, Gerd Hoffmann wrote: > When running in SEV mode keep the VC handler installed. > Add a function to uninstall it later. >=20 > This allows using the cpuid instruction in SetCr3ForPageTables64, > which is needed to check for la57 & 1G page support. >=20 > Signed-off-by: Gerd Hoffmann Looks good, just one minor comment below. Reviewed-by: Tom Lendacky > --- > OvmfPkg/ResetVector/Ia32/AmdSev.asm | 12 ++++++++++-- > OvmfPkg/ResetVector/Ia32/PageTables64.asm | 1 + > OvmfPkg/ResetVector/Main.asm | 4 ++++ > 3 files changed, 15 insertions(+), 2 deletions(-) >=20 > diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm b/OvmfPkg/ResetVector/Ia= 32/AmdSev.asm > index ed94f1dc668f..9063ce1080d3 100644 > --- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm > +++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm > @@ -320,9 +320,9 @@ NoSevEsVcHlt: > NoSevPass: > xor eax, eax > =20 > -SevExit: > ; > - ; Clear exception handlers and stack > + ; When NOT running in SEV mode: clear exception handlers and stack h= ere. > + ; Otherwise: SevClearVcHandlerAndStack must be called later. > ; > push eax > mov eax, ADDR_OF(IdtrClear) > @@ -330,8 +330,16 @@ SevExit: > pop eax > mov esp, 0 > =20 > +SevExit: > OneTimeCallRet CheckSevFeatures > =20 > +SevClearVcHandlerAndStack: > + ; Clear exception handlers and stack > + mov eax, ADDR_OF(IdtrClear) > + lidt [cs:eax] > + mov esp, 0 > + OneTimeCallRet SevClearVcHandlerAndStack > + > ; Start of #VC exception handling routines > ; > =20 > diff --git a/OvmfPkg/ResetVector/Ia32/PageTables64.asm b/OvmfPkg/ResetVec= tor/Ia32/PageTables64.asm > index ada3dc0ffbe0..6e2063430802 100644 > --- a/OvmfPkg/ResetVector/Ia32/PageTables64.asm > +++ b/OvmfPkg/ResetVector/Ia32/PageTables64.asm > @@ -250,6 +250,7 @@ SevInit: > CreatePageTables4Level edx > ; Clear the C-bit from the GHCB page if the SEV-ES is enabled. > OneTimeCall SevClearPageEncMaskForGhcbPage > + OneTimeCall SevClearVcHandlerAndStack > jmp SetCr3 > =20 > TdxBspInit: > diff --git a/OvmfPkg/ResetVector/Main.asm b/OvmfPkg/ResetVector/Main.asm > index 46cfa87c4c0a..88b25db3bc9e 100644 > --- a/OvmfPkg/ResetVector/Main.asm > +++ b/OvmfPkg/ResetVector/Main.asm > @@ -80,7 +80,11 @@ SearchBfv: > ; Set the OVMF/SEV work area as appropriate. > ; > OneTimeCall CheckSevFeatures > + cmp byte[WORK_AREA_GUEST_TYPE], 1 > + jnz NoSevIa32 > + OneTimeCall SevClearVcHandlerAndStack I think it is safe to invoke SevClearVcHandlerAndStack no matter what if=20 you want to avoid the cmp and jnz instructions. Thanks, Tom > =20 > +NoSevIa32: > ; > ; Restore initial EAX value into the EAX register > ; -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116176): https://edk2.groups.io/g/devel/message/116176 Mute This Topic: https://groups.io/mt/104506799/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-