public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: John Allen <john.allen@amd.com>
To: <pbonzini@redhat.com>, <kvm@vger.kernel.org>, <seanjc@google.com>
Cc: <thomas.lendacky@amd.com>, <bp@alien8.de>, <mlevitsk@redhat.com>,
	<linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<yazen.ghannam@amd.com>, John Allen <john.allen@amd.com>
Subject: [PATCH v2] KVM: x86: Advertise SUCCOR and OVERFLOW_RECOV cpuid bits
Date: Wed, 31 Jul 2024 14:36:49 +0000	[thread overview]
Message-ID: <20240731143649.17082-1-john.allen@amd.com> (raw)

Handling deferred, uncorrected MCEs on AMD guests is now possible with
additional support in qemu. Ensure that the SUCCOR and OVERFLOW_RECOV
bits are advertised to the guest in KVM.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Allen <john.allen@amd.com>
---
v2:
  - Add cpuid_entry_override for CPUID_8000_0007_EBX.
  - Handle masking bits in arch/x86/kvm/cpuid.c
---
 arch/x86/kvm/cpuid.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 2617be544480..f8e1fd409cee 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -743,6 +743,11 @@ void kvm_set_cpu_caps(void)
 	if (!tdp_enabled && IS_ENABLED(CONFIG_X86_64))
 		kvm_cpu_cap_set(X86_FEATURE_GBPAGES);
 
+	kvm_cpu_cap_mask(CPUID_8000_0007_EBX,
+		F(OVERFLOW_RECOV) |
+		F(SUCCOR)
+	);
+
 	kvm_cpu_cap_init_kvm_defined(CPUID_8000_0007_EDX,
 		SF(CONSTANT_TSC)
 	);
@@ -1237,11 +1242,12 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
 		entry->edx &= ~GENMASK(17, 16);
 		break;
 	case 0x80000007: /* Advanced power management */
+		cpuid_entry_override(entry, CPUID_8000_0007_EBX);
 		cpuid_entry_override(entry, CPUID_8000_0007_EDX);
 
 		/* mask against host */
 		entry->edx &= boot_cpu_data.x86_power;
-		entry->eax = entry->ebx = entry->ecx = 0;
+		entry->eax = entry->ecx = 0;
 		break;
 	case 0x80000008: {
 		/*
-- 
2.34.1


             reply	other threads:[~2024-07-31 14:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 14:36 John Allen [this message]
2024-08-15 15:16 ` [PATCH v2] KVM: x86: Advertise SUCCOR and OVERFLOW_RECOV cpuid bits Sean Christopherson

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=20240731143649.17082-1-john.allen@amd.com \
    --to=john.allen@amd.com \
    --cc=bp@alien8.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox