diff mbox series

[kvm-unit-tests,3/5] x86: nVMX: Require WB for the EPT walks when possible

Message ID 20190221022445.3873-4-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86: nVMX: Address feedback on EPT series | expand

Commit Message

Sean Christopherson Feb. 21, 2019, 2:24 a.m. UTC
The memtype used by hardware when walking EPT tables is specified by
software via an encoding in the EPTP.  Ignoring the fact that no sane
VMM would default to UC for page table walks, KVM only supports WB,
and has only ever supported WB (added in commit ca72d970ff9a, "KVM:
nEPT: Advertise WB type EPTP").

Require WB and remove the UC handling altogether.  Eliminating what is
effectively dead code also removes the confusing error message (that
never fires) regarding memtype, e.g. "EPT paging-structure memory type
UC&WB are not supported" may be interpreted as stating that KVM unit
tests require WC *and* WB.

Cc: Marc Orr <marcorr@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 x86/vmx_tests.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Marc Orr Feb. 21, 2019, 7:20 p.m. UTC | #1
On Wed, Feb 20, 2019 at 6:24 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> The memtype used by hardware when walking EPT tables is specified by
> software via an encoding in the EPTP.  Ignoring the fact that no sane
> VMM would default to UC for page table walks, KVM only supports WB,
> and has only ever supported WB (added in commit ca72d970ff9a, "KVM:
> nEPT: Advertise WB type EPTP").
>
> Require WB and remove the UC handling altogether.  Eliminating what is
> effectively dead code also removes the confusing error message (that
> never fires) regarding memtype, e.g. "EPT paging-structure memory type
> UC&WB are not supported" may be interpreted as stating that KVM unit
> tests require WC *and* WB.
>
> Cc: Marc Orr <marcorr@google.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  x86/vmx_tests.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index bd17088..c9cea0e 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -1011,11 +1011,8 @@ static int setup_eptp(u64 hpa, bool enable_ad)
>                 printf("\tEPT is not supported");
>                 return 1;
>         }
> -
> -       if (!(ept_vpid.val & EPT_CAP_UC) &&
> -                       !(ept_vpid.val & EPT_CAP_WB)) {
> -               printf("\tEPT paging-structure memory type "
> -                               "UC&WB are not supported\n");
> +       if (!(ept_vpid.val & EPT_CAP_WB)) {
> +               printf("WB memtype for EPT walks not supported\n");
>                 return 1;
>         }
>         if (!(ept_vpid.val & EPT_CAP_PWL4)) {
> @@ -1023,10 +1020,7 @@ static int setup_eptp(u64 hpa, bool enable_ad)
>                 return 1;
>         }
>
> -       if (ept_vpid.val & EPT_CAP_UC)
> -               eptp = EPT_MEM_TYPE_UC;
> -       else
> -               eptp = EPT_MEM_TYPE_WB;
> +       eptp = EPT_MEM_TYPE_WB;
>         eptp |= (3 << EPTP_PG_WALK_LEN_SHIFT);
>         eptp |= hpa;
>         if (enable_ad)
> --
> 2.20.1
>

Reviewed-by: Marc Orr <marcorr@google.com>
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index bd17088..c9cea0e 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1011,11 +1011,8 @@  static int setup_eptp(u64 hpa, bool enable_ad)
 		printf("\tEPT is not supported");
 		return 1;
 	}
-
-	if (!(ept_vpid.val & EPT_CAP_UC) &&
-			!(ept_vpid.val & EPT_CAP_WB)) {
-		printf("\tEPT paging-structure memory type "
-				"UC&WB are not supported\n");
+	if (!(ept_vpid.val & EPT_CAP_WB)) {
+		printf("WB memtype for EPT walks not supported\n");
 		return 1;
 	}
 	if (!(ept_vpid.val & EPT_CAP_PWL4)) {
@@ -1023,10 +1020,7 @@  static int setup_eptp(u64 hpa, bool enable_ad)
 		return 1;
 	}
 
-	if (ept_vpid.val & EPT_CAP_UC)
-		eptp = EPT_MEM_TYPE_UC;
-	else
-		eptp = EPT_MEM_TYPE_WB;
+	eptp = EPT_MEM_TYPE_WB;
 	eptp |= (3 << EPTP_PG_WALK_LEN_SHIFT);
 	eptp |= hpa;
 	if (enable_ad)