All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Doru Blânzeanu" <dblanzeanu@linux.microsoft.com>
To: qemu-devel@nongnu.org
Cc: "Doru Blânzeanu" <dblanzeanu@microsoft.com>,
	"Wei Liu" <liuwe@microsoft.com>,
	"Magnus Kulke" <magnuskulke@linux.microsoft.com>,
	"Magnus Kulke" <magnuskulke@microsoft.com>,
	"Doru Blânzeanu" <dblanzeanu@linux.microsoft.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Wei Liu" <wei.liu@kernel.org>, "Zhao Liu" <zhao1.liu@intel.com>
Subject: [PATCH v4 0/2] Add CPU topology extension support for mshv guests
Date: Thu,  3 Dec 2026 17:52:09 +0200	[thread overview]
Message-ID: <20261203155211.42970-1-dblanzeanu@linux.microsoft.com> (raw)

This patch changes how MSHV constructs and registers the guest CPUID table.
It consists of three commits:

1. mshv/mshv-cpu.c: Collect all Intel topology subleaves and AMD cache subleaves
2. target/i386/mshv: Initialize the extended CPUID limit for host/max CPUs

Previous to the first commit, `collect_cpuid_entries` treated `0x0b` and `0x1f`
like ordinary leaves and collected only sub-leaf zero. But these Intel topology
leaves contain one sub-leaf per topology level.
With this patch, now it repeatedly calls `cpu_x86_cpuid` and stores every
result until ECX[15:8] becomes zero (same as kvm does).
This fix correctly reports CPU topology and cache leaves when TOPOEXT is
enabled.

The second commit changes the minimum extended CPUID xlevel to 0x8000_001E during
mshv instance initialization for host/max CPUs (the ones that have TOPOEXT
enabled).

Changes since V3:
- Slight changes in commit message to better reflect the changes in the code
- Refactor the leaf collection to use a switch statement instead of if/else

Changes since V2:
- Drop the unconditional SMT support in the mshv partition. It will be submitted
  in a later patch
- Change how xlevel is set, from generic accelerator to mshv specific.
  Now, mshv follows kvm's approach of setting xlevel to the host's visible
  extended CPUID maximum for host/max CPUs.

Changes since V1:
- Enable SMT support in the mshv partition

Doru Blânzeanu (2):
  mshv/mshv-cpu.c: Collect all Intel topology subleaves and AMD cache
    subleaves
  target/i386/mshv: Initialize the extended CPUID limit for host/max
    CPUs

 target/i386/mshv/mshv-cpu.c | 131 ++++++++++++++++++++++--------------
 1 file changed, 80 insertions(+), 51 deletions(-)

-- 
2.48.1.vfs.0.0



             reply	other threads:[~2026-12-03 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:52 Doru Blânzeanu [this message]
2026-12-03 15:52 ` [PATCH v4 1/2] mshv/mshv-cpu.c: Collect all Intel topology subleaves and AMD cache subleaves Doru Blânzeanu
2026-12-03 15:52 ` [PATCH v4 2/2] target/i386/mshv: Initialize the extended CPUID limit for host/max CPUs Doru Blânzeanu

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=20261203155211.42970-1-dblanzeanu@linux.microsoft.com \
    --to=dblanzeanu@linux.microsoft.com \
    --cc=dblanzeanu@microsoft.com \
    --cc=liuwe@microsoft.com \
    --cc=magnuskulke@linux.microsoft.com \
    --cc=magnuskulke@microsoft.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.liu@kernel.org \
    --cc=zhao1.liu@intel.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.