All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/mips/jazz: Map the UART devices unconditionally
@ 2021-06-29  5:37 Philippe Mathieu-Daudé
  2021-06-29  9:00 ` Peter Maydell
  2021-07-01 21:21 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-06-29  5:37 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Aleksandar Rikalo, Mark Cave-Ayland,
	Philippe Mathieu-Daudé,
	Hervé Poussineau, Aurelien Jarno

When using the Magnum ARC firmware we can see accesses to the
UART1 beeing rejected, because the device is not mapped:

  $ qemu-system-mips64el -M magnum -d guest_errors,unimp -bios NTPROM.RAW
  Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
  Invalid access at addr 0x80007001, size 1, region '(null)', reason: rejected
  Invalid access at addr 0x80007002, size 1, region '(null)', reason: rejected
  Invalid access at addr 0x80007003, size 1, region '(null)', reason: rejected
  Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected

Since both UARTs are present (soldered on the board) regardless there
are character devices connected, map them unconditionally.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/mips/jazz.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index 1e1cf8154e7..e33d639af63 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -333,16 +333,12 @@ static void mips_jazz_init(MachineState *machine,
     memory_region_add_subregion(address_space, 0x80005000, i8042);
 
     /* Serial ports */
-    if (serial_hd(0)) {
-        serial_mm_init(address_space, 0x80006000, 0,
-                       qdev_get_gpio_in(rc4030, 8), 8000000 / 16,
-                       serial_hd(0), DEVICE_NATIVE_ENDIAN);
-    }
-    if (serial_hd(1)) {
-        serial_mm_init(address_space, 0x80007000, 0,
-                       qdev_get_gpio_in(rc4030, 9), 8000000 / 16,
-                       serial_hd(1), DEVICE_NATIVE_ENDIAN);
-    }
+    serial_mm_init(address_space, 0x80006000, 0,
+                   qdev_get_gpio_in(rc4030, 8), 8000000 / 16,
+                   serial_hd(0), DEVICE_NATIVE_ENDIAN);
+    serial_mm_init(address_space, 0x80007000, 0,
+                   qdev_get_gpio_in(rc4030, 9), 8000000 / 16,
+                   serial_hd(1), DEVICE_NATIVE_ENDIAN);
 
     /* Parallel port */
     if (parallel_hds[0])
-- 
2.31.1



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

* Re: [PATCH] hw/mips/jazz: Map the UART devices unconditionally
  2021-06-29  5:37 [PATCH] hw/mips/jazz: Map the UART devices unconditionally Philippe Mathieu-Daudé
@ 2021-06-29  9:00 ` Peter Maydell
  2021-07-01 21:21 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2021-06-29  9:00 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Aleksandar Rikalo, Mark Cave-Ayland, QEMU Developers,
	Hervé Poussineau, Aurelien Jarno

On Tue, 29 Jun 2021 at 06:37, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> When using the Magnum ARC firmware we can see accesses to the
> UART1 beeing rejected, because the device is not mapped:

"being"

>
>   $ qemu-system-mips64el -M magnum -d guest_errors,unimp -bios NTPROM.RAW
>   Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007001, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007002, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007003, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
>
> Since both UARTs are present (soldered on the board) regardless there

"regardless of whether there are"

> are character devices connected, map them unconditionally.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

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

(This code pre-dated commit 12051d82f004 which made it safe to pass NULL
in as a chardev to serial devices.)

thanks
-- PMM


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

* Re: [PATCH] hw/mips/jazz: Map the UART devices unconditionally
  2021-06-29  5:37 [PATCH] hw/mips/jazz: Map the UART devices unconditionally Philippe Mathieu-Daudé
  2021-06-29  9:00 ` Peter Maydell
@ 2021-07-01 21:21 ` Philippe Mathieu-Daudé
  2021-07-03  5:20   ` Mark Cave-Ayland
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-07-01 21:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Aleksandar Rikalo, Mark Cave-Ayland,
	Aurelien Jarno, Hervé Poussineau

On 6/29/21 7:37 AM, Philippe Mathieu-Daudé wrote:
> When using the Magnum ARC firmware we can see accesses to the
> UART1 beeing rejected, because the device is not mapped:
> 
>   $ qemu-system-mips64el -M magnum -d guest_errors,unimp -bios NTPROM.RAW
>   Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007001, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007002, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007003, size 1, region '(null)', reason: rejected
>   Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
> 
> Since both UARTs are present (soldered on the board) regardless there
> are character devices connected, map them unconditionally.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/mips/jazz.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)

Patch queued to mips-next (with Peter's corrections applied).


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

* Re: [PATCH] hw/mips/jazz: Map the UART devices unconditionally
  2021-07-01 21:21 ` Philippe Mathieu-Daudé
@ 2021-07-03  5:20   ` Mark Cave-Ayland
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Cave-Ayland @ 2021-07-03  5:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Aleksandar Rikalo, Hervé Poussineau, Aurelien Jarno

On 01/07/2021 22:21, Philippe Mathieu-Daudé wrote:

> On 6/29/21 7:37 AM, Philippe Mathieu-Daudé wrote:
>> When using the Magnum ARC firmware we can see accesses to the
>> UART1 beeing rejected, because the device is not mapped:
>>
>>    $ qemu-system-mips64el -M magnum -d guest_errors,unimp -bios NTPROM.RAW
>>    Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
>>    Invalid access at addr 0x80007001, size 1, region '(null)', reason: rejected
>>    Invalid access at addr 0x80007002, size 1, region '(null)', reason: rejected
>>    Invalid access at addr 0x80007003, size 1, region '(null)', reason: rejected
>>    Invalid access at addr 0x80007004, size 1, region '(null)', reason: rejected
>>
>> Since both UARTs are present (soldered on the board) regardless there
>> are character devices connected, map them unconditionally.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>   hw/mips/jazz.c | 16 ++++++----------
>>   1 file changed, 6 insertions(+), 10 deletions(-)
> 
> Patch queued to mips-next (with Peter's corrections applied).

Looks good to me. For future reference serial_mm_init() was another candidate on my 
list of init functions that could be replaced with qdev at some point...


ATB,

Mark.


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

end of thread, other threads:[~2021-07-03  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29  5:37 [PATCH] hw/mips/jazz: Map the UART devices unconditionally Philippe Mathieu-Daudé
2021-06-29  9:00 ` Peter Maydell
2021-07-01 21:21 ` Philippe Mathieu-Daudé
2021-07-03  5:20   ` Mark Cave-Ayland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.