kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Babu Moger" <babu.moger@amd.com>,
	"Ewan Hai" <ewanhai-oc@zhaoxin.com>,
	"Tejus GK" <tejus.gk@nutanix.com>,
	"Jason Zeng" <jason.zeng@intel.com>,
	"Manish Mishra" <manish.mishra@nutanix.com>,
	"Tao Su" <tao1.su@intel.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [RFC 01/10] i386/cpu: Mark CPUID[0x80000005] as reserved for Intel
Date: Thu, 24 Apr 2025 10:52:24 +0800	[thread overview]
Message-ID: <aAmnaAbrELVl3UiT@intel.com> (raw)
In-Reply-To: <596c7a44-797b-4a16-bd7e-0f0dc5c2e593@intel.com>

> > +        /*
> > +         * cache info (L1 cache)
> > +         *
> > +         * For !vendor_cpuid_only case, non-AMD CPU would get the wrong
> > +         * information, i.e., get AMD's cache model. It doesn't matter,
> > +         * vendor_cpuid_only has been turned on by default since
> > +         * PC machine v6.1.
> > +         */
> 
> We need to define a new compat property for it other than vendor_cpuid_only,
> for 10.1.
> 
> I proposed some change to leaf FEAT_8000_0001_EDX[1], and I was told by
> Paolo (privately) that vendor_cpuid_only doesn't suffice.
> 
>  On Fri, Oct 11, 2024 at 6:22 PM Xiaoyao Li <xiaoyao.li@intel.com> wrote:
>  >
>  > On 10/11/2024 11:30 PM, Paolo Bonzini wrote:
>  > > On Fri, Oct 11, 2024 at 4:55 PM Xiaoyao Li <xiaoyao.li@intel.com>
> wrote:
>  > >>
>  > >> I think patch 8 is also a general issue> Without it, the
>  > >> CPUID_EXT2_AMD_ALIASES bits are exposed to Intel VMs which are
>  > >> reserved bits for Intel.
>  > >
>  > > Yes but you'd have to add compat properties for these. If you can do
>  > > it for TDX only, that's easier.
>  >
>  > Does vendor_cpuid_only suffice?
> 
>  Unfortunately not, because it is turned off only for <=6.0 machine
>  types. Here you'd have to turn it off for <=9.1 machine types.
> 
> 
> [1] https://lore.kernel.org/qemu-devel/20240814075431.339209-9-xiaoyao.li@intel.com/

For the patch link, you wanted to mark it as unavailiable but it would
break the machine <= 6.0 (with vendor_cpuid_only turned off), correct?

For this patch:
 * vendor_cpuid_only turns off for <= 6.0 machine, no change.
 * vendor_cpuid_only turns on for > 6.0 machine, I treated it as a
   "direct" fix because original codes encode the AMD cache model info
   on non-AMD platform (in ecx & edx). This doesn't make sense. Non-AMD
   platform should use cache_info_cpuid4 or 0 here. If it is considered
   a fix, it may be more appropriate to use cache_info_cpuid4.

I think it's somehow similar to the “trade-offs” Daniel indicated [2].

This case can also be fixed by compat option. Then we don't  need to
encode cache_info_cpuid4 info for non-AMD platforms in this leaf.

Do you still need the patches in your links? (I didn't find the related
patch merged.) If so, I can add the compat option in the next version
which could also help you land your previous patches v10.1 as well.

[2]: https://lore.kernel.org/qemu-devel/Z08j2Ii-QuZk3lTY@redhat.com/

> > +        if (cpu->vendor_cpuid_only &&
> > +            (IS_INTEL_CPU(env) || IS_ZHAOXIN_CPU(env))) {
> > +            *eax = *ebx = *ecx = *edx = 0;
> > +            break;
> > +        } else if (cpu->cache_info_passthrough) {
> >               x86_cpu_get_cache_cpuid(index, 0, eax, ebx, ecx, edx);
> >               break;
> >           }
> > +
> >           *eax = (L1_DTLB_2M_ASSOC << 24) | (L1_DTLB_2M_ENTRIES << 16) |
> >                  (L1_ITLB_2M_ASSOC <<  8) | (L1_ITLB_2M_ENTRIES);
> >           *ebx = (L1_DTLB_4K_ASSOC << 24) | (L1_DTLB_4K_ENTRIES << 16) |
> 

  reply	other threads:[~2025-04-24  2:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 11:46 [RFC 00/10] i386/cpu: Cache CPUID fixup, Intel cache model & topo CPUID enhencement Zhao Liu
2025-04-23 11:46 ` [RFC 01/10] i386/cpu: Mark CPUID[0x80000005] as reserved for Intel Zhao Liu
2025-04-23 13:05   ` Xiaoyao Li
2025-04-24  2:52     ` Zhao Liu [this message]
2025-04-24 13:44   ` Ewan Hai
2025-04-25  9:39     ` Zhao Liu
2025-05-26  8:35   ` Ewan Hai
2025-05-27  9:15     ` Zhao Liu
2025-05-27  9:56       ` Ewan Hai
2025-06-24  7:22         ` Zhao Liu
2025-06-24 11:04           ` Ewan Hai
2025-06-25  3:03             ` Zhao Liu
2025-06-25  2:54               ` Ewan Hai
2025-06-25  9:19     ` Zhao Liu
2025-06-25 10:05       ` Ewan Hai
2025-04-23 11:46 ` [RFC 02/10] i386/cpu: Fix CPUID[0x80000006] for Intel CPU Zhao Liu
2025-04-23 11:46 ` [RFC 03/10] i386/cpu: Introduce cache model for SierraForest Zhao Liu
2025-04-23 11:46 ` [RFC 04/10] i386/cpu: Introduce cache model for GraniteRapids Zhao Liu
2025-04-23 11:46 ` [RFC 05/10] i386/cpu: Introduce cache model for SapphireRapids Zhao Liu
2025-04-24  4:54   ` Tejus GK
2025-04-24  6:53     ` Zhao Liu
2025-04-23 11:46 ` [RFC 06/10] i386/cpu: Introduce enable_cpuid_0x1f to force exposing CPUID 0x1f Zhao Liu
2025-05-13 12:45   ` Igor Mammedov
2025-05-14 15:23     ` Zhao Liu
2025-05-15  6:43       ` Xiaoyao Li
2025-04-23 11:46 ` [RFC 07/10] i386/cpu: Add a "cpuid-0x1f" property Zhao Liu
2025-04-23 11:47 ` [RFC 08/10] i386/cpu: Enable 0x1f leaf for SierraForest by default Zhao Liu
2025-04-23 11:47 ` [RFC 09/10] i386/cpu: Enable 0x1f leaf for GraniteRapids " Zhao Liu
2025-04-23 11:47 ` [RFC 10/10] i386/cpu: Enable 0x1f leaf for SapphireRapids " Zhao Liu
2025-04-24  6:57 ` [RFC 00/10] i386/cpu: Cache CPUID fixup, Intel cache model & topo CPUID enhencement Zhao Liu
2025-05-26 10:52 ` Ewan Hai
2025-05-27  9:19   ` Zhao Liu
2025-05-27  9:58     ` Ewan Hai

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=aAmnaAbrELVl3UiT@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=babu.moger@amd.com \
    --cc=berrange@redhat.com \
    --cc=ewanhai-oc@zhaoxin.com \
    --cc=imammedo@redhat.com \
    --cc=jason.zeng@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=manish.mishra@nutanix.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tao1.su@intel.com \
    --cc=tejus.gk@nutanix.com \
    --cc=xiaoyao.li@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 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).