On Tue, Apr 01, 2025 at 11:35:49AM +0800, Ewan Hai wrote: > Date: Tue, 1 Apr 2025 11:35:49 +0800 > From: Ewan Hai <ewanhai...@zhaoxin.com> > Subject: Re: [PATCH v2 08/10] target/i386/kvm: reset AMD PMU registers > during VM reset > > > > [2] As mentioned in [1], QEMU always sets the vCPU's vendor to match the > > > host's > > > vendor > > > when acceleration (KVM or HVF) is enabled. Therefore, if users want to > > > emulate a > > > Zhaoxin CPU on an Intel host, the vendor must be set manually.Furthermore, > > > should we display a warning to users who enable both vPMU and KVM > > > acceleration > > > but do not manually set the guest vendor when it differs from the host > > > vendor? > > > > Maybe not? Sometimes I emulate AMD on Intel host, while vendor is still the > > default :) > > Okay, handling this situation can be rather complex, so let's keep it > simple. I have added a dedicated function to capture the intended behavior > for potential future reference. > > Anyway, Thanks for taking Zhaoxin's situation into account, regardless. >
Thanks for your code example!! Zhaoxin implements perfmon v2, so I think checking the vendor might be overly complicated. If a check is needed, it seems more reasonable to check the perfmon version rather than the vendor, similar to how avx10 version is checked in x86_cpu_filter_features(). I understand Ewan's concern is that if an Intel guest requires a higher perfmon version that the Zhaoxin host doesn't support, there could be issues (although I think this situation doesn't currently exist in KVM-QEMU, one reason is QEMU uses the pmu_version in 0xa queried from KVM directly, which means QEMU currently doesn't support custom pmu_version). (I'll help go through Dongli's v3 soon.) Thank you both, Zhao