Skip to content

Commit f7387ef

Browse files
leonardo-leecapriobp3tk0v
authored andcommitted
x86/sev: Fix operator precedence in GHCB_MSR_VMPL_REQ_LEVEL macro
The GHCB_MSR_VMPL_REQ_LEVEL macro lacked parentheses around the bitmask expression, causing the shift operation to bind too early. As a result, when requesting VMPL1 (e.g., GHCB_MSR_VMPL_REQ_LEVEL(1)), incorrect values such as 0x000000016 were generated instead of the intended 0x100000016 (the requested VMPL level is specified in GHCBData[39:32]). Fix the precedence issue by grouping the masked value before applying the shift. [ bp: Massage commit message. ] Fixes: 34ff659 ("x86/sev: Use kernel provided SVSM Calling Areas") Signed-off-by: Seongman Lee <augustus92@kaist.ac.kr> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250511092329.12680-1-cloudlee1719@gmail.com
1 parent 5214a9f commit f7387ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/include/asm/sev-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ enum psc_op {
116116
#define GHCB_MSR_VMPL_REQ 0x016
117117
#define GHCB_MSR_VMPL_REQ_LEVEL(v) \
118118
/* GHCBData[39:32] */ \
119-
(((u64)(v) & GENMASK_ULL(7, 0) << 32) | \
119+
((((u64)(v) & GENMASK_ULL(7, 0)) << 32) | \
120120
/* GHCBDdata[11:0] */ \
121121
GHCB_MSR_VMPL_REQ)
122122

0 commit comments

Comments
 (0)