On Thu, 13 Feb 2025 12:48:30 +0100
Markus Armbruster <arm...@redhat.com> wrote:

> gaosong <gaos...@loongson.cn> writes:
> 
> > Cc: Markus
> >
> > hi, Markus
> >
> > What is the difference between CPU_MODEL_EXPANSION_TYPE_STATIC and 
> > CPU_MODEL_EXPANSION_TYPE_FULL?  

the only difference is that 'static' expansion will not report properties
not mentioned in hard-codded CPU model definition see: builtin_x86_defs

while 'full' will iterate over/report all rw properties of CPU object
created from provided model name.

> I don't know :)
> 
> Here's the documentation:
> 
>     ##
>     # @CpuModelExpansionType:
>     #
>     # An enumeration of CPU model expansion types.
>     #
>     # @static: Expand to a static CPU model, a combination of a static
>     #     base model name and property delta changes.  As the static base
>     #     model will never change, the expanded CPU model will be the
>     #     same, independent of QEMU version, machine type, machine
>     #     options, and accelerator options.  Therefore, the resulting
>     #     model can be used by tooling without having to specify a
>     #     compatibility machine - e.g. when displaying the "host" model.
>     #     The @static CPU models are migration-safe.

Looking at related x86 code above description sounds like a fiction.
Both 'static' and 'full' do use
 qmp_query_cpu_model_expansion()
     x86_cpu_from_model()
         cpu = object_new(foo_cpu_class)
         x86_cpu_expand_features(cpu)
and the later 2 calls are subjects to being influenced by:
    "QEMU version, machine type (compat machinery), machine options, and 
accelerator options"
and -cpu option

>     #
>     # @full: Expand all properties.  The produced model is not guaranteed
>     #     to be migration-safe, but allows tooling to get an insight and
>     #     work with model details.
>     #
>     # .. note:: When a non-migration-safe CPU model is expanded in static
>     #    mode, some features enabled by the CPU model may be omitted,
>     #    because they can't be implemented by a static CPU model
>     #    definition (e.g. cache info passthrough and PMU passthrough in
>     #    x86).  If you need an accurate representation of the features
>     #    enabled by a non-migration-safe CPU model, use @full.  If you
>     #    need a static representation that will keep ABI compatibility
>     #    even when changing QEMU version or machine-type, use @static (but
>     #    keep in mind that some features may be omitted).
>     #
>     # Since: 2.8
>     ##
> 
> If you have further questions, David Hildenbrand or Eduardo Habkost
> (cc'ed) might be able to help.
> 
> 



Reply via email to