From: Mohammed Gamal <mgamal@redhat.com>
To: qemu-devel@nongnu.org, pbonzini@redhat.com
Cc: ehabkost@redhat.com, mtosatti@redhat.com, rth@twiddle.net,
kvm@vger.kernel.org, Mohammed Gamal <mgamal@redhat.com>
Subject: [PATCH 1/2] kvm: Add support for KVM_CAP_HAS_SMALLER_MAXPHYADDR
Date: Fri, 19 Jun 2020 17:53:43 +0200 [thread overview]
Message-ID: <20200619155344.79579-2-mgamal@redhat.com> (raw)
In-Reply-To: <20200619155344.79579-1-mgamal@redhat.com>
This adds the KVM_CAP_HAS_SMALLER_MAXPHYADDR capability
and a helper function to check for this capability.
This will allow QEMU to decide to what to do if the host
CPU can't handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR properly.
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
| 1 +
target/i386/kvm.c | 5 +++++
target/i386/kvm_i386.h | 1 +
3 files changed, 7 insertions(+)
--git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 9804495a46..9eb61a303f 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -1017,6 +1017,7 @@ struct kvm_ppc_resize_hpt {
#define KVM_CAP_S390_VCPU_RESETS 179
#define KVM_CAP_S390_PROTECTED 180
#define KVM_CAP_PPC_SECURE_GUEST 181
+#define KVM_CAP_SMALLER_MAXPHYADDR 184
#ifdef KVM_CAP_IRQ_ROUTING
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index b3c13cb898..01100dbf20 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -136,6 +136,11 @@ bool kvm_has_smm(void)
return kvm_check_extension(kvm_state, KVM_CAP_X86_SMM);
}
+bool kvm_has_smaller_maxphyaddr(void)
+{
+ return kvm_check_extension(kvm_state, KVM_CAP_SMALLER_MAXPHYADDR);
+}
+
bool kvm_has_adjust_clock_stable(void)
{
int ret = kvm_check_extension(kvm_state, KVM_CAP_ADJUST_CLOCK);
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index 00bde7acaf..513f8eebbb 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -34,6 +34,7 @@
bool kvm_allows_irq0_override(void);
bool kvm_has_smm(void);
+bool kvm_has_smaller_maxphyaddr(void);
bool kvm_has_adjust_clock_stable(void);
bool kvm_has_exception_payload(void);
void kvm_synchronize_all_tsc(void);
--
2.26.2
next prev parent reply other threads:[~2020-06-19 15:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 15:53 [PATCH 0/2] kvm: x86/cpu: Support guest MAXPHYADDR < host MAXPHYADDR Mohammed Gamal
2020-06-19 15:53 ` Mohammed Gamal [this message]
2020-06-19 15:53 ` [PATCH 2/2] x86/cpu: Handle GUEST_MAXPHYADDR < HOST_MAXPHYADDR for hosts that don't support it Mohammed Gamal
2020-06-19 16:25 ` Paolo Bonzini
2020-07-08 17:16 ` Eduardo Habkost
2020-07-08 17:26 ` Daniel P. Berrangé
2020-07-09 9:44 ` Gerd Hoffmann
2020-07-09 9:55 ` Mohammed Gamal
2020-07-09 10:11 ` Paolo Bonzini
2020-07-09 17:00 ` Jim Mattson
2020-07-09 19:13 ` Eduardo Habkost
2020-07-10 7:22 ` Paolo Bonzini
2020-07-10 16:02 ` Eduardo Habkost
2020-07-10 16:49 ` Paolo Bonzini
2020-07-10 7:21 ` Paolo Bonzini
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=20200619155344.79579-2-mgamal@redhat.com \
--to=mgamal@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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