From: kenneth_jia--- via <qemu-devel@nongnu.org>
To: "'Cédric Le Goater'" <clg@kaod.org>,
"'qemu-arm@nongnu.org'" <qemu-arm@nongnu.org>
Cc: "'Cédric Le Goater'" <clg@redhat.com>,
"'Philippe Mathieu-Daudé'" <philmd@linaro.org>,
"'Jamin Lin'" <jamin_lin@aspeedtech.com>,
"'Andrew Jeffery'" <andrew@codeconstruct.com.au>,
"'Gavin Shan'" <gshan@redhat.com>,
"'open list:All patches CC here'" <qemu-devel@nongnu.org>
Subject: 答复: [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts
Date: Fri, 13 Dec 2024 09:48:48 +0000 [thread overview]
Message-ID: <4c9f90399854448497317465c1e4cedc@asus.com> (raw)
In-Reply-To: <8af809d7-5fa2-471f-9fc9-eee482988894@kaod.org>
We plans to use a relatively large number of UART connections, and currently test all UARTs that can be used.
When we use qumu for simulation, the problem was discovered.
The current code does not allocate char devices with index 5 (label serial5).
And even if there are more serial devices, the last one (UAR12) is not connected to serial.
Add debug information to watch:
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 556498f2a0..786df450ed 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -369,6 +369,7 @@ static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
continue;
}
aspeed_soc_uart_set_chr(s, uart, serial_hd(i));
+ printf("uart %d char index %d name %s\n", uart-sc->uarts_base, i, serial_hd(i)?serial_hd(i)->filename:"null");
}
}
Test command
~/office_qemu/build/qemu-system-arm -m 1G -M ast2600-evb,fmc-model=mx66l1g45g -nographic \
-drive file=./${evb}.bin,format=raw,if=mtd,unit=0 \
-drive file=./emmc1.bin,format=raw,if=sd,unit=2 \
-net nic -net nic -net nic -net nic \
-net user,hostfwd=::2443-:443,hostfwd=::2242-:22,hostfwd=udp::2623-:623 \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty \
-serial pty
Output Log:
QEMU 9.2.50 monitor - type 'help' for more information
char device redirected to /dev/pts/6 (label serial0)
char device redirected to /dev/pts/7 (label serial1)
char device redirected to /dev/pts/8 (label serial2)
char device redirected to /dev/pts/9 (label serial3)
char device redirected to /dev/pts/10 (label serial4)
char device redirected to /dev/pts/11 (label serial5)
char device redirected to /dev/pts/12 (label serial6)
char device redirected to /dev/pts/13 (label serial7)
char device redirected to /dev/pts/14 (label serial8)
char device redirected to /dev/pts/15 (label serial9)
char device redirected to /dev/pts/16 (label serial10)
char device redirected to /dev/pts/17 (label serial11)
char device redirected to /dev/pts/19 (label serial12)
char device redirected to /dev/pts/21 (label serial13)
char device redirected to /dev/pts/22 (label serial14)
uart 0 char index 1 name pty:/dev/pts/7
uart 1 char index 2 name pty:/dev/pts/8
uart 2 char index 3 name pty:/dev/pts/9
uart 3 char index 4 name pty:/dev/pts/10
uart 5 char index 6 name pty:/dev/pts/12
uart 6 char index 7 name pty:/dev/pts/13
uart 7 char index 8 name pty:/dev/pts/14
uart 8 char index 9 name pty:/dev/pts/15
uart 9 char index 10 name pty:/dev/pts/16
uart 10 char index 11 name pty:/dev/pts/17
uart 11 char index 12 name pty:/dev/pts/19
(qemu)
Issue:
/dev/pts/17 (label serial11) is not connected to a UART,
UART12 is not connect to a serial device.
-----邮件原件-----
发件人: Cédric Le Goater <clg@kaod.org>
发送时间: 2024年12月13日 15:19
收件人: Kenneth Jia(贾纪东_华硕上海) <kenneth_jia@asus.com>; 'qemu-arm@nongnu.org' <qemu-arm@nongnu.org>
抄送: 'Cédric Le Goater' <clg@redhat.com>; 'Philippe Mathieu-Daudé' <philmd@linaro.o
>
> Subject: [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts
>
> In the loop, we need ignore the index increase when uart ==
> uart_chosen
>
> We should increase the index only after we allocate a serial.
>
> Signed-off-by: Kenneth Jia <kenneth_jia@asus.com>
Could you please tell us a bit on your test environment ? I am interested to know how you found the issue.
Also, please use "git send-email" to send patches.
Anyhow,
Fixes: d2b3eaefb4d7 ("aspeed: Refactor UART init for multi-SoC machines")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
>
> ---
>
> hw/arm/aspeed.c | 4 ++--
>
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
>
> index 556498f2a0..d8cb2d1429 100644
>
> --- a/hw/arm/aspeed.c
>
> +++ b/hw/arm/aspeed.c
>
> @@ -364,11 +364,11 @@ static void
> connect_serial_hds_to_uarts(AspeedMachineState *bmc)
>
> int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen :
> amc->uart_default;
>
> aspeed_soc_uart_set_chr(s, uart_chosen, serial_hd(0));
>
> - for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; i++,
> uart++) {
>
> + for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; uart++)
> +{
>
> if (uart == uart_chosen) {
>
> continue;
>
> }
>
> - aspeed_soc_uart_set_chr(s, uart, serial_hd(i));
>
> + aspeed_soc_uart_set_chr(s, uart, serial_hd(i++));
>
> }
>
> }
>
> --
>
> 2.34.1
>
<p></p>
next prev parent reply other threads:[~2024-12-13 9:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 13:31 [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts kenneth_jia--- via
2024-12-12 13:31 ` kenneth_jia--- via
2024-12-13 7:19 ` Cédric Le Goater
2024-12-13 9:48 ` kenneth_jia--- via [this message]
2024-12-13 9:56 ` 答复: " Cédric Le Goater
2024-12-13 10:11 ` 答复: " kenneth_jia--- via
2024-12-13 10:11 ` kenneth_jia--- via
2024-12-13 10:47 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c9f90399854448497317465c1e4cedc@asus.com \
--to=qemu-devel@nongnu.org \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=clg@redhat.com \
--cc=gshan@redhat.com \
--cc=jamin_lin@aspeedtech.com \
--cc=kenneth_jia@asus.com \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.