[Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-24 Thread Igor Mammedov
adds simple arm/virt test case that starts guest with
bios-tables-test.aarch64.iso.qcow2 boot image which
initializes UefiTestSupport* structure in RAM once
guest is booted.

 * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper

Signed-off-by: Igor Mammedov 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Philippe Mathieu-Daudé 
---
v3:
  * use firmware blobs directly from pc-bios directory
  * use bios-tables-test.aarch64.iso.qcow2 as test boot image
  * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
previos version (Laszlo)
  * add Makefile rule to include bios-tables-test into
check-qtest-aarch64 target
v2:
  * specify in test_data where board's RAM starts and RAM size
---
 tests/Makefile.include   |  1 +
 tests/bios-tables-test.c | 17 +
 2 files changed, 18 insertions(+)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index e2432d5..983c8b1 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
 check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
 check-qtest-aarch64-y += tests/migration-test$(EXESUF)
+check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
 
 check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
 
diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 1be55a1..f117461 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
 test_acpi_tcg_dimm_pxm(MACHINE_PC);
 }
 
+static void test_acpi_virt_tcg(void)
+{
+test_data data = {
+.machine = "virt",
+.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+.cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+.ram_start = 0x4000ULL,
+.scan_len = 128ULL * 1024 * 1024,
+};
+
+test_acpi_one("-cpu cortex-a57 ", &data);
+free_test_data(&data);
+}
+
 int main(int argc, char *argv[])
 {
 const char *arch = qtest_get_arch();
@@ -840,6 +855,8 @@ int main(int argc, char *argv[])
 qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
 qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
 qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
+} else if (strcmp(arch, "aarch64") == 0) {
+qtest_add_func("acpi/virt", test_acpi_virt_tcg);
 }
 ret = g_test_run();
 boot_sector_cleanup(disk);
-- 
2.7.4




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-05-02 Thread Igor Mammedov
On Fri, 26 Apr 2019 17:28:10 +0100
Wei Xu  wrote:

> Hi Igor,
> 
> On 4/26/2019 12:54 PM, Igor Mammedov wrote:
> > On Fri, 26 Apr 2019 00:51:56 +0800
> > x00249684  wrote:
> > 
> >> Hi Igor,
> >>
> >> +static void test_acpi_virt_tcg(void)
> >> +{
> >> +test_data data = {
> >> +.machine = "virt",
> >> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> >> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> >> +.cd = 
> >> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> >> +.ram_start = 0x4000ULL,
> >> +.scan_len = 128ULL * 1024 * 1024,
> >> +};
> >> +
> >> +test_acpi_one("-cpu cortex-a57 ", &data);
> >>
> >> Replaced the cortex-a57 with host and succesfully tested on the hisilicon 
> >> arm64 
> >> D05 board. Otherwise it failed with "kvm_init_vcpu failed: Invalid 
> >> argument".
> >> Is it possilbe to set the cpu type like numa-test.c?
> > 
> > I think it works with numa-test because it uses TCG only but in case of 
> > bios-tables-test
> > it uses accel="kvm:tcg" to leverage KVM capabilities whenever possible to 
> > speed up test.
> > 
> > Now back to our ARM test case, uefi requirement is to use 64bit CPU (hence 
> > it was cortex-a57)
> > however unlike x86 it obviously breaks since KVM accelerator on ARM host is 
> > used
> > and it doesn't work with anything other than 'host' cpu model.
> > 
> > I think we still want to use KVM whenever possible, but problem lies in that
> > user (testcase) doesn't have an idea if KVM accelerator is available and 
> > host is 64 CPU.
> > 
> > to sum up we need to support 2 modes:
> >   1. host is 64 ARM, use kvm with -cpu host
> >   2. all other cases use tcg with -cpu cortex-a57
> > 
> > I can hack to probe if /dev/kvm is accessible and host is 64 bit and use #1
> > otherwise fallback to #2
> > or as quick fix do only #2 initially and think about a better solution to 
> > #1 
> 
> Thanks!
> Fine to me.
> 
> > 
> > Is there any other suggestions/opinions how to approach issue/proceed.
> 
> To check the host cpu architecture is ARM or not, maybe we can check the value
> of "CPU implementer" is 0x41 or not from the /proc/cpuinfo.

it turned out it's more complicated.
we also should pick a correct GIC depending on host's CPU and that
changes ACPI tables, so it will worn on some hosts and fail on other.

I'll add a patch to enable test case to pick accelerator and force TCG
for ARM tests for now.

> 
> Best Regards,
> Wei
> 
> > 
> > PS:
> > we probably would like to reuse this not only for acpi tests but also for 
> > other
> > arm/virt test cases that involve running guest code. 
> > 
> >> Thanks!
> >>
> >> Best Regards,
> >> Wei
> > 
> > 
> > .
> > 
> 




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-05-02 Thread Wei Xu
Hi Igor,

On 5/2/2019 3:24 PM, Igor Mammedov wrote:
> On Fri, 26 Apr 2019 17:28:10 +0100
> Wei Xu  wrote:
> 
>> Hi Igor,
>>
>> On 4/26/2019 12:54 PM, Igor Mammedov wrote:
>>> On Fri, 26 Apr 2019 00:51:56 +0800
>>> x00249684  wrote:
>>>
 Hi Igor,

 +static void test_acpi_virt_tcg(void)
 +{
 +test_data data = {
 +.machine = "virt",
 +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
 +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
 +.cd = 
 "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
 +.ram_start = 0x4000ULL,
 +.scan_len = 128ULL * 1024 * 1024,
 +};
 +
 +test_acpi_one("-cpu cortex-a57 ", &data);

 Replaced the cortex-a57 with host and succesfully tested on the hisilicon 
 arm64 
 D05 board. Otherwise it failed with "kvm_init_vcpu failed: Invalid 
 argument".
 Is it possilbe to set the cpu type like numa-test.c?
>>>
>>> I think it works with numa-test because it uses TCG only but in case of 
>>> bios-tables-test
>>> it uses accel="kvm:tcg" to leverage KVM capabilities whenever possible to 
>>> speed up test.
>>>
>>> Now back to our ARM test case, uefi requirement is to use 64bit CPU (hence 
>>> it was cortex-a57)
>>> however unlike x86 it obviously breaks since KVM accelerator on ARM host is 
>>> used
>>> and it doesn't work with anything other than 'host' cpu model.
>>>
>>> I think we still want to use KVM whenever possible, but problem lies in that
>>> user (testcase) doesn't have an idea if KVM accelerator is available and 
>>> host is 64 CPU.
>>>
>>> to sum up we need to support 2 modes:
>>>   1. host is 64 ARM, use kvm with -cpu host
>>>   2. all other cases use tcg with -cpu cortex-a57
>>>
>>> I can hack to probe if /dev/kvm is accessible and host is 64 bit and use #1
>>> otherwise fallback to #2
>>> or as quick fix do only #2 initially and think about a better solution to 
>>> #1 
>>
>> Thanks!
>> Fine to me.
>>
>>>
>>> Is there any other suggestions/opinions how to approach issue/proceed.
>>
>> To check the host cpu architecture is ARM or not, maybe we can check the 
>> value
>> of "CPU implementer" is 0x41 or not from the /proc/cpuinfo.
> 
> it turned out it's more complicated.
> we also should pick a correct GIC depending on host's CPU and that
> changes ACPI tables, so it will worn on some hosts and fail on other.
Sorry, I did not consider that case.

> 
> I'll add a patch to enable test case to pick accelerator and force TCG
> for ARM tests for now.
>

Thanks!

Best Regards,
Wei

>>
>> Best Regards,
>> Wei
>>
>>>
>>> PS:
>>> we probably would like to reuse this not only for acpi tests but also for 
>>> other
>>> arm/virt test cases that involve running guest code. 
>>>
 Thanks!

 Best Regards,
 Wei
>>>
>>>
>>> .
>>>
>>
> 
> 
> .
> 




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-05-02 Thread Laszlo Ersek
On 05/02/19 16:27, Igor Mammedov wrote:
> On Fri, 26 Apr 2019 19:11:50 +0200
> Laszlo Ersek  wrote:
> 
>> On 04/25/19 07:34, Igor Mammedov wrote:
>>> adds simple arm/virt test case that starts guest with
>>> bios-tables-test.aarch64.iso.qcow2 boot image which
>>> initializes UefiTestSupport* structure in RAM once
>>> guest is booted.
>>>
>>>  * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper
>>>
>>> Signed-off-by: Igor Mammedov 
>>> Reviewed-by: Laszlo Ersek 
>>> Reviewed-by: Philippe Mathieu-Daudé 
>>> ---
>>> v3:
>>>   * use firmware blobs directly from pc-bios directory
>>>   * use bios-tables-test.aarch64.iso.qcow2 as test boot image
>>>   * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
>>> previos version (Laszlo)
>>>   * add Makefile rule to include bios-tables-test into
>>> check-qtest-aarch64 target
>>> v2:
>>>   * specify in test_data where board's RAM starts and RAM size
>>> ---
>>>  tests/Makefile.include   |  1 +
>>>  tests/bios-tables-test.c | 17 +
>>>  2 files changed, 18 insertions(+)
>>>
>>> diff --git a/tests/Makefile.include b/tests/Makefile.include
>>> index e2432d5..983c8b1 100644
>>> --- a/tests/Makefile.include
>>> +++ b/tests/Makefile.include
>>> @@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
>>>  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
>>>  check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
>>>  check-qtest-aarch64-y += tests/migration-test$(EXESUF)
>>> +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
>>>  
>>>  check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
>>>  
>>> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
>>> index 1be55a1..f117461 100644
>>> --- a/tests/bios-tables-test.c
>>> +++ b/tests/bios-tables-test.c
>>> @@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
>>>  test_acpi_tcg_dimm_pxm(MACHINE_PC);
>>>  }
>>>  
>>> +static void test_acpi_virt_tcg(void)
>>> +{
>>> +test_data data = {
>>> +.machine = "virt",
>>> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
>>> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
>>> +.cd = 
>>> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
>>> +.ram_start = 0x4000ULL,
>>> +.scan_len = 128ULL * 1024 * 1024,
>>> +};
>>> +
>>> +test_acpi_one("-cpu cortex-a57 ", &data);
>>> +free_test_data(&data);
>>> +}
>>> +
>>>  int main(int argc, char *argv[])
>>>  {
>>>  const char *arch = qtest_get_arch();
>>> @@ -840,6 +855,8 @@ int main(int argc, char *argv[])
>>>  qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>>>  qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>>>  qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
>>> +} else if (strcmp(arch, "aarch64") == 0) {
>>> +qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>>>  }
>>>  ret = g_test_run();
>>>  boot_sector_cleanup(disk);
>>>
>>
>> Looks good, my R-b stands.
>>
>> (Please let me know if you want me to look at other patches in the
>> series... struggling again with email bankruptcy...)
>>
>> Thanks!
>> Laszlo
>>
> 
> on respin there will be a new patch added
> 
>   [PATCH v4 11/15] tests: acpi: allow to override default accelerator
> 
> and change to this patch will be forcing TCG accelerator:
> 
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 6cb8b16..385e1ab 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -817,7 +817,6 @@ static void test_acpi_virt_tcg(void)
>  {
>  test_data data = {
>  .machine = "virt",
> +.accel = "tcg",
>  .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
>  .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
>  .cd = 
> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> 

You can keep my R-b with that update.

Thanks!
Laszlo



Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-05-02 Thread Igor Mammedov
On Fri, 26 Apr 2019 19:11:50 +0200
Laszlo Ersek  wrote:

> On 04/25/19 07:34, Igor Mammedov wrote:
> > adds simple arm/virt test case that starts guest with
> > bios-tables-test.aarch64.iso.qcow2 boot image which
> > initializes UefiTestSupport* structure in RAM once
> > guest is booted.
> > 
> >  * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper
> > 
> > Signed-off-by: Igor Mammedov 
> > Reviewed-by: Laszlo Ersek 
> > Reviewed-by: Philippe Mathieu-Daudé 
> > ---
> > v3:
> >   * use firmware blobs directly from pc-bios directory
> >   * use bios-tables-test.aarch64.iso.qcow2 as test boot image
> >   * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
> > previos version (Laszlo)
> >   * add Makefile rule to include bios-tables-test into
> > check-qtest-aarch64 target
> > v2:
> >   * specify in test_data where board's RAM starts and RAM size
> > ---
> >  tests/Makefile.include   |  1 +
> >  tests/bios-tables-test.c | 17 +
> >  2 files changed, 18 insertions(+)
> > 
> > diff --git a/tests/Makefile.include b/tests/Makefile.include
> > index e2432d5..983c8b1 100644
> > --- a/tests/Makefile.include
> > +++ b/tests/Makefile.include
> > @@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
> >  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
> >  check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
> >  check-qtest-aarch64-y += tests/migration-test$(EXESUF)
> > +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
> >  
> >  check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
> >  
> > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > index 1be55a1..f117461 100644
> > --- a/tests/bios-tables-test.c
> > +++ b/tests/bios-tables-test.c
> > @@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
> >  test_acpi_tcg_dimm_pxm(MACHINE_PC);
> >  }
> >  
> > +static void test_acpi_virt_tcg(void)
> > +{
> > +test_data data = {
> > +.machine = "virt",
> > +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> > +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> > +.cd = 
> > "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> > +.ram_start = 0x4000ULL,
> > +.scan_len = 128ULL * 1024 * 1024,
> > +};
> > +
> > +test_acpi_one("-cpu cortex-a57 ", &data);
> > +free_test_data(&data);
> > +}
> > +
> >  int main(int argc, char *argv[])
> >  {
> >  const char *arch = qtest_get_arch();
> > @@ -840,6 +855,8 @@ int main(int argc, char *argv[])
> >  qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >  qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >  qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> > +} else if (strcmp(arch, "aarch64") == 0) {
> > +qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >  }
> >  ret = g_test_run();
> >  boot_sector_cleanup(disk);
> > 
> 
> Looks good, my R-b stands.
> 
> (Please let me know if you want me to look at other patches in the
> series... struggling again with email bankruptcy...)
> 
> Thanks!
> Laszlo
> 

on respin there will be a new patch added

  [PATCH v4 11/15] tests: acpi: allow to override default accelerator

and change to this patch will be forcing TCG accelerator:

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 6cb8b16..385e1ab 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -817,7 +817,6 @@ static void test_acpi_virt_tcg(void)
 {
 test_data data = {
 .machine = "virt",
+.accel = "tcg",
 .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
 .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
 .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",



Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-25 Thread Philippe Mathieu-Daudé
On 4/25/19 7:34 AM, Igor Mammedov wrote:
> adds simple arm/virt test case that starts guest with
> bios-tables-test.aarch64.iso.qcow2 boot image which
> initializes UefiTestSupport* structure in RAM once
> guest is booted.
> 
>  * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper
> 
> Signed-off-by: Igor Mammedov 
> Reviewed-by: Laszlo Ersek 

> Reviewed-by: Philippe Mathieu-Daudé 
Please replace previous R-b by:

Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 

> ---
> v3:
>   * use firmware blobs directly from pc-bios directory
>   * use bios-tables-test.aarch64.iso.qcow2 as test boot image
>   * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
> previos version (Laszlo)
>   * add Makefile rule to include bios-tables-test into
> check-qtest-aarch64 target
> v2:
>   * specify in test_data where board's RAM starts and RAM size
> ---
>  tests/Makefile.include   |  1 +
>  tests/bios-tables-test.c | 17 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index e2432d5..983c8b1 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
>  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
>  check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
>  check-qtest-aarch64-y += tests/migration-test$(EXESUF)
> +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
>  
>  check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
>  
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 1be55a1..f117461 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
>  test_acpi_tcg_dimm_pxm(MACHINE_PC);
>  }
>  
> +static void test_acpi_virt_tcg(void)
> +{
> +test_data data = {
> +.machine = "virt",
> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> +.cd = 
> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> +.ram_start = 0x4000ULL,
> +.scan_len = 128ULL * 1024 * 1024,
> +};
> +
> +test_acpi_one("-cpu cortex-a57 ", &data);
> +free_test_data(&data);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  const char *arch = qtest_get_arch();
> @@ -840,6 +855,8 @@ int main(int argc, char *argv[])
>  qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>  qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>  qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> +} else if (strcmp(arch, "aarch64") == 0) {
> +qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>  }
>  ret = g_test_run();
>  boot_sector_cleanup(disk);
> 



Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-25 Thread Igor Mammedov
On Thu, 25 Apr 2019 14:41:28 +0200
Philippe Mathieu-Daudé  wrote:

> On 4/25/19 7:34 AM, Igor Mammedov wrote:
> > adds simple arm/virt test case that starts guest with
> > bios-tables-test.aarch64.iso.qcow2 boot image which
> > initializes UefiTestSupport* structure in RAM once
> > guest is booted.
> > 
> >  * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper
> > 
> > Signed-off-by: Igor Mammedov 
> > Reviewed-by: Laszlo Ersek   
> 
> > Reviewed-by: Philippe Mathieu-Daudé   
> Please replace previous R-b by:

done

> Reviewed-by: Philippe Mathieu-Daudé 
> Tested-by: Philippe Mathieu-Daudé 
> 
> > ---
> > v3:
> >   * use firmware blobs directly from pc-bios directory
> >   * use bios-tables-test.aarch64.iso.qcow2 as test boot image
> >   * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
> > previos version (Laszlo)
> >   * add Makefile rule to include bios-tables-test into
> > check-qtest-aarch64 target
> > v2:
> >   * specify in test_data where board's RAM starts and RAM size
> > ---
> >  tests/Makefile.include   |  1 +
> >  tests/bios-tables-test.c | 17 +
> >  2 files changed, 18 insertions(+)
> > 
> > diff --git a/tests/Makefile.include b/tests/Makefile.include
> > index e2432d5..983c8b1 100644
> > --- a/tests/Makefile.include
> > +++ b/tests/Makefile.include
> > @@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
> >  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
> >  check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
> >  check-qtest-aarch64-y += tests/migration-test$(EXESUF)
> > +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
> >  
> >  check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
> >  
> > diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> > index 1be55a1..f117461 100644
> > --- a/tests/bios-tables-test.c
> > +++ b/tests/bios-tables-test.c
> > @@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
> >  test_acpi_tcg_dimm_pxm(MACHINE_PC);
> >  }
> >  
> > +static void test_acpi_virt_tcg(void)
> > +{
> > +test_data data = {
> > +.machine = "virt",
> > +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> > +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> > +.cd = 
> > "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> > +.ram_start = 0x4000ULL,
> > +.scan_len = 128ULL * 1024 * 1024,
> > +};
> > +
> > +test_acpi_one("-cpu cortex-a57 ", &data);
> > +free_test_data(&data);
> > +}
> > +
> >  int main(int argc, char *argv[])
> >  {
> >  const char *arch = qtest_get_arch();
> > @@ -840,6 +855,8 @@ int main(int argc, char *argv[])
> >  qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
> >  qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
> >  qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> > +} else if (strcmp(arch, "aarch64") == 0) {
> > +qtest_add_func("acpi/virt", test_acpi_virt_tcg);
> >  }
> >  ret = g_test_run();
> >  boot_sector_cleanup(disk);
> >   
> 




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-25 Thread x00249684
Hi Igor,

+static void test_acpi_virt_tcg(void)
+{
+test_data data = {
+.machine = "virt",
+.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
+.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
+.cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
+.ram_start = 0x4000ULL,
+.scan_len = 128ULL * 1024 * 1024,
+};
+
+test_acpi_one("-cpu cortex-a57 ", &data);

Replaced the cortex-a57 with host and succesfully tested on the hisilicon arm64 
D05 board. Otherwise it failed with "kvm_init_vcpu failed: Invalid argument".
Is it possilbe to set the cpu type like numa-test.c?
Thanks!

Best Regards,
Wei



Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-26 Thread Igor Mammedov
On Fri, 26 Apr 2019 00:51:56 +0800
x00249684  wrote:

> Hi Igor,
> 
> +static void test_acpi_virt_tcg(void)
> +{
> +test_data data = {
> +.machine = "virt",
> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> +.cd = 
> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> +.ram_start = 0x4000ULL,
> +.scan_len = 128ULL * 1024 * 1024,
> +};
> +
> +test_acpi_one("-cpu cortex-a57 ", &data);
> 
> Replaced the cortex-a57 with host and succesfully tested on the hisilicon 
> arm64 
> D05 board. Otherwise it failed with "kvm_init_vcpu failed: Invalid argument".
> Is it possilbe to set the cpu type like numa-test.c?

I think it works with numa-test because it uses TCG only but in case of 
bios-tables-test
it uses accel="kvm:tcg" to leverage KVM capabilities whenever possible to speed 
up test.

Now back to our ARM test case, uefi requirement is to use 64bit CPU (hence it 
was cortex-a57)
however unlike x86 it obviously breaks since KVM accelerator on ARM host is used
and it doesn't work with anything other than 'host' cpu model.

I think we still want to use KVM whenever possible, but problem lies in that
user (testcase) doesn't have an idea if KVM accelerator is available and host 
is 64 CPU.

to sum up we need to support 2 modes:
  1. host is 64 ARM, use kvm with -cpu host
  2. all other cases use tcg with -cpu cortex-a57

I can hack to probe if /dev/kvm is accessible and host is 64 bit and use #1
otherwise fallback to #2
or as quick fix do only #2 initially and think about a better solution to #1 

Is there any other suggestions/opinions how to approach issue/proceed.

PS:
we probably would like to reuse this not only for acpi tests but also for other
arm/virt test cases that involve running guest code. 

> Thanks!
> 
> Best Regards,
> Wei




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-26 Thread Wei Xu
Hi Igor,

On 4/26/2019 12:54 PM, Igor Mammedov wrote:
> On Fri, 26 Apr 2019 00:51:56 +0800
> x00249684  wrote:
> 
>> Hi Igor,
>>
>> +static void test_acpi_virt_tcg(void)
>> +{
>> +test_data data = {
>> +.machine = "virt",
>> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
>> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
>> +.cd = 
>> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
>> +.ram_start = 0x4000ULL,
>> +.scan_len = 128ULL * 1024 * 1024,
>> +};
>> +
>> +test_acpi_one("-cpu cortex-a57 ", &data);
>>
>> Replaced the cortex-a57 with host and succesfully tested on the hisilicon 
>> arm64 
>> D05 board. Otherwise it failed with "kvm_init_vcpu failed: Invalid argument".
>> Is it possilbe to set the cpu type like numa-test.c?
> 
> I think it works with numa-test because it uses TCG only but in case of 
> bios-tables-test
> it uses accel="kvm:tcg" to leverage KVM capabilities whenever possible to 
> speed up test.
> 
> Now back to our ARM test case, uefi requirement is to use 64bit CPU (hence it 
> was cortex-a57)
> however unlike x86 it obviously breaks since KVM accelerator on ARM host is 
> used
> and it doesn't work with anything other than 'host' cpu model.
> 
> I think we still want to use KVM whenever possible, but problem lies in that
> user (testcase) doesn't have an idea if KVM accelerator is available and host 
> is 64 CPU.
> 
> to sum up we need to support 2 modes:
>   1. host is 64 ARM, use kvm with -cpu host
>   2. all other cases use tcg with -cpu cortex-a57
> 
> I can hack to probe if /dev/kvm is accessible and host is 64 bit and use #1
> otherwise fallback to #2
> or as quick fix do only #2 initially and think about a better solution to #1 

Thanks!
Fine to me.

> 
> Is there any other suggestions/opinions how to approach issue/proceed.

To check the host cpu architecture is ARM or not, maybe we can check the value
of "CPU implementer" is 0x41 or not from the /proc/cpuinfo.

Best Regards,
Wei

> 
> PS:
> we probably would like to reuse this not only for acpi tests but also for 
> other
> arm/virt test cases that involve running guest code. 
> 
>> Thanks!
>>
>> Best Regards,
>> Wei
> 
> 
> .
> 




Re: [Qemu-devel] [PATCH v3 11/13] tests: acpi: add simple arm/virt testcase

2019-04-26 Thread Laszlo Ersek
On 04/25/19 07:34, Igor Mammedov wrote:
> adds simple arm/virt test case that starts guest with
> bios-tables-test.aarch64.iso.qcow2 boot image which
> initializes UefiTestSupport* structure in RAM once
> guest is booted.
> 
>  * see commit: tests: acpi: add acpi_find_rsdp_address_uefi() helper
> 
> Signed-off-by: Igor Mammedov 
> Reviewed-by: Laszlo Ersek 
> Reviewed-by: Philippe Mathieu-Daudé 
> ---
> v3:
>   * use firmware blobs directly from pc-bios directory
>   * use bios-tables-test.aarch64.iso.qcow2 as test boot image
>   * drop leftover qtest-uefi-images-aarch64 iMakefile rule from
> previos version (Laszlo)
>   * add Makefile rule to include bios-tables-test into
> check-qtest-aarch64 target
> v2:
>   * specify in test_data where board's RAM starts and RAM size
> ---
>  tests/Makefile.include   |  1 +
>  tests/bios-tables-test.c | 17 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index e2432d5..983c8b1 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -267,6 +267,7 @@ check-qtest-arm-y += tests/hexloader-test$(EXESUF)
>  check-qtest-aarch64-y = tests/numa-test$(EXESUF)
>  check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
>  check-qtest-aarch64-y += tests/migration-test$(EXESUF)
> +check-qtest-aarch64-y += tests/bios-tables-test$(EXESUF)
>  
>  check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
>  
> diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index 1be55a1..f117461 100644
> --- a/tests/bios-tables-test.c
> +++ b/tests/bios-tables-test.c
> @@ -812,6 +812,21 @@ static void test_acpi_piix4_tcg_dimm_pxm(void)
>  test_acpi_tcg_dimm_pxm(MACHINE_PC);
>  }
>  
> +static void test_acpi_virt_tcg(void)
> +{
> +test_data data = {
> +.machine = "virt",
> +.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
> +.uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
> +.cd = 
> "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
> +.ram_start = 0x4000ULL,
> +.scan_len = 128ULL * 1024 * 1024,
> +};
> +
> +test_acpi_one("-cpu cortex-a57 ", &data);
> +free_test_data(&data);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  const char *arch = qtest_get_arch();
> @@ -840,6 +855,8 @@ int main(int argc, char *argv[])
>  qtest_add_func("acpi/q35/numamem", test_acpi_q35_tcg_numamem);
>  qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm);
>  qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm);
> +} else if (strcmp(arch, "aarch64") == 0) {
> +qtest_add_func("acpi/virt", test_acpi_virt_tcg);
>  }
>  ret = g_test_run();
>  boot_sector_cleanup(disk);
> 

Looks good, my R-b stands.

(Please let me know if you want me to look at other patches in the
series... struggling again with email bankruptcy...)

Thanks!
Laszlo