]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
x86/sev: Fix operator precedence in GHCB_MSR_VMPL_REQ_LEVEL macro
authorSeongman Lee <augustus92@kaist.ac.kr>
Sun, 11 May 2025 09:23:28 +0000 (18:23 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:55 +0000 (11:13 +0200)
commitc472a35b51a1d32a676a42504e1256fba533aedd
treeeed57462eeb37cbb0b81a498175f2672ae2b3710
parent2aa204c40725c82880263947bde08e88509b229c
x86/sev: Fix operator precedence in GHCB_MSR_VMPL_REQ_LEVEL macro

[ Upstream commit f7387eff4bad33d12719c66c43541c095556ae4e ]

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: 34ff65901735 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/include/asm/sev-common.h