hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
PATCH 1/1 hw/ppc/spapr: Test whether TCG is enabled with tcg_enabled()
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;
Signature · 1 line
2.38.1
Quoted 7 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)
Ciao,
Claudio
Quoted 17 lines
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;
Greg Kurz
Reviewed-byQuoted 11 lines · On Tue, 20 Jun 2023 09:55:49 +0200 Claudio Fontana <[email protected]> wrote:
Quoted 7 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)
This check was added with TCG in mind because it is a known limitation. I don't see any reason to prevent qtest from being used with the rest of this function though.
Quoted 17 lines
Ciao,
Claudio
Quoted 12 lines
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +0
-0@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads;
Quoted 2 lines
hw/ppc/spapr.c static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) · line 2527
Quoted 2 lines
hw/ppc/spapr.c +1
-1-if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {
Bonjour Philippe,
Please drop the unneeded parens in the second check.
With this fixed,
Cheers,
--
Greg
Quoted 4 lines
Quoted 3 lines
hw/ppc/spapr.c +0
-0error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;
Signature · 1 line
Greg
Quoted 10 lines · Greg Kurz
Quoted 7 lines · On Tue, 20 Jun 2023 09:55:49 +0200 Claudio Fontana <[email protected]> wrote:
Quoted 6 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Philippe Mathieu-Daudé <[email protected]>I don't remember anymore, but what about qtest ? It is usually the forgotten case in these kind of tests... so much complexity :-)
Good to think about this, since such changes indeed usually break, qtests :)
Quoted 3 lines
This check was added with TCG in mind because it is a known limitation. I don't see any reason to prevent qtest from being used with the rest of this function though.
We don't have any CPU core when using qtest accelerator, so this check is irrelevant IMHO (not reachable with '-accel qtest').
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +0
-0@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads;
Quoted 6 lines
Quoted 2 lines
hw/ppc/spapr.c static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) · line 2527
Quoted 2 lines
hw/ppc/spapr.c +1
-1-if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {Bonjour Philippe,
Please drop the unneeded parens in the second check.
I wanted to do that but then thought someone would ask me to do one change at once ;)
Quoted 3 lines
With this fixed,
Reviewed-by Greg Kurz <[email protected]>
Thanks!
Quoted 16 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) · line 2529
Quoted 7 lines
hw/ppc/spapr.c +1
-1@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );
Quoted 1 line
hw/ppc/spapr.c +0
-0return ;
Quoted 7 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 9 lines
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp) · line 2530
Quoted 8 lines
hw/ppc/spapr.c +1
-1@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;
Nick,
You might want to include this patch in the series adding SMT support to pseries/spapr :
https://patchew.org/QEMU/[email protected]/
C.
Quoted 7 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that '!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 2 lines · Philippe Mathieu-Daudé
Although the PPC target only supports the TCG and KVM accelerators, QEMU supports more. We can no assume that
Typo: -> can not assume
Regards,
BALATON Zoltan
Quoted 23 lines
'!kvm == tcg', so test for the correct accelerator. This also eases code review, because here we don't care about KVM, we really want to test for TCG.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
hw/ppc/spapr.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -2524,7 +2524,7 @@ static void spapr_set_vsmt_mode(SpaprMachineState *spapr, Error **errp)int ret;unsigned int smp_threads = ms->smp.threads; -if (!kvm_enabled () && (smp_threads >1 )) { +if (tcg_enabled () && (smp_threads >1 )) {error_setg (errp,"TCG cannot support more than 1 thread/core " "on a pseries machine" );return ;