All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, jmattson@google.com, mlevitsk@redhat.com
Subject: [PATCH KVM 0/3] nSVM: Fix PAT in VMCB02 and check PAT in VMCB12
Date: Tue, 18 Jan 2022 14:14:46 -0500	[thread overview]
Message-ID: <20220118191449.38852-1-krish.sadhukhan@oracle.com> (raw)

According to section "Nested Paging and VMRUN/#VMEXIT" in APM vol 2:

    "When VMRUN is executed with nested paging enabled (NP_ENABLE = 1),
     the paging registers are affected as follows:

        • VMRUN loads the guest paging state from the guest VMCB into the
          guest registers (i.e., VMRUN loads CR3 with the VMCB CR3 field,
          etc.). The guest PAT register is loaded from G_PAT field in the
          VMCB.

    The following guest state is illegal:

	• Any G_PAT.PA field has an unsupported type encoding or any
	  reserved field in G_PAT has a nonzero value."


Patch# 1 does the following:
	i) Fixes the PAT value in VMCB02 before launching nested guests as
	   follows:

		If nested paging is enabled in VMCB12, use PAT from VMCB12.
		Otherwise, use PAT from VMCB01.

	ii) When nested guests attempt to write MSR_IA32_CR_PAT, the register
	    is updated only when nested paging is disabled and PAT from VMCB12
	    is used to update it.

	iii) Adds checks for the PAT fields in VMCB12.

Patch# 2 adds a helper to check if PAT is supported by the VCPU.
Patch# 3 adds tests for all the PAT fields.


[PATCH KVM 1/3] nSVM: Fix PAT value in VMCB02
[PATCH kvm-unit-tests 2/3] SVM: Add a helpter function for checking if PAT is
[PATCH kvm-unit-tests 3/3] nSVM: Test G_PAT fields

 arch/x86/kvm/svm/nested.c | 34 +++++++++++++++++++++++++++-------
 arch/x86/kvm/svm/svm.c    |  3 ++-
 arch/x86/kvm/svm/svm.h    |  3 ++-
 3 files changed, 31 insertions(+), 9 deletions(-)

Krish Sadhukhan (1):
      nSVM: Fix PAT value in VMCB02

 lib/x86/asm/page.h  | 11 +++++++++
 lib/x86/processor.h |  1 +
 x86/svm.c           | 13 +++++++++++
 x86/svm.h           |  2 ++
 x86/svm_tests.c     | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 93 insertions(+)

Krish Sadhukhan (2):
      SVM: Add a helpter function for checking if PAT is supported by the VCPU
      nSVM: Test G_PAT fields


             reply	other threads:[~2022-01-18 20:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 19:14 Krish Sadhukhan [this message]
2022-01-18 19:14 ` [PATCH KVM 1/3] nSVM: Fix PAT in VMCB02 and check PAT in VMCB12 Krish Sadhukhan
2022-01-18 19:14 ` [PATCH kvm-unit-tests 2/3] SVM: Add a helpter function for checking if PAT is supported by the VCPU Krish Sadhukhan
2022-01-18 19:14 ` [PATCH kvm-unit-tests 3/3] nSVM: Test G_PAT fields Krish Sadhukhan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118191449.38852-1-krish.sadhukhan@oracle.com \
    --to=krish.sadhukhan@oracle.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.