* [Qemu-devel] [PULL v2 1/9] smbios: Fix assertion on socket count calculation
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types Michael S. Tsirkin
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Gabriel Somlo, qemu-stable,
Anthony Liguori, Igor Mammedov
From: Eduardo Habkost <ehabkost@redhat.com>
QEMU currently allows the number of VCPUs to not be a multiple of the
number of threads per socket, but the smbios socket count calculation
introduced by commit c97294ec1b9e36887e119589d456557d72ab37b5 doesn't
take that into account, triggering an assertion. e.g.:
$ ./x86_64-softmmu/qemu-system-x86_64 -smp 4,sockets=2,cores=6,threads=1
qemu-system-x86_64: /home/ehabkost/rh/proj/virt/qemu/hw/i386/smbios.c:825: smbios_get_tables: Assertion `smbios_smp_sockets >= 1' failed.
Aborted (core dumped)
Socket count calculation doesn't belong to smbios.c and should
eventually be moved to the main SMP topology configuration code. But
while we don't move the code, at least make it correct by rounding up
the division.
Cc: Gabriel Somlo <somlo@cmu.edu>
Cc: qemu-stable@nongnu.org
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/smbios.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index e3fa1b2..0ae5960 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -821,7 +821,7 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
smbios_build_type_2_table();
smbios_build_type_3_table();
- smbios_smp_sockets = smp_cpus / (smp_cores * smp_threads);
+ smbios_smp_sockets = DIV_ROUND_UP(smp_cpus, smp_cores * smp_threads);
assert(smbios_smp_sockets >= 1);
for (i = 0; i < smbios_smp_sockets; i++) {
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 1/9] smbios: Fix assertion on socket count calculation Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-11-03 13:04 ` Laszlo Ersek
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 3/9] i386/pc: add piix and q35 machtypes to sorting families for -M \? Michael S. Tsirkin
` (7 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Marcel Apfelbaum, Anthony Liguori,
Paolo Bonzini, Laszlo Ersek, =?UTF-8?q?Andreas=20F=C3=A4rber?=,
David Gibson
From: Laszlo Ersek <lersek@redhat.com>
Commit 261747f1 ("vl: Use MachineClass instead of global QEMUMachine
list") broke the ordering of the machine types in the user-visible output
of
qemu-system-XXXX -M \?
This occurred because registration was rebased from a manually maintained
linked list to GLib hash tables:
qemu_register_machine()
type_register()
type_register_internal()
type_table_add()
g_hash_table_insert()
and because the listing was rebased accordingly, from the traversal of the
list to the traversal of the hash table (rendered as an ad-hoc list):
machine_parse()
object_class_get_list(TYPE_MACHINE)
object_class_foreach()
g_hash_table_foreach()
The current order is a "random" one, for practical purposes, which is
annoying for users.
Introduce new members QEMUMachine.family and MachineClass.family, allowing
machine types to be "clustered". Introduce a comparator function that
establishes a total ordering between machine types, ordering machine types
in the same family next to each other. In machine_parse(), list the
supported machine types sorted with the comparator function.
The comparator function:
- sorts whole families before standalone machine types,
- sorts whole families between each other in alphabetically increasing
order,
- sorts machine types inside the same family in alphabetically decreasing
order,
- sorts standalone machine types between each other in alphabetically
increasing order.
After this patch, all machine types are considered standalone, and
accordingly, the output is alphabetically ascending. This will be refined
in the following patches.
Effects on the x86_64 output:
Before:
> Supported machines are:
> pc-0.13 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
> pc-1.0 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
> pc-1.1 Standard PC (i440FX + PIIX, 1996)
> pc-0.14 Standard PC (i440FX + PIIX, 1996)
> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
> pc-0.15 Standard PC (i440FX + PIIX, 1996)
> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
> isapc ISA-only PC
> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
> pc-1.2 Standard PC (i440FX + PIIX, 1996)
> pc-0.10 Standard PC (i440FX + PIIX, 1996)
> pc-0.11 Standard PC (i440FX + PIIX, 1996)
> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
> none empty machine
> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
> pc-0.12 Standard PC (i440FX + PIIX, 1996)
> pc-1.3 Standard PC (i440FX + PIIX, 1996)
After:
> Supported machines are:
> isapc ISA-only PC
> none empty machine
> pc-0.10 Standard PC (i440FX + PIIX, 1996)
> pc-0.11 Standard PC (i440FX + PIIX, 1996)
> pc-0.12 Standard PC (i440FX + PIIX, 1996)
> pc-0.13 Standard PC (i440FX + PIIX, 1996)
> pc-0.14 Standard PC (i440FX + PIIX, 1996)
> pc-0.15 Standard PC (i440FX + PIIX, 1996)
> pc-1.0 Standard PC (i440FX + PIIX, 1996)
> pc-1.1 Standard PC (i440FX + PIIX, 1996)
> pc-1.2 Standard PC (i440FX + PIIX, 1996)
> pc-1.3 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
Effects on the aarch64 output:
Before:
> Supported machines are:
> lm3s811evb Stellaris LM3S811EVB
> canon-a1100 Canon PowerShot A1100 IS
> vexpress-a15 ARM Versatile Express for Cortex-A15
> vexpress-a9 ARM Versatile Express for Cortex-A9
> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
> connex Gumstix Connex (PXA255)
> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
> lm3s6965evb Stellaris LM3S6965EVB
> versatileab ARM Versatile/AB (ARM926EJ-S)
> borzoi Borzoi PDA (PXA270)
> tosa Tosa PDA (PXA255)
> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> midway Calxeda Midway (ECX-2000)
> mainstone Mainstone II (PXA27x)
> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
> terrier Terrier PDA (PXA270)
> highbank Calxeda Highbank (ECX-1000)
> cubieboard cubietech cubieboard
> sx1-v1 Siemens SX1 (OMAP310) V1
> sx1 Siemens SX1 (OMAP310) V2
> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
> kzm ARM KZM Emulation Baseboard (ARM1136)
> akita Akita PDA (PXA270)
> z2 Zipit Z2 (PXA27x)
> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
> versatilepb ARM Versatile/PB (ARM926EJ-S)
> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
> spitz Spitz PDA (PXA270)
> none empty machine
> virt ARM Virtual Machine
> collie Collie PDA (SA-1110)
> smdkc210 Samsung SMDKC210 board (Exynos4210)
> verdex Gumstix Verdex (PXA270)
> nuri Samsung NURI board (Exynos4210)
> integratorcp ARM Integrator/CP (ARM926EJ-S)
After:
> Supported machines are:
> akita Akita PDA (PXA270)
> borzoi Borzoi PDA (PXA270)
> canon-a1100 Canon PowerShot A1100 IS
> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> collie Collie PDA (SA-1110)
> connex Gumstix Connex (PXA255)
> cubieboard cubietech cubieboard
> highbank Calxeda Highbank (ECX-1000)
> integratorcp ARM Integrator/CP (ARM926EJ-S)
> kzm ARM KZM Emulation Baseboard (ARM1136)
> lm3s6965evb Stellaris LM3S6965EVB
> lm3s811evb Stellaris LM3S811EVB
> mainstone Mainstone II (PXA27x)
> midway Calxeda Midway (ECX-2000)
> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
> none empty machine
> nuri Samsung NURI board (Exynos4210)
> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
> smdkc210 Samsung SMDKC210 board (Exynos4210)
> spitz Spitz PDA (PXA270)
> sx1 Siemens SX1 (OMAP310) V2
> sx1-v1 Siemens SX1 (OMAP310) V1
> terrier Terrier PDA (PXA270)
> tosa Tosa PDA (PXA255)
> verdex Gumstix Verdex (PXA270)
> versatileab ARM Versatile/AB (ARM926EJ-S)
> versatilepb ARM Versatile/PB (ARM926EJ-S)
> vexpress-a15 ARM Versatile Express for Cortex-A15
> vexpress-a9 ARM Versatile Express for Cortex-A9
> virt ARM Virtual Machine
> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
> z2 Zipit Z2 (PXA27x)
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
---
include/hw/boards.h | 2 ++
hw/i386/pc.c | 1 +
vl.c | 38 +++++++++++++++++++++++++++++++++++++-
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index e07c03f..4429a1e 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -19,6 +19,7 @@ typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
struct QEMUMachine {
+ const char *family; /* NULL iff @name identifies a standalone machtype */
const char *name;
const char *alias;
const char *desc;
@@ -76,6 +77,7 @@ struct MachineClass {
ObjectClass parent_class;
/*< public >*/
+ const char *family; /* NULL iff @name identifies a standalone machtype */
const char *name;
const char *alias;
const char *desc;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index d045e8b..21beb72 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1516,6 +1516,7 @@ static void pc_generic_machine_class_init(ObjectClass *oc, void *data)
MachineClass *mc = MACHINE_CLASS(oc);
QEMUMachine *qm = data;
+ mc->family = qm->family;
mc->name = qm->name;
mc->alias = qm->alias;
mc->desc = qm->desc;
diff --git a/vl.c b/vl.c
index aee73e1..a518f84 100644
--- a/vl.c
+++ b/vl.c
@@ -1460,6 +1460,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
MachineClass *mc = MACHINE_CLASS(oc);
QEMUMachine *qm = data;
+ mc->family = qm->family;
mc->name = qm->name;
mc->alias = qm->alias;
mc->desc = qm->desc;
@@ -2534,7 +2535,41 @@ static int debugcon_parse(const char *devname)
return 0;
}
-static MachineClass *machine_parse(const char *name)
+static gint machine_class_cmp(gconstpointer a, gconstpointer b)
+{
+ const MachineClass *mc1 = a, *mc2 = b;
+ int res;
+
+ if (mc1->family == NULL) {
+ if (mc2->family == NULL) {
+ /* Compare standalone machine types against each other; they sort
+ * in increasing order.
+ */
+ return strcmp(object_class_get_name(OBJECT_CLASS(mc1)),
+ object_class_get_name(OBJECT_CLASS(mc2)));
+ }
+
+ /* Standalone machine types sort after families. */
+ return 1;
+ }
+
+ if (mc2->family == NULL) {
+ /* Families sort before standalone machine types. */
+ return -1;
+ }
+
+ /* Families sort between each other alphabetically increasingly. */
+ res = strcmp(mc1->family, mc2->family);
+ if (res != 0) {
+ return res;
+ }
+
+ /* Within the same family, machine types sort in decreasing order. */
+ return strcmp(object_class_get_name(OBJECT_CLASS(mc2)),
+ object_class_get_name(OBJECT_CLASS(mc1)));
+}
+
+ static MachineClass *machine_parse(const char *name)
{
MachineClass *mc = NULL;
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
@@ -2550,6 +2585,7 @@ static MachineClass *machine_parse(const char *name)
error_printf("Use -machine help to list supported machines!\n");
} else {
printf("Supported machines are:\n");
+ machines = g_slist_sort(machines, machine_class_cmp);
for (el = machines; el; el = el->next) {
MachineClass *mc = el->data;
if (mc->alias) {
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types Michael S. Tsirkin
@ 2014-11-03 13:04 ` Laszlo Ersek
2014-11-03 13:10 ` Laszlo Ersek
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Laszlo Ersek @ 2014-11-03 13:04 UTC (permalink / raw)
To: Michael S. Tsirkin, qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Marcel Apfelbaum, Anthony Liguori,
Paolo Bonzini, Andreas Färber, David Gibson
On 10/22/14 10:18, Michael S. Tsirkin wrote:
> From: Laszlo Ersek <lersek@redhat.com>
>
> Commit 261747f1 ("vl: Use MachineClass instead of global QEMUMachine
> list") broke the ordering of the machine types in the user-visible output
> of
>
> qemu-system-XXXX -M \?
>
> This occurred because registration was rebased from a manually maintained
> linked list to GLib hash tables:
>
> qemu_register_machine()
> type_register()
> type_register_internal()
> type_table_add()
> g_hash_table_insert()
>
> and because the listing was rebased accordingly, from the traversal of the
> list to the traversal of the hash table (rendered as an ad-hoc list):
>
> machine_parse()
> object_class_get_list(TYPE_MACHINE)
> object_class_foreach()
> g_hash_table_foreach()
>
> The current order is a "random" one, for practical purposes, which is
> annoying for users.
>
> Introduce new members QEMUMachine.family and MachineClass.family, allowing
> machine types to be "clustered". Introduce a comparator function that
> establishes a total ordering between machine types, ordering machine types
> in the same family next to each other. In machine_parse(), list the
> supported machine types sorted with the comparator function.
>
> The comparator function:
> - sorts whole families before standalone machine types,
> - sorts whole families between each other in alphabetically increasing
> order,
> - sorts machine types inside the same family in alphabetically decreasing
> order,
> - sorts standalone machine types between each other in alphabetically
> increasing order.
>
> After this patch, all machine types are considered standalone, and
> accordingly, the output is alphabetically ascending. This will be refined
> in the following patches.
>
> Effects on the x86_64 output:
>
> Before:
>
>> Supported machines are:
>> pc-0.13 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
>> pc-1.0 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
>> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
>> pc-1.1 Standard PC (i440FX + PIIX, 1996)
>> pc-0.14 Standard PC (i440FX + PIIX, 1996)
>> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
>> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
>> pc-0.15 Standard PC (i440FX + PIIX, 1996)
>> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
>> isapc ISA-only PC
>> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
>> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
>> pc-1.2 Standard PC (i440FX + PIIX, 1996)
>> pc-0.10 Standard PC (i440FX + PIIX, 1996)
>> pc-0.11 Standard PC (i440FX + PIIX, 1996)
>> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
>> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
>> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
>> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
>> none empty machine
>> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
>> pc-0.12 Standard PC (i440FX + PIIX, 1996)
>> pc-1.3 Standard PC (i440FX + PIIX, 1996)
>
> After:
>
>> Supported machines are:
>> isapc ISA-only PC
>> none empty machine
>> pc-0.10 Standard PC (i440FX + PIIX, 1996)
>> pc-0.11 Standard PC (i440FX + PIIX, 1996)
>> pc-0.12 Standard PC (i440FX + PIIX, 1996)
>> pc-0.13 Standard PC (i440FX + PIIX, 1996)
>> pc-0.14 Standard PC (i440FX + PIIX, 1996)
>> pc-0.15 Standard PC (i440FX + PIIX, 1996)
>> pc-1.0 Standard PC (i440FX + PIIX, 1996)
>> pc-1.1 Standard PC (i440FX + PIIX, 1996)
>> pc-1.2 Standard PC (i440FX + PIIX, 1996)
>> pc-1.3 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
>> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
>> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
>> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
>> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
>> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
>> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
>> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
>
> Effects on the aarch64 output:
>
> Before:
>
>> Supported machines are:
>> lm3s811evb Stellaris LM3S811EVB
>> canon-a1100 Canon PowerShot A1100 IS
>> vexpress-a15 ARM Versatile Express for Cortex-A15
>> vexpress-a9 ARM Versatile Express for Cortex-A9
>> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
>> connex Gumstix Connex (PXA255)
>> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
>> lm3s6965evb Stellaris LM3S6965EVB
>> versatileab ARM Versatile/AB (ARM926EJ-S)
>> borzoi Borzoi PDA (PXA270)
>> tosa Tosa PDA (PXA255)
>> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
>> midway Calxeda Midway (ECX-2000)
>> mainstone Mainstone II (PXA27x)
>> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
>> terrier Terrier PDA (PXA270)
>> highbank Calxeda Highbank (ECX-1000)
>> cubieboard cubietech cubieboard
>> sx1-v1 Siemens SX1 (OMAP310) V1
>> sx1 Siemens SX1 (OMAP310) V2
>> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
>> kzm ARM KZM Emulation Baseboard (ARM1136)
>> akita Akita PDA (PXA270)
>> z2 Zipit Z2 (PXA27x)
>> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
>> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
>> versatilepb ARM Versatile/PB (ARM926EJ-S)
>> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
>> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
>> spitz Spitz PDA (PXA270)
>> none empty machine
>> virt ARM Virtual Machine
>> collie Collie PDA (SA-1110)
>> smdkc210 Samsung SMDKC210 board (Exynos4210)
>> verdex Gumstix Verdex (PXA270)
>> nuri Samsung NURI board (Exynos4210)
>> integratorcp ARM Integrator/CP (ARM926EJ-S)
>
> After:
>
>> Supported machines are:
>> akita Akita PDA (PXA270)
>> borzoi Borzoi PDA (PXA270)
>> canon-a1100 Canon PowerShot A1100 IS
>> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
>> collie Collie PDA (SA-1110)
>> connex Gumstix Connex (PXA255)
>> cubieboard cubietech cubieboard
>> highbank Calxeda Highbank (ECX-1000)
>> integratorcp ARM Integrator/CP (ARM926EJ-S)
>> kzm ARM KZM Emulation Baseboard (ARM1136)
>> lm3s6965evb Stellaris LM3S6965EVB
>> lm3s811evb Stellaris LM3S811EVB
>> mainstone Mainstone II (PXA27x)
>> midway Calxeda Midway (ECX-2000)
>> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
>> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
>> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
>> none empty machine
>> nuri Samsung NURI board (Exynos4210)
>> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
>> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
>> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
>> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
>> smdkc210 Samsung SMDKC210 board (Exynos4210)
>> spitz Spitz PDA (PXA270)
>> sx1 Siemens SX1 (OMAP310) V2
>> sx1-v1 Siemens SX1 (OMAP310) V1
>> terrier Terrier PDA (PXA270)
>> tosa Tosa PDA (PXA255)
>> verdex Gumstix Verdex (PXA270)
>> versatileab ARM Versatile/AB (ARM926EJ-S)
>> versatilepb ARM Versatile/PB (ARM926EJ-S)
>> vexpress-a15 ARM Versatile Express for Cortex-A15
>> vexpress-a9 ARM Versatile Express for Cortex-A9
>> virt ARM Virtual Machine
>> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
>> z2 Zipit Z2 (PXA27x)
>
> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> include/hw/boards.h | 2 ++
> hw/i386/pc.c | 1 +
> vl.c | 38 +++++++++++++++++++++++++++++++++++++-
> 3 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index e07c03f..4429a1e 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -19,6 +19,7 @@ typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
> typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
>
> struct QEMUMachine {
> + const char *family; /* NULL iff @name identifies a standalone machtype */
> const char *name;
> const char *alias;
> const char *desc;
> @@ -76,6 +77,7 @@ struct MachineClass {
> ObjectClass parent_class;
> /*< public >*/
>
> + const char *family; /* NULL iff @name identifies a standalone machtype */
> const char *name;
> const char *alias;
> const char *desc;
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index d045e8b..21beb72 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1516,6 +1516,7 @@ static void pc_generic_machine_class_init(ObjectClass *oc, void *data)
> MachineClass *mc = MACHINE_CLASS(oc);
> QEMUMachine *qm = data;
>
> + mc->family = qm->family;
> mc->name = qm->name;
> mc->alias = qm->alias;
> mc->desc = qm->desc;
> diff --git a/vl.c b/vl.c
> index aee73e1..a518f84 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1460,6 +1460,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
> MachineClass *mc = MACHINE_CLASS(oc);
> QEMUMachine *qm = data;
>
> + mc->family = qm->family;
> mc->name = qm->name;
> mc->alias = qm->alias;
> mc->desc = qm->desc;
> @@ -2534,7 +2535,41 @@ static int debugcon_parse(const char *devname)
> return 0;
> }
>
> -static MachineClass *machine_parse(const char *name)
> +static gint machine_class_cmp(gconstpointer a, gconstpointer b)
> +{
> + const MachineClass *mc1 = a, *mc2 = b;
> + int res;
> +
> + if (mc1->family == NULL) {
> + if (mc2->family == NULL) {
> + /* Compare standalone machine types against each other; they sort
> + * in increasing order.
> + */
> + return strcmp(object_class_get_name(OBJECT_CLASS(mc1)),
> + object_class_get_name(OBJECT_CLASS(mc2)));
> + }
> +
> + /* Standalone machine types sort after families. */
> + return 1;
> + }
> +
> + if (mc2->family == NULL) {
> + /* Families sort before standalone machine types. */
> + return -1;
> + }
> +
> + /* Families sort between each other alphabetically increasingly. */
> + res = strcmp(mc1->family, mc2->family);
> + if (res != 0) {
> + return res;
> + }
> +
> + /* Within the same family, machine types sort in decreasing order. */
> + return strcmp(object_class_get_name(OBJECT_CLASS(mc2)),
> + object_class_get_name(OBJECT_CLASS(mc1)));
> +}
> +
> + static MachineClass *machine_parse(const char *name)
> {
> MachineClass *mc = NULL;
> GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
> @@ -2550,6 +2585,7 @@ static MachineClass *machine_parse(const char *name)
> error_printf("Use -machine help to list supported machines!\n");
> } else {
> printf("Supported machines are:\n");
> + machines = g_slist_sort(machines, machine_class_cmp);
> for (el = machines; el; el = el->next) {
> MachineClass *mc = el->data;
> if (mc->alias) {
>
May I ask about the fate of this PULL request (in particular I care
about this patch, and the next one)?
Thank you,
Laszlo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types
2014-11-03 13:04 ` Laszlo Ersek
@ 2014-11-03 13:10 ` Laszlo Ersek
2014-11-03 13:11 ` Andreas Färber
2014-11-03 13:11 ` Michael S. Tsirkin
2 siblings, 0 replies; 15+ messages in thread
From: Laszlo Ersek @ 2014-11-03 13:10 UTC (permalink / raw)
To: Michael S. Tsirkin, qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Marcel Apfelbaum, Anthony Liguori,
Paolo Bonzini, Andreas Färber, David Gibson
On 11/03/14 14:04, Laszlo Ersek wrote:
> On 10/22/14 10:18, Michael S. Tsirkin wrote:
>> From: Laszlo Ersek <lersek@redhat.com>
>
> May I ask about the fate of this PULL request (in particular I care
> about this patch, and the next one)?
Never mind, I can see Michael's new PULL req, posted about half an hour ago.
http://thread.gmane.org/gmane.comp.emulators.qemu/304600
Sorry about the noise.
Thanks!
Laszlo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types
2014-11-03 13:04 ` Laszlo Ersek
2014-11-03 13:10 ` Laszlo Ersek
@ 2014-11-03 13:11 ` Andreas Färber
2014-11-03 13:11 ` Michael S. Tsirkin
2 siblings, 0 replies; 15+ messages in thread
From: Andreas Färber @ 2014-11-03 13:11 UTC (permalink / raw)
To: Laszlo Ersek
Cc: Peter Maydell, Eduardo Habkost, Marcel Apfelbaum,
Michael S. Tsirkin, qemu-devel, Anthony Liguori, Paolo Bonzini,
David Gibson
Am 03.11.2014 um 14:04 schrieb Laszlo Ersek:
> On 10/22/14 10:18, Michael S. Tsirkin wrote:
>> From: Laszlo Ersek <lersek@redhat.com>
>>
>> Commit 261747f1 ("vl: Use MachineClass instead of global QEMUMachine
>> list") broke the ordering of the machine types in the user-visible output
>> of
>>
>> qemu-system-XXXX -M \?
>>
>> This occurred because registration was rebased from a manually maintained
>> linked list to GLib hash tables:
>>
>> qemu_register_machine()
>> type_register()
>> type_register_internal()
>> type_table_add()
>> g_hash_table_insert()
>>
>> and because the listing was rebased accordingly, from the traversal of the
>> list to the traversal of the hash table (rendered as an ad-hoc list):
>>
>> machine_parse()
>> object_class_get_list(TYPE_MACHINE)
>> object_class_foreach()
>> g_hash_table_foreach()
>>
>> The current order is a "random" one, for practical purposes, which is
>> annoying for users.
>>
>> Introduce new members QEMUMachine.family and MachineClass.family, allowing
>> machine types to be "clustered". Introduce a comparator function that
>> establishes a total ordering between machine types, ordering machine types
>> in the same family next to each other. In machine_parse(), list the
>> supported machine types sorted with the comparator function.
>>
>> The comparator function:
>> - sorts whole families before standalone machine types,
>> - sorts whole families between each other in alphabetically increasing
>> order,
>> - sorts machine types inside the same family in alphabetically decreasing
>> order,
>> - sorts standalone machine types between each other in alphabetically
>> increasing order.
>>
>> After this patch, all machine types are considered standalone, and
>> accordingly, the output is alphabetically ascending. This will be refined
>> in the following patches.
>>
>> Effects on the x86_64 output:
>>
>> Before:
>>
>>> Supported machines are:
>>> pc-0.13 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.0 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
>>> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
>>> pc-1.1 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.14 Standard PC (i440FX + PIIX, 1996)
>>> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
>>> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.15 Standard PC (i440FX + PIIX, 1996)
>>> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
>>> isapc ISA-only PC
>>> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
>>> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
>>> pc-1.2 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.10 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.11 Standard PC (i440FX + PIIX, 1996)
>>> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
>>> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
>>> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
>>> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
>>> none empty machine
>>> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
>>> pc-0.12 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.3 Standard PC (i440FX + PIIX, 1996)
>>
>> After:
>>
>>> Supported machines are:
>>> isapc ISA-only PC
>>> none empty machine
>>> pc-0.10 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.11 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.12 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.13 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.14 Standard PC (i440FX + PIIX, 1996)
>>> pc-0.15 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.0 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.1 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.2 Standard PC (i440FX + PIIX, 1996)
>>> pc-1.3 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
>>> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
>>> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
>>> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
>>> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
>>> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
>>> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
>>> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
>>
>> Effects on the aarch64 output:
>>
>> Before:
>>
>>> Supported machines are:
>>> lm3s811evb Stellaris LM3S811EVB
>>> canon-a1100 Canon PowerShot A1100 IS
>>> vexpress-a15 ARM Versatile Express for Cortex-A15
>>> vexpress-a9 ARM Versatile Express for Cortex-A9
>>> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
>>> connex Gumstix Connex (PXA255)
>>> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
>>> lm3s6965evb Stellaris LM3S6965EVB
>>> versatileab ARM Versatile/AB (ARM926EJ-S)
>>> borzoi Borzoi PDA (PXA270)
>>> tosa Tosa PDA (PXA255)
>>> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
>>> midway Calxeda Midway (ECX-2000)
>>> mainstone Mainstone II (PXA27x)
>>> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
>>> terrier Terrier PDA (PXA270)
>>> highbank Calxeda Highbank (ECX-1000)
>>> cubieboard cubietech cubieboard
>>> sx1-v1 Siemens SX1 (OMAP310) V1
>>> sx1 Siemens SX1 (OMAP310) V2
>>> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
>>> kzm ARM KZM Emulation Baseboard (ARM1136)
>>> akita Akita PDA (PXA270)
>>> z2 Zipit Z2 (PXA27x)
>>> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
>>> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
>>> versatilepb ARM Versatile/PB (ARM926EJ-S)
>>> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
>>> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
>>> spitz Spitz PDA (PXA270)
>>> none empty machine
>>> virt ARM Virtual Machine
>>> collie Collie PDA (SA-1110)
>>> smdkc210 Samsung SMDKC210 board (Exynos4210)
>>> verdex Gumstix Verdex (PXA270)
>>> nuri Samsung NURI board (Exynos4210)
>>> integratorcp ARM Integrator/CP (ARM926EJ-S)
>>
>> After:
>>
>>> Supported machines are:
>>> akita Akita PDA (PXA270)
>>> borzoi Borzoi PDA (PXA270)
>>> canon-a1100 Canon PowerShot A1100 IS
>>> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
>>> collie Collie PDA (SA-1110)
>>> connex Gumstix Connex (PXA255)
>>> cubieboard cubietech cubieboard
>>> highbank Calxeda Highbank (ECX-1000)
>>> integratorcp ARM Integrator/CP (ARM926EJ-S)
>>> kzm ARM KZM Emulation Baseboard (ARM1136)
>>> lm3s6965evb Stellaris LM3S6965EVB
>>> lm3s811evb Stellaris LM3S811EVB
>>> mainstone Mainstone II (PXA27x)
>>> midway Calxeda Midway (ECX-2000)
>>> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
>>> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
>>> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
>>> none empty machine
>>> nuri Samsung NURI board (Exynos4210)
>>> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
>>> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
>>> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
>>> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
>>> smdkc210 Samsung SMDKC210 board (Exynos4210)
>>> spitz Spitz PDA (PXA270)
>>> sx1 Siemens SX1 (OMAP310) V2
>>> sx1-v1 Siemens SX1 (OMAP310) V1
>>> terrier Terrier PDA (PXA270)
>>> tosa Tosa PDA (PXA255)
>>> verdex Gumstix Verdex (PXA270)
>>> versatileab ARM Versatile/AB (ARM926EJ-S)
>>> versatilepb ARM Versatile/PB (ARM926EJ-S)
>>> vexpress-a15 ARM Versatile Express for Cortex-A15
>>> vexpress-a9 ARM Versatile Express for Cortex-A9
>>> virt ARM Virtual Machine
>>> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
>>> z2 Zipit Z2 (PXA27x)
>>
>> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>> Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
>> Acked-by: David Gibson <david@gibson.dropbear.id.au>
[...]
>
> May I ask about the fate of this PULL request (in particular I care
> about this patch, and the next one)?
Michael sent a new, larger PULL shortly before you asked. :)
Cheers,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types
2014-11-03 13:04 ` Laszlo Ersek
2014-11-03 13:10 ` Laszlo Ersek
2014-11-03 13:11 ` Andreas Färber
@ 2014-11-03 13:11 ` Michael S. Tsirkin
2 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-11-03 13:11 UTC (permalink / raw)
To: Laszlo Ersek
Cc: Peter Maydell, Eduardo Habkost, Marcel Apfelbaum, qemu-devel,
Anthony Liguori, Paolo Bonzini, Andreas Färber, David Gibson
On Mon, Nov 03, 2014 at 02:04:25PM +0100, Laszlo Ersek wrote:
> On 10/22/14 10:18, Michael S. Tsirkin wrote:
> > From: Laszlo Ersek <lersek@redhat.com>
> >
> > Commit 261747f1 ("vl: Use MachineClass instead of global QEMUMachine
> > list") broke the ordering of the machine types in the user-visible output
> > of
> >
> > qemu-system-XXXX -M \?
> >
> > This occurred because registration was rebased from a manually maintained
> > linked list to GLib hash tables:
> >
> > qemu_register_machine()
> > type_register()
> > type_register_internal()
> > type_table_add()
> > g_hash_table_insert()
> >
> > and because the listing was rebased accordingly, from the traversal of the
> > list to the traversal of the hash table (rendered as an ad-hoc list):
> >
> > machine_parse()
> > object_class_get_list(TYPE_MACHINE)
> > object_class_foreach()
> > g_hash_table_foreach()
> >
> > The current order is a "random" one, for practical purposes, which is
> > annoying for users.
> >
> > Introduce new members QEMUMachine.family and MachineClass.family, allowing
> > machine types to be "clustered". Introduce a comparator function that
> > establishes a total ordering between machine types, ordering machine types
> > in the same family next to each other. In machine_parse(), list the
> > supported machine types sorted with the comparator function.
> >
> > The comparator function:
> > - sorts whole families before standalone machine types,
> > - sorts whole families between each other in alphabetically increasing
> > order,
> > - sorts machine types inside the same family in alphabetically decreasing
> > order,
> > - sorts standalone machine types between each other in alphabetically
> > increasing order.
> >
> > After this patch, all machine types are considered standalone, and
> > accordingly, the output is alphabetically ascending. This will be refined
> > in the following patches.
> >
> > Effects on the x86_64 output:
> >
> > Before:
> >
> >> Supported machines are:
> >> pc-0.13 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.0 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
> >> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
> >> pc-1.1 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.14 Standard PC (i440FX + PIIX, 1996)
> >> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
> >> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.15 Standard PC (i440FX + PIIX, 1996)
> >> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
> >> isapc ISA-only PC
> >> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> >> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
> >> pc-1.2 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.10 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.11 Standard PC (i440FX + PIIX, 1996)
> >> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
> >> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> >> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
> >> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
> >> none empty machine
> >> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
> >> pc-0.12 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.3 Standard PC (i440FX + PIIX, 1996)
> >
> > After:
> >
> >> Supported machines are:
> >> isapc ISA-only PC
> >> none empty machine
> >> pc-0.10 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.11 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.12 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.13 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.14 Standard PC (i440FX + PIIX, 1996)
> >> pc-0.15 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.0 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.1 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.2 Standard PC (i440FX + PIIX, 1996)
> >> pc-1.3 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
> >> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
> >> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> >> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
> >> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
> >> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
> >> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> >> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
> >
> > Effects on the aarch64 output:
> >
> > Before:
> >
> >> Supported machines are:
> >> lm3s811evb Stellaris LM3S811EVB
> >> canon-a1100 Canon PowerShot A1100 IS
> >> vexpress-a15 ARM Versatile Express for Cortex-A15
> >> vexpress-a9 ARM Versatile Express for Cortex-A9
> >> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
> >> connex Gumstix Connex (PXA255)
> >> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
> >> lm3s6965evb Stellaris LM3S6965EVB
> >> versatileab ARM Versatile/AB (ARM926EJ-S)
> >> borzoi Borzoi PDA (PXA270)
> >> tosa Tosa PDA (PXA255)
> >> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> >> midway Calxeda Midway (ECX-2000)
> >> mainstone Mainstone II (PXA27x)
> >> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
> >> terrier Terrier PDA (PXA270)
> >> highbank Calxeda Highbank (ECX-1000)
> >> cubieboard cubietech cubieboard
> >> sx1-v1 Siemens SX1 (OMAP310) V1
> >> sx1 Siemens SX1 (OMAP310) V2
> >> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
> >> kzm ARM KZM Emulation Baseboard (ARM1136)
> >> akita Akita PDA (PXA270)
> >> z2 Zipit Z2 (PXA27x)
> >> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
> >> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
> >> versatilepb ARM Versatile/PB (ARM926EJ-S)
> >> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
> >> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
> >> spitz Spitz PDA (PXA270)
> >> none empty machine
> >> virt ARM Virtual Machine
> >> collie Collie PDA (SA-1110)
> >> smdkc210 Samsung SMDKC210 board (Exynos4210)
> >> verdex Gumstix Verdex (PXA270)
> >> nuri Samsung NURI board (Exynos4210)
> >> integratorcp ARM Integrator/CP (ARM926EJ-S)
> >
> > After:
> >
> >> Supported machines are:
> >> akita Akita PDA (PXA270)
> >> borzoi Borzoi PDA (PXA270)
> >> canon-a1100 Canon PowerShot A1100 IS
> >> cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
> >> collie Collie PDA (SA-1110)
> >> connex Gumstix Connex (PXA255)
> >> cubieboard cubietech cubieboard
> >> highbank Calxeda Highbank (ECX-1000)
> >> integratorcp ARM Integrator/CP (ARM926EJ-S)
> >> kzm ARM KZM Emulation Baseboard (ARM1136)
> >> lm3s6965evb Stellaris LM3S6965EVB
> >> lm3s811evb Stellaris LM3S811EVB
> >> mainstone Mainstone II (PXA27x)
> >> midway Calxeda Midway (ECX-2000)
> >> musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
> >> n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
> >> n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
> >> none empty machine
> >> nuri Samsung NURI board (Exynos4210)
> >> realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
> >> realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
> >> realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
> >> realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
> >> smdkc210 Samsung SMDKC210 board (Exynos4210)
> >> spitz Spitz PDA (PXA270)
> >> sx1 Siemens SX1 (OMAP310) V2
> >> sx1-v1 Siemens SX1 (OMAP310) V1
> >> terrier Terrier PDA (PXA270)
> >> tosa Tosa PDA (PXA255)
> >> verdex Gumstix Verdex (PXA270)
> >> versatileab ARM Versatile/AB (ARM926EJ-S)
> >> versatilepb ARM Versatile/PB (ARM926EJ-S)
> >> vexpress-a15 ARM Versatile Express for Cortex-A15
> >> vexpress-a9 ARM Versatile Express for Cortex-A9
> >> virt ARM Virtual Machine
> >> xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
> >> z2 Zipit Z2 (PXA27x)
> >
> > RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
> > Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
> > Acked-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > include/hw/boards.h | 2 ++
> > hw/i386/pc.c | 1 +
> > vl.c | 38 +++++++++++++++++++++++++++++++++++++-
> > 3 files changed, 40 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > index e07c03f..4429a1e 100644
> > --- a/include/hw/boards.h
> > +++ b/include/hw/boards.h
> > @@ -19,6 +19,7 @@ typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
> > typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
> >
> > struct QEMUMachine {
> > + const char *family; /* NULL iff @name identifies a standalone machtype */
> > const char *name;
> > const char *alias;
> > const char *desc;
> > @@ -76,6 +77,7 @@ struct MachineClass {
> > ObjectClass parent_class;
> > /*< public >*/
> >
> > + const char *family; /* NULL iff @name identifies a standalone machtype */
> > const char *name;
> > const char *alias;
> > const char *desc;
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index d045e8b..21beb72 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1516,6 +1516,7 @@ static void pc_generic_machine_class_init(ObjectClass *oc, void *data)
> > MachineClass *mc = MACHINE_CLASS(oc);
> > QEMUMachine *qm = data;
> >
> > + mc->family = qm->family;
> > mc->name = qm->name;
> > mc->alias = qm->alias;
> > mc->desc = qm->desc;
> > diff --git a/vl.c b/vl.c
> > index aee73e1..a518f84 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -1460,6 +1460,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
> > MachineClass *mc = MACHINE_CLASS(oc);
> > QEMUMachine *qm = data;
> >
> > + mc->family = qm->family;
> > mc->name = qm->name;
> > mc->alias = qm->alias;
> > mc->desc = qm->desc;
> > @@ -2534,7 +2535,41 @@ static int debugcon_parse(const char *devname)
> > return 0;
> > }
> >
> > -static MachineClass *machine_parse(const char *name)
> > +static gint machine_class_cmp(gconstpointer a, gconstpointer b)
> > +{
> > + const MachineClass *mc1 = a, *mc2 = b;
> > + int res;
> > +
> > + if (mc1->family == NULL) {
> > + if (mc2->family == NULL) {
> > + /* Compare standalone machine types against each other; they sort
> > + * in increasing order.
> > + */
> > + return strcmp(object_class_get_name(OBJECT_CLASS(mc1)),
> > + object_class_get_name(OBJECT_CLASS(mc2)));
> > + }
> > +
> > + /* Standalone machine types sort after families. */
> > + return 1;
> > + }
> > +
> > + if (mc2->family == NULL) {
> > + /* Families sort before standalone machine types. */
> > + return -1;
> > + }
> > +
> > + /* Families sort between each other alphabetically increasingly. */
> > + res = strcmp(mc1->family, mc2->family);
> > + if (res != 0) {
> > + return res;
> > + }
> > +
> > + /* Within the same family, machine types sort in decreasing order. */
> > + return strcmp(object_class_get_name(OBJECT_CLASS(mc2)),
> > + object_class_get_name(OBJECT_CLASS(mc1)));
> > +}
> > +
> > + static MachineClass *machine_parse(const char *name)
> > {
> > MachineClass *mc = NULL;
> > GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
> > @@ -2550,6 +2585,7 @@ static MachineClass *machine_parse(const char *name)
> > error_printf("Use -machine help to list supported machines!\n");
> > } else {
> > printf("Supported machines are:\n");
> > + machines = g_slist_sort(machines, machine_class_cmp);
> > for (el = machines; el; el = el->next) {
> > MachineClass *mc = el->data;
> > if (mc->alias) {
> >
>
> May I ask about the fate of this PULL request (in particular I care
> about this patch, and the next one)?
>
> Thank you,
> Laszlo
I just sent a new request today including this patch.
Pls take a look, and let me know if something's missing.
--
MST
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 3/9] i386/pc: add piix and q35 machtypes to sorting families for -M \?
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 1/9] smbios: Fix assertion on socket count calculation Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 2/9] well-defined listing order for machine types Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 4/9] pc: Fix disabling of vapic for compat PC models Michael S. Tsirkin
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Marcel Apfelbaum, Anthony Liguori, Paolo Bonzini,
Laszlo Ersek, David Gibson
From: Laszlo Ersek <lersek@redhat.com>
With this patch applied, the output of -M \? is
> Supported machines are:
> pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-2.2)
> pc-i440fx-2.2 Standard PC (i440FX + PIIX, 1996) (default)
> pc-i440fx-2.1 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
> pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
> pc-1.3 Standard PC (i440FX + PIIX, 1996)
> pc-1.2 Standard PC (i440FX + PIIX, 1996)
> pc-1.1 Standard PC (i440FX + PIIX, 1996)
> pc-1.0 Standard PC (i440FX + PIIX, 1996)
> pc-0.15 Standard PC (i440FX + PIIX, 1996)
> pc-0.14 Standard PC (i440FX + PIIX, 1996)
> pc-0.13 Standard PC (i440FX + PIIX, 1996)
> pc-0.12 Standard PC (i440FX + PIIX, 1996)
> pc-0.11 Standard PC (i440FX + PIIX, 1996)
> pc-0.10 Standard PC (i440FX + PIIX, 1996)
> q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.2)
> pc-q35-2.2 Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.1 Standard PC (Q35 + ICH9, 2009)
> pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
> pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
> isapc ISA-only PC
> none empty machine
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1145042
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/i386/pc_piix.c | 1 +
hw/i386/pc_q35.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 4384633..25ca253 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -451,6 +451,7 @@ static void pc_xen_hvm_init(MachineState *machine)
#define PC_I440FX_MACHINE_OPTIONS \
PC_DEFAULT_MACHINE_OPTIONS, \
+ .family = "pc_piix", \
.desc = "Standard PC (i440FX + PIIX, 1996)", \
.hot_add_cpu = pc_hot_add_cpu
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index bb0dc8e..905e79d 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -347,6 +347,7 @@ static void pc_q35_init_1_4(MachineState *machine)
#define PC_Q35_MACHINE_OPTIONS \
PC_DEFAULT_MACHINE_OPTIONS, \
+ .family = "pc_q35", \
.desc = "Standard PC (Q35 + ICH9, 2009)", \
.hot_add_cpu = pc_hot_add_cpu, \
.units_per_default_bus = 1
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 4/9] pc: Fix disabling of vapic for compat PC models
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (2 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 3/9] i386/pc: add piix and q35 machtypes to sorting families for -M \? Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 5/9] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive Michael S. Tsirkin
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori, Jan Kiszka
From: Jan Kiszka <jan.kiszka@siemens.com>
We used to be able to address both the QEMU and the KVM APIC via "apic".
This doesn't work anymore. So we need to use their parent class to turn
off the vapic on machines that should not expose them.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/pc_piix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 25ca253..f6edde1 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -662,7 +662,7 @@ static QEMUMachine pc_machine_v1_1 = {
.property = "class",\
.value = stringify(PCI_CLASS_MEMORY_RAM),\
},{\
- .driver = "apic",\
+ .driver = "apic-common",\
.property = "vapic",\
.value = "off",\
},{\
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 5/9] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive.
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (3 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 4/9] pc: Fix disabling of vapic for compat PC models Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 6/9] pcie: change confused comment clearer Michael S. Tsirkin
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Gal Hammer, Peter Maydell, Anthony Liguori, Paolo Bonzini
From: Gal Hammer <ghammer@redhat.com>
Add a 16-bytes buffer to allow storing a 128-bit UUID value in an
ACPI table.
Signed-off-by: Gal Hammer <ghammer@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
| 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
--git a/scripts/acpi_extract.py b/scripts/acpi_extract.py
index 22ea468..10c1ffb 100755
--- a/scripts/acpi_extract.py
+++ b/scripts/acpi_extract.py
@@ -139,13 +139,16 @@ def aml_name_string(offset):
offset += 1
return offset;
-# Given data offset, find 8 byte buffer offset
-def aml_data_buffer8(offset):
- #0x08 NameOp NameString DataRef
- expect = [0x11, 0x0B, 0x0A, 0x08]
+# Given data offset, find variable length byte buffer offset
+def aml_data_buffer(offset, length):
+ #0x11 PkgLength BufferSize ByteList
+ if (length > 63):
+ die( "Name offset 0x%x: expected a one byte PkgLength (length<=63)" %
+ (offset));
+ expect = [0x11, length+3, 0x0A, length]
if (aml[offset:offset+4] != expect):
die( "Name offset 0x%x: expected %s actual %s" %
- (offset, aml[offset:offset+4], expect))
+ (offset, expect, aml[offset:offset+4]))
return offset + len(expect)
# Given data offset, find dword const offset
@@ -172,9 +175,9 @@ def aml_data_byte_const(offset):
(offset, aml[offset]));
return offset + 1;
-# Find name'd buffer8
-def aml_name_buffer8(offset):
- return aml_data_buffer8(aml_name_string(offset) + 4)
+# Find name'd buffer
+def aml_name_buffer(offset, length):
+ return aml_data_buffer(aml_name_string(offset) + 4, length)
# Given name offset, find dword const offset
def aml_name_dword_const(offset):
@@ -308,7 +311,9 @@ for i in range(len(asl)):
output[array] = aml
continue
if (directive == "ACPI_EXTRACT_NAME_BUFFER8"):
- offset = aml_name_buffer8(offset)
+ offset = aml_name_buffer(offset, 8)
+ elif (directive == "ACPI_EXTRACT_NAME_BUFFER16"):
+ offset = aml_name_buffer(offset, 16)
elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"):
offset = aml_name_dword_const(offset)
elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"):
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 6/9] pcie: change confused comment clearer
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (4 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 5/9] i386: Add an ACPI_EXTRACT_NAME_BUFFER16 directive Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 7/9] virtio-pci: fix migration for pci bus master Michael S. Tsirkin
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Gonglei, Anthony Liguori
From: Gonglei <arei.gonglei@huawei.com>
This comment applies to all functions below it.
It is not appropriate that called capability allocation
functions, change it into capability list management functions.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/pcie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index b64a004..58455bd 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -529,7 +529,7 @@ bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev)
}
/**************************************************************************
- * pci express extended capability allocation functions
+ * pci express extended capability list management functions
* uint16_t ext_cap_id (16 bit)
* uint8_t cap_ver (4 bit)
* uint16_t cap_offset (12 bit)
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 7/9] virtio-pci: fix migration for pci bus master
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (5 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 6/9] pcie: change confused comment clearer Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 8/9] intel_iommu: fix VTD_SID_TO_BUS Michael S. Tsirkin
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, qemu-ppc, Alexander Graf, Anthony Liguori
Current support for bus master (clearing OK bit) together with the need to
support guests which do not enable PCI bus mastering, leads to extra state in
VIRTIO_PCI_FLAG_BUS_MASTER_BUG bit, which isn't robust in case of cross-version
migration for the case when guests use the device before setting DRIVER_OK.
Rip out this code, and replace it:
- Modern QEMU doesn't need VIRTIO_PCI_FLAG_BUS_MASTER_BUG
so just drop it for latest machine type.
- For compat machine types, set PCI_COMMAND if DRIVER_OK
is set.
As this is needed for 2.1 for both pc and ppc, move PC_COMPAT macros from pc.h
to a new common header.
Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
---
hw/virtio/virtio-pci.h | 5 +++++
include/hw/compat.h | 23 +++++++++++++++++++++++
include/hw/i386/pc.h | 18 ++----------------
hw/i386/pc_piix.c | 2 +-
hw/i386/pc_q35.c | 2 +-
hw/ppc/spapr.c | 7 +++++++
hw/virtio/virtio-pci.c | 29 +++++++++++------------------
7 files changed, 50 insertions(+), 36 deletions(-)
create mode 100644 include/hw/compat.h
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 1cea157..8873b6d 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -53,6 +53,11 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
#define VIRTIO_PCI_BUS_CLASS(klass) \
OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
+/* Need to activate work-arounds for buggy guests at vmstate load. */
+#define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT 0
+#define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
+ (1 << VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT)
+
/* Performance improves when virtqueue kick processing is decoupled from the
* vcpu thread using ioeventfd for some devices. */
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
diff --git a/include/hw/compat.h b/include/hw/compat.h
new file mode 100644
index 0000000..2a1a5bb
--- /dev/null
+++ b/include/hw/compat.h
@@ -0,0 +1,23 @@
+#ifndef HW_COMPAT_H
+#define HW_COMPAT_H
+
+#define HW_COMPAT_2_1 \
+ {\
+ .driver = "intel-hda",\
+ .property = "old_msi_addr",\
+ .value = "on",\
+ },{\
+ .driver = "VGA",\
+ .property = "qemu-extended-regs",\
+ .value = "off",\
+ },{\
+ .driver = "secondary-vga",\
+ .property = "qemu-extended-regs",\
+ .value = "off",\
+ },{\
+ .driver = "virtio-pci",\
+ .property = "virtio-pci-bus-master-bug-migration",\
+ .value = "on",\
+ }
+
+#endif /* HW_COMPAT_H */
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 1c2602e..02a1d61 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -14,6 +14,7 @@
#include "sysemu/sysemu.h"
#include "hw/pci/pci.h"
#include "hw/boards.h"
+#include "hw/compat.h"
#define HPET_INTCAP "hpet-intcap"
@@ -301,23 +302,8 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
int e820_get_num_entries(void);
bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
-#define PC_COMPAT_2_1 \
- {\
- .driver = "intel-hda",\
- .property = "old_msi_addr",\
- .value = "on",\
- },{\
- .driver = "VGA",\
- .property = "qemu-extended-regs",\
- .value = "off",\
- },{\
- .driver = "secondary-vga",\
- .property = "qemu-extended-regs",\
- .value = "off",\
- }
-
#define PC_COMPAT_2_0 \
- PC_COMPAT_2_1, \
+ HW_COMPAT_2_1, \
{\
.driver = "virtio-scsi-pci",\
.property = "any_layout",\
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index f6edde1..417b713 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -474,7 +474,7 @@ static QEMUMachine pc_i440fx_machine_v2_1 = {
.name = "pc-i440fx-2.1",
.init = pc_init_pci,
.compat_props = (GlobalProperty[]) {
- PC_COMPAT_2_1,
+ HW_COMPAT_2_1,
{ /* end of list */ }
},
};
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 905e79d..6bc77f8 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -370,7 +370,7 @@ static QEMUMachine pc_q35_machine_v2_1 = {
.name = "pc-q35-2.1",
.init = pc_q35_init,
.compat_props = (GlobalProperty[]) {
- PC_COMPAT_2_1,
+ HW_COMPAT_2_1,
{ /* end of list */ }
},
};
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 2becc9f..623f626 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -57,6 +57,8 @@
#include "trace.h"
#include "hw/nmi.h"
+#include "hw/compat.h"
+
#include <libfdt.h>
/* SLOF memory layout:
@@ -1689,10 +1691,15 @@ static const TypeInfo spapr_machine_info = {
static void spapr_machine_2_1_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ static GlobalProperty compat_props[] = {
+ HW_COMPAT_2_1,
+ { /* end of list */ }
+ };
mc->name = "pseries-2.1";
mc->desc = "pSeries Logical Partition (PAPR compliant) v2.1";
mc->is_default = 0;
+ mc->compat_props = compat_props;
}
static const TypeInfo spapr_machine_2_1_info = {
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index ae7fef9..39b954e 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -86,9 +86,6 @@
* 12 is historical, and due to x86 page size. */
#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
-/* Flags track per-device state like workarounds for quirks in older guests. */
-#define VIRTIO_PCI_FLAG_BUS_MASTER_BUG (1 << 0)
-
static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size,
VirtIOPCIProxy *dev);
@@ -323,14 +320,6 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
proxy->pci_dev.config[PCI_COMMAND] |
PCI_COMMAND_MASTER, 1);
}
-
- /* Linux before 2.6.34 sets the device as OK without enabling
- the PCI device bus master bit. In this case we need to disable
- some safety checks. */
- if ((val & VIRTIO_CONFIG_S_DRIVER_OK) &&
- !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
- proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
- }
break;
case VIRTIO_MSI_CONFIG_VECTOR:
msix_vector_unuse(&proxy->pci_dev, vdev->config_vector);
@@ -483,8 +472,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
pci_default_write_config(pci_dev, address, val, len);
if (range_covers_byte(address, len, PCI_COMMAND) &&
- !(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER) &&
- !(proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG)) {
+ !(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
virtio_pci_stop_ioeventfd(proxy);
virtio_set_status(vdev, vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK);
}
@@ -895,11 +883,15 @@ static void virtio_pci_vmstate_change(DeviceState *d, bool running)
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
if (running) {
- /* Try to find out if the guest has bus master disabled, but is
- in ready state. Then we have a buggy guest OS. */
- if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&
+ /* Old QEMU versions did not set bus master enable on status write.
+ * Detect DRIVER set and enable it.
+ */
+ if ((proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION) &&
+ (vdev->status & VIRTIO_CONFIG_S_DRIVER) &&
!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
- proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
+ pci_default_write_config(&proxy->pci_dev, PCI_COMMAND,
+ proxy->pci_dev.config[PCI_COMMAND] |
+ PCI_COMMAND_MASTER, 1);
}
virtio_pci_start_ioeventfd(proxy);
} else {
@@ -1040,10 +1032,11 @@ static void virtio_pci_reset(DeviceState *qdev)
virtio_pci_stop_ioeventfd(proxy);
virtio_bus_reset(bus);
msix_unuse_all_vectors(&proxy->pci_dev);
- proxy->flags &= ~VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
static Property virtio_pci_properties[] = {
+ DEFINE_PROP_BIT("virtio-pci-bus-master-bug-migration", VirtIOPCIProxy, flags,
+ VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT, false),
DEFINE_VIRTIO_COMMON_FEATURES(VirtIOPCIProxy, host_features),
DEFINE_PROP_END_OF_LIST(),
};
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 8/9] intel_iommu: fix VTD_SID_TO_BUS
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (6 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 7/9] virtio-pci: fix migration for pci bus master Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 9/9] tests: fix rebuild-expected-aml.sh for acpi-test rename Michael S. Tsirkin
2014-10-22 20:42 ` [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Peter Maydell
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori
(((sid) >> 8) && 0xff) makes no sense
(((sid) >> 8) & 0xff) seems to be what was meant.
https://bugs.launchpad.net/qemu/+bug/1382477
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/i386/intel_iommu.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h
index f4701e1..e321ee4 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -37,7 +37,7 @@
#define VTD_PCI_DEVFN_MAX 256
#define VTD_PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
#define VTD_PCI_FUNC(devfn) ((devfn) & 0x07)
-#define VTD_SID_TO_BUS(sid) (((sid) >> 8) && 0xff)
+#define VTD_SID_TO_BUS(sid) (((sid) >> 8) & 0xff)
#define VTD_SID_TO_DEVFN(sid) ((sid) & 0xff)
#define DMAR_REG_SIZE 0x230
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL v2 9/9] tests: fix rebuild-expected-aml.sh for acpi-test rename
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (7 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 8/9] intel_iommu: fix VTD_SID_TO_BUS Michael S. Tsirkin
@ 2014-10-22 8:18 ` Michael S. Tsirkin
2014-10-22 20:42 ` [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Peter Maydell
9 siblings, 0 replies; 15+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22 8:18 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Marcel Apfelbaum, Anthony Liguori, Paolo Bonzini
From: Paolo Bonzini <pbonzini@redhat.com>
This is now called bios-tables-test.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
tests/acpi-test-data/rebuild-expected-aml.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/acpi-test-data/rebuild-expected-aml.sh b/tests/acpi-test-data/rebuild-expected-aml.sh
index ab98498..11bf743 100755
--- a/tests/acpi-test-data/rebuild-expected-aml.sh
+++ b/tests/acpi-test-data/rebuild-expected-aml.sh
@@ -23,13 +23,13 @@ else
exit 1;
fi
-if [ ! -e "tests/acpi-test" ]; then
- echo "Test: acpi-test is required! Run make check before this script."
+if [ ! -e "tests/bios-tables-test" ]; then
+ echo "Test: bios-tables-test is required! Run make check before this script."
echo "Run this script from the build directory."
exit 1;
fi
-TEST_ACPI_REBUILD_AML=y QTEST_QEMU_BINARY=$qemu tests/acpi-test
+TEST_ACPI_REBUILD_AML=y QTEST_QEMU_BINARY=$qemu tests/bios-tables-test
echo "The files were rebuilt and can be added to git."
echo "However, if new files were created, please copy them manually" \
--
MST
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes
2014-10-22 8:18 [Qemu-devel] [PULL v2 0/9] pc, virtio, misc bugfixes Michael S. Tsirkin
` (8 preceding siblings ...)
2014-10-22 8:18 ` [Qemu-devel] [PULL v2 9/9] tests: fix rebuild-expected-aml.sh for acpi-test rename Michael S. Tsirkin
@ 2014-10-22 20:42 ` Peter Maydell
9 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2014-10-22 20:42 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: QEMU Developers, Anthony Liguori
On 22 October 2014 09:18, Michael S. Tsirkin <mst@redhat.com> wrote:
> The following changes since commit 5f77ef69a195098baddfdc6d189f1b4a94587378:
>
> glib: add compatibility interface for g_strcmp0() (2014-10-16 23:02:31 +0100)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to 8b4c5b49268123687334d5753128f4cb78d7f88c:
>
> tests: fix rebuild-expected-aml.sh for acpi-test rename (2014-10-22 11:16:13 +0300)
>
> ----------------------------------------------------------------
> pc, virtio, misc bugfixes
>
> A bunch of minor bugfixes all over the place.
>
> changes from v1:
> fix for test re-generation script
> add missing acks to two patches
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------
Hi. I'm afraid this has a merge conflict in include/hw/i386/pc.h
which I don't understand well enough to fix. Could you rebase and
resend, please?
thanks
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread