All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
@ 2020-12-16 18:17 Philippe Mathieu-Daudé
  2020-12-17  0:08 ` Jiaxun Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-12-16 18:17 UTC (permalink / raw)
  To: qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Philippe Mathieu-Daudé,
	Jiaxun Yang, Wainer dos Santos Moschetta, Cleber Rosa

Test the PMON firmware. As the firmware is not redistributable,
it has to be downloaded manually first. Then it can be used by
providing its path via the PMON_PATH environment variable:

  $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
    PMON_PATH=/images/pmon \
    avocado --show=app,console \
      run -t machine:loongson3-virt tests/acceptance
  JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
  JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
   (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
  console: PMON2000 MIPS Initializing. Standby...
  console: 00000000
  console: Shut down other cores
  console: 0xbfe00190  : 0000000000000000
  console: CPU CLK SEL : 00000000
  console: MEM CLK SEL : 00000000
  console: Change the driver
  console: Soft CLK SEL adjust begin
  console: HT         :00000000
  console: DDR_DIV:00000002
  console: BBGEN start  :
  console: BBGEN config value  :00000000
  console: MC RESET
  console: Fix L1xbar illegal access at NODE 0
  console: Fix L2xbar in NODE 0
  console: 32 bit PCI space translate to 64 bit HT space
  console: Waiting HyperTransport bus to be up.
  PASS (0.10 s)
   (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
  console: PMON2000 MIPS Initializing. Standby...
  console: 0xbfe00190  : 0000000000000000
  console: CPU CLK SEL : 00000000
  console: CPU clk frequency = SYSCLK x 0x0000001e /  1
  console: MEM CLK SEL : 00000000
  console: DDR clk frequency = MEMCLK x 0x0000001e /  3
  console: Fix L1xbar illegal access
  console: Fix L2xbar illegal access
  console: Init tlb...
  console: godson2 caches found
  PASS (0.12 s)
  RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 0.58 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
---
 MAINTAINERS                                 |  1 +
 tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_loongson3v.py

diff --git a/MAINTAINERS b/MAINTAINERS
index f75fa2a7142..9a02d44f997 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
 R: Jiaxun Yang <jiaxun.yang@flygoat.com>
 S: Maintained
 F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
 Boston
 M: Paul Burton <paulburton@kernel.org>
diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
new file mode 100644
index 00000000000..8e698bbc99b
--- /dev/null
+++ b/tests/acceptance/machine_mips_loongson3v.py
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import time
+
+from avocado import skipUnless
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
+
+class MipsFuloong3(Test):
+
+    timeout = 60
+
+    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    def test_pmon_BLD_serial_console(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=endian:little
+        :avocado: tags=machine:loongson3-virt
+        :avocado: tags=cpu:Loongson-3A1000
+        :avocado: tags=device:liointc
+        :avocado: tags=device:goldfish_rtc
+        """
+        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
+        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
+        pmon_path = self.fetch_asset('file://' + os.path.join(
+                                        os.getenv('PMON_PATH'), pmon_name),
+                                     asset_hash=pmon_hash, algorithm='md5')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', pmon_path)
+        self.vm.launch()
+        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
+        wait_for_console_pattern(self, 'Shut down other cores')
+        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
+
+    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    def test_pmon_A1101_serial_console(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=endian:little
+        :avocado: tags=machine:loongson3-virt
+        :avocado: tags=cpu:Loongson-3A1000
+        :avocado: tags=device:liointc
+        :avocado: tags=device:goldfish_rtc
+        """
+        pmon_name = 'pmon-A1101-2.0.8.bin'
+        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
+        pmon_path = self.fetch_asset('file://' + os.path.join(
+                                        os.getenv('PMON_PATH'), pmon_name),
+                                     asset_hash=pmon_hash, algorithm='md5')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', pmon_path)
+        self.vm.launch()
+        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
+        wait_for_console_pattern(self, 'godson2 caches found')
-- 
2.26.2



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-16 18:17 [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU Philippe Mathieu-Daudé
@ 2020-12-17  0:08 ` Jiaxun Yang
  2020-12-17  3:36 ` Jiaxun Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Jiaxun Yang @ 2020-12-17  0:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Wainer dos Santos Moschetta, Cleber Rosa



于 2020年12月17日 GMT+08:00 上午2:17:59, "Philippe Mathieu-Daudé" <f4bug@amsat.org> 写到:
>Test the PMON firmware. As the firmware is not redistributable,
>it has to be downloaded manually first. Then it can be used by
>providing its path via the PMON_PATH environment variable:

Well I have a distribution of PMON customized for loongson3-virt.

Will push it to GitHub later.


Thanks.


- Jiaxun


>
>  $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>    PMON_PATH=/images/pmon \
>    avocado --show=app,console \
>      run -t machine:loongson3-virt tests/acceptance
>  JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
>  JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
>   (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
>  console: PMON2000 MIPS Initializing. Standby...
>  console: 00000000
>  console: Shut down other cores
>  console: 0xbfe00190  : 0000000000000000
>  console: CPU CLK SEL : 00000000
>  console: MEM CLK SEL : 00000000
>  console: Change the driver
>  console: Soft CLK SEL adjust begin
>  console: HT         :00000000
>  console: DDR_DIV:00000002
>  console: BBGEN start  :
>  console: BBGEN config value  :00000000
>  console: MC RESET
>  console: Fix L1xbar illegal access at NODE 0
>  console: Fix L2xbar in NODE 0
>  console: 32 bit PCI space translate to 64 bit HT space
>  console: Waiting HyperTransport bus to be up.
>  PASS (0.10 s)
>   (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
>  console: PMON2000 MIPS Initializing. Standby...
>  console: 0xbfe00190  : 0000000000000000
>  console: CPU CLK SEL : 00000000
>  console: CPU clk frequency = SYSCLK x 0x0000001e /  1
>  console: MEM CLK SEL : 00000000
>  console: DDR clk frequency = MEMCLK x 0x0000001e /  3
>  console: Fix L1xbar illegal access
>  console: Fix L2xbar illegal access
>  console: Init tlb...
>  console: godson2 caches found
>  PASS (0.12 s)
>  RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>  JOB TIME   : 0.58 s
>
>Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>---
>Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
>---
> MAINTAINERS                                 |  1 +
> tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
> 2 files changed, 67 insertions(+)
> create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>
>diff --git a/MAINTAINERS b/MAINTAINERS
>index f75fa2a7142..9a02d44f997 100644
>--- a/MAINTAINERS
>+++ b/MAINTAINERS
>@@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
> R: Jiaxun Yang <jiaxun.yang@flygoat.com>
> S: Maintained
> F: hw/intc/loongson_liointc.c
>+F: tests/acceptance/machine_mips_loongson3v.py
> 
> Boston
> M: Paul Burton <paulburton@kernel.org>
>diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
>new file mode 100644
>index 00000000000..8e698bbc99b
>--- /dev/null
>+++ b/tests/acceptance/machine_mips_loongson3v.py
>@@ -0,0 +1,66 @@
>+# Functional tests for the Generic Loongson-3 Platform.
>+#
>+# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
>+#
>+# This work is licensed under the terms of the GNU GPL, version 2 or later.
>+# See the COPYING file in the top-level directory.
>+#
>+# SPDX-License-Identifier: GPL-2.0-or-later
>+
>+import os
>+import time
>+
>+from avocado import skipUnless
>+from avocado_qemu import Test
>+from avocado_qemu import wait_for_console_pattern
>+
>+class MipsFuloong3(Test):
>+
>+    timeout = 60
>+
>+    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
>+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>+    def test_pmon_BLD_serial_console(self):
>+        """
>+        :avocado: tags=arch:mips64el
>+        :avocado: tags=endian:little
>+        :avocado: tags=machine:loongson3-virt
>+        :avocado: tags=cpu:Loongson-3A1000
>+        :avocado: tags=device:liointc
>+        :avocado: tags=device:goldfish_rtc
>+        """
>+        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
>+        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
>+        pmon_path = self.fetch_asset('file://' + os.path.join(
>+                                        os.getenv('PMON_PATH'), pmon_name),
>+                                     asset_hash=pmon_hash, algorithm='md5')
>+
>+        self.vm.set_console()
>+        self.vm.add_args('-bios', pmon_path)
>+        self.vm.launch()
>+        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
>+        wait_for_console_pattern(self, 'Shut down other cores')
>+        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
>+
>+    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
>+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>+    def test_pmon_A1101_serial_console(self):
>+        """
>+        :avocado: tags=arch:mips64el
>+        :avocado: tags=endian:little
>+        :avocado: tags=machine:loongson3-virt
>+        :avocado: tags=cpu:Loongson-3A1000
>+        :avocado: tags=device:liointc
>+        :avocado: tags=device:goldfish_rtc
>+        """
>+        pmon_name = 'pmon-A1101-2.0.8.bin'
>+        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
>+        pmon_path = self.fetch_asset('file://' + os.path.join(
>+                                        os.getenv('PMON_PATH'), pmon_name),
>+                                     asset_hash=pmon_hash, algorithm='md5')
>+
>+        self.vm.set_console()
>+        self.vm.add_args('-bios', pmon_path)
>+        self.vm.launch()
>+        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
>+        wait_for_console_pattern(self, 'godson2 caches found')


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-16 18:17 [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU Philippe Mathieu-Daudé
  2020-12-17  0:08 ` Jiaxun Yang
@ 2020-12-17  3:36 ` Jiaxun Yang
  2020-12-18 15:21   ` Philippe Mathieu-Daudé
  2020-12-18 15:27 ` Wainer dos Santos Moschetta
  2020-12-18 20:51 ` Willian Rampazzo
  3 siblings, 1 reply; 17+ messages in thread
From: Jiaxun Yang @ 2020-12-17  3:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Wainer dos Santos Moschetta, Cleber Rosa



在 2020/12/17 上午2:17, Philippe Mathieu-Daudé 写道:
> Test the PMON firmware. As the firmware is not redistributable,
> it has to be downloaded manually first. Then it can be used by
> providing its path via the PMON_PATH environment variable:

We have a PMON port for loongson3-virt machine[1] and it's redistributable.

You can also fetch prebuilt binary from GitHub action artifacts, I can 
also make
a release on GitHub to make it easier.

Thanks.

[1] https://github.com/loongson-community/pmon

- Jiaxun
>
>    $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>      PMON_PATH=/images/pmon \
>      avocado --show=app,console \
>        run -t machine:loongson3-virt tests/acceptance
>    JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
>    JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
>     (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 00000000
>    console: Shut down other cores
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: MEM CLK SEL : 00000000
>    console: Change the driver
>    console: Soft CLK SEL adjust begin
>    console: HT         :00000000
>    console: DDR_DIV:00000002
>    console: BBGEN start  :
>    console: BBGEN config value  :00000000
>    console: MC RESET
>    console: Fix L1xbar illegal access at NODE 0
>    console: Fix L2xbar in NODE 0
>    console: 32 bit PCI space translate to 64 bit HT space
>    console: Waiting HyperTransport bus to be up.
>    PASS (0.10 s)
>     (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: CPU clk frequency = SYSCLK x 0x0000001e /  1
>    console: MEM CLK SEL : 00000000
>    console: DDR clk frequency = MEMCLK x 0x0000001e /  3
>    console: Fix L1xbar illegal access
>    console: Fix L2xbar illegal access
>    console: Init tlb...
>    console: godson2 caches found
>    PASS (0.12 s)
>    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>    JOB TIME   : 0.58 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
> ---
>   MAINTAINERS                                 |  1 +
>   tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
>   2 files changed, 67 insertions(+)
>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f75fa2a7142..9a02d44f997 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
>   R: Jiaxun Yang <jiaxun.yang@flygoat.com>
>   S: Maintained
>   F: hw/intc/loongson_liointc.c
> +F: tests/acceptance/machine_mips_loongson3v.py
>   
>   Boston
>   M: Paul Burton <paulburton@kernel.org>
> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> new file mode 100644
> index 00000000000..8e698bbc99b
> --- /dev/null
> +++ b/tests/acceptance/machine_mips_loongson3v.py
> @@ -0,0 +1,66 @@
> +# Functional tests for the Generic Loongson-3 Platform.
> +#
> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time
> +
> +from avocado import skipUnless
> +from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
> +
> +class MipsFuloong3(Test):
> +
> +    timeout = 60
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_BLD_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
> +        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'Shut down other cores')
> +        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_A1101_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon-A1101-2.0.8.bin'
> +        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'godson2 caches found')


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-17  3:36 ` Jiaxun Yang
@ 2020-12-18 15:21   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-12-18 15:21 UTC (permalink / raw)
  To: Jiaxun Yang, qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Wainer dos Santos Moschetta, Cleber Rosa

On 12/17/20 4:36 AM, Jiaxun Yang wrote:
> 在 2020/12/17 上午2:17, Philippe Mathieu-Daudé 写道:
>> Test the PMON firmware. As the firmware is not redistributable,
>> it has to be downloaded manually first. Then it can be used by
>> providing its path via the PMON_PATH environment variable:
> 
> We have a PMON port for loongson3-virt machine[1] and it's redistributable.
> 
> You can also fetch prebuilt binary from GitHub action artifacts, I can
> also make
> a release on GitHub to make it easier.

It would be easier indeed, because I can not fetch a job artifact
without using credential. Maybe we can, but I already exhausted
the time I had to test Huacai series, so for now I'll start with
offline testing.

> 
> Thanks.
> 
> [1] https://github.com/loongson-community/pmon
> 
> - Jiaxun
>>
>>    $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>      PMON_PATH=/images/pmon \
>>      avocado --show=app,console \
>>        run -t machine:loongson3-virt tests/acceptance
>>    JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
>>    JOB LOG    :
>> /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
>>     (1/2)
>> tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
>>
>>    console: PMON2000 MIPS Initializing. Standby...
>>    console: 00000000
>>    console: Shut down other cores
>>    console: 0xbfe00190  : 0000000000000000
>>    console: CPU CLK SEL : 00000000
>>    console: MEM CLK SEL : 00000000
>>    console: Change the driver
>>    console: Soft CLK SEL adjust begin
>>    console: HT         :00000000
>>    console: DDR_DIV:00000002
>>    console: BBGEN start  :
>>    console: BBGEN config value  :00000000
>>    console: MC RESET
>>    console: Fix L1xbar illegal access at NODE 0
>>    console: Fix L2xbar in NODE 0
>>    console: 32 bit PCI space translate to 64 bit HT space
>>    console: Waiting HyperTransport bus to be up.
>>    PASS (0.10 s)
>>     (2/2)
>> tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
>>
>>    console: PMON2000 MIPS Initializing. Standby...
>>    console: 0xbfe00190  : 0000000000000000
>>    console: CPU CLK SEL : 00000000
>>    console: CPU clk frequency = SYSCLK x 0x0000001e /  1
>>    console: MEM CLK SEL : 00000000
>>    console: DDR clk frequency = MEMCLK x 0x0000001e /  3
>>    console: Fix L1xbar illegal access
>>    console: Fix L2xbar illegal access
>>    console: Init tlb...
>>    console: godson2 caches found
>>    PASS (0.12 s)
>>    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 |
>> INTERRUPT 0 | CANCEL 0
>>    JOB TIME   : 0.58 s
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
>> ---
>>   MAINTAINERS                                 |  1 +
>>   tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
>>   2 files changed, 67 insertions(+)
>>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index f75fa2a7142..9a02d44f997 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
>>   R: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>   S: Maintained
>>   F: hw/intc/loongson_liointc.c
>> +F: tests/acceptance/machine_mips_loongson3v.py
>>     Boston
>>   M: Paul Burton <paulburton@kernel.org>
>> diff --git a/tests/acceptance/machine_mips_loongson3v.py
>> b/tests/acceptance/machine_mips_loongson3v.py
>> new file mode 100644
>> index 00000000000..8e698bbc99b
>> --- /dev/null
>> +++ b/tests/acceptance/machine_mips_loongson3v.py
>> @@ -0,0 +1,66 @@
>> +# Functional tests for the Generic Loongson-3 Platform.
>> +#
>> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
>> +#
>> +# This work is licensed under the terms of the GNU GPL, version 2 or
>> later.
>> +# See the COPYING file in the top-level directory.
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import os
>> +import time
>> +
>> +from avocado import skipUnless
>> +from avocado_qemu import Test
>> +from avocado_qemu import wait_for_console_pattern
>> +
>> +class MipsFuloong3(Test):
>> +
>> +    timeout = 60
>> +
>> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted
>> code')
>> +    def test_pmon_BLD_serial_console(self):
>> +        """
>> +        :avocado: tags=arch:mips64el
>> +        :avocado: tags=endian:little
>> +        :avocado: tags=machine:loongson3-virt
>> +        :avocado: tags=cpu:Loongson-3A1000
>> +        :avocado: tags=device:liointc
>> +        :avocado: tags=device:goldfish_rtc
>> +        """
>> +        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
>> +        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
>> +        pmon_path = self.fetch_asset('file://' + os.path.join(
>> +                                        os.getenv('PMON_PATH'),
>> pmon_name),
>> +                                     asset_hash=pmon_hash,
>> algorithm='md5')
>> +
>> +        self.vm.set_console()
>> +        self.vm.add_args('-bios', pmon_path)
>> +        self.vm.launch()
>> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing.
>> Standby...')
>> +        wait_for_console_pattern(self, 'Shut down other cores')
>> +        wait_for_console_pattern(self, 'Waiting HyperTransport bus to
>> be up.')
>> +
>> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted
>> code')
>> +    def test_pmon_A1101_serial_console(self):
>> +        """
>> +        :avocado: tags=arch:mips64el
>> +        :avocado: tags=endian:little
>> +        :avocado: tags=machine:loongson3-virt
>> +        :avocado: tags=cpu:Loongson-3A1000
>> +        :avocado: tags=device:liointc
>> +        :avocado: tags=device:goldfish_rtc
>> +        """
>> +        pmon_name = 'pmon-A1101-2.0.8.bin'
>> +        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
>> +        pmon_path = self.fetch_asset('file://' + os.path.join(
>> +                                        os.getenv('PMON_PATH'),
>> pmon_name),
>> +                                     asset_hash=pmon_hash,
>> algorithm='md5')
>> +
>> +        self.vm.set_console()
>> +        self.vm.add_args('-bios', pmon_path)
>> +        self.vm.launch()
>> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing.
>> Standby...')
>> +        wait_for_console_pattern(self, 'godson2 caches found')
> 


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-16 18:17 [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU Philippe Mathieu-Daudé
  2020-12-17  0:08 ` Jiaxun Yang
  2020-12-17  3:36 ` Jiaxun Yang
@ 2020-12-18 15:27 ` Wainer dos Santos Moschetta
  2020-12-18 20:51 ` Willian Rampazzo
  3 siblings, 0 replies; 17+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-12-18 15:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Cleber Rosa

Hi,

On 12/16/20 3:17 PM, Philippe Mathieu-Daudé wrote:
> Test the PMON firmware. As the firmware is not redistributable,
> it has to be downloaded manually first. Then it can be used by
> providing its path via the PMON_PATH environment variable:
>
>    $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>      PMON_PATH=/images/pmon \
>      avocado --show=app,console \
>        run -t machine:loongson3-virt tests/acceptance
>    JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
>    JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
>     (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 00000000
>    console: Shut down other cores
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: MEM CLK SEL : 00000000
>    console: Change the driver
>    console: Soft CLK SEL adjust begin
>    console: HT         :00000000
>    console: DDR_DIV:00000002
>    console: BBGEN start  :
>    console: BBGEN config value  :00000000
>    console: MC RESET
>    console: Fix L1xbar illegal access at NODE 0
>    console: Fix L2xbar in NODE 0
>    console: 32 bit PCI space translate to 64 bit HT space
>    console: Waiting HyperTransport bus to be up.
>    PASS (0.10 s)
>     (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: CPU clk frequency = SYSCLK x 0x0000001e /  1
>    console: MEM CLK SEL : 00000000
>    console: DDR clk frequency = MEMCLK x 0x0000001e /  3
>    console: Fix L1xbar illegal access
>    console: Fix L2xbar illegal access
>    console: Init tlb...
>    console: godson2 caches found
>    PASS (0.12 s)
>    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>    JOB TIME   : 0.58 s
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
> ---
>   MAINTAINERS                                 |  1 +
>   tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
>   2 files changed, 67 insertions(+)
>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py

lgtm.

Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>

>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f75fa2a7142..9a02d44f997 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
>   R: Jiaxun Yang <jiaxun.yang@flygoat.com>
>   S: Maintained
>   F: hw/intc/loongson_liointc.c
> +F: tests/acceptance/machine_mips_loongson3v.py
>   
>   Boston
>   M: Paul Burton <paulburton@kernel.org>
> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> new file mode 100644
> index 00000000000..8e698bbc99b
> --- /dev/null
> +++ b/tests/acceptance/machine_mips_loongson3v.py
> @@ -0,0 +1,66 @@
> +# Functional tests for the Generic Loongson-3 Platform.
> +#
> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time
> +
> +from avocado import skipUnless
> +from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
> +
> +class MipsFuloong3(Test):
> +
> +    timeout = 60
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_BLD_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
> +        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'Shut down other cores')
> +        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_A1101_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon-A1101-2.0.8.bin'
> +        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'godson2 caches found')



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-16 18:17 [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-12-18 15:27 ` Wainer dos Santos Moschetta
@ 2020-12-18 20:51 ` Willian Rampazzo
  2020-12-21 12:51   ` Huacai Chen
  3 siblings, 1 reply; 17+ messages in thread
From: Willian Rampazzo @ 2020-12-18 20:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel, Huacai Chen
  Cc: Philippe Mathieu-Daudé, Wainer dos Santos Moschetta, Cleber Rosa

On 12/16/20 3:17 PM, Philippe Mathieu-Daudé wrote:
> Test the PMON firmware. As the firmware is not redistributable,
> it has to be downloaded manually first. Then it can be used by
> providing its path via the PMON_PATH environment variable:
> 
>    $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>      PMON_PATH=/images/pmon \
>      avocado --show=app,console \
>        run -t machine:loongson3-virt tests/acceptance
>    JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
>    JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
>     (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 00000000
>    console: Shut down other cores
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: MEM CLK SEL : 00000000
>    console: Change the driver
>    console: Soft CLK SEL adjust begin
>    console: HT         :00000000
>    console: DDR_DIV:00000002
>    console: BBGEN start  :
>    console: BBGEN config value  :00000000
>    console: MC RESET
>    console: Fix L1xbar illegal access at NODE 0
>    console: Fix L2xbar in NODE 0
>    console: 32 bit PCI space translate to 64 bit HT space
>    console: Waiting HyperTransport bus to be up.
>    PASS (0.10 s)
>     (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
>    console: PMON2000 MIPS Initializing. Standby...
>    console: 0xbfe00190  : 0000000000000000
>    console: CPU CLK SEL : 00000000
>    console: CPU clk frequency = SYSCLK x 0x0000001e /  1
>    console: MEM CLK SEL : 00000000
>    console: DDR clk frequency = MEMCLK x 0x0000001e /  3
>    console: Fix L1xbar illegal access
>    console: Fix L2xbar illegal access
>    console: Init tlb...
>    console: godson2 caches found
>    PASS (0.12 s)
>    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>    JOB TIME   : 0.58 s
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
> ---
>   MAINTAINERS                                 |  1 +
>   tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
>   2 files changed, 67 insertions(+)
>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f75fa2a7142..9a02d44f997 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
>   R: Jiaxun Yang <jiaxun.yang@flygoat.com>
>   S: Maintained
>   F: hw/intc/loongson_liointc.c
> +F: tests/acceptance/machine_mips_loongson3v.py
>   
>   Boston
>   M: Paul Burton <paulburton@kernel.org>
> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> new file mode 100644
> index 00000000000..8e698bbc99b
> --- /dev/null
> +++ b/tests/acceptance/machine_mips_loongson3v.py
> @@ -0,0 +1,66 @@
> +# Functional tests for the Generic Loongson-3 Platform.
> +#
> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time
> +
> +from avocado import skipUnless
> +from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
> +
> +class MipsFuloong3(Test):
> +
> +    timeout = 60
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_BLD_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
> +        pmon_hash = '38916ee03ed09a86997b40c687c83e92'

In case you keep this approach of manually downloading the binary, it 
would be good to have a pointer (url) to it to avoid download of an 
incorrect binary that will not match the hash here.

> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'Shut down other cores')
> +        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
> +
> +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_A1101_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +        pmon_name = 'pmon-A1101-2.0.8.bin'

Same comment here about the pointer to the binary.

> +        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
> +        pmon_path = self.fetch_asset('file://' + os.path.join(
> +                                        os.getenv('PMON_PATH'), pmon_name),
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'godson2 caches found')
> 

Inspite of a small comment,

Reviewed-by: Willian Rampazzo <willianr@redhat.com>



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-18 20:51 ` Willian Rampazzo
@ 2020-12-21 12:51   ` Huacai Chen
  2020-12-21 15:34     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 17+ messages in thread
From: Huacai Chen @ 2020-12-21 12:51 UTC (permalink / raw)
  To: Willian Rampazzo
  Cc: Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, QEMU Developers, Cleber Rosa,
	Philippe Mathieu-Daudé

Hi, Philippe,

On Sat, Dec 19, 2020 at 4:51 AM Willian Rampazzo <wrampazz@redhat.com> wrote:
>
> On 12/16/20 3:17 PM, Philippe Mathieu-Daudé wrote:
> > Test the PMON firmware. As the firmware is not redistributable,
> > it has to be downloaded manually first. Then it can be used by
> > providing its path via the PMON_PATH environment variable:
A1101 is a real machine type, and there is a UEFI-based bios designed
for loongson3-virt machine (though it is also not redistributable),
why not test that one?

Huacai
> >
> >    $ AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
> >      PMON_PATH=/images/pmon \
> >      avocado --show=app,console \
> >        run -t machine:loongson3-virt tests/acceptance
> >    JOB ID     : 363e66a2d20b1c0e3f515653f9137483b83b2984
> >    JOB LOG    : /home/phil/avocado/job-results/job-2020-12-16T19.02-363e66a/job.log
> >     (1/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_BLD_serial_console:
> >    console: PMON2000 MIPS Initializing. Standby...
> >    console: 00000000
> >    console: Shut down other cores
> >    console: 0xbfe00190  : 0000000000000000
> >    console: CPU CLK SEL : 00000000
> >    console: MEM CLK SEL : 00000000
> >    console: Change the driver
> >    console: Soft CLK SEL adjust begin
> >    console: HT         :00000000
> >    console: DDR_DIV:00000002
> >    console: BBGEN start  :
> >    console: BBGEN config value  :00000000
> >    console: MC RESET
> >    console: Fix L1xbar illegal access at NODE 0
> >    console: Fix L2xbar in NODE 0
> >    console: 32 bit PCI space translate to 64 bit HT space
> >    console: Waiting HyperTransport bus to be up.
> >    PASS (0.10 s)
> >     (2/2) tests/acceptance/machine_mips_fuloong3.py:MipsFuloong3.test_pmon_A1101_serial_console:
> >    console: PMON2000 MIPS Initializing. Standby...
> >    console: 0xbfe00190  : 0000000000000000
> >    console: CPU CLK SEL : 00000000
> >    console: CPU clk frequency = SYSCLK x 0x0000001e /  1
> >    console: MEM CLK SEL : 00000000
> >    console: DDR clk frequency = MEMCLK x 0x0000001e /  3
> >    console: Fix L1xbar illegal access
> >    console: Fix L2xbar illegal access
> >    console: Init tlb...
> >    console: godson2 caches found
> >    PASS (0.12 s)
> >    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> >    JOB TIME   : 0.58 s
> >
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
> > Based-on: <20201215125716.477023-1-chenhuacai@kernel.org>
> > ---
> >   MAINTAINERS                                 |  1 +
> >   tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
> >   2 files changed, 67 insertions(+)
> >   create mode 100644 tests/acceptance/machine_mips_loongson3v.py
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index f75fa2a7142..9a02d44f997 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1166,6 +1166,7 @@ M: Huacai Chen <chenhuacai@kernel.org>
> >   R: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >   S: Maintained
> >   F: hw/intc/loongson_liointc.c
> > +F: tests/acceptance/machine_mips_loongson3v.py
> >
> >   Boston
> >   M: Paul Burton <paulburton@kernel.org>
> > diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> > new file mode 100644
> > index 00000000000..8e698bbc99b
> > --- /dev/null
> > +++ b/tests/acceptance/machine_mips_loongson3v.py
> > @@ -0,0 +1,66 @@
> > +# Functional tests for the Generic Loongson-3 Platform.
> > +#
> > +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> > +# See the COPYING file in the top-level directory.
> > +#
> > +# SPDX-License-Identifier: GPL-2.0-or-later
> > +
> > +import os
> > +import time
> > +
> > +from avocado import skipUnless
> > +from avocado_qemu import Test
> > +from avocado_qemu import wait_for_console_pattern
> > +
> > +class MipsFuloong3(Test):
> > +
> > +    timeout = 60
> > +
> > +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> > +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> > +    def test_pmon_BLD_serial_console(self):
> > +        """
> > +        :avocado: tags=arch:mips64el
> > +        :avocado: tags=endian:little
> > +        :avocado: tags=machine:loongson3-virt
> > +        :avocado: tags=cpu:Loongson-3A1000
> > +        :avocado: tags=device:liointc
> > +        :avocado: tags=device:goldfish_rtc
> > +        """
> > +        pmon_name = 'pmon_BLD-3A3000-780EMATX-1w-V1.10.bin'
> > +        pmon_hash = '38916ee03ed09a86997b40c687c83e92'
>
> In case you keep this approach of manually downloading the binary, it
> would be good to have a pointer (url) to it to avoid download of an
> incorrect binary that will not match the hash here.
>
> > +        pmon_path = self.fetch_asset('file://' + os.path.join(
> > +                                        os.getenv('PMON_PATH'), pmon_name),
> > +                                     asset_hash=pmon_hash, algorithm='md5')
> > +
> > +        self.vm.set_console()
> > +        self.vm.add_args('-bios', pmon_path)
> > +        self.vm.launch()
> > +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> > +        wait_for_console_pattern(self, 'Shut down other cores')
> > +        wait_for_console_pattern(self, 'Waiting HyperTransport bus to be up.')
> > +
> > +    @skipUnless(os.getenv('PMON_PATH'), 'PMON_PATH not available')
> > +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> > +    def test_pmon_A1101_serial_console(self):
> > +        """
> > +        :avocado: tags=arch:mips64el
> > +        :avocado: tags=endian:little
> > +        :avocado: tags=machine:loongson3-virt
> > +        :avocado: tags=cpu:Loongson-3A1000
> > +        :avocado: tags=device:liointc
> > +        :avocado: tags=device:goldfish_rtc
> > +        """
> > +        pmon_name = 'pmon-A1101-2.0.8.bin'
>
> Same comment here about the pointer to the binary.
>
> > +        pmon_hash = 'cc40276213cfa20922720f183b92ab61'
> > +        pmon_path = self.fetch_asset('file://' + os.path.join(
> > +                                        os.getenv('PMON_PATH'), pmon_name),
> > +                                     asset_hash=pmon_hash, algorithm='md5')
> > +
> > +        self.vm.set_console()
> > +        self.vm.add_args('-bios', pmon_path)
> > +        self.vm.launch()
> > +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> > +        wait_for_console_pattern(self, 'godson2 caches found')
> >
>
> Inspite of a small comment,
>
> Reviewed-by: Willian Rampazzo <willianr@redhat.com>
>


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-21 12:51   ` Huacai Chen
@ 2020-12-21 15:34     ` Philippe Mathieu-Daudé
  2020-12-22  0:40       ` Jiaxun Yang
  0 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-12-21 15:34 UTC (permalink / raw)
  To: Huacai Chen, Willian Rampazzo
  Cc: Philippe Mathieu-Daudé,
	QEMU Developers, Wainer dos Santos Moschetta, Cleber Rosa

On 12/21/20 1:51 PM, Huacai Chen wrote:
> Hi, Philippe,
> 
> On Sat, Dec 19, 2020 at 4:51 AM Willian Rampazzo <wrampazz@redhat.com> wrote:
>>
>> On 12/16/20 3:17 PM, Philippe Mathieu-Daudé wrote:
>>> Test the PMON firmware. As the firmware is not redistributable,
>>> it has to be downloaded manually first. Then it can be used by
>>> providing its path via the PMON_PATH environment variable:
> A1101 is a real machine type, and there is a UEFI-based bios designed
> for loongson3-virt machine (though it is also not redistributable),
> why not test that one?

Well, if you already shared that information, I probably missed it.

I'm trying to add test for your machine to be able to test it regularly
to avoid regressions... I'd rather let you contribute the tests :)

Phil.


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2020-12-21 15:34     ` Philippe Mathieu-Daudé
@ 2020-12-22  0:40       ` Jiaxun Yang
  0 siblings, 0 replies; 17+ messages in thread
From: Jiaxun Yang @ 2020-12-22  0:40 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Huacai Chen, Willian Rampazzo
  Cc: Philippe Mathieu-Daudé,
	QEMU Developers, Wainer dos Santos Moschetta, Cleber Rosa

在 2020/12/21 下午11:34, Philippe Mathieu-Daudé 写道:
> On 12/21/20 1:51 PM, Huacai Chen wrote:
>> Hi, Philippe,
>>
>> On Sat, Dec 19, 2020 at 4:51 AM Willian Rampazzo <wrampazz@redhat.com> wrote:
>>> On 12/16/20 3:17 PM, Philippe Mathieu-Daudé wrote:
>>>> Test the PMON firmware. As the firmware is not redistributable,
>>>> it has to be downloaded manually first. Then it can be used by
>>>> providing its path via the PMON_PATH environment variable:
>> A1101 is a real machine type, and there is a UEFI-based bios designed
>> for loongson3-virt machine (though it is also not redistributable),
>> why not test that one?
> Well, if you already shared that information, I probably missed it.
>
> I'm trying to add test for your machine to be able to test it regularly
> to avoid regressions... I'd rather let you contribute the tests :)

Hi Huacai and Philippe,

I will contribute a test with our port of PMON.
UEFI firmware lacks reasonable console output and interactive shell.

Thanks

- Jiaxun

>
> Phil.
>



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-19  6:59       ` Jiaxun Yang
@ 2021-01-19  7:19         ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-19  7:19 UTC (permalink / raw)
  To: Jiaxun Yang, BALATON Zoltan via

On 1/19/21 7:59 AM, Jiaxun Yang wrote:
> On Tue, Jan 19, 2021, at 1:57 PM, Philippe Mathieu-Daudé wrote:
>> On 1/18/21 5:54 PM, Alex Bennée wrote:
>>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>>> On 1/12/21 3:07 AM, Jiaxun Yang wrote:
>>>>> Test booting of PMON bootloader on loongson3-virt platform.
>>>>>
>>>>> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>>>>     avocado --show=app,console \
>>>>>       run -t machine:loongson3-virt tests/acceptance
>>>>> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
>>>>> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
>>>>> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
>>>> ...
>>>>> console: This software may be redistributed under the BSD copyright.
>>>>> console: Copyright 2000-2002, Opsycon AB, Sweden.
>>>>> console: Copyright 2005, ICT CAS.
>>>>> console: CPU GODSON3 BogoMIPS: 1327
>>>>> PASS (3.89 s)
>>>>> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>>>>> JOB TIME   : 4.38 s
>>>>>
>>>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>>>> ---
>>>>>  MAINTAINERS                                 |  1 +
>>>>>  tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>>>>>  2 files changed, 40 insertions(+)
>>>>>  create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>>>>>
>>>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>>>> index 4be087b88e..f38882f997 100644
>>>>> --- a/MAINTAINERS
>>>>> +++ b/MAINTAINERS
>>>>> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
>>>>>  F: hw/mips/loongson3_bootp.c
>>>>>  F: hw/mips/loongson3_bootp.h
>>>>>  F: hw/mips/loongson3_virt.c
>>>>> +F: tests/acceptance/machine_mips_loongson3v.py
>>>>>  
>>>>>  Boston
>>>>>  M: Paul Burton <paulburton@kernel.org>
>>>>> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
>>>>> new file mode 100644
>>>>> index 0000000000..17a85de69f
>>>>> --- /dev/null
>>>>> +++ b/tests/acceptance/machine_mips_loongson3v.py
>>>>> @@ -0,0 +1,39 @@
>>>>> +# Functional tests for the Generic Loongson-3 Platform.
>>>>> +#
>>>>> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>>
>>>> 2021 Jiaxun Yang <jiaxun.yang@flygoat.com>? :D
>>
>> Jiaxun, if you agree I can update that line and queue your patch.
> 
> Please do. Thanks!

So:

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

and applied (not removing AVOCADO_ALLOW_UNTRUSTED_CODE,
fixing copyright line) to mips-next.

Thanks,

Phil.


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-19  5:57     ` Philippe Mathieu-Daudé
@ 2021-01-19  6:59       ` Jiaxun Yang
  2021-01-19  7:19         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 17+ messages in thread
From: Jiaxun Yang @ 2021-01-19  6:59 UTC (permalink / raw)
  To: BALATON Zoltan via



On Tue, Jan 19, 2021, at 1:57 PM, Philippe Mathieu-Daudé wrote:
> On 1/18/21 5:54 PM, Alex Bennée wrote:
> > Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
> >> On 1/12/21 3:07 AM, Jiaxun Yang wrote:
> >>> Test booting of PMON bootloader on loongson3-virt platform.
> >>>
> >>> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
> >>>     avocado --show=app,console \
> >>>       run -t machine:loongson3-virt tests/acceptance
> >>> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
> >>> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
> >>> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
> >> ...
> >>> console: This software may be redistributed under the BSD copyright.
> >>> console: Copyright 2000-2002, Opsycon AB, Sweden.
> >>> console: Copyright 2005, ICT CAS.
> >>> console: CPU GODSON3 BogoMIPS: 1327
> >>> PASS (3.89 s)
> >>> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> >>> JOB TIME   : 4.38 s
> >>>
> >>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >>> ---
> >>>  MAINTAINERS                                 |  1 +
> >>>  tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
> >>>  2 files changed, 40 insertions(+)
> >>>  create mode 100644 tests/acceptance/machine_mips_loongson3v.py
> >>>
> >>> diff --git a/MAINTAINERS b/MAINTAINERS
> >>> index 4be087b88e..f38882f997 100644
> >>> --- a/MAINTAINERS
> >>> +++ b/MAINTAINERS
> >>> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
> >>>  F: hw/mips/loongson3_bootp.c
> >>>  F: hw/mips/loongson3_bootp.h
> >>>  F: hw/mips/loongson3_virt.c
> >>> +F: tests/acceptance/machine_mips_loongson3v.py
> >>>  
> >>>  Boston
> >>>  M: Paul Burton <paulburton@kernel.org>
> >>> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> >>> new file mode 100644
> >>> index 0000000000..17a85de69f
> >>> --- /dev/null
> >>> +++ b/tests/acceptance/machine_mips_loongson3v.py
> >>> @@ -0,0 +1,39 @@
> >>> +# Functional tests for the Generic Loongson-3 Platform.
> >>> +#
> >>> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> >>
> >> 2021 Jiaxun Yang <jiaxun.yang@flygoat.com>? :D
> 
> Jiaxun, if you agree I can update that line and queue your patch.

Please do. Thanks!

- Jiaxun

> 
> >>
> >>> +#
> >>> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> >>> +# See the COPYING file in the top-level directory.
> >>> +#
> >>> +# SPDX-License-Identifier: GPL-2.0-or-later
> >>> +
> >>> +import os
> >>> +import time
> >>> +
> >>> +from avocado import skipUnless
> >>> +from avocado_qemu import Test
> >>> +from avocado_qemu import wait_for_console_pattern
> >>> +
> >>> +class MipsLoongson3v(Test):
> >>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> >>
> >> The source code is published [1], you provided reproducible
> >> workflow [2] and a tag [3] with a public build artifacts [4],
> >> so my understanding is this is "trustable" binary.
> >>
> >> Alex, would it be OK to add this test without the UNTRUSTED tag
> >> (amending the links in the commit description)?
> > 
> > It's a subjective call. Having open source code is a minimum step to
> > being "trusted" but really the trust is in the community that hosts the
> > code. The upstream distros (e.g. Debian/Fedora) are trusted because
> > people install their software on their desktops and basically give the
> > software publisher root on their machines. There has to be a level of
> > trust that the distros won't abuse that to steal information from their
> > users.
> > 
> > I personally have no idea about the loongson community because it's not
> > one I interact with so I have no idea what sort of place it is. Is it a
> > code dump for semi-proprietary non-upstreamed kernels or is it a place
> > that has a good development culture with a sane security process that is
> > responsive to problems and moderately conservative with what they merge?
> > 
> > If you would trust your keys to a machine running this communities
> > software then by all means treated it as a trusted source.
> 
> Subjective call understood :)
> 
> Thanks for your clear explanation,
> 
> Phil.
> 
>

-- 
- Jiaxun


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-18 16:54   ` Alex Bennée
@ 2021-01-19  5:57     ` Philippe Mathieu-Daudé
  2021-01-19  6:59       ` Jiaxun Yang
  0 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-19  5:57 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Huacai Chen, qemu-devel, Wainer dos Santos Moschetta, Cleber Rosa

On 1/18/21 5:54 PM, Alex Bennée wrote:
> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>> On 1/12/21 3:07 AM, Jiaxun Yang wrote:
>>> Test booting of PMON bootloader on loongson3-virt platform.
>>>
>>> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>>     avocado --show=app,console \
>>>       run -t machine:loongson3-virt tests/acceptance
>>> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
>>> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
>>> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
>> ...
>>> console: This software may be redistributed under the BSD copyright.
>>> console: Copyright 2000-2002, Opsycon AB, Sweden.
>>> console: Copyright 2005, ICT CAS.
>>> console: CPU GODSON3 BogoMIPS: 1327
>>> PASS (3.89 s)
>>> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>>> JOB TIME   : 4.38 s
>>>
>>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>>> ---
>>>  MAINTAINERS                                 |  1 +
>>>  tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>>>  2 files changed, 40 insertions(+)
>>>  create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 4be087b88e..f38882f997 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
>>>  F: hw/mips/loongson3_bootp.c
>>>  F: hw/mips/loongson3_bootp.h
>>>  F: hw/mips/loongson3_virt.c
>>> +F: tests/acceptance/machine_mips_loongson3v.py
>>>  
>>>  Boston
>>>  M: Paul Burton <paulburton@kernel.org>
>>> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
>>> new file mode 100644
>>> index 0000000000..17a85de69f
>>> --- /dev/null
>>> +++ b/tests/acceptance/machine_mips_loongson3v.py
>>> @@ -0,0 +1,39 @@
>>> +# Functional tests for the Generic Loongson-3 Platform.
>>> +#
>>> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> 2021 Jiaxun Yang <jiaxun.yang@flygoat.com>? :D

Jiaxun, if you agree I can update that line and queue your patch.

>>
>>> +#
>>> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
>>> +# See the COPYING file in the top-level directory.
>>> +#
>>> +# SPDX-License-Identifier: GPL-2.0-or-later
>>> +
>>> +import os
>>> +import time
>>> +
>>> +from avocado import skipUnless
>>> +from avocado_qemu import Test
>>> +from avocado_qemu import wait_for_console_pattern
>>> +
>>> +class MipsLoongson3v(Test):
>>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>>
>> The source code is published [1], you provided reproducible
>> workflow [2] and a tag [3] with a public build artifacts [4],
>> so my understanding is this is "trustable" binary.
>>
>> Alex, would it be OK to add this test without the UNTRUSTED tag
>> (amending the links in the commit description)?
> 
> It's a subjective call. Having open source code is a minimum step to
> being "trusted" but really the trust is in the community that hosts the
> code. The upstream distros (e.g. Debian/Fedora) are trusted because
> people install their software on their desktops and basically give the
> software publisher root on their machines. There has to be a level of
> trust that the distros won't abuse that to steal information from their
> users.
> 
> I personally have no idea about the loongson community because it's not
> one I interact with so I have no idea what sort of place it is. Is it a
> code dump for semi-proprietary non-upstreamed kernels or is it a place
> that has a good development culture with a sane security process that is
> responsive to problems and moderately conservative with what they merge?
> 
> If you would trust your keys to a machine running this communities
> software then by all means treated it as a trusted source.

Subjective call understood :)

Thanks for your clear explanation,

Phil.


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-12 12:10 ` Philippe Mathieu-Daudé
@ 2021-01-18 16:54   ` Alex Bennée
  2021-01-19  5:57     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 17+ messages in thread
From: Alex Bennée @ 2021-01-18 16:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Huacai Chen, Wainer dos Santos Moschetta, qemu-devel, Cleber Rosa


Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> Hi Jiaxun, Alex,
>
> On 1/12/21 3:07 AM, Jiaxun Yang wrote:
>> Test booting of PMON bootloader on loongson3-virt platform.
>> 
>> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>     avocado --show=app,console \
>>       run -t machine:loongson3-virt tests/acceptance
>> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
>> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
>> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
> ...
>> console: This software may be redistributed under the BSD copyright.
>> console: Copyright 2000-2002, Opsycon AB, Sweden.
>> console: Copyright 2005, ICT CAS.
>> console: CPU GODSON3 BogoMIPS: 1327
>> PASS (3.89 s)
>> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>> JOB TIME   : 4.38 s
>> 
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>  MAINTAINERS                                 |  1 +
>>  tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>>  2 files changed, 40 insertions(+)
>>  create mode 100644 tests/acceptance/machine_mips_loongson3v.py
>> 
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 4be087b88e..f38882f997 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
>>  F: hw/mips/loongson3_bootp.c
>>  F: hw/mips/loongson3_bootp.h
>>  F: hw/mips/loongson3_virt.c
>> +F: tests/acceptance/machine_mips_loongson3v.py
>>  
>>  Boston
>>  M: Paul Burton <paulburton@kernel.org>
>> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
>> new file mode 100644
>> index 0000000000..17a85de69f
>> --- /dev/null
>> +++ b/tests/acceptance/machine_mips_loongson3v.py
>> @@ -0,0 +1,39 @@
>> +# Functional tests for the Generic Loongson-3 Platform.
>> +#
>> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> 2021 Jiaxun Yang <jiaxun.yang@flygoat.com>? :D
>
>> +#
>> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
>> +# See the COPYING file in the top-level directory.
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import os
>> +import time
>> +
>> +from avocado import skipUnless
>> +from avocado_qemu import Test
>> +from avocado_qemu import wait_for_console_pattern
>> +
>> +class MipsLoongson3v(Test):
>> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
>
> The source code is published [1], you provided reproducible
> workflow [2] and a tag [3] with a public build artifacts [4],
> so my understanding is this is "trustable" binary.
>
> Alex, would it be OK to add this test without the UNTRUSTED tag
> (amending the links in the commit description)?

It's a subjective call. Having open source code is a minimum step to
being "trusted" but really the trust is in the community that hosts the
code. The upstream distros (e.g. Debian/Fedora) are trusted because
people install their software on their desktops and basically give the
software publisher root on their machines. There has to be a level of
trust that the distros won't abuse that to steal information from their
users.

I personally have no idea about the loongson community because it's not
one I interact with so I have no idea what sort of place it is. Is it a
code dump for semi-proprietary non-upstreamed kernels or is it a place
that has a good development culture with a sane security process that is
responsive to problems and moderately conservative with what they merge?

If you would trust your keys to a machine running this communities
software then by all means treated it as a trusted source.

>
> [1] https://github.com/loongson-community/pmon/
> [2]
> https://github.com/loongson-community/pmon/blob/master/.github/workflows/compile.yml
> [3] https://github.com/loongson-community/pmon/releases/tag/20210112
> [4] https://github.com/loongson-community/pmon/actions/runs/479132723
>
>> +    def test_pmon_serial_console(self):
>> +        """
>> +        :avocado: tags=arch:mips64el
>> +        :avocado: tags=endian:little
>> +        :avocado: tags=machine:loongson3-virt
>> +        :avocado: tags=cpu:Loongson-3A1000
>> +        :avocado: tags=device:liointc
>> +        :avocado: tags=device:goldfish_rtc
>> +        """
>> +
>> +        pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
>> +        pmon_path = self.fetch_asset('https://github.com/loongson-community/pmon/'
>> +                                    'releases/download/20210112/pmon-3avirt.bin',
>> +                                     asset_hash=pmon_hash, algorithm='md5')
>> +
>> +        self.vm.set_console()
>> +        self.vm.add_args('-bios', pmon_path)
>> +        self.vm.launch()
>> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
>> +        wait_for_console_pattern(self, 'Copy PMON to execute location done.')
>> +        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')
>> 


-- 
Alex Bennée


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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-12 14:05 ` Wainer dos Santos Moschetta
@ 2021-01-13 23:26   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-13 23:26 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, Jiaxun Yang, qemu-devel
  Cc: Huacai Chen, Willian Rampazzo, Cleber Rosa

On 1/12/21 3:05 PM, Wainer dos Santos Moschetta wrote:
> Hi,
> 
> On 1/11/21 11:07 PM, Jiaxun Yang wrote:
>> Test booting of PMON bootloader on loongson3-virt platform.
>>
>> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>>      avocado --show=app,console \
>>        run -t machine:loongson3-virt tests/acceptance
>> Fetching asset from
>> tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
>>
>> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
>> JOB LOG    :
>> /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
>>   (1/1)
>> tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console: 
>> console: PMON2000 MIPS Initializing. Standby...
>> console: 00000000Jump to 9fc
> <snip>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>   MAINTAINERS                                 |  1 +
>>   tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>>   2 files changed, 40 insertions(+)
>>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py
> 
> Allow me to use this new test as an example to start a discussion about
> the organization of the acceptance files.
> 
> The mips64le tests currently are:
> 
> $ ./venv/bin/avocado list -t arch:mips64el acceptance/
> 
> INSTRUMENTED
> acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_malta
> INSTRUMENTED
> acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_fuloong2e
> INSTRUMENTED
> acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_malta_5KEc_cpio
> 
> INSTRUMENTED
> acceptance/linux_ssh_mips_malta.py:LinuxSSH.test_mips_malta64el_kernel3_2_0
> INSTRUMENTED
> acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
> 
> INSTRUMENTED
> acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core
> 
> INSTRUMENTED
> acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores
> 
> INSTRUMENTED
> acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores
> 
> INSTRUMENTED
> acceptance/replay_kernel.py:ReplayKernelNormal.test_mips64el_malta
> INSTRUMENTED
> acceptance/replay_kernel.py:ReplayKernelSlow.test_mips64el_malta_5KEc_cpio
> 
> Most of them are simple "boot linux (or firmware) and check the console"
> tests. The replay_kernel.py contain tests for a given feature and happen
> to be testing on mips64el as well. So on tests/acceptance directory
> we've got boot tests spread across files and mixed with "generic"
> feature tests.
> 
> I think we should find a home for those boot tests. Maybe throw them all
> in a sub-directory called "boot_tests", or in arch-oriented directories
> (boot_tests/mips64el, boot_tests/x86_64, ...) which would make easier to
> reference them in the MAINTAINERS file.
> 
> Any thought?

[thread hijack...]

A tests might be multi-arch. If you think it is easier to have the
tests sorted in subfolders, go ahead :) Where is a test is not a
problem. The problem we have to solve is how to relate a test with
its maintainers / developers interested in it.

We once said what really matters are Avocado tags. This might be an
underused feature of Avocado. Maybe what we need is a script to
relate test tags with MAINTAINERS?

Let's say we use the 'A' tag for that:

-- >8 --
diff --git a/MAINTAINERS b/MAINTAINERS
index cb0656aec3d..a484d429d78 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -646,6 +646,7 @@ M: Anup Patel <anup.patel@wdc.com>
 M: Alistair Francis <Alistair.Francis@wdc.com>
 L: qemu-riscv@nongnu.org
 S: Maintained
+A: device:goldfish_rtc
 F: hw/rtc/goldfish_rtc.c
 F: include/hw/rtc/goldfish_rtc.h

@@ -1160,6 +1161,11 @@ Loongson-3 virtual platforms
 M: Huacai Chen <chenhuacai@kernel.org>
 R: Jiaxun Yang <jiaxun.yang@flygoat.com>
 S: Maintained
+A: machine:loongson3-virt
+A: cpu:Loongson-3A1000
+A: device:liointc
+A: device:goldfish_rtc
 F: hw/intc/loongson_liointc.c
 F: hw/mips/loongson3_bootp.c
 F: hw/mips/loongson3_bootp.h
---

If this test fails, it should list the maintainers of the
loongson3-virt machine and the goldfish RTC.

Maintainers add their tags of interest, and can Ack when a
developer add a tag to their MAINTAINERS entry.

Thought? :)



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-12  2:07 Jiaxun Yang
  2021-01-12 12:10 ` Philippe Mathieu-Daudé
@ 2021-01-12 14:05 ` Wainer dos Santos Moschetta
  2021-01-13 23:26   ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 17+ messages in thread
From: Wainer dos Santos Moschetta @ 2021-01-12 14:05 UTC (permalink / raw)
  To: Jiaxun Yang, qemu-devel
  Cc: Huacai Chen, Philippe Mathieu-Daudé, Willian Rampazzo, Cleber Rosa

Hi,

On 1/11/21 11:07 PM, Jiaxun Yang wrote:
> Test booting of PMON bootloader on loongson3-virt platform.
>
> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>      avocado --show=app,console \
>        run -t machine:loongson3-virt tests/acceptance
> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
>   (1/1) tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console:  console: PMON2000 MIPS Initializing. Standby...
> console: 00000000Jump to 9fc
<snip>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   MAINTAINERS                                 |  1 +
>   tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>   2 files changed, 40 insertions(+)
>   create mode 100644 tests/acceptance/machine_mips_loongson3v.py

Allow me to use this new test as an example to start a discussion about 
the organization of the acceptance files.

The mips64le tests currently are:

$ ./venv/bin/avocado list -t arch:mips64el acceptance/

INSTRUMENTED 
acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_malta
INSTRUMENTED 
acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_fuloong2e
INSTRUMENTED 
acceptance/boot_linux_console.py:BootLinuxConsole.test_mips64el_malta_5KEc_cpio
INSTRUMENTED 
acceptance/linux_ssh_mips_malta.py:LinuxSSH.test_mips_malta64el_kernel3_2_0
INSTRUMENTED 
acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
INSTRUMENTED 
acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_1core
INSTRUMENTED 
acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_7cores
INSTRUMENTED 
acceptance/machine_mips_malta.py:MaltaMachineFramebuffer.test_mips_malta_i6400_framebuffer_logo_8cores
INSTRUMENTED 
acceptance/replay_kernel.py:ReplayKernelNormal.test_mips64el_malta
INSTRUMENTED 
acceptance/replay_kernel.py:ReplayKernelSlow.test_mips64el_malta_5KEc_cpio

Most of them are simple "boot linux (or firmware) and check the console" 
tests. The replay_kernel.py contain tests for a given feature and happen 
to be testing on mips64el as well. So on tests/acceptance directory 
we've got boot tests spread across files and mixed with "generic" 
feature tests.

I think we should find a home for those boot tests. Maybe throw them all 
in a sub-directory called "boot_tests", or in arch-oriented directories 
(boot_tests/mips64el, boot_tests/x86_64, ...) which would make easier to 
reference them in the MAINTAINERS file.

Any thought?

>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4be087b88e..f38882f997 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
>   F: hw/mips/loongson3_bootp.c
>   F: hw/mips/loongson3_bootp.h
>   F: hw/mips/loongson3_virt.c
> +F: tests/acceptance/machine_mips_loongson3v.py
>   
>   Boston
>   M: Paul Burton <paulburton@kernel.org>
> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> new file mode 100644
> index 0000000000..17a85de69f
> --- /dev/null
> +++ b/tests/acceptance/machine_mips_loongson3v.py
> @@ -0,0 +1,39 @@
> +# Functional tests for the Generic Loongson-3 Platform.
> +#
> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time

Unused time import

Thanks!

- Wainer

> +
> +from avocado import skipUnless
> +from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
> +
> +class MipsLoongson3v(Test):
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
> +    def test_pmon_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +
> +        pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
> +        pmon_path = self.fetch_asset('https://github.com/loongson-community/pmon/'
> +                                    'releases/download/20210112/pmon-3avirt.bin',
> +                                     asset_hash=pmon_hash, algorithm='md5'
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'Copy PMON to execute location done.')
> +        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')



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

* Re: [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
  2021-01-12  2:07 Jiaxun Yang
@ 2021-01-12 12:10 ` Philippe Mathieu-Daudé
  2021-01-18 16:54   ` Alex Bennée
  2021-01-12 14:05 ` Wainer dos Santos Moschetta
  1 sibling, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-12 12:10 UTC (permalink / raw)
  To: Jiaxun Yang, qemu-devel, Alex Bennée
  Cc: Huacai Chen, Wainer dos Santos Moschetta, Cleber Rosa

Hi Jiaxun, Alex,

On 1/12/21 3:07 AM, Jiaxun Yang wrote:
> Test booting of PMON bootloader on loongson3-virt platform.
> 
> $ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
>     avocado --show=app,console \
>       run -t machine:loongson3-virt tests/acceptance
> Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
> JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
> JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
...
> console: This software may be redistributed under the BSD copyright.
> console: Copyright 2000-2002, Opsycon AB, Sweden.
> console: Copyright 2005, ICT CAS.
> console: CPU GODSON3 BogoMIPS: 1327
> PASS (3.89 s)
> RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
> JOB TIME   : 4.38 s
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  MAINTAINERS                                 |  1 +
>  tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
>  2 files changed, 40 insertions(+)
>  create mode 100644 tests/acceptance/machine_mips_loongson3v.py
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4be087b88e..f38882f997 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
>  F: hw/mips/loongson3_bootp.c
>  F: hw/mips/loongson3_bootp.h
>  F: hw/mips/loongson3_virt.c
> +F: tests/acceptance/machine_mips_loongson3v.py
>  
>  Boston
>  M: Paul Burton <paulburton@kernel.org>
> diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
> new file mode 100644
> index 0000000000..17a85de69f
> --- /dev/null
> +++ b/tests/acceptance/machine_mips_loongson3v.py
> @@ -0,0 +1,39 @@
> +# Functional tests for the Generic Loongson-3 Platform.
> +#
> +# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>

2021 Jiaxun Yang <jiaxun.yang@flygoat.com>? :D

> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import os
> +import time
> +
> +from avocado import skipUnless
> +from avocado_qemu import Test
> +from avocado_qemu import wait_for_console_pattern
> +
> +class MipsLoongson3v(Test):
> +    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')

The source code is published [1], you provided reproducible
workflow [2] and a tag [3] with a public build artifacts [4],
so my understanding is this is "trustable" binary.

Alex, would it be OK to add this test without the UNTRUSTED tag
(amending the links in the commit description)?

[1] https://github.com/loongson-community/pmon/
[2]
https://github.com/loongson-community/pmon/blob/master/.github/workflows/compile.yml
[3] https://github.com/loongson-community/pmon/releases/tag/20210112
[4] https://github.com/loongson-community/pmon/actions/runs/479132723

> +    def test_pmon_serial_console(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=endian:little
> +        :avocado: tags=machine:loongson3-virt
> +        :avocado: tags=cpu:Loongson-3A1000
> +        :avocado: tags=device:liointc
> +        :avocado: tags=device:goldfish_rtc
> +        """
> +
> +        pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
> +        pmon_path = self.fetch_asset('https://github.com/loongson-community/pmon/'
> +                                    'releases/download/20210112/pmon-3avirt.bin',
> +                                     asset_hash=pmon_hash, algorithm='md5')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', pmon_path)
> +        self.vm.launch()
> +        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
> +        wait_for_console_pattern(self, 'Copy PMON to execute location done.')
> +        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')
> 



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

* [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU
@ 2021-01-12  2:07 Jiaxun Yang
  2021-01-12 12:10 ` Philippe Mathieu-Daudé
  2021-01-12 14:05 ` Wainer dos Santos Moschetta
  0 siblings, 2 replies; 17+ messages in thread
From: Jiaxun Yang @ 2021-01-12  2:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Huacai Chen, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Cleber Rosa

Test booting of PMON bootloader on loongson3-virt platform.

$ (venv) AVOCADO_ALLOW_UNTRUSTED_CODE=1 \
    avocado --show=app,console \
      run -t machine:loongson3-virt tests/acceptance
Fetching asset from tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console
JOB ID     : 8e202b3727847c9104d0d3d6546ed225d35f6706
JOB LOG    : /home/flygoat/avocado/job-results/job-2021-01-12T10.02-8e202b3/job.log
 (1/1) tests/acceptance/machine_mips_loongson3v.py:MipsLoongson3v.test_pmon_serial_console:  console: PMON2000 MIPS Initializing. Standby...
console: 00000000Jump to 9fc
console: Init Memory done.
console: The uncache data is:
console: 00000000:  5555555555555555
console: 00000008:  aaaaaaaaaaaaaaaa
console: 00000010:  3333333333333333
console: 00000018:  cccccccccccccccc
console: 00000020:  7777777777777777
console: 00000028:  8888888888888888
console: 00000030:  1111111111111111
console: 00000038:  eeeeeeeeeeeeeeee
console: The cached  data is:
console: 00000000:  5555555555555555
console: 00000008:  aaaaaaaaaaaaaaaa
console: 00000010:  3333333333333333
console: 00000018:  cccccccccccccccc
console: 00000020:  7777777777777777
console: 00000028:  8888888888888888
console: 00000030:  1111111111111111
console: 00000038:  eeeeeeeeeeeeeeee
console: Copy PMON to execute location...
console: start = 0x8f900000
console: s0 = 0x30300000
console: _edata = 0x8f989010
console: _end = 0x8f98a028copy text section done.
console: Copy PMON to execute location done.
console: sp=8f8fc000
console: Uncompressing Bios............................................................................OK,Booting Bios
console: FREQ
console: DONE
console: DEVI
console: ENVI
console: MAPV
console: NVRAM@8f7ff898
console: STDV
console: 80100000:  memory between 8f7ff400-8f800000  is already been allocated,heap is already above this point
console: SBDD
console: P12PCIH
console: PCIH
console: PCID
console: setting up 1 bus
console: PCI bus 0 slot 1: probe...completed
console: PCI bus 0 slot 1/0: vendor/product: 0x106b/0x003f (serialbus, USB, interface: 0x10, revision: 0x00)
console: PCI bus 0 slot 1/0: reg 0x10 = 0xffffff00
console: PCI bus 0 slot 2: probe...completed
console: PCI bus 0 slot 2/0: vendor/product: 0x1af4/0x1000 (network, ethernet, interface: 0x00, revision: 0x00)
console: PCI bus 0 slot 2/0: reg 0x10 = 0xffffffe1
console: PCI bus 0 slot 2/0: reg 0x14 = 0xfffff000
console: PCI bus 0 slot 2/0: reg 0x20 = 0xffffc00c
console: PCI bus 0 slot 2/0: reg 0x30 = 0xfffc0000
console: PCI bus 0 slot 3: probe...completed
console: PCI bus 0 slot 4: probe...completed
console: PCI bus 0 slot 5: probe...completed
console: PCI bus 0 slot 6: probe...completed
console: PCI bus 0 slot 7: probe...completed
console: PCI bus 0 slot 8: probe...completed
console: PCI bus 0 slot 9: probe...completed
console: PCI bus 0 slot 10: probe...completed
console: PCI bus 0 slot 11: probe...completed
console: PCI bus 0 slot 12: probe...completed
console: PCI bus 0 slot 13: probe...completed
console: PCI bus 0 slot 14: probe...completed
console: PCI bus 0 slot 15: probe...completed
console: PCI bus 0 slot 16: probe...completed
console: PCI bus 0 slot 17: probe...completed
console: PCI bus 0 slot 18: probe...completed
console: PCI bus 0 slot 19: probe...completed
console: PCI bus 0 slot 20: probe...completed
console: PCI bus 0 slot 21: probe...completed
console: PCI bus 0 slot 22: probe...completed
console: PCI bus 0 slot 23: probe...completed
console: PCI bus 0 slot 24: probe...completed
console: PCI bus 0 slot 25: probe...completed
console: PCI bus 0 slot 26: probe...completed
console: PCI bus 0 slot 27: probe...completed
console: PCI bus 0 slot 28: probe...completed
console: PCI bus 0 slot 29: probe...completed
console: PCI bus 0 slot 30: probe...completed
console: PCI bus 0 slot 31: probe...completed
console: PCIS
console: PCIR
console: PCIW
console: PCI bus 0 slot 2/0: mem @0x40000000, reg 0x30 262144 bytes
console: PCI bus 0 slot 2/0: mem @0x40040000, reg 0x20 16384 bytes
console: PCI bus 0 slot 2/0: mem @0x40044000, reg 0x14 4096 bytes
console: PCI bus 0 slot 1/0: mem @0x40045000, reg 0x10 256 bytes
console: PCI bus 0 slot 2/0: exp @0x40000000, 262144 bytes
console: PCI bus 0 slot 2/0: i/o @0x00004000, reg 0x10 32 bytes
console: NETI
console: RTCL
console: PCID
console: VGAI
console: memorysize=c000000,base=8f6ff508,sysMem=8f6ef500
console: in setup_int_vect!done!VESA
console: vga bios init failed, rc=-1
console: in configure
console: mainbus0 (root)
console: localbus0 at mainbus0
console: loopdev0 at mainbus0pcibr0 at mainbus0
console: pci0 at pcibr0 bus 0
console: ohci0 at pci0 dev 1 function 0 vendor/product: 0x106b/0x003f (serialbus, USB, interface: 0x10, revision: 0x00)usb base addr : 0xc0045000, bus_base is : 0xc0000000
console: OHCI revision: 0x00000010
console: RH: a: 0x00000203 b: 0x00000000
console: early period(0x0)
console: OHCI 8c01ec00 initialized ok
console: New Device 0
console: usb_get_descriptor
console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  110
console: bDeviceClass =9
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: set address 1
console: usb_get_descriptor
console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  110
console: bDeviceClass =9
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: idVendor =0
console: idProduct =0
console: bcdDevice =0
console: iManufacturer=0
console: iProduct =1
console: iSerialNumber=0
console: bNumConfigurations=1
console: usb_get_descriptor
console: usb_get_descriptor
console: get_conf_no 0 Result 25, wLength 25
console: if 0, ep 0
console: bLength=9
console: bDescriptorType=2
console: wTotalLength=19
console: bNumInterfaces=1
console: bConfigurationValue=1
console: iConfiguration=0
console: bmAttributes=40
console: MaxPower=0
console: 09 04 00 00 01 09 00 00 00 07 05 81 03 02 00 ff
console: ##EP epmaxpacketin[1] = 2
console: set configuration 1
console: new device strings: Mfr=0, Product=1, SerialNumber=0
console: USB device number 1 default language ID 0x409
console: Manufacturer
console: Product      OHCI Root Hub
console: SerialNumber
console: New Device 1
console: usb_get_descriptor
-console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  200
console: bDeviceClass =0
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: set address 2
console: usb_get_descriptor
console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  200
console: bDeviceClass =0
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: idVendor =627
console: idProduct =1
console: bcdDevice =0
console: iManufacturer=1
console: iProduct =4
console: iSerialNumber=b
console: bNumConfigurations=1
console: usb_get_descriptor
console: usb_get_descriptor
console: get_conf_no 0 Result 34, wLength 34
console: unknown Description Type : 21
console: 09 21 11 01 00 01 22 3F 00
console: if 0, ep 0
console: bLength=9
console: bDescriptorType=2
console: wTotalLength=22
console: bNumInterfaces=1
console: bConfigurationValue=1
console: iConfiguration=8
console: bmAttributes=a0
console: MaxPower=32
console: 09 04 00 00 01 03 01 01 00 09 21 11 01 00 01 22 3f 00 07 05 81 03 08 00 0a
console: ##EP epmaxpacketin[1] = 8
console: set configuration 1
console: new device strings: Mfr=1, Product=4, SerialNumber=11
console: USB device number 2 default language ID 0x409
console: Manufacturer QEMU
console: Product      QEMU USB Keyboard
console: SerialNumber 68284-0000:00:01.0-1
console: drive at ohci0 devnum 2, Product QEMU USB Keyboard
console: not configured
console: New Device 2
console: usb_get_descriptor
console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  200
console: bDeviceClass =0
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: set address 3
console: usb_get_descriptor
console: bLength = 12
console: bDescriptorType =1
console: bcdUSB =  200
console: bDeviceClass =0
console: bDeviceSubClass =0
console: bDeviceProtocol =0
console: bMaxPacketSize0 =8
console: idVendor =627
console: idProduct =1
console: bcdDevice =0
console: iManufacturer=1
console: iProduct =3
console: iSerialNumber=a
console: bNumConfigurations=1
console: usb_get_descriptor
console: usb_get_descriptor
console: get_conf_no 0 Result 34, wLength 34
console: unknown Description Type : 21
console: 09 21 01 00 00 01 22 4A 00
console: if 0, ep 0
console: bLength=9
console: bDescriptorType=2
console: wTotalLength=22
console: bNumInterfaces=1
console: bConfigurationValue=1
console: iConfiguration=7
console: bmAttributes=a0
console: MaxPower=32
console: 09 04 00 00 01 03 00 00 00 09 21 01 00 00 01 22 4a 00 07 05 81 03 08 00 0a
console: ##EP epmaxpacketin[1] = 8
console: set configuration 1
console: new device strings: Mfr=1, Product=3, SerialNumber=10
console: USB device number 3 default language ID 0x409
console: Manufacturer QEMU
console: Product      QEMU USB Tablet
console: SerialNumber 28754-0000:00:01.0-2
console: drive at ohci0 devnum 3, Product QEMU USB Tablet
console: not configured
console: drive at ohci0 devnum 1, Product OHCI Root Hub
console: not configured
console: vendor/product: 0x1af4/0x1000 (network, ethernet, interface: 0x00, revision: 0x00) at pci0 dev 2 function 0 not configured
console: out configure
console: Press <Del> to set BIOS,waiting for 3 seconds here.....
|console: devconfig done.
console: ifinit done.
console: domaininit done.
console: init_proc....
console: HSTI
console: SYMI
console: SBDE
console: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
console: [[  [[[[[[[[[       [[[[[       [[[[   [[[[[  [[[[[      [[[[[       [[[[[       [[[[   [[[[[  [[
console: [[  [[[[[[[[   [[[[  [[[   [[[[  [[[    [[[[  [[[[  [[[[  [[[   [[[[  [[[   [[[[  [[[    [[[[  [[
console: [[  [[[[[[[[  [[[[[[ [[[  [[[[[[ [[[  [  [[[  [[[  [[[[[[[[[[[[   [[[[[[[  [[[[[[ [[[  [  [[[  [[
console: [[  [[[[[[[[  [[[[[[ [[[  [[[[[[ [[[  [[  [[  [[[  [[[    [[[[[[[    [[[[  [[[[[[ [[[  [[  [[  [[
console: [[  [[[[[[[[  [[[[[[ [[[  [[[[[[ [[[  [[[  [  [[[  [[[[[  [[[[[[[[[[  [[[  [[[[[[ [[[  [[[  [  [[
console: [[  [[[[[[[[   [[[[  [[[   [[[[  [[[  [[[[    [[[   [[[[  [[[   [[[  [[[[   [[[[  [[[  [[[[    [[
console: [[       [[[[       [[[[[       [[[[  [[[[[   [[[[       [[[[[      [[[[[[       [[[[  [[[[[   [[
console: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[2011 Loongson][[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
console: Configuration [Bonito,EL,NET,SCSI,IDE]
console: Version: PMON2000 3.3 (Bonito) #0: Tue Dec 22 01:58:09 UTC 2020 commit b3ece66234adbf7d4e453f0ba4f326c099ac2a76 Author: Jiaxun Yang <jiaxun.yang@flygoat.com> Date:   Tue Dec 22 09:51:10 2020 +0800 .
console: Supported loaders [txt, srec, elf, bin]
console: Supported filesystems [net, fat, fs, disk, iso9660, socket, tty, ram]
console: This software may be redistributed under the BSD copyright.
console: Copyright 2000-2002, Opsycon AB, Sweden.
console: Copyright 2005, ICT CAS.
console: CPU GODSON3 BogoMIPS: 1327
PASS (3.89 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB TIME   : 4.38 s

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 MAINTAINERS                                 |  1 +
 tests/acceptance/machine_mips_loongson3v.py | 39 +++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_loongson3v.py

diff --git a/MAINTAINERS b/MAINTAINERS
index 4be087b88e..f38882f997 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1164,6 +1164,7 @@ F: hw/intc/loongson_liointc.c
 F: hw/mips/loongson3_bootp.c
 F: hw/mips/loongson3_bootp.h
 F: hw/mips/loongson3_virt.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
 Boston
 M: Paul Burton <paulburton@kernel.org>
diff --git a/tests/acceptance/machine_mips_loongson3v.py b/tests/acceptance/machine_mips_loongson3v.py
new file mode 100644
index 0000000000..17a85de69f
--- /dev/null
+++ b/tests/acceptance/machine_mips_loongson3v.py
@@ -0,0 +1,39 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import time
+
+from avocado import skipUnless
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
+
+class MipsLoongson3v(Test):
+    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
+    def test_pmon_serial_console(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=endian:little
+        :avocado: tags=machine:loongson3-virt
+        :avocado: tags=cpu:Loongson-3A1000
+        :avocado: tags=device:liointc
+        :avocado: tags=device:goldfish_rtc
+        """
+
+        pmon_hash = '7c8b45dd81ccfc55ff28f5aa267a41c3'
+        pmon_path = self.fetch_asset('https://github.com/loongson-community/pmon/'
+                                    'releases/download/20210112/pmon-3avirt.bin',
+                                     asset_hash=pmon_hash, algorithm='md5')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', pmon_path)
+        self.vm.launch()
+        wait_for_console_pattern(self, 'PMON2000 MIPS Initializing. Standby...')
+        wait_for_console_pattern(self, 'Copy PMON to execute location done.')
+        wait_for_console_pattern(self, 'CPU GODSON3 BogoMIPS:')
-- 
2.30.0



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

end of thread, other threads:[~2021-01-19  7:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 18:17 [PATCH] tests/acceptance: Test PMON with Loongson-3A1000 CPU Philippe Mathieu-Daudé
2020-12-17  0:08 ` Jiaxun Yang
2020-12-17  3:36 ` Jiaxun Yang
2020-12-18 15:21   ` Philippe Mathieu-Daudé
2020-12-18 15:27 ` Wainer dos Santos Moschetta
2020-12-18 20:51 ` Willian Rampazzo
2020-12-21 12:51   ` Huacai Chen
2020-12-21 15:34     ` Philippe Mathieu-Daudé
2020-12-22  0:40       ` Jiaxun Yang
2021-01-12  2:07 Jiaxun Yang
2021-01-12 12:10 ` Philippe Mathieu-Daudé
2021-01-18 16:54   ` Alex Bennée
2021-01-19  5:57     ` Philippe Mathieu-Daudé
2021-01-19  6:59       ` Jiaxun Yang
2021-01-19  7:19         ` Philippe Mathieu-Daudé
2021-01-12 14:05 ` Wainer dos Santos Moschetta
2021-01-13 23:26   ` Philippe Mathieu-Daudé

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.