qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests
@ 2019-12-30 11:09 Philippe Mathieu-Daudé
  2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

After looking at Niek Linnenbank implementation of the
Allwinner H3 [1], I looked what is common in the A10 [2].

Add some tests before modifying the code further.

[1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg665532.html
[2] https://www.mail-archive.com/qemu-devel@nongnu.org/msg666809.html

Philippe Mathieu-Daudé (6):
  tests/boot_linux_console: Add initrd test for the CubieBoard
  tests/boot_linux_console: Add a SD card test for the CubieBoard
  hw/arm/allwinner-a10: Move SoC definitions out of header
  hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios()
  hw/arm/allwinner-a10: Remove local qemu_irq variables
  hw/arm/cubieboard: Disable unsupported M-USB in device tree blob [RFC]

 include/hw/arm/allwinner-a10.h         |  7 ---
 hw/arm/allwinner-a10.c                 | 39 ++++++------
 hw/arm/cubieboard.c                    | 24 ++++++++
 tests/acceptance/boot_linux_console.py | 85 ++++++++++++++++++++++++++
 4 files changed, 130 insertions(+), 25 deletions(-)

-- 
2.21.0



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

* [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2019-12-30 20:52   ` Wainer dos Santos Moschetta
  2019-12-30 11:09 ` [PATCH 2/6] tests/boot_linux_console: Add a SD card " Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

This test boots a Linux kernel on a CubieBoard and verify
the serial output is working.

The kernel image and DeviceTree blob are built by the Armbian
project (based on Debian):
https://docs.armbian.com/Developer-Guide_Build-Preparation/

The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test

If ARM is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:arm" tags.

Alternatively, this test can be run using:

  $ avocado --show=console run -t machine:cubieboard tests/acceptance/boot_linux_console.py
  console: Uncompressing Linux... done, booting the kernel.
  console: Booting Linux on physical CPU 0x0
  console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
  console: CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7), cr=50c5387d
  console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
  console: OF: fdt: Machine model: Cubietech Cubieboard
  [...]
  console: Boot successful.
  console: cat /proc/cpuinfo
  console: / # cat /proc/cpuinfo
  console: processor      : 0
  console: model name     : ARMv7 Processor rev 0 (v7l)
  console: BogoMIPS       : 832.51
  [...]
  console: Hardware       : Allwinner sun4i/sun5i Families
  console: Revision       : 0000
  console: Serial         : 0000000000000000
  console: cat /proc/iomem
  console: / # cat /proc/iomem
  console: 01c00000-01c0002f : system-control@1c00000
  console: 01c02000-01c02fff : dma-controller@1c02000
  console: 01c05000-01c05fff : spi@1c05000
  console: 01c0b080-01c0b093 : mdio@1c0b080
  console: 01c0c000-01c0cfff : lcd-controller@1c0c000
  console: 01c0d000-01c0dfff : lcd-controller@1c0d000
  console: 01c0f000-01c0ffff : mmc@1c0f000
  [...]
  PASS (54.35 s)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 9c6aa2040a..4643f60e37 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -400,6 +400,47 @@ class BootLinuxConsole(Test):
         self.wait_for_console_pattern('Boot successful.')
         # TODO user command, for now the uart is stuck
 
+    def test_arm_cubieboard_initrd(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:cubieboard
+        """
+        deb_url = ('https://apt.armbian.com/pool/main/l/'
+                   'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
+        deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        kernel_path = self.extract_from_deb(deb_path,
+                                            '/boot/vmlinuz-4.20.7-sunxi')
+        dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
+        dtb_path = self.extract_from_deb(deb_path, dtb_path)
+        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
+                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
+                      'arm/rootfs-armv5.cpio.gz')
+        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
+        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
+        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
+        archive.gzip_uncompress(initrd_path_gz, initrd_path)
+
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=ttyS0,115200 '
+                               'usbcore.nousb '
+                               'panic=-1 noreboot')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-dtb', dtb_path,
+                         '-initrd', initrd_path,
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        self.wait_for_console_pattern('Boot successful.')
+
+        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+                                                'Allwinner sun4i/sun5i')
+        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
+                                                'system-control@1c00000')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=arch:s390x
-- 
2.21.0



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

* [PATCH 2/6] tests/boot_linux_console: Add a SD card test for the CubieBoard
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
  2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2019-12-30 11:09 ` [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

The kernel image and DeviceTree blob are built by the Armbian
project (based on Debian):
https://docs.armbian.com/Developer-Guide_Build-Preparation/

The cpio image used comes from the linux-build-test project:
https://github.com/groeck/linux-build-test

If ARM is a target being built, "make check-acceptance" will
automatically include this test by the use of the "arch:arm" tags.

Alternatively, this test can be run using:

  $ avocado --show=console run -t machine:cubieboard tests/acceptance/boot_linux_console.py
  console: Uncompressing Linux... done, booting the kernel.
  console: Booting Linux on physical CPU 0x0
  console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
  [...]
  console: ahci-sunxi 1c18000.sata: Linked as a consumer to regulator.4
  console: ahci-sunxi 1c18000.sata: controller can't do 64bit DMA, forcing 32bit
  console: ahci-sunxi 1c18000.sata: AHCI 0001.0000 32 slots 1 ports 1.5 Gbps 0x1 impl platform mode
  console: ahci-sunxi 1c18000.sata: flags: ncq only
  console: scsi host0: ahci-sunxi
  console: ata1: SATA max UDMA/133 mmio [mem 0x01c18000-0x01c18fff] port 0x100 irq 27
  console: of_cfs_init
  console: of_cfs_init: OK
  console: vcc3v0: disabling
  console: vcc5v0: disabling
  console: usb1-vbus: disabling
  console: usb2-vbus: disabling
  console: ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
  console: ata1.00: ATA-7: QEMU HARDDISK, 2.5+, max UDMA/100
  console: ata1.00: 40960 sectors, multi 16: LBA48 NCQ (depth 32)
  console: ata1.00: applying bridge limits
  console: ata1.00: configured for UDMA/100
  console: scsi 0:0:0:0: Direct-Access     ATA      QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
  console: sd 0:0:0:0: Attached scsi generic sg0 type 0
  console: sd 0:0:0:0: [sda] 40960 512-byte logical blocks: (21.0 MB/20.0 MiB)
  console: sd 0:0:0:0: [sda] Write Protect is off
  console: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
  console: sd 0:0:0:0: [sda] Attached SCSI disk
  console: EXT4-fs (sda): mounting ext2 file system using the ext4 subsystem
  console: EXT4-fs (sda): mounted filesystem without journal. Opts: (null)
  console: VFS: Mounted root (ext2 filesystem) readonly on device 8:0.
  [...]
  console: cat /proc/partitions
  console: / # cat /proc/partitions
  console: major minor  #blocks  name
  console: 1        0       4096 ram0
  console: 1        1       4096 ram1
  console: 1        2       4096 ram2
  console: 1        3       4096 ram3
  console: 8        0      20480 sda
  console: reboot
  console: / # reboot
  [...]
  console: sd 0:0:0:0: [sda] Synchronizing SCSI cache
  console: reboot: Restarting system
  PASS (48.39 s)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 44 ++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 4643f60e37..e40b84651b 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -441,6 +441,50 @@ class BootLinuxConsole(Test):
         exec_command_and_wait_for_pattern(self, 'reboot',
                                                 'reboot: Restarting system')
 
+    def test_arm_cubieboard_sata(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:cubieboard
+        """
+        deb_url = ('https://apt.armbian.com/pool/main/l/'
+                   'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
+        deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        kernel_path = self.extract_from_deb(deb_path,
+                                            '/boot/vmlinuz-4.20.7-sunxi')
+        dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
+        dtb_path = self.extract_from_deb(deb_path, dtb_path)
+        rootfs_url = ('https://github.com/groeck/linux-build-test/raw/'
+                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
+                      'arm/rootfs-armv5.ext2.gz')
+        rootfs_hash = '093e89d2b4d982234bf528bc9fb2f2f17a9d1f93'
+        rootfs_path_gz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash)
+        rootfs_path = os.path.join(self.workdir, 'rootfs.cpio')
+        archive.gzip_uncompress(rootfs_path_gz, rootfs_path)
+
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=ttyS0,115200 '
+                               'usbcore.nousb '
+                               'root=/dev/sda ro '
+                               'panic=-1 noreboot')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-dtb', dtb_path,
+                         '-drive', 'if=none,format=raw,id=disk0,file='
+                                   + rootfs_path,
+                         '-device', 'ide-hd,bus=ide.0,drive=disk0',
+                         '-append', kernel_command_line,
+                         '-no-reboot')
+        self.vm.launch()
+        self.wait_for_console_pattern('Boot successful.')
+
+        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
+                                                'Allwinner sun4i/sun5i')
+        exec_command_and_wait_for_pattern(self, 'cat /proc/partitions',
+                                                'sda')
+        exec_command_and_wait_for_pattern(self, 'reboot',
+                                                'reboot: Restarting system')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=arch:s390x
-- 
2.21.0



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

* [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
  2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
  2019-12-30 11:09 ` [PATCH 2/6] tests/boot_linux_console: Add a SD card " Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2020-01-06 15:59   ` Peter Maydell
  2019-12-30 11:09 ` [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

These definitions are specific to the A10 SoC and don't need
to be exported to the different Allwinner peripherals.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/arm/allwinner-a10.h | 6 ------
 hw/arm/allwinner-a10.c         | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index 7d2d215630..941c61e533 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -12,12 +12,6 @@
 #include "target/arm/cpu.h"
 
 
-#define AW_A10_PIC_REG_BASE     0x01c20400
-#define AW_A10_PIT_REG_BASE     0x01c20c00
-#define AW_A10_UART0_REG_BASE   0x01c28000
-#define AW_A10_EMAC_BASE        0x01c0b000
-#define AW_A10_SATA_BASE        0x01c18000
-
 #define AW_A10_SDRAM_BASE       0x40000000
 
 #define TYPE_AW_A10 "allwinner-a10"
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 118032c8c7..0f1af5a880 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -25,6 +25,12 @@
 #include "hw/misc/unimp.h"
 #include "sysemu/sysemu.h"
 
+#define AW_A10_PIC_REG_BASE     0x01c20400
+#define AW_A10_PIT_REG_BASE     0x01c20c00
+#define AW_A10_UART0_REG_BASE   0x01c28000
+#define AW_A10_EMAC_BASE        0x01c0b000
+#define AW_A10_SATA_BASE        0x01c18000
+
 static void aw_a10_init(Object *obj)
 {
     AwA10State *s = AW_A10(obj);
-- 
2.21.0



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

* [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios()
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2019-12-30 11:09 ` [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2020-01-06 16:01   ` Peter Maydell
  2019-12-30 11:09 ` [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

By calling qdev_pass_gpios() we don't need to hold a copy of the
IRQs from the INTC into the SoC state.
Instead of filling an array of qemu_irq and passing it around, we
can now directly call qdev_get_gpio_in() on the SoC.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/arm/allwinner-a10.h |  1 -
 hw/arm/allwinner-a10.c         | 24 +++++++++++-------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index 941c61e533..40d0b1d9c0 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -23,7 +23,6 @@ typedef struct AwA10State {
     /*< public >*/
 
     ARMCPU cpu;
-    qemu_irq irq[AW_A10_PIC_INT_NR];
     AwA10PITState timer;
     AwA10PICState intc;
     AwEmacState emac;
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 0f1af5a880..966fbd4a6e 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -55,7 +55,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
 {
     AwA10State *s = AW_A10(dev);
     SysBusDevice *sysbusdev;
-    uint8_t i;
     qemu_irq fiq, irq;
     Error *err = NULL;
 
@@ -76,9 +75,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
     sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE);
     sysbus_connect_irq(sysbusdev, 0, irq);
     sysbus_connect_irq(sysbusdev, 1, fiq);
-    for (i = 0; i < AW_A10_PIC_INT_NR; i++) {
-        s->irq[i] = qdev_get_gpio_in(DEVICE(&s->intc), i);
-    }
+    qdev_pass_gpios(DEVICE(&s->intc), dev, NULL);
 
     object_property_set_bool(OBJECT(&s->timer), true, "realized", &err);
     if (err != NULL) {
@@ -87,12 +84,12 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
     }
     sysbusdev = SYS_BUS_DEVICE(&s->timer);
     sysbus_mmio_map(sysbusdev, 0, AW_A10_PIT_REG_BASE);
-    sysbus_connect_irq(sysbusdev, 0, s->irq[22]);
-    sysbus_connect_irq(sysbusdev, 1, s->irq[23]);
-    sysbus_connect_irq(sysbusdev, 2, s->irq[24]);
-    sysbus_connect_irq(sysbusdev, 3, s->irq[25]);
-    sysbus_connect_irq(sysbusdev, 4, s->irq[67]);
-    sysbus_connect_irq(sysbusdev, 5, s->irq[68]);
+    sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(dev, 22));
+    sysbus_connect_irq(sysbusdev, 1, qdev_get_gpio_in(dev, 23));
+    sysbus_connect_irq(sysbusdev, 2, qdev_get_gpio_in(dev, 24));
+    sysbus_connect_irq(sysbusdev, 3, qdev_get_gpio_in(dev, 25));
+    sysbus_connect_irq(sysbusdev, 4, qdev_get_gpio_in(dev, 67));
+    sysbus_connect_irq(sysbusdev, 5, qdev_get_gpio_in(dev, 68));
 
     memory_region_init_ram(&s->sram_a, OBJECT(dev), "sram A", 48 * KiB,
                            &error_fatal);
@@ -111,7 +108,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
     }
     sysbusdev = SYS_BUS_DEVICE(&s->emac);
     sysbus_mmio_map(sysbusdev, 0, AW_A10_EMAC_BASE);
-    sysbus_connect_irq(sysbusdev, 0, s->irq[55]);
+    sysbus_connect_irq(sysbusdev, 0, qdev_get_gpio_in(dev, 55));
 
     object_property_set_bool(OBJECT(&s->sata), true, "realized", &err);
     if (err) {
@@ -119,10 +116,11 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->sata), 0, AW_A10_SATA_BASE);
-    sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, s->irq[56]);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, qdev_get_gpio_in(dev, 56));
 
     /* FIXME use a qdev chardev prop instead of serial_hd() */
-    serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->irq[1],
+    serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2,
+                   qdev_get_gpio_in(dev, 1),
                    115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
 }
 
-- 
2.21.0



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

* [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2019-12-30 11:09 ` [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2020-01-06 16:01   ` Peter Maydell
  2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
  2020-01-06 16:24 ` [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Peter Maydell
  6 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

We won't reuse the CPU IRQ/FIQ variables. Simplify by calling
qdev_get_gpio_in() in place.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/arm/allwinner-a10.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 966fbd4a6e..1cde165611 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -55,7 +55,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
 {
     AwA10State *s = AW_A10(dev);
     SysBusDevice *sysbusdev;
-    qemu_irq fiq, irq;
     Error *err = NULL;
 
     object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
@@ -63,8 +62,6 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
         error_propagate(errp, err);
         return;
     }
-    irq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ);
-    fiq = qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ);
 
     object_property_set_bool(OBJECT(&s->intc), true, "realized", &err);
     if (err != NULL) {
@@ -73,8 +70,10 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
     }
     sysbusdev = SYS_BUS_DEVICE(&s->intc);
     sysbus_mmio_map(sysbusdev, 0, AW_A10_PIC_REG_BASE);
-    sysbus_connect_irq(sysbusdev, 0, irq);
-    sysbus_connect_irq(sysbusdev, 1, fiq);
+    sysbus_connect_irq(sysbusdev, 0,
+                       qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
+    sysbus_connect_irq(sysbusdev, 1,
+                       qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
     qdev_pass_gpios(DEVICE(&s->intc), dev, NULL);
 
     object_property_set_bool(OBJECT(&s->timer), true, "realized", &err);
-- 
2.21.0



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

* [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2019-12-30 11:09 ` [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables Philippe Mathieu-Daudé
@ 2019-12-30 11:09 ` Philippe Mathieu-Daudé
  2019-12-30 11:33   ` Niek Linnenbank
  2020-01-06 16:07   ` Peter Maydell
  2020-01-06 16:24 ` [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Peter Maydell
  6 siblings, 2 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 11:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beniamino Galvani, Niek Linnenbank,
	qemu-arm, Willian Rampazzo, Cleber Rosa

We do not model the Sunxi Multipoint USB.
The Linux kernel OOPS when booting:

  ------------[ cut here ]------------
  WARNING: CPU: 0 PID: 144 at drivers/usb/musb/sunxi.c:400 sunxi_musb_ep_offset+0x39/0x3c
  sunxi_musb_ep_offset called with non 0 offset
  Modules linked in:
  CPU: 0 PID: 144 Comm: kworker/0:2 Not tainted 4.20.7-sunxi #5.75
  Hardware name: Allwinner sun4i/sun5i Families
  Workqueue: events deferred_probe_work_func
  [<c010d77d>] (unwind_backtrace) from [<c010a425>] (show_stack+0x11/0x14)
  [<c010a425>] (show_stack) from [<c08d9141>] (dump_stack+0x69/0x78)
  [<c08d9141>] (dump_stack) from [<c011b161>] (__warn+0xa1/0xb4)
  [<c011b161>] (__warn) from [<c011b1a7>] (warn_slowpath_fmt+0x33/0x48)
  [<c011b1a7>] (warn_slowpath_fmt) from [<c0725c81>] (sunxi_musb_ep_offset+0x39/0x3c)
  [<c0725c81>] (sunxi_musb_ep_offset) from [<c071b481>] (ep_config_from_hw+0x99/0x104)
  [<c071b481>] (ep_config_from_hw) from [<c071c8d9>] (musb_probe+0x765/0xa0c)
  [<c071c8d9>] (musb_probe) from [<c063fa4f>] (platform_drv_probe+0x33/0x68)
  [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>] (really_probe+0x16f/0x1e0)
  [<c063e4ef>] (really_probe) from [<c063e67f>] (driver_probe_device+0x43/0x11c)
  [<c063e67f>] (driver_probe_device) from [<c063d0cf>] (bus_for_each_drv+0x37/0x70)
  [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>] (__device_attach+0x83/0xc8)
  [<c063e32f>] (__device_attach) from [<c063da8b>] (bus_probe_device+0x5b/0x60)
  [<c063da8b>] (bus_probe_device) from [<c063b7a5>] (device_add+0x2f5/0x474)
  [<c063b7a5>] (device_add) from [<c063f8ef>] (platform_device_add+0xb7/0x184)
  [<c063f8ef>] (platform_device_add) from [<c06400df>] (platform_device_register_full+0xb3/0xc4)
  [<c06400df>] (platform_device_register_full) from [<c0725a2f>] (sunxi_musb_probe+0x1d7/0x2f4)
  [<c0725a2f>] (sunxi_musb_probe) from [<c063fa4f>] (platform_drv_probe+0x33/0x68)
  [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>] (really_probe+0x16f/0x1e0)
  [<c063e4ef>] (really_probe) from [<c063e67f>] (driver_probe_device+0x43/0x11c)
  [<c063e67f>] (driver_probe_device) from [<c063d0cf>] (bus_for_each_drv+0x37/0x70)
  [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>] (__device_attach+0x83/0xc8)
  [<c063e32f>] (__device_attach) from [<c063da8b>] (bus_probe_device+0x5b/0x60)
  [<c063da8b>] (bus_probe_device) from [<c063ddcf>] (deferred_probe_work_func+0x4b/0x6c)
  [<c063ddcf>] (deferred_probe_work_func) from [<c012e38b>] (process_one_work+0x167/0x384)
  [<c012e38b>] (process_one_work) from [<c012f07d>] (worker_thread+0x251/0x3fc)
  [<c012f07d>] (worker_thread) from [<c0132949>] (kthread+0xfd/0x104)
  [<c0132949>] (kthread) from [<c01010f9>] (ret_from_fork+0x11/0x38)
  Exception stack(0xc6999fb0 to 0xc6999ff8)
  9fa0:                                     00000000 00000000 00000000 00000000
  9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
  ---[ end trace b309edbca98c7de2 ]---
  musb-sunxi 1c13000.usb: Error unknown readb offset 128
  musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
  musb-hdrc: probe of musb-hdrc.1.auto failed with error -22

This is not critical but confusing. To avoid the Linux kernel to
probe this device, mark it disabled in the device tree blob.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
I'm not sure if this is a QEMU anti-pattern or bad practice.
I know we prefer to be as close to the hardware as possible,
but here the hardware is not changed, the dtb is. However
this makes the guest behave differently. At least we don't
have to manually edit the dts. If this is only annoying for
acceptance testing, we might consider manually editing the
dts in the tests setup().
---
 hw/arm/cubieboard.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index 6dc2f1d6b6..dd10577696 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -22,10 +22,34 @@
 #include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "hw/arm/allwinner-a10.h"
+#include <libfdt.h>
+
+static void cubieboard_modify_dtb(const struct arm_boot_info *info, void *fdt)
+{
+    static const char unsupported_compat[] = "allwinner,sun4i-a10-musb";
+    char node_path[72];
+    int offset;
+
+    offset = fdt_node_offset_by_compatible(fdt, -1, unsupported_compat);
+    while (offset >= 0) {
+        int r = fdt_get_path(fdt, offset, node_path, sizeof(node_path));
+        assert(r >= 0);
+        r = fdt_setprop_string(fdt, offset, "status", "disabled");
+        if (r < 0) {
+            error_report("%s: Couldn't disable %s: %s", __func__,
+                         unsupported_compat, fdt_strerror(r));
+            exit(1);
+        }
+        warn_report("cubieboard: disabled unsupported node %s (%s) "
+                    "in device tree", node_path, unsupported_compat);
+        offset = fdt_node_offset_by_compatible(fdt, offset, unsupported_compat);
+    }
+}
 
 static struct arm_boot_info cubieboard_binfo = {
     .loader_start = AW_A10_SDRAM_BASE,
     .board_id = 0x1008,
+    .modify_dtb = cubieboard_modify_dtb,
 };
 
 typedef struct CubieBoardState {
-- 
2.21.0



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

* Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
@ 2019-12-30 11:33   ` Niek Linnenbank
  2019-12-30 13:55     ` Philippe Mathieu-Daudé
  2020-01-06 16:07   ` Peter Maydell
  1 sibling, 1 reply; 19+ messages in thread
From: Niek Linnenbank @ 2019-12-30 11:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, QEMU Developers, Wainer dos Santos Moschetta,
	Beniamino Galvani, qemu-arm, Willian Rampazzo, Cleber Rosa

[-- Attachment #1: Type: text/plain, Size: 6340 bytes --]

Hello Philippe,

I have a suggestion: probably you can apply (almost) the same patch to get
USB
working for A10 as I did in the Allwinner H3, in patch #4 "add USB host
controller" [1]
That way you can avoid the DTB modifications and with low effort get USB
working as well for this board.
As far as I can see, in Section 21.1 in the A10 user manual [2] has the
same description
as for the H3. It basically has the standard EHCI and OHCI interfaces.

[1] https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg03266.html
[2] https://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf

Regards,
Niek

On Mon, Dec 30, 2019 at 12:10 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> We do not model the Sunxi Multipoint USB.
> The Linux kernel OOPS when booting:
>
>   ------------[ cut here ]------------
>   WARNING: CPU: 0 PID: 144 at drivers/usb/musb/sunxi.c:400
> sunxi_musb_ep_offset+0x39/0x3c
>   sunxi_musb_ep_offset called with non 0 offset
>   Modules linked in:
>   CPU: 0 PID: 144 Comm: kworker/0:2 Not tainted 4.20.7-sunxi #5.75
>   Hardware name: Allwinner sun4i/sun5i Families
>   Workqueue: events deferred_probe_work_func
>   [<c010d77d>] (unwind_backtrace) from [<c010a425>] (show_stack+0x11/0x14)
>   [<c010a425>] (show_stack) from [<c08d9141>] (dump_stack+0x69/0x78)
>   [<c08d9141>] (dump_stack) from [<c011b161>] (__warn+0xa1/0xb4)
>   [<c011b161>] (__warn) from [<c011b1a7>] (warn_slowpath_fmt+0x33/0x48)
>   [<c011b1a7>] (warn_slowpath_fmt) from [<c0725c81>]
> (sunxi_musb_ep_offset+0x39/0x3c)
>   [<c0725c81>] (sunxi_musb_ep_offset) from [<c071b481>]
> (ep_config_from_hw+0x99/0x104)
>   [<c071b481>] (ep_config_from_hw) from [<c071c8d9>]
> (musb_probe+0x765/0xa0c)
>   [<c071c8d9>] (musb_probe) from [<c063fa4f>]
> (platform_drv_probe+0x33/0x68)
>   [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>]
> (really_probe+0x16f/0x1e0)
>   [<c063e4ef>] (really_probe) from [<c063e67f>]
> (driver_probe_device+0x43/0x11c)
>   [<c063e67f>] (driver_probe_device) from [<c063d0cf>]
> (bus_for_each_drv+0x37/0x70)
>   [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>]
> (__device_attach+0x83/0xc8)
>   [<c063e32f>] (__device_attach) from [<c063da8b>]
> (bus_probe_device+0x5b/0x60)
>   [<c063da8b>] (bus_probe_device) from [<c063b7a5>]
> (device_add+0x2f5/0x474)
>   [<c063b7a5>] (device_add) from [<c063f8ef>]
> (platform_device_add+0xb7/0x184)
>   [<c063f8ef>] (platform_device_add) from [<c06400df>]
> (platform_device_register_full+0xb3/0xc4)
>   [<c06400df>] (platform_device_register_full) from [<c0725a2f>]
> (sunxi_musb_probe+0x1d7/0x2f4)
>   [<c0725a2f>] (sunxi_musb_probe) from [<c063fa4f>]
> (platform_drv_probe+0x33/0x68)
>   [<c063fa4f>] (platform_drv_probe) from [<c063e4ef>]
> (really_probe+0x16f/0x1e0)
>   [<c063e4ef>] (really_probe) from [<c063e67f>]
> (driver_probe_device+0x43/0x11c)
>   [<c063e67f>] (driver_probe_device) from [<c063d0cf>]
> (bus_for_each_drv+0x37/0x70)
>   [<c063d0cf>] (bus_for_each_drv) from [<c063e32f>]
> (__device_attach+0x83/0xc8)
>   [<c063e32f>] (__device_attach) from [<c063da8b>]
> (bus_probe_device+0x5b/0x60)
>   [<c063da8b>] (bus_probe_device) from [<c063ddcf>]
> (deferred_probe_work_func+0x4b/0x6c)
>   [<c063ddcf>] (deferred_probe_work_func) from [<c012e38b>]
> (process_one_work+0x167/0x384)
>   [<c012e38b>] (process_one_work) from [<c012f07d>]
> (worker_thread+0x251/0x3fc)
>   [<c012f07d>] (worker_thread) from [<c0132949>] (kthread+0xfd/0x104)
>   [<c0132949>] (kthread) from [<c01010f9>] (ret_from_fork+0x11/0x38)
>   Exception stack(0xc6999fb0 to 0xc6999ff8)
>   9fa0:                                     00000000 00000000 00000000
> 00000000
>   9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 00000000
>   9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
>   ---[ end trace b309edbca98c7de2 ]---
>   musb-sunxi 1c13000.usb: Error unknown readb offset 128
>   musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -22
>   musb-hdrc: probe of musb-hdrc.1.auto failed with error -22
>
> This is not critical but confusing. To avoid the Linux kernel to
> probe this device, mark it disabled in the device tree blob.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> I'm not sure if this is a QEMU anti-pattern or bad practice.
> I know we prefer to be as close to the hardware as possible,
> but here the hardware is not changed, the dtb is. However
> this makes the guest behave differently. At least we don't
> have to manually edit the dts. If this is only annoying for
> acceptance testing, we might consider manually editing the
> dts in the tests setup().
> ---
>  hw/arm/cubieboard.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
> index 6dc2f1d6b6..dd10577696 100644
> --- a/hw/arm/cubieboard.c
> +++ b/hw/arm/cubieboard.c
> @@ -22,10 +22,34 @@
>  #include "hw/sysbus.h"
>  #include "hw/boards.h"
>  #include "hw/arm/allwinner-a10.h"
> +#include <libfdt.h>
> +
> +static void cubieboard_modify_dtb(const struct arm_boot_info *info, void
> *fdt)
> +{
> +    static const char unsupported_compat[] = "allwinner,sun4i-a10-musb";
> +    char node_path[72];
> +    int offset;
> +
> +    offset = fdt_node_offset_by_compatible(fdt, -1, unsupported_compat);
> +    while (offset >= 0) {
> +        int r = fdt_get_path(fdt, offset, node_path, sizeof(node_path));
> +        assert(r >= 0);
> +        r = fdt_setprop_string(fdt, offset, "status", "disabled");
> +        if (r < 0) {
> +            error_report("%s: Couldn't disable %s: %s", __func__,
> +                         unsupported_compat, fdt_strerror(r));
> +            exit(1);
> +        }
> +        warn_report("cubieboard: disabled unsupported node %s (%s) "
> +                    "in device tree", node_path, unsupported_compat);
> +        offset = fdt_node_offset_by_compatible(fdt, offset,
> unsupported_compat);
> +    }
> +}
>
>  static struct arm_boot_info cubieboard_binfo = {
>      .loader_start = AW_A10_SDRAM_BASE,
>      .board_id = 0x1008,
> +    .modify_dtb = cubieboard_modify_dtb,
>  };
>
>  typedef struct CubieBoardState {
> --
> 2.21.0
>
>

-- 
Niek Linnenbank

[-- Attachment #2: Type: text/html, Size: 7821 bytes --]

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

* Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2019-12-30 11:33   ` Niek Linnenbank
@ 2019-12-30 13:55     ` Philippe Mathieu-Daudé
  2019-12-30 20:05       ` Niek Linnenbank
  0 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-30 13:55 UTC (permalink / raw)
  To: Niek Linnenbank, Philippe Mathieu-Daudé
  Cc: Peter Maydell, QEMU Developers, Wainer dos Santos Moschetta,
	Beniamino Galvani, qemu-arm, Willian Rampazzo, Cleber Rosa

On 12/30/19 12:33 PM, Niek Linnenbank wrote:
> Hello Philippe,
> 
> I have a suggestion: probably you can apply (almost) the same patch to 
> get USB
> working for A10 as I did in the Allwinner H3, in patch #4 "add USB host 
> controller" [1]
> That way you can avoid the DTB modifications and with low effort get USB 
> working as well for this board.
> As far as I can see, in Section 21.1 in the A10 user manual [2] has the 
> same description
> as for the H3. It basically has the standard EHCI and OHCI interfaces.

Oh good news. I guess in the long term we want a AllwinnerSoc parent 
class where all common blocks are mapped, and A10/H3 children with the 
differences. But we'll worry about that after your H3 series get merged.

> [1] https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg03266.html
> [2] https://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf
> 
> Regards,
> Niek



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

* Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2019-12-30 13:55     ` Philippe Mathieu-Daudé
@ 2019-12-30 20:05       ` Niek Linnenbank
  0 siblings, 0 replies; 19+ messages in thread
From: Niek Linnenbank @ 2019-12-30 20:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, QEMU Developers, Beniamino Galvani,
	qemu-arm, Willian Rampazzo, Cleber Rosa

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

Hey Philippe,

I took a second look at this and, it seems my previous suggestion was only
partly valid.
The kernel error you reported came from the driver in
drivers/usb/musb/sunxi.c. Apparently, this
is an Allwinner specific driver for M-USB. And I don't see it documented in
the A10 user manual.

On the other hand, the USB host interfaces EHCI/OHCI do apply for the A10
SoC and this board.
Linux has them defined in the DTB in arch/arm/boot/dts/sun4i-a10.dtsi
(ehci0/1, ohci0/1).
But probably that is for another patch/commit.

Regards,
Niek

On Mon, Dec 30, 2019 at 2:56 PM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> On 12/30/19 12:33 PM, Niek Linnenbank wrote:
> > Hello Philippe,
> >
> > I have a suggestion: probably you can apply (almost) the same patch to
> > get USB
> > working for A10 as I did in the Allwinner H3, in patch #4 "add USB host
> > controller" [1]
> > That way you can avoid the DTB modifications and with low effort get USB
> > working as well for this board.
> > As far as I can see, in Section 21.1 in the A10 user manual [2] has the
> > same description
> > as for the H3. It basically has the standard EHCI and OHCI interfaces.
>
> Oh good news. I guess in the long term we want a AllwinnerSoc parent
> class where all common blocks are mapped, and A10/H3 children with the
> differences. But we'll worry about that after your H3 series get merged.
>
> > [1] https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg03266.html
> > [2] https://linux-sunxi.org/File:Allwinner_A10_User_manual_V1.5.pdf
> >
> > Regards,
> > Niek
>
>

-- 
Niek Linnenbank

[-- Attachment #2: Type: text/html, Size: 2507 bytes --]

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

* Re: [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard
  2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
@ 2019-12-30 20:52   ` Wainer dos Santos Moschetta
  2019-12-31 11:41     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Wainer dos Santos Moschetta @ 2019-12-30 20:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Beniamino Galvani, Niek Linnenbank, qemu-arm,
	Willian Rampazzo, Cleber Rosa


On 12/30/19 9:09 AM, Philippe Mathieu-Daudé wrote:
> This test boots a Linux kernel on a CubieBoard and verify
> the serial output is working.
>
> The kernel image and DeviceTree blob are built by the Armbian
> project (based on Debian):
> https://docs.armbian.com/Developer-Guide_Build-Preparation/
>
> The cpio image used comes from the linux-build-test project:
> https://github.com/groeck/linux-build-test
>
> If ARM is a target being built, "make check-acceptance" will
> automatically include this test by the use of the "arch:arm" tags.
>
> Alternatively, this test can be run using:
>
>    $ avocado --show=console run -t machine:cubieboard tests/acceptance/boot_linux_console.py
>    console: Uncompressing Linux... done, booting the kernel.
>    console: Booting Linux on physical CPU 0x0
>    console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 CET 2019
>    console: CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7), cr=50c5387d
>    console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
>    console: OF: fdt: Machine model: Cubietech Cubieboard
>    [...]
>    console: Boot successful.
>    console: cat /proc/cpuinfo
>    console: / # cat /proc/cpuinfo
>    console: processor      : 0
>    console: model name     : ARMv7 Processor rev 0 (v7l)
>    console: BogoMIPS       : 832.51
>    [...]
>    console: Hardware       : Allwinner sun4i/sun5i Families
>    console: Revision       : 0000
>    console: Serial         : 0000000000000000
>    console: cat /proc/iomem
>    console: / # cat /proc/iomem
>    console: 01c00000-01c0002f : system-control@1c00000
>    console: 01c02000-01c02fff : dma-controller@1c02000
>    console: 01c05000-01c05fff : spi@1c05000
>    console: 01c0b080-01c0b093 : mdio@1c0b080
>    console: 01c0c000-01c0cfff : lcd-controller@1c0c000
>    console: 01c0d000-01c0dfff : lcd-controller@1c0d000
>    console: 01c0f000-01c0ffff : mmc@1c0f000
>    [...]
>    PASS (54.35 s)
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++
>   1 file changed, 41 insertions(+)
>
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 9c6aa2040a..4643f60e37 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -400,6 +400,47 @@ class BootLinuxConsole(Test):
>           self.wait_for_console_pattern('Boot successful.')
>           # TODO user command, for now the uart is stuck
>   
> +    def test_arm_cubieboard_initrd(self):

Unless you have two tests, one with and without initrd (not the case 
though) the suffix '_initrd' is useless. So I suggest to remove it.

> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:cubieboard
> +        """
> +        deb_url = ('https://apt.armbian.com/pool/main/l/'
> +                   'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
> +        deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        kernel_path = self.extract_from_deb(deb_path,
> +                                            '/boot/vmlinuz-4.20.7-sunxi')
> +        dtb_path = '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
> +        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
> +                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
> +                      'arm/rootfs-armv5.cpio.gz')
> +        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
> +        initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
> +        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
> +        archive.gzip_uncompress(initrd_path_gz, initrd_path)
> +
> +        self.vm.set_console()
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> +                               'console=ttyS0,115200 '
> +                               'usbcore.nousb '
> +                               'panic=-1 noreboot')
> +        self.vm.add_args('-kernel', kernel_path,
> +                         '-dtb', dtb_path,
> +                         '-initrd', initrd_path,
> +                         '-append', kernel_command_line,
> +                         '-no-reboot')
> +        self.vm.launch()
> +        self.wait_for_console_pattern('Boot successful.')
> +
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
> +                                                'Allwinner sun4i/sun5i')
> +        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
> +                                                'system-control@1c00000')
> +        exec_command_and_wait_for_pattern(self, 'reboot',
> +                                                'reboot: Restarting system')


I ran this test case with success, so:

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

With the comment regarding the _initrd suffix:

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


> +
>       def test_s390x_s390_ccw_virtio(self):
>           """
>           :avocado: tags=arch:s390x



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

* Re: [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard
  2019-12-30 20:52   ` Wainer dos Santos Moschetta
@ 2019-12-31 11:41     ` Philippe Mathieu-Daudé
  2020-01-03 13:31       ` Wainer dos Santos Moschetta
  0 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-12-31 11:41 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Beniamino Galvani, Niek Linnenbank, qemu-arm,
	Willian Rampazzo, Cleber Rosa

On 12/30/19 9:52 PM, Wainer dos Santos Moschetta wrote:
> On 12/30/19 9:09 AM, Philippe Mathieu-Daudé wrote:
>> This test boots a Linux kernel on a CubieBoard and verify
>> the serial output is working.
>>
>> The kernel image and DeviceTree blob are built by the Armbian
>> project (based on Debian):
>> https://docs.armbian.com/Developer-Guide_Build-Preparation/
>>
>> The cpio image used comes from the linux-build-test project:
>> https://github.com/groeck/linux-build-test
>>
>> If ARM is a target being built, "make check-acceptance" will
>> automatically include this test by the use of the "arch:arm" tags.
>>
>> Alternatively, this test can be run using:
>>
>>    $ avocado --show=console run -t machine:cubieboard 
>> tests/acceptance/boot_linux_console.py
>>    console: Uncompressing Linux... done, booting the kernel.
>>    console: Booting Linux on physical CPU 0x0
>>    console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc version 
>> 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 09:02:10 
>> CET 2019
>>    console: CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7), 
>> cr=50c5387d
>>    console: CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing 
>> instruction cache
>>    console: OF: fdt: Machine model: Cubietech Cubieboard
>>    [...]
>>    console: Boot successful.
>>    console: cat /proc/cpuinfo
>>    console: / # cat /proc/cpuinfo
>>    console: processor      : 0
>>    console: model name     : ARMv7 Processor rev 0 (v7l)
>>    console: BogoMIPS       : 832.51
>>    [...]
>>    console: Hardware       : Allwinner sun4i/sun5i Families
>>    console: Revision       : 0000
>>    console: Serial         : 0000000000000000
>>    console: cat /proc/iomem
>>    console: / # cat /proc/iomem
>>    console: 01c00000-01c0002f : system-control@1c00000
>>    console: 01c02000-01c02fff : dma-controller@1c02000
>>    console: 01c05000-01c05fff : spi@1c05000
>>    console: 01c0b080-01c0b093 : mdio@1c0b080
>>    console: 01c0c000-01c0cfff : lcd-controller@1c0c000
>>    console: 01c0d000-01c0dfff : lcd-controller@1c0d000
>>    console: 01c0f000-01c0ffff : mmc@1c0f000
>>    [...]
>>    PASS (54.35 s)
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   tests/acceptance/boot_linux_console.py | 41 ++++++++++++++++++++++++++
>>   1 file changed, 41 insertions(+)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py 
>> b/tests/acceptance/boot_linux_console.py
>> index 9c6aa2040a..4643f60e37 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -400,6 +400,47 @@ class BootLinuxConsole(Test):
>>           self.wait_for_console_pattern('Boot successful.')
>>           # TODO user command, for now the uart is stuck
>> +    def test_arm_cubieboard_initrd(self):
> 
> Unless you have two tests, one with and without initrd (not the case 
> though) the suffix '_initrd' is useless. So I suggest to remove it.

The next patch adds a SD card test:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg667628.html

If one developer has other tests in progress, but one done, I think it 
might sense to add the full test name when the first patch is merged, so 
next tests don't have to modify the first test name.

>> +        """
>> +        :avocado: tags=arch:arm
>> +        :avocado: tags=machine:cubieboard
>> +        """
>> +        deb_url = ('https://apt.armbian.com/pool/main/l/'
>> +                   
>> 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
>> +        deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
>> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
>> +        kernel_path = self.extract_from_deb(deb_path,
>> +                                            
>> '/boot/vmlinuz-4.20.7-sunxi')
>> +        dtb_path = 
>> '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
>> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
>> +        initrd_url = ('https://github.com/groeck/linux-build-test/raw/'
>> +                      '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
>> +                      'arm/rootfs-armv5.cpio.gz')
>> +        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
>> +        initrd_path_gz = self.fetch_asset(initrd_url, 
>> asset_hash=initrd_hash)
>> +        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
>> +        archive.gzip_uncompress(initrd_path_gz, initrd_path)
>> +
>> +        self.vm.set_console()
>> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
>> +                               'console=ttyS0,115200 '
>> +                               'usbcore.nousb '
>> +                               'panic=-1 noreboot')
>> +        self.vm.add_args('-kernel', kernel_path,
>> +                         '-dtb', dtb_path,
>> +                         '-initrd', initrd_path,
>> +                         '-append', kernel_command_line,
>> +                         '-no-reboot')
>> +        self.vm.launch()
>> +        self.wait_for_console_pattern('Boot successful.')
>> +
>> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
>> +                                                'Allwinner sun4i/sun5i')
>> +        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
>> +                                                
>> 'system-control@1c00000')
>> +        exec_command_and_wait_for_pattern(self, 'reboot',
>> +                                                'reboot: Restarting 
>> system')
> 
> 
> I ran this test case with success, so:
> 
> Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>

Thanks Wainer!

> 
> With the comment regarding the _initrd suffix:
> 
> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> 
> 
>> +
>>       def test_s390x_s390_ccw_virtio(self):
>>           """
>>           :avocado: tags=arch:s390x
> 
> 



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

* Re: [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard
  2019-12-31 11:41     ` Philippe Mathieu-Daudé
@ 2020-01-03 13:31       ` Wainer dos Santos Moschetta
  0 siblings, 0 replies; 19+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-01-03 13:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Beniamino Galvani, Niek Linnenbank, qemu-arm,
	Willian Rampazzo, Cleber Rosa


On 12/31/19 9:41 AM, Philippe Mathieu-Daudé wrote:
> On 12/30/19 9:52 PM, Wainer dos Santos Moschetta wrote:
>> On 12/30/19 9:09 AM, Philippe Mathieu-Daudé wrote:
>>> This test boots a Linux kernel on a CubieBoard and verify
>>> the serial output is working.
>>>
>>> The kernel image and DeviceTree blob are built by the Armbian
>>> project (based on Debian):
>>> https://docs.armbian.com/Developer-Guide_Build-Preparation/
>>>
>>> The cpio image used comes from the linux-build-test project:
>>> https://github.com/groeck/linux-build-test
>>>
>>> If ARM is a target being built, "make check-acceptance" will
>>> automatically include this test by the use of the "arch:arm" tags.
>>>
>>> Alternatively, this test can be run using:
>>>
>>>    $ avocado --show=console run -t machine:cubieboard 
>>> tests/acceptance/boot_linux_console.py
>>>    console: Uncompressing Linux... done, booting the kernel.
>>>    console: Booting Linux on physical CPU 0x0
>>>    console: Linux version 4.20.7-sunxi (root@armbian.com) (gcc 
>>> version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #5.75 SMP Fri Feb 8 
>>> 09:02:10 CET 2019
>>>    console: CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7), 
>>> cr=50c5387d
>>>    console: CPU: PIPT / VIPT nonaliasing data cache, VIPT 
>>> nonaliasing instruction cache
>>>    console: OF: fdt: Machine model: Cubietech Cubieboard
>>>    [...]
>>>    console: Boot successful.
>>>    console: cat /proc/cpuinfo
>>>    console: / # cat /proc/cpuinfo
>>>    console: processor      : 0
>>>    console: model name     : ARMv7 Processor rev 0 (v7l)
>>>    console: BogoMIPS       : 832.51
>>>    [...]
>>>    console: Hardware       : Allwinner sun4i/sun5i Families
>>>    console: Revision       : 0000
>>>    console: Serial         : 0000000000000000
>>>    console: cat /proc/iomem
>>>    console: / # cat /proc/iomem
>>>    console: 01c00000-01c0002f : system-control@1c00000
>>>    console: 01c02000-01c02fff : dma-controller@1c02000
>>>    console: 01c05000-01c05fff : spi@1c05000
>>>    console: 01c0b080-01c0b093 : mdio@1c0b080
>>>    console: 01c0c000-01c0cfff : lcd-controller@1c0c000
>>>    console: 01c0d000-01c0dfff : lcd-controller@1c0d000
>>>    console: 01c0f000-01c0ffff : mmc@1c0f000
>>>    [...]
>>>    PASS (54.35 s)
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 41 
>>> ++++++++++++++++++++++++++
>>>   1 file changed, 41 insertions(+)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>> b/tests/acceptance/boot_linux_console.py
>>> index 9c6aa2040a..4643f60e37 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -400,6 +400,47 @@ class BootLinuxConsole(Test):
>>>           self.wait_for_console_pattern('Boot successful.')
>>>           # TODO user command, for now the uart is stuck
>>> +    def test_arm_cubieboard_initrd(self):
>>
>> Unless you have two tests, one with and without initrd (not the case 
>> though) the suffix '_initrd' is useless. So I suggest to remove it.
>
> The next patch adds a SD card test:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg667628.html
>
> If one developer has other tests in progress, but one done, I think it 
> might sense to add the full test name when the first patch is merged, 
> so next tests don't have to modify the first test name.


That's right. Disregard my comment.

- Wainer


>
>>> +        """
>>> +        :avocado: tags=arch:arm
>>> +        :avocado: tags=machine:cubieboard
>>> +        """
>>> +        deb_url = ('https://apt.armbian.com/pool/main/l/'
>>> + 'linux-4.20.7-sunxi/linux-image-dev-sunxi_5.75_armhf.deb')
>>> +        deb_hash = '1334c29c44d984ffa05ed10de8c3361f33d78315'
>>> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
>>> +        kernel_path = self.extract_from_deb(deb_path,
>>> + '/boot/vmlinuz-4.20.7-sunxi')
>>> +        dtb_path = 
>>> '/usr/lib/linux-image-dev-sunxi/sun4i-a10-cubieboard.dtb'
>>> +        dtb_path = self.extract_from_deb(deb_path, dtb_path)
>>> +        initrd_url = 
>>> ('https://github.com/groeck/linux-build-test/raw/'
>>> + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/'
>>> +                      'arm/rootfs-armv5.cpio.gz')
>>> +        initrd_hash = '2b50f1873e113523967806f4da2afe385462ff9b'
>>> +        initrd_path_gz = self.fetch_asset(initrd_url, 
>>> asset_hash=initrd_hash)
>>> +        initrd_path = os.path.join(self.workdir, 'rootfs.cpio')
>>> +        archive.gzip_uncompress(initrd_path_gz, initrd_path)
>>> +
>>> +        self.vm.set_console()
>>> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
>>> +                               'console=ttyS0,115200 '
>>> +                               'usbcore.nousb '
>>> +                               'panic=-1 noreboot')
>>> +        self.vm.add_args('-kernel', kernel_path,
>>> +                         '-dtb', dtb_path,
>>> +                         '-initrd', initrd_path,
>>> +                         '-append', kernel_command_line,
>>> +                         '-no-reboot')
>>> +        self.vm.launch()
>>> +        self.wait_for_console_pattern('Boot successful.')
>>> +
>>> +        exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo',
>>> +                                                'Allwinner 
>>> sun4i/sun5i')
>>> +        exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
>>> + 'system-control@1c00000')
>>> +        exec_command_and_wait_for_pattern(self, 'reboot',
>>> +                                                'reboot: Restarting 
>>> system')
>>
>>
>> I ran this test case with success, so:
>>
>> Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>
> Thanks Wainer!
>
>>
>> With the comment regarding the _initrd suffix:
>>
>> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
>>
>>
>>> +
>>>       def test_s390x_s390_ccw_virtio(self):
>>>           """
>>>           :avocado: tags=arch:s390x
>>
>>
>



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

* Re: [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header
  2019-12-30 11:09 ` [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header Philippe Mathieu-Daudé
@ 2020-01-06 15:59   ` Peter Maydell
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2020-01-06 15:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On Mon, 30 Dec 2019 at 11:09, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> These definitions are specific to the A10 SoC and don't need
> to be exported to the different Allwinner peripherals.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/arm/allwinner-a10.h | 6 ------
>  hw/arm/allwinner-a10.c         | 6 ++++++
>  2 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios()
  2019-12-30 11:09 ` [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() Philippe Mathieu-Daudé
@ 2020-01-06 16:01   ` Peter Maydell
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2020-01-06 16:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On Mon, 30 Dec 2019 at 11:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> By calling qdev_pass_gpios() we don't need to hold a copy of the
> IRQs from the INTC into the SoC state.
> Instead of filling an array of qemu_irq and passing it around, we
> can now directly call qdev_get_gpio_in() on the SoC.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  include/hw/arm/allwinner-a10.h |  1 -
>  hw/arm/allwinner-a10.c         | 24 +++++++++++-------------
>  2 files changed, 11 insertions(+), 14 deletions(-)
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables
  2019-12-30 11:09 ` [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables Philippe Mathieu-Daudé
@ 2020-01-06 16:01   ` Peter Maydell
  0 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2020-01-06 16:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On Mon, 30 Dec 2019 at 11:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> We won't reuse the CPU IRQ/FIQ variables. Simplify by calling
> qdev_get_gpio_in() in place.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
  2019-12-30 11:33   ` Niek Linnenbank
@ 2020-01-06 16:07   ` Peter Maydell
  2020-01-06 16:36     ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 19+ messages in thread
From: Peter Maydell @ 2020-01-06 16:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On Mon, 30 Dec 2019 at 11:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> We do not model the Sunxi Multipoint USB.
> The Linux kernel OOPS when booting:

> This is not critical but confusing. To avoid the Linux kernel to
> probe this device, mark it disabled in the device tree blob.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> I'm not sure if this is a QEMU anti-pattern or bad practice.
> I know we prefer to be as close to the hardware as possible,
> but here the hardware is not changed, the dtb is. However
> this makes the guest behave differently. At least we don't
> have to manually edit the dts. If this is only annoying for
> acceptance testing, we might consider manually editing the
> dts in the tests setup().

In general I'd definitely prefer it if we avoided editing
the DTB for things like this (we have very few boards that
edit the DTB and none of them do it as workarounds for
buggy/missing device emulation). Is it possible to have
at least a dummy implementation of the controller that's
enough to make the probe function fail more cleanly?

thanks
-- PMM


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

* Re: [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests
  2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
@ 2020-01-06 16:24 ` Peter Maydell
  6 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2020-01-06 16:24 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On Mon, 30 Dec 2019 at 11:09, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> After looking at Niek Linnenbank implementation of the
> Allwinner H3 [1], I looked what is common in the A10 [2].
>
> Add some tests before modifying the code further.
>
> [1] https://www.mail-archive.com/qemu-devel@nongnu.org/msg665532.html
> [2] https://www.mail-archive.com/qemu-devel@nongnu.org/msg666809.html
>
> Philippe Mathieu-Daudé (6):
>   tests/boot_linux_console: Add initrd test for the CubieBoard
>   tests/boot_linux_console: Add a SD card test for the CubieBoard
>   hw/arm/allwinner-a10: Move SoC definitions out of header
>   hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios()
>   hw/arm/allwinner-a10: Remove local qemu_irq variables
>   hw/arm/cubieboard: Disable unsupported M-USB in device tree blob [RFC]

I've added patches 1-5 to target-arm.next (but not the RFC patch 6,
which I've replied with my view on.)

thanks
-- PMM


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

* Re: [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob
  2020-01-06 16:07   ` Peter Maydell
@ 2020-01-06 16:36     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-06 16:36 UTC (permalink / raw)
  To: Peter Maydell, Philippe Mathieu-Daudé
  Cc: QEMU Developers, Wainer dos Santos Moschetta, Beniamino Galvani,
	Niek Linnenbank, qemu-arm, Willian Rampazzo, Cleber Rosa

On 1/6/20 5:07 PM, Peter Maydell wrote:
> On Mon, 30 Dec 2019 at 11:10, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>
>> We do not model the Sunxi Multipoint USB.
>> The Linux kernel OOPS when booting:
> 
>> This is not critical but confusing. To avoid the Linux kernel to
>> probe this device, mark it disabled in the device tree blob.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> I'm not sure if this is a QEMU anti-pattern or bad practice.
>> I know we prefer to be as close to the hardware as possible,
>> but here the hardware is not changed, the dtb is. However
>> this makes the guest behave differently. At least we don't
>> have to manually edit the dts. If this is only annoying for
>> acceptance testing, we might consider manually editing the
>> dts in the tests setup().
> 
> In general I'd definitely prefer it if we avoided editing
> the DTB for things like this (we have very few boards that
> edit the DTB and none of them do it as workarounds for
> buggy/missing device emulation).

Yes I understand (I was expecting this answer, but better to have it 
explicit).

> Is it possible to have
> at least a dummy implementation of the controller that's
> enough to make the probe function fail more cleanly?

Niek gave some pointers. Anyway The kernel is not crashing, it is just 
oopsing, so this is not fatal (the VM is still usable).

Thanks!

Phil.



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

end of thread, other threads:[~2020-01-06 16:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 11:09 [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Philippe Mathieu-Daudé
2019-12-30 11:09 ` [PATCH 1/6] tests/boot_linux_console: Add initrd test for the CubieBoard Philippe Mathieu-Daudé
2019-12-30 20:52   ` Wainer dos Santos Moschetta
2019-12-31 11:41     ` Philippe Mathieu-Daudé
2020-01-03 13:31       ` Wainer dos Santos Moschetta
2019-12-30 11:09 ` [PATCH 2/6] tests/boot_linux_console: Add a SD card " Philippe Mathieu-Daudé
2019-12-30 11:09 ` [PATCH 3/6] hw/arm/allwinner-a10: Move SoC definitions out of header Philippe Mathieu-Daudé
2020-01-06 15:59   ` Peter Maydell
2019-12-30 11:09 ` [PATCH 4/6] hw/arm/allwinner-a10: Simplify by passing IRQs with qdev_pass_gpios() Philippe Mathieu-Daudé
2020-01-06 16:01   ` Peter Maydell
2019-12-30 11:09 ` [PATCH 5/6] hw/arm/allwinner-a10: Remove local qemu_irq variables Philippe Mathieu-Daudé
2020-01-06 16:01   ` Peter Maydell
2019-12-30 11:09 ` [RFC PATCH 6/6] hw/arm/cubieboard: Disable unsupported M-USB in device tree blob Philippe Mathieu-Daudé
2019-12-30 11:33   ` Niek Linnenbank
2019-12-30 13:55     ` Philippe Mathieu-Daudé
2019-12-30 20:05       ` Niek Linnenbank
2020-01-06 16:07   ` Peter Maydell
2020-01-06 16:36     ` Philippe Mathieu-Daudé
2020-01-06 16:24 ` [PATCH 0/6] hw/arm/cubieboard: Few cleanups, add acceptance tests Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).