]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: SVM: Use unsigned integers when dealing with ASIDs
authorSean Christopherson <seanjc@google.com>
Wed, 31 Jan 2024 23:56:07 +0000 (15:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:09 +0000 (16:38 +0200)
commit8431127ac8926910c39dbbb155c43d011d44783b
tree82b901dd5c0d98971804779bc68b71f1925bf9e4
parentf726bdd14deb36fc82bed0dd3d17135e9c516342
KVM: SVM: Use unsigned integers when dealing with ASIDs

[ Upstream commit 466eec4a22a76c462781bf6d45cb02cbedf21a61 ]

Convert all local ASID variables and parameters throughout the SEV code
from signed integers to unsigned integers.  As ASIDs are fundamentally
unsigned values, and the global min/max variables are appropriately
unsigned integers, too.

Functionally, this is a glorified nop as KVM guarantees min_sev_asid is
non-zero, and no CPU supports -1u as the _only_ asid, i.e. the signed vs.
unsigned goof won't cause problems in practice.

Opportunistically use sev_get_asid() in sev_flush_encrypted_page() instead
of open coding an equivalent.

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20240131235609.4161407-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Stable-dep-of: 0aa6b90ef9d7 ("KVM: SVM: Add support for allowing zero SEV ASIDs")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kvm/svm/sev.c
arch/x86/kvm/trace.h