All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt
@ 2018-02-01 17:28 Wei Huang
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine Wei Huang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Wei Huang @ 2018-02-01 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, wei, drjones

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(+)

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;
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine
  2018-02-01 17:28 [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Wei Huang
@ 2018-02-01 17:28 ` Wei Huang
  2018-02-01 21:51   ` Thomas Huth
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 3/4] tests: Enable drive_del-test on arm/aarch64 Wei Huang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Wei Huang @ 2018-02-01 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, wei, drjones

This patch adds a small binary kernel to test aarch64 virt machine's
UART.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 tests/Makefile.include   | 1 +
 tests/boot-serial-test.c | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index ca82e0c..ebdb151 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -367,6 +367,7 @@ gcov-files-arm-y += hw/timer/arm_mptimer.c
 check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
 
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
+check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
 
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 
diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
index 418c5b9..66f7a84 100644
--- a/tests/boot-serial-test.c
+++ b/tests/boot-serial-test.c
@@ -55,6 +55,13 @@ static const uint8_t bios_raspi2[] = {
     0x00, 0x10, 0x20, 0x3f,                 /* 0x3f201000 = UART0 base addr */
 };
 
+static const uint8_t kernel_aarch64[] = {
+    0x81, 0x0a, 0x80, 0x52,                 /* mov     w1, #0x54 */
+    0x02, 0x20, 0xa1, 0xd2,                 /* mov     x2, #0x9000000 */
+    0x41, 0x00, 0x00, 0x39,                 /* strb    w1, [x2] */
+    0xfd, 0xff, 0xff, 0x17,                 /* b       -12 (loop) */
+};
+
 typedef struct testdef {
     const char *arch;       /* Target architecture */
     const char *machine;    /* Name of the machine */
@@ -87,6 +94,8 @@ static testdef_t tests[] = {
       sizeof(kernel_plml605), kernel_plml605 },
     { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxiesim },
     { "arm", "raspi2", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 },
+    { "aarch64", "virt", "-cpu cortex-a57", "TT", sizeof(kernel_aarch64),
+      kernel_aarch64 },
 
     { NULL }
 };
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 3/4] tests: Enable drive_del-test on arm/aarch64
  2018-02-01 17:28 [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Wei Huang
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine Wei Huang
@ 2018-02-01 17:28 ` Wei Huang
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 4/4] tests: Enable xhci test arm/aarch64 Wei Huang
  2018-02-01 18:03 ` [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Peter Maydell
  3 siblings, 0 replies; 6+ messages in thread
From: Wei Huang @ 2018-02-01 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, wei, drjones

Signed-off-by: Wei Huang <wei@redhat.com>
---
 tests/Makefile.include | 2 ++
 tests/drive_del-test.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index ebdb151..e28277c 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -365,9 +365,11 @@ gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
 check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
+check-qtest-arm-y += tests/drive_del-test$(EXESUF)
 
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
 check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
+check-qtest-aarch64-y += tests/drive_del-test$(EXESUF)
 
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c
index c9ac997..2e39442 100644
--- a/tests/drive_del-test.c
+++ b/tests/drive_del-test.c
@@ -123,7 +123,8 @@ int main(int argc, char **argv)
     /* TODO I guess any arch with a hot-pluggable virtio bus would do */
     if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64") ||
         !strcmp(arch, "ppc") || !strcmp(arch, "ppc64") ||
-        !strcmp(arch, "s390x")) {
+        !strcmp(arch, "s390x") || !strcmp(arch, "arm") ||
+        !strcmp(arch, "aarch64")) {
         qtest_add_func("/drive_del/after_failed_device_add",
                        test_after_failed_device_add);
         qtest_add_func("/blockdev/drive_del_device_del",
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PATCH 4/4] tests: Enable xhci test arm/aarch64
  2018-02-01 17:28 [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Wei Huang
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine Wei Huang
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 3/4] tests: Enable drive_del-test on arm/aarch64 Wei Huang
@ 2018-02-01 17:28 ` Wei Huang
  2018-02-01 18:03 ` [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Peter Maydell
  3 siblings, 0 replies; 6+ messages in thread
From: Wei Huang @ 2018-02-01 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm, peter.maydell, wei, drjones

Signed-off-by: Wei Huang <wei@redhat.com>
---
 tests/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index e28277c..a79a7b8 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -366,10 +366,12 @@ check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
 check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
 check-qtest-arm-y += tests/drive_del-test$(EXESUF)
+check-qtest-arm-y += tests/usb-hcd-xhci-test$(EXESUF)
 
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
 check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
 check-qtest-aarch64-y += tests/drive_del-test$(EXESUF)
+check-qtest-aarch64-y += tests/usb-hcd-xhci-test$(EXESUF)
 
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt
  2018-02-01 17:28 [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Wei Huang
                   ` (2 preceding siblings ...)
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 4/4] tests: Enable xhci test arm/aarch64 Wei Huang
@ 2018-02-01 18:03 ` Peter Maydell
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2018-02-01 18:03 UTC (permalink / raw)
  To: Wei Huang; +Cc: QEMU Developers, qemu-arm, Andrew Jones

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine
  2018-02-01 17:28 ` [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine Wei Huang
@ 2018-02-01 21:51   ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2018-02-01 21:51 UTC (permalink / raw)
  To: Wei Huang, qemu-devel; +Cc: peter.maydell, drjones, qemu-arm

On 01.02.2018 18:28, Wei Huang wrote:
> This patch adds a small binary kernel to test aarch64 virt machine's
> UART.
> 
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  tests/Makefile.include   | 1 +
>  tests/boot-serial-test.c | 9 +++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index ca82e0c..ebdb151 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -367,6 +367,7 @@ gcov-files-arm-y += hw/timer/arm_mptimer.c
>  check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
>  
>  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
> +check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
>  
>  check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
>  
> diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
> index 418c5b9..66f7a84 100644
> --- a/tests/boot-serial-test.c
> +++ b/tests/boot-serial-test.c
> @@ -55,6 +55,13 @@ static const uint8_t bios_raspi2[] = {
>      0x00, 0x10, 0x20, 0x3f,                 /* 0x3f201000 = UART0 base addr */
>  };
>  
> +static const uint8_t kernel_aarch64[] = {
> +    0x81, 0x0a, 0x80, 0x52,                 /* mov     w1, #0x54 */
> +    0x02, 0x20, 0xa1, 0xd2,                 /* mov     x2, #0x9000000 */
> +    0x41, 0x00, 0x00, 0x39,                 /* strb    w1, [x2] */
> +    0xfd, 0xff, 0xff, 0x17,                 /* b       -12 (loop) */
> +};
> +
>  typedef struct testdef {
>      const char *arch;       /* Target architecture */
>      const char *machine;    /* Name of the machine */
> @@ -87,6 +94,8 @@ static testdef_t tests[] = {
>        sizeof(kernel_plml605), kernel_plml605 },
>      { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxiesim },
>      { "arm", "raspi2", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 },
> +    { "aarch64", "virt", "-cpu cortex-a57", "TT", sizeof(kernel_aarch64),
> +      kernel_aarch64 },
>  
>      { NULL }
>  };
> 

Acked-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-01 21:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 17:28 [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Wei Huang
2018-02-01 17:28 ` [Qemu-devel] [PATCH 2/4] tests/boot-serial-test: Add support for the aarch64 virt machine Wei Huang
2018-02-01 21:51   ` Thomas Huth
2018-02-01 17:28 ` [Qemu-devel] [PATCH 3/4] tests: Enable drive_del-test on arm/aarch64 Wei Huang
2018-02-01 17:28 ` [Qemu-devel] [PATCH 4/4] tests: Enable xhci test arm/aarch64 Wei Huang
2018-02-01 18:03 ` [Qemu-devel] [PATCH 1/4] hw/arm/virt: Set default machine and CPU types for mach-virt Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.