diff mbox

[1/4] hw/arm/virt: Set default machine and CPU types for mach-virt

Message ID 1517506091-10396-1-git-send-email-wei@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Huang Feb. 1, 2018, 5:28 p.m. UTC
Unlike most other QEMU architectures, the default machine type for
mach-virt is not set. This causes problems in situations where the
default machine types are not provided (e.g. qtest_start() function
in many QEMU tests). This patch designates the latest mach-virt
machine type (alias of "virt") as the default machine type. It also
changes the default CPU depending on the target.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Peter Maydell Feb. 1, 2018, 6:03 p.m. UTC | #1
On 1 February 2018 at 17:28, Wei Huang <wei@redhat.com> wrote:
> Unlike most other QEMU architectures, the default machine type for
> mach-virt is not set.

This is deliberate. There is no single "right" choice for
a machine type for Arm boards. We had a bunch of problems
back when we did have a default type, because it was the
ancient integratorcp board, and users got confused expecting
QEMU to just work without specifying a machine type.

> This causes problems in situations where the
> default machine types are not provided (e.g. qtest_start() function
> in many QEMU tests). This patch designates the latest mach-virt
> machine type (alias of "virt") as the default machine type. It also
> changes the default CPU depending on the target.

> +#ifdef TARGET_AARCH64
> +    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
> +#else
>      mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
> +#endif

This makes the behaviour be different depending whether you're
running qemu-system-arm or qemu-system-aarch64. The two are
supposed to behave the same way if you give them the same
command line options (like x86 QEMU).


thanks
-- PMM
diff mbox

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index b334c82..f6b1408 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -68,6 +68,7 @@ 
         mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \
         if (latest) { \
             mc->alias = "virt"; \
+            mc->is_default = 1; \
         } \
     } \
     static const TypeInfo machvirt_##major##_##minor##_info = { \
@@ -1603,7 +1604,12 @@  static void virt_machine_class_init(ObjectClass *oc, void *data)
     mc->minimum_page_bits = 12;
     mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
     mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
+#ifdef TARGET_AARCH64
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
+#else
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
+#endif
+
     mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
 }