Skip to contentSkip to conversation

hw/sparc: Map the UART devices unconditionally

PATCH In review Philippe Mathieu-Daudé 3 participants 9 messages Jun 8, 2020 – Jun 9, 2020

lore
Share & tools
lore
#0 lore raw

cover hw/sparc: Map the UART devices unconditionally

Few more SPARC patches.

Mark/Artyom/Frederic if you Ack them I'll simply add them to the current trivial SPARC patch queue I prepared.

Regards,

Phil.

Philippe Mathieu-Daudé (3):
hw/sparc/leon3: Map the UART device unconditionally hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition hw/sparc64/niagara: Map the UART device unconditionally

 hw/sparc/leon3.c     | 18 ++++++++----------
 hw/sparc64/niagara.c |  7 ++-----
 2 files changed, 10 insertions(+), 15 deletions(-)
Signature · 1 line
2.21.3
#1 lore raw

PATCH 1/3 hw/sparc/leon3: Map the UART device unconditionally

The UART is present on the chipset regardless there is a character device connected to it. Map it unconditionally.

---
 hw/sparc/leon3.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
hw/sparc/leon3.c +8 -10
index 8f024dab7b..cc55117dec 100644
@@ -339,16 +339,14 @@ static void leon3_generic_hw_init(MachineState *machine)
                             0, LEON3_TIMER_IRQ, GRLIB_APBIO_AREA);
 
     /* Allocate uart */
-    if (serial_hd(0)) {
-        dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);
-        qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
-        qdev_init_nofail(dev);
-        sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
-        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
-        grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
-                                GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
-                                LEON3_UART_IRQ, GRLIB_APBIO_AREA);
-    }
+    dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);
+    qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
+    grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
+                            GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
+                            LEON3_UART_IRQ, GRLIB_APBIO_AREA);
 }
 
 static void leon3_generic_machine_init(MachineClass *mc)
Signature · 1 line
2.21.3
Reviewed-by KONRAD Frederic on v1 1/3
#2 lore raw

Re: [PATCH 1/3] hw/sparc/leon3: Map the UART device unconditionally

Le 6/8/20 à 7:21 PM, Philippe Mathieu-Daudé a écrit :

Quoted 28 lines

The UART is present on the chipset regardless there is a character device connected to it. Map it unconditionally.

---
  hw/sparc/leon3.c | 18 ++++++++----------
  1 file changed, 8 insertions(+), 10 deletions(-)
hw/sparc/leon3.c +1 -10
index 8f024dab7b..cc55117dec 100644
@@ -339,16 +339,14 @@ static void leon3_generic_hw_init(MachineState *machine)
                              0, LEON3_TIMER_IRQ, GRLIB_APBIO_AREA);
 
      /* Allocate uart */
-    if (serial_hd(0)) {
-        dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);
-        qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
-        qdev_init_nofail(dev);
-        sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
-        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
-        grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
-                                GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
-                                LEON3_UART_IRQ, GRLIB_APBIO_AREA);
-    }
+    dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);

hw/sparc/leon3.c static void leon3_generic_hw_init(MachineState *machine) · line 352

Quoted 10 lines
hw/sparc/leon3.c +7 -0
+    qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
+    grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
+                            GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
+                            LEON3_UART_IRQ, GRLIB_APBIO_AREA);
  }
 
  static void leon3_generic_machine_init(MachineClass *mc)

Thanks!

#3 lore raw

Re: [PATCH 1/3] hw/sparc/leon3: Map the UART device unconditionally

Quoted 40 lines · Fred Konrad
Quoted 36 lines · Philippe Mathieu-Daudé

The UART is present on the chipset regardless there is a character device connected to it. Map it unconditionally.

---
  hw/sparc/leon3.c | 18 ++++++++----------
  1 file changed, 8 insertions(+), 10 deletions(-)
hw/sparc/leon3.c +8 -10
index 8f024dab7b..cc55117dec 100644
@@ -339,16 +339,14 @@ static void leon3_generic_hw_init(MachineState *machine)
                              0, LEON3_TIMER_IRQ, GRLIB_APBIO_AREA);
 
      /* Allocate uart */
-    if (serial_hd(0)) {
-        dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);
-        qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
-        qdev_init_nofail(dev);
-        sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
-        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
-        grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
-                                GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
-                                LEON3_UART_IRQ, GRLIB_APBIO_AREA);
-    }
+    dev = qdev_create(NULL, TYPE_GRLIB_APB_UART);
+    qdev_prop_set_chr(dev, "chrdev", serial_hd(0));
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, LEON3_UART_OFFSET);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irqs[LEON3_UART_IRQ]);
+    grlib_apb_pnp_add_entry(apb_pnp, LEON3_UART_OFFSET, 0xFFF,
+                            GRLIB_VENDOR_GAISLER, GRLIB_APBUART_DEV, 1,
+                            LEON3_UART_IRQ, GRLIB_APBIO_AREA);
  }
 
Quoted 4 lines

hw/sparc/leon3.c static void leon3_generic_hw_init(MachineState *machine) · line 352

Quoted 2 lines
hw/sparc/leon3.c +0 -0
  static void leon3_generic_machine_init(MachineClass *mc)

--
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu

#4 lore raw

PATCH 2/3 hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition

In reply to Philippe Mathieu-Daudé

NIAGARA_UART_BASE is already defined few lines earlier.

---
 hw/sparc64/niagara.c | 1 -
 1 file changed, 1 deletion(-)
hw/sparc64/niagara.c +0 -1
index ab5ef8c5b3..201fb05d50 100644
@@ -68,7 +68,6 @@ typedef struct NiagaraBoardState {
 
 #define NIAGARA_VDISK_BASE  0x1f40000000ULL
 #define NIAGARA_RTC_BASE    0xfff0c1fff8ULL
-#define NIAGARA_UART_BASE   0x1f10000000ULL
 
 /* Firmware layout
  *
Signature · 1 line
2.21.3
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition

Quoted 4 lines · Philippe Mathieu-Daudé

NIAGARA_UART_BASE is already defined few lines earlier.

Thanks!

Quoted 19 lines
---
 hw/sparc64/niagara.c | 1 -
 1 file changed, 1 deletion(-)
hw/sparc64/niagara.c +0 -2
index ab5ef8c5b3..201fb05d50 100644
@@ -68,7 +68,6 @@ typedef struct NiagaraBoardState {
 
 #define NIAGARA_VDISK_BASE  0x1f40000000ULL
 #define NIAGARA_RTC_BASE    0xfff0c1fff8ULL
-#define NIAGARA_UART_BASE   0x1f10000000ULL
 
 /* Firmware layout
  *
--

2.21.3

Signature · 4 lines
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
#6 lore raw

PATCH 3/3 hw/sparc64/niagara: Map the UART device unconditionally

In reply to Philippe Mathieu-Daudé

The UART is present on the machine regardless there is a character device connected to it. Map it unconditionally.

---
 hw/sparc64/niagara.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
hw/sparc64/niagara.c +2 -4
index 201fb05d50..a87d55f6bb 100644
@@ -151,10 +151,8 @@ static void niagara_init(MachineState *machine)
             exit(1);
         }
     }
-    if (serial_hd(0)) {
-        serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL, 115200,
-                       serial_hd(0), DEVICE_BIG_ENDIAN);
-    }
+    serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL,
+                   115200, serial_hd(0), DEVICE_BIG_ENDIAN);
     create_unimplemented_device("sun4v-iob", NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
     sun4v_rtc_init(NIAGARA_RTC_BASE);
 }
Signature · 1 line
2.21.3
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] hw/sparc64/niagara: Map the UART device unconditionally

Quoted 5 lines · Philippe Mathieu-Daudé

The UART is present on the machine regardless there is a character device connected to it. Map it unconditionally.

Quoted 24 lines
---
 hw/sparc64/niagara.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
hw/sparc64/niagara.c +2 -5
index 201fb05d50..a87d55f6bb 100644
@@ -151,10 +151,8 @@ static void niagara_init(MachineState *machine)
             exit(1);
         }
     }
-    if (serial_hd(0)) {
-        serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL, 115200,
-                       serial_hd(0), DEVICE_BIG_ENDIAN);
-    }
+    serial_mm_init(sysmem, NIAGARA_UART_BASE, 0, NULL,
+                   115200, serial_hd(0), DEVICE_BIG_ENDIAN);
     create_unimplemented_device("sun4v-iob", NIAGARA_IOBBASE, NIAGARA_IOBSIZE);
     sun4v_rtc_init(NIAGARA_RTC_BASE);
 }
--

2.21.3

Signature · 4 lines
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

Few more SPARC patches.

Mark/Artyom/Frederic if you Ack them I'll simply add them to the current trivial SPARC patch queue I prepared.

Regards,

Phil.

Quoted 9 lines

Philippe Mathieu-Daudé (3):
hw/sparc/leon3: Map the UART device unconditionally hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition hw/sparc64/niagara: Map the UART device unconditionally

 hw/sparc/leon3.c     | 18 ++++++++----------
 hw/sparc64/niagara.c |  7 ++-----
 2 files changed, 10 insertions(+), 15 deletions(-)

Thanks, series applied to for the next (temporary) sparc-next pull request.