qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Like Xu <like.xu.linux@gmail.com>
To: Eduardo Habkost <ehabkost@redhat.com>, Joerg Roedel <joro@8bytes.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH] target/i386/cpu: Use the KVM reported value for the number of ASIDs
Date: Thu, 15 Jul 2021 18:39:45 +0800	[thread overview]
Message-ID: <20210715103945.95004-1-likexu@tencent.com> (raw)

From: Like Xu <likexu@tencent.com>

If KVM is enabled, use the supported number of address space identifiers
(ASIDs) by the CPUID Fn8000_000A_EBX instead of hard-coding it to 0x10.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 target/i386/cpu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 48b55ebd0a..959c4425a4 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5523,7 +5523,13 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
     case 0x8000000A:
         if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_SVM) {
             *eax = 0x00000001; /* SVM Revision */
-            *ebx = 0x00000010; /* nr of ASIDs */
+            /* nr of ASIDs */
+            if (kvm_enabled()) {
+                *ebx = kvm_arch_get_supported_cpuid(cs->kvm_state,
+                                                    0x8000000A, 0, R_EBX);
+            } else {
+                *ebx = 0x00000010;
+            }
             *ecx = 0;
             *edx = env->features[FEAT_SVM]; /* optional features */
         } else {
-- 
2.32.0



                 reply	other threads:[~2021-07-15 13:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210715103945.95004-1-likexu@tencent.com \
    --to=like.xu.linux@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=joro@8bytes.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vkuznets@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).