x86/kvm: Avoid looking up PKRU in XSAVE buffer
authorDave Hansen <dave.hansen@linux.intel.com>
Wed, 23 Jun 2021 12:01:49 +0000 (14:01 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 23 Jun 2021 15:49:47 +0000 (17:49 +0200)
commit71ef453355a9197fcfd8ff22391a4ad7861d79e6
treebde92779907c14bad580980c017fbcfb08bf7f57
parent02b93c0b00df222b9ccf7a1fbd0eb59353d0a58c
x86/kvm: Avoid looking up PKRU in XSAVE buffer

PKRU is being removed from the kernel XSAVE/FPU buffers.  This removal
will probably include warnings for code that look up PKRU in those
buffers.

KVM currently looks up the location of PKRU but doesn't even use the
pointer that it gets back.  Rework the code to avoid calling
get_xsave_addr() except in cases where its result is actually used.

This makes the code more clear and also avoids the inevitable PKRU
warnings.

This is probably a good cleanup and could go upstream idependently
of any PKRU rework.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121453.541037562@linutronix.de
arch/x86/kvm/x86.c