From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.2866.1689380833781568182 for ; Fri, 14 Jul 2023 17:27:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tpyq2K/N; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E3FF61E16 for ; Sat, 15 Jul 2023 00:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 899C1C433CD for ; Sat, 15 Jul 2023 00:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689380832; bh=OQuyuyB0+8QG/XTobHh36GvsbiSgtSP4T7Tslb4wdlw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tpyq2K/NAcuOineXVeLRSd2tZum7m/eduPjTe/52jpqbykFkPPHvH5SeIYqrr0i1e r7IWSpby1wdTwsCj309/Y2Qh2A/qOBkwQ2p97+zN2l25aVxzaGgqMrdTZjgyECx/P6 euBhjqmUcizARiVoe2mT1d38Oj9/8QJKfk+FXPLNIIhgXzFVFV1VQqtuKKRp0sdBXt VsKfo5v4d5t+RZnSXwxEsFGNAiPMD4TXYh0Ist9LjbrCiDoDzNVkZvu/x3TtV8KLza ixA8IPISL3l3fel+TQzAEyLwf0u4viKFsfrOaJ5cxL/pztx6dOuq3q8KuX/vq832W8 7EpyD3Z8Xc5uw== Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-4fb73ba3b5dso4329721e87.1 for ; Fri, 14 Jul 2023 17:27:12 -0700 (PDT) X-Gm-Message-State: ABy/qLZ+Va+Wbs/tFPF27la6xp/mpAvAX3oDy+iuetl7Ujl3QsuH8KWW Vtb4ZdW8wCrqcTQpNTsHBwouVOxZtvswK+Y2mOw= X-Google-Smtp-Source: APBJJlH+zF82a4HLdiAJ2I2MgqqCP64GB6R6wISmr/SUSvzuwBSE0HRXzkXL2/TUq0uFogzXrOiQUsR+nZ9pCo/RTM0= X-Received: by 2002:a05:6512:2813:b0:4fc:4f3e:9cbf with SMTP id cf19-20020a056512281300b004fc4f3e9cbfmr6074945lfb.50.1689380830439; Fri, 14 Jul 2023 17:27:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Ard Biesheuvel" Date: Sat, 15 Jul 2023 02:26:59 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] OvmfPkg/ResetVector: Fix assembler bit test flag check To: Tom Lendacky Cc: devel@edk2.groups.io, Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Erdem Aktas , James Bottomley , Min Xu , Michael Roth Content-Type: text/plain; charset="UTF-8" On Fri, 14 Jul 2023 at 22:28, Tom Lendacky wrote: > > Commit 63c50d3ff2854a76432b752af4f2a76f33ff1974 changed the check that is > used to determine if SEV-ES is active. Originally, a CMP instruction with > a supporting JZ instruction was used for the check. It was changed to use > the BT instruction but not JZ instruction. The result of a BT instruction > changes the the carry flag (CF) and not the zero flag (ZF). As a result, > the wrong condition is being checked. Update the JZ to a JNC to properly > detect if SEV-ES is active. > > Fixes: 63c50d3ff285 ("OvmfPkg/ResetVector: cache the SEV status MSR...") > Signed-off-by: Tom Lendacky > --- > OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm b/OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm > index c5c683ebed3e..429a58c5efd3 100644 > --- a/OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm > +++ b/OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm > @@ -44,7 +44,7 @@ Transition32FlatTo64Flat: > > mov ecx, 1 > bt [SEV_ES_WORK_AREA_STATUS_MSR], ecx > - jz EnablePaging > + jnc EnablePaging > > ; > ; SEV-ES is active, perform a quick sanity check against the reported Merged as #4646 Thanks,