openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Abhishek Singh Dagur <abhishek@drut.io>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	openbmc@lists.ozlabs.org,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, "Cédric Le Goater" <clg@kaod.org>
Subject: Re: Using QEMU how to redirect serial /dev/ttyS2 output of guest machine to host machine.
Date: Fri, 17 Mar 2023 16:06:43 +0000	[thread overview]
Message-ID: <87mt4b73sv.fsf@linaro.org> (raw)
In-Reply-To: <CAJ1un7j0FNpYaaviQxoKQN4O+C8RejqA918CdBamPySKyAEJUQ@mail.gmail.com>


Abhishek Singh Dagur <abhishek@drut.io> writes:

(cc aspeed maintainers)

> Hi all,
>
> We are using obmc-phosphor-image on an ast2500 board which is trying to communicate with other devices
> over serial port /dev/ttyS2.
> As we are trying to emulate the machine on qemu we need to redirect the request to the host machine so
> that it can handle this request and return appropriately.
> We tried using QEMU options like -serial ,-chardev but still not the
> concrete way we get to do it.

Yeah I'm afraid its non-obvious, certainly for built in serial ports.
Try something like:

  ./qemu-system-aarch64 -M ast2500-evb \
    -serial null -serial null -serial chardev:myserial \
    -chardev file,id=myserial,path=output.txt \
    $MORE_OPTIONS

You have to add a -serial for each serial port up to the one you care
about and then set the chardev for it.

If you where adding a device to the system then you can explicitly set
the target chardev for it with something like:

  -device isa-serial,iobase=nnn,irq=nnn,chardev=ID

> It will be very helpful if you can provide us some guidance on this.

Another quirk for the aspeed boards seems to be the default uart can be
an arbitrary one depending on the board model:

334:    aspeed_soc_uart_set_chr(s, amc->uart_default, serial_hd(0)); 
336:        if (uart == amc->uart_default) {                         
1112:    amc->uart_default = ASPEED_DEV_UART5;                       
1407:    amc->uart_default = ASPEED_DEV_UART1;                       

as a result ASPEED_DEV_UART5 will always be the first serial port
(serial_hd(0)). I don't know how Linux numbers them but worth being
aware of.

>
> Thank you,
> Abhishek


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro

  reply	other threads:[~2023-03-22  0:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 13:13 Using QEMU how to redirect serial /dev/ttyS2 output of guest machine to host machine Abhishek Singh Dagur
2023-03-17 16:06 ` Alex Bennée [this message]
2023-03-17 17:24   ` Cédric Le Goater
2023-03-17 17:40     ` Abhishek Singh Dagur

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=87mt4b73sv.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=abhishek@drut.io \
    --cc=clg@kaod.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=openbmc@lists.ozlabs.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@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 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).