On 24/11/22 5:40 pm, Jiri Denemark wrote:
On Wed, Nov 23, 2022 at 18:34:38 +0530, manish.mishra wrote:
oh i see you meant something like this,

   <cpu mode='custom' match='exact' check='none'>
     <numa>
       <cell id='0' cpus='0-239' memory='8388608' unit='KiB' memAccess='shared'/>
     </numa>
   </cpu>

   <qemu:commandline>
     <qemu:arg value='-cpu'/>
     <qemu:arg value='enforce,Icelake-v4,x2apic=on,hv-time,kvm-pv-eoi=on'/>
   </qemu:commandline>
This won't work as libvirt should add a default CPU model there and
replace check='none' with check='full' once the domain starts.

But we actually have a way to do what you need even without any change
in libvirt:

  <cpu mode='host-passthrough' check='none'>
    <topology .../>
    <numa>
      ...
    </numa>
    ...
  </cpu>

  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='Icelake-Server-v4,enforce,x2apic=on,hv-time,kvm-pv-eoi=on'/>
  </qemu:commandline>

This will result in

  -cpu host,migratable=on
  ...
  -cpu Icelake-Server-v4,enforce,x2apic=on,hv-time,kvm-pv-eoi=on

and libvirt will not touch the check='none' attribute once the domain
starts and it would not complain about any unknown CPU features or
models as there's nothing to check in <cpu/>.

That is, there's no need to come up with anything special to support
passing arbitrary options to -cpu.

Jirka


Thank you so much Jirka, let me give this a try with few different cases. I will let you know how this goes or if we need anything extra.

Thanks

Manish Mishra