[Qemu-devel] [PULL v6 07/12] pc: Fix error message on die-id validation

Eduardo Habkost posted 12 patches 6 years, 5 months ago
Maintainers: Shannon Zhao <shannon.zhaosl@gmail.com>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Andrew Jeffery <andrew@aj.id.au>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Eric Blake <eblake@redhat.com>, Richard Henderson <rth@twiddle.net>, "Michael S. Tsirkin" <mst@redhat.com>, Beniamino Galvani <b.galvani@gmail.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Andrew Baumann <Andrew.Baumann@microsoft.com>, David Gibson <david@gibson.dropbear.id.au>, Eduardo Habkost <ehabkost@redhat.com>, Peter Chubb <peter.chubb@nicta.com.au>, Peter Maydell <peter.maydell@linaro.org>, Andrzej Zaborowski <balrogg@gmail.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, Paolo Bonzini <pbonzini@redhat.com>, Leif Lindholm <leif.lindholm@linaro.org>, Igor Mammedov <imammedo@redhat.com>, Alistair Francis <alistair@alistair23.me>, "Cédric Le Goater" <clg@kaod.org>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Joel Stanley <joel@jms.id.au>, Markus Armbruster <armbru@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Rob Herring <robh@kernel.org>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
[Qemu-devel] [PULL v6 07/12] pc: Fix error message on die-id validation
Posted by Eduardo Habkost 6 years, 5 months ago
The error message for die-id range validation is incorrect.  Example:

  $ qemu-system-x86_64 -smp 1,sockets=6,maxcpus=6 \
    -device qemu64-x86_64-cpu,socket-id=1,die-id=1,core-id=0,thread-id=0
  qemu-system-x86_64: -device qemu64-x86_64-cpu,socket-id=1,die-id=1,core-id=0,thread-id=0: \
    Invalid CPU die-id: 1 must be in range 0:5

The actual range for die-id in this example is 0:0.

Fix the error message to use smp_dies and print the correct range.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190815183803.13346-2-ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Vanderson M. do Rosario <vandersonmr2@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 985e9261b0..584cd3ed0a 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2430,7 +2430,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
             return;
         } else if (cpu->die_id > pcms->smp_dies - 1) {
             error_setg(errp, "Invalid CPU die-id: %u must be in range 0:%u",
-                       cpu->die_id, max_socket);
+                       cpu->die_id, pcms->smp_dies - 1);
             return;
         }
         if (cpu->core_id < 0) {
-- 
2.21.0