OSDN Git Service

KVM: SVM: Allocate SEV command structures on local stack
authorSean Christopherson <seanjc@google.com>
Tue, 6 Apr 2021 22:49:52 +0000 (15:49 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 21 Apr 2021 16:20:07 +0000 (12:20 -0400)
commit238eca821cee90e91139da84ef4f38c74d7cf0d9
tree559925f1aabb8ce350b21d5e7437390adedfdb29
parenta402e35177797d736dd3dc2d8537c1c9ac90d54a
KVM: SVM: Allocate SEV command structures on local stack

Use the local stack to "allocate" the structures used to communicate with
the PSP.  The largest struct used by KVM, sev_data_launch_secret, clocks
in at 52 bytes, well within the realm of reasonable stack usage.  The
smallest structs are a mere 4 bytes, i.e. the pointer for the allocation
is larger than the allocation itself.

Now that the PSP driver plays nice with vmalloc pointers, putting the
data on a virtually mapped stack (CONFIG_VMAP_STACK=y) will not cause
explosions.

Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210406224952.4177376-9-seanjc@google.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
[Apply same treatment to PSP migration commands. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c