Skip to contentSkip to conversation

tests/acceptance: Test PMON with Loongson-3A1000 CPU

PATCH In review Philippe Mathieu-Daudé 5 participants 9 messages Dec 16, 2020 – Dec 22, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance: Test PMON with Loongson-3A1000 CPU

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

---
Based-on: <[email protected]>

---
 MAINTAINERS                                 |  1 +
 tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_loongson3v.py
MAINTAINERS +1 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>
 R: Jiaxun Yang <[email protected]>
 S: Maintained
 F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
 Boston
 M: Paul Burton <[email protected]>
tests/acceptance/machine_mips_loongson3v.py new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.26.2
#1 lore raw
Quoted 3 lines · 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

Quoted 134 lines
   $ 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

---
Based-on: <[email protected]>

---
  MAINTAINERS                                 |  1 +
  tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
  2 files changed, 67 insertions(+)

create mode 100644 tests/acceptance/machine_mips_loongson3v.py

MAINTAINERS +1 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Maintained
  F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
  Boston
  M: Paul Burton <[email protected]>
tests/acceptance/machine_mips_loongson3v.py new file +66 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# 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 lore raw
Quoted 10 lines · Jiaxun Yang
Quoted 3 lines · 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.

Quoted 157 lines

Thanks.

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

- Jiaxun

Quoted 150 lines
   $ 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

---
Based-on: <[email protected]>
---
  MAINTAINERS                                 |  1 + tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++

  2 files changed, 67 insertions(+)

  create mode 100644 tests/acceptance/machine_mips_loongson3v.py

MAINTAINERS +0 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>

  R: Jiaxun Yang <[email protected]>
  S: Maintained
  F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
    Boston
  M: Paul Burton <[email protected]>

tests/acceptance/machine_mips_loongson3v.py new file +5 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or

later.

tests/acceptance/machine_mips_loongson3v.py new file +17 -0
+# 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')

#3 lore raw
In reply to Philippe Mathieu-Daudé

于 2020年12月17日 GMT+08:00 上午2:17:59, "Philippe Mathieu-Daudé" <[email protected]> 写到:

Quoted 3 lines

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

Quoted 134 lines
 $ 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

---
Based-on: <[email protected]>
---
MAINTAINERS | 1 +
tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++

2 files changed, 67 insertions(+)

create mode 100644 tests/acceptance/machine_mips_loongson3v.py

MAINTAINERS +0 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>

R: Jiaxun Yang <[email protected]>
S: Maintained
F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py

Boston
M: Paul Burton <[email protected]>

tests/acceptance/machine_mips_loongson3v.py new file +66 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# 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')
Reviewed-by on v1 1/1
#4 lore raw
In reply to Philippe Mathieu-Daudé

Hi,

Quoted 44 lines · 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:

   $ 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
Quoted 8 lines

---
Based-on: <[email protected]>

---
  MAINTAINERS                                 |  1 +
  tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
  2 files changed, 67 insertions(+)

create mode 100644 tests/acceptance/machine_mips_loongson3v.py

lgtm.

Quoted 85 lines
MAINTAINERS +1 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Maintained
  F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
  Boston
  M: Paul Burton <[email protected]>
tests/acceptance/machine_mips_loongson3v.py new file +66 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# 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')
Reviewed-by on v1 1/1
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 94 lines · 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:

   $ 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

---
Based-on: <[email protected]>

---
  MAINTAINERS                                 |  1 +
  tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
  2 files changed, 67 insertions(+)

create mode 100644 tests/acceptance/machine_mips_loongson3v.py

MAINTAINERS +1 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Maintained
  F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
  Boston
  M: Paul Burton <[email protected]>
tests/acceptance/machine_mips_loongson3v.py new file +23 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# 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):

tests/acceptance/machine_mips_loongson3v.py line 33

Quoted 10 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+        """
+        :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.

Quoted 13 lines
tests/acceptance/machine_mips_loongson3v.py new file +13 -0
+        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')

tests/acceptance/machine_mips_loongson3v.py line 56

Quoted 10 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+    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.

tests/acceptance/machine_mips_loongson3v.py line 66

Quoted 11 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+        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,

#6 lore raw

Hi, Philippe,

Quoted 5 lines · Willian Rampazzo
Quoted 3 lines · 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:

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

Quoted 148 lines
Quoted 91 lines
   $ 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

---
Based-on: <[email protected]>

---
  MAINTAINERS                                 |  1 +
  tests/acceptance/machine_mips_loongson3v.py | 66 +++++++++++++++++++++
  2 files changed, 67 insertions(+)

create mode 100644 tests/acceptance/machine_mips_loongson3v.py

MAINTAINERS +1 -0
index f75fa2a7142..9a02d44f997 100644
@@ -1166,6 +1166,7 @@ M: Huacai Chen <[email protected]>
  R: Jiaxun Yang <[email protected]>
  S: Maintained
  F: hw/intc/loongson_liointc.c
+F: tests/acceptance/machine_mips_loongson3v.py
 
  Boston
  M: Paul Burton <[email protected]>
tests/acceptance/machine_mips_loongson3v.py new file +23 -0
new file mode 100644
index 00000000000..8e698bbc99b
@@ -0,0 +1,66 @@
+# Functional tests for the Generic Loongson-3 Platform.
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <[email protected]>
+#
+# 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):

tests/acceptance/machine_mips_loongson3v.py line 33

Quoted 10 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+        """
+        :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.

Quoted 13 lines
tests/acceptance/machine_mips_loongson3v.py new file +13 -0
+        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')

tests/acceptance/machine_mips_loongson3v.py line 56

Quoted 10 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+    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.

tests/acceptance/machine_mips_loongson3v.py line 66

Quoted 11 lines
tests/acceptance/machine_mips_loongson3v.py new file +10 -0
+        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,

#7 lore raw
Quoted 11 lines · Huacai Chen

Hi, Philippe,

Quoted 5 lines · Willian Rampazzo
Quoted 3 lines · 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:

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.

#8 lore raw
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Huacai Chen

Hi, Philippe,

Quoted 4 lines · Willian Rampazzo
Quoted 3 lines · 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:

Quoted 7 lines
Quoted 3 lines

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

Quoted 3 lines

Phil.