On 09/01/2018 05:07 AM, Peter Maydell wrote:
> On 1 September 2018 at 06:11, Wei Huang <w...@redhat.com> wrote:
>> This patch adds migration test support for aarch64. The test code, which
>> implements the same functionality as x86, is booted as a kernel in qemu.
>> Here are the design choices we make for aarch64:
>>
>> * We choose this -kernel approach because aarch64 QEMU doesn't provide a
>> built-in fw like x86 does. So instead of relying on a boot loader, we
>> use -kernel approach for aarch64.
>> * The serial output is sent to PL011 directly.
>> * The physical memory base for mach-virt machine is 0x40000000. We change
>> the start_address and end_address for aarch64.
>>
>> In addition to providing the binary, this patch also includes the source
>> code and the build script in tests/migration/aarch64. So users can change
>> the source and/or re-compile the binary as they wish.
>> + } else if (strcmp(arch, "aarch64") == 0) {
>> + struct utsname utsname;
>> +
>
> The comment says:
>
>> + /* kvm and tcg need different cpu and gic-version configs */
>
> ...but the code below it doesn't change the cpu or gic-version
> based on 'accel'.
My bad. The code below can be removed.
>
>> + if (access("/dev/kvm", F_OK) == 0 && uname(&utsname) == 0 &&
>> + strcmp(utsname.machine, "aarch64") == 0) {
>> + accel = "kvm";
>> + } else {
>> + accel = "tcg";
>> + }
>
> Maybe we could just use -accel=kvm,tcg rather than guessing
> whether kvm is going to work ? If this is how the x86 code
> works then probably best to do the same as that, though.
Yes, "kvm,tcg" work work (I just verified with "tcg" only). I will
update the code after more comments are collected.
>
>> +
>> + init_bootfile(bootpath, aarch64_kernel);
>> + cmd_src = g_strdup_printf("-machine virt,accel=%s,gic-version=max "
>> + "-name vmsource,debug-threads=on -cpu max
>> "
>> + "-m 150M -serial file:%s/src_serial "
>> + "-kernel %s ",
>> + accel, tmpfs, bootpath);
>> + cmd_dst = g_strdup_printf("-machine virt,accel=%s,gic-version=max "
>> + "-name vmdest,debug-threads=on -cpu max "
>> + "-m 150M -serial file:%s/dest_serial "
>> + "-kernel %s "
>> + "-incoming %s ",
>> + accel, tmpfs, bootpath, uri);
>> +
>> + start_address = ARM_TEST_MEM_START;
>> + end_address = ARM_TEST_MEM_END;
>> +
>> + g_assert(sizeof(aarch64_kernel) <= ARM_TEST_MAX_KERNEL_SIZE);
>
> thanks
> -- PMM
>