Message ID | 20250302220112.17653-4-dongli.zhang@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | target/i386/kvm/pmu: PMU Enhancement, Bugfix and Cleanup | expand |
On Sun, Mar 02, 2025 at 02:00:11PM -0800, Dongli Zhang wrote: > Date: Sun, 2 Mar 2025 14:00:11 -0800 > From: Dongli Zhang <dongli.zhang@oracle.com> > Subject: [PATCH v2 03/10] [DO NOT MERGE] kvm: Introduce > kvm_arch_pre_create_vcpu() > X-Mailer: git-send-email 2.43.5 > > From: Xiaoyao Li <xiaoyao.li@intel.com> > > Introduce kvm_arch_pre_create_vcpu(), to perform arch-dependent > work prior to create any vcpu. This is for i386 TDX because it needs > call TDX_INIT_VM before creating any vcpu. > > The specific implemnet of i386 will be added in the future patch. > > Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> > Acked-by: Gerd Hoffmann <kraxel@redhat.com> Your Signed-off is missing... (When you send the patch, it's better to attach your own Signed-off :-)) > --- > I used to send a version: > https://lore.kernel.org/all/20221119122901.2469-2-dongli.zhang@oracle.com/ > Just pick the one from Xiaoyao's patchset as Dapeng may use this version > as well. > https://lore.kernel.org/all/20250124132048.3229049-8-xiaoyao.li@intel.com/ > > accel/kvm/kvm-all.c | 5 +++++ > include/system/kvm.h | 1 + > target/arm/kvm.c | 5 +++++ > target/i386/kvm/kvm.c | 5 +++++ > target/loongarch/kvm/kvm.c | 5 +++++ > target/mips/kvm.c | 5 +++++ > target/ppc/kvm.c | 5 +++++ > target/riscv/kvm/kvm-cpu.c | 5 +++++ > target/s390x/kvm/kvm.c | 5 +++++ > 9 files changed, 41 insertions(+) Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Hi Zhao, On 3/5/25 6:46 AM, Zhao Liu wrote: > On Sun, Mar 02, 2025 at 02:00:11PM -0800, Dongli Zhang wrote: >> Date: Sun, 2 Mar 2025 14:00:11 -0800 >> From: Dongli Zhang <dongli.zhang@oracle.com> >> Subject: [PATCH v2 03/10] [DO NOT MERGE] kvm: Introduce >> kvm_arch_pre_create_vcpu() >> X-Mailer: git-send-email 2.43.5 >> >> From: Xiaoyao Li <xiaoyao.li@intel.com> >> >> Introduce kvm_arch_pre_create_vcpu(), to perform arch-dependent >> work prior to create any vcpu. This is for i386 TDX because it needs >> call TDX_INIT_VM before creating any vcpu. >> >> The specific implemnet of i386 will be added in the future patch. >> >> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> >> Acked-by: Gerd Hoffmann <kraxel@redhat.com> > > Your Signed-off is missing... > > (When you send the patch, it's better to attach your own Signed-off :-)) Thank you very much! I didn't know if I would need to wait until this patch is merged into mainline QEMU. That's why I didn't add my signed-off. I will add in v3 and remove "DO NOT MERGE" if the patch isn't in QEMU when I am sending out v3. Dongli Zhang > >> --- >> I used to send a version: >> https://urldefense.com/v3/__https://lore.kernel.org/all/20221119122901.2469-2-dongli.zhang@oracle.com/__;!!ACWV5N9M2RV99hQ!P5Ki_gsFsvAUNjV4-CNmMcDAJA5QRyzJ5ufGtNqeH6Ayt2ZUxwoPde3VQVer_o9Y2xRSVTwCN5fdjO-Dyerp$ >> Just pick the one from Xiaoyao's patchset as Dapeng may use this version >> as well. >> https://urldefense.com/v3/__https://lore.kernel.org/all/20250124132048.3229049-8-xiaoyao.li@intel.com/__;!!ACWV5N9M2RV99hQ!P5Ki_gsFsvAUNjV4-CNmMcDAJA5QRyzJ5ufGtNqeH6Ayt2ZUxwoPde3VQVer_o9Y2xRSVTwCN5fdjN17lCxG$ >> >> accel/kvm/kvm-all.c | 5 +++++ >> include/system/kvm.h | 1 + >> target/arm/kvm.c | 5 +++++ >> target/i386/kvm/kvm.c | 5 +++++ >> target/loongarch/kvm/kvm.c | 5 +++++ >> target/mips/kvm.c | 5 +++++ >> target/ppc/kvm.c | 5 +++++ >> target/riscv/kvm/kvm-cpu.c | 5 +++++ >> target/s390x/kvm/kvm.c | 5 +++++ >> 9 files changed, 41 insertions(+) > > Reviewed-by: Zhao Liu <zhao1.liu@intel.com> >
> I didn't know if I would need to wait until this patch is merged into > mainline QEMU. That's why I didn't add my signed-off. No problem if Xiaoyao is okay with it (copyright of patches need to honor the original author & signed-off). IMO, if your series is accepted first, it also helps to reduce the size of the TDX series, and it helps the subsequent PMU development (like mediated PMU). Conversely, it's also not a big deal; you can simply rebase and remove this patch at that time. Even I'm thinking that my KVM PMU filter should perhaps base on your work. > I will add in v3 and remove "DO NOT MERGE" if the patch isn't in QEMU when > I am sending out v3. Okay. Thanks, Zhao
On 3/7/2025 3:52 PM, Zhao Liu wrote: >> I didn't know if I would need to wait until this patch is merged into >> mainline QEMU. That's why I didn't add my signed-off. > > No problem if Xiaoyao is okay with it (copyright of patches need to > honor the original author & signed-off). IMO, if your series is accepted > first, it also helps to reduce the size of the TDX series, and it helps > the subsequent PMU development (like mediated PMU). Conversely, it's > also not a big deal; you can simply rebase and remove this patch at that > time. Hi Dongli, Usually, if my TDX series is going to be merged soon, or you think this series won't be accepted soon before TDX series, you can just mention in the cover letter that this series has a dependency on other patch. For the case that your series might be accepted earlier, it's better to just grab the patches needed by this series from others' series. Just like what you did here. Like Zhao mentioned, when you grab a patch from others and post with your series, you need keep the original patch as is (the unchanged authorship and signed-off-by chain), in addition to add your signed-off-by at last in the chain. > Even I'm thinking that my KVM PMU filter should perhaps base on your work. > >> I will add in v3 and remove "DO NOT MERGE" if the patch isn't in QEMU when >> I am sending out v3. Be sure to add your signed-off-by, which tells you are involved. > Okay. > > Thanks, > Zhao >
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f89568bfa3..df9840e53a 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -540,6 +540,11 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp) trace_kvm_init_vcpu(cpu->cpu_index, kvm_arch_vcpu_id(cpu)); + ret = kvm_arch_pre_create_vcpu(cpu, errp); + if (ret < 0) { + goto err; + } + ret = kvm_create_vcpu(cpu); if (ret < 0) { error_setg_errno(errp, -ret, diff --git a/include/system/kvm.h b/include/system/kvm.h index ab17c09a55..d7dfa25493 100644 --- a/include/system/kvm.h +++ b/include/system/kvm.h @@ -374,6 +374,7 @@ int kvm_arch_get_default_type(MachineState *ms); int kvm_arch_init(MachineState *ms, KVMState *s); +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp); int kvm_arch_init_vcpu(CPUState *cpu); int kvm_arch_destroy_vcpu(CPUState *cpu); diff --git a/target/arm/kvm.c b/target/arm/kvm.c index da30bdbb23..93f1a7245b 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1874,6 +1874,11 @@ static int kvm_arm_sve_set_vls(ARMCPU *cpu) #define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5 +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { int ret; diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 6c749d4ee8..f41e190fb8 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2051,6 +2051,11 @@ full: abort(); } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { struct { diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c index a3f55155b0..91c3c67cdb 100644 --- a/target/loongarch/kvm/kvm.c +++ b/target/loongarch/kvm/kvm.c @@ -973,6 +973,11 @@ static int kvm_cpu_check_pmu(CPUState *cs, Error **errp) return 0; } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { uint64_t val; diff --git a/target/mips/kvm.c b/target/mips/kvm.c index d67b7c1a8e..ec53acb51a 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -61,6 +61,11 @@ int kvm_arch_irqchip_create(KVMState *s) return 0; } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { CPUMIPSState *env = cpu_env(cs); diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 966c2c6572..758298d565 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -477,6 +477,11 @@ static void kvmppc_hw_debug_points_init(CPUPPCState *cenv) } } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { PowerPCCPU *cpu = POWERPC_CPU(cs); diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 23ce779359..55be7542e7 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -1362,6 +1362,11 @@ static int kvm_vcpu_enable_sbi_dbcn(RISCVCPU *cpu, CPUState *cs) return kvm_set_one_reg(cs, kvm_sbi_dbcn.kvm_reg_id, ®); } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { int ret = 0; diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 4d56e653dd..1f592733f4 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -404,6 +404,11 @@ unsigned long kvm_arch_vcpu_id(CPUState *cpu) return cpu->cpu_index; } +int kvm_arch_pre_create_vcpu(CPUState *cpu, Error **errp) +{ + return 0; +} + int kvm_arch_init_vcpu(CPUState *cs) { unsigned int max_cpus = MACHINE(qdev_get_machine())->smp.max_cpus;