qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jiahuan Zhang <jiahuanzhang90@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Guest application reading from pl011 without device driver
Date: Tue, 21 Mar 2017 19:33:52 +0100	[thread overview]
Message-ID: <CAJy91CbNq+1XNgGyvPv+2WHqHbOu3Ee7xcaLSKF0TKB5poAPSg@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA_t9iLude4Vu3Zc=_wcXMTtFb4Q4oJ8O+zLAJ9isAPqHQ@mail.gmail.com>

Okay. Thank you very much.
I'll take your advice and test.
Let's see the chardev maintainers reply.

Best,
Huan

2017年3月21日 19:28,"Peter Maydell" <peter.maydell@linaro.org>写道:

> On 21 March 2017 at 18:11, Jiahuan Zhang <jiahuanzhang90@gmail.com> wrote:
> > What do you mean "RXFE will be cleared"?
> > Here RXFE is
> > #define PL011_RXFE   0x10
>
> I mean that as soon as 1 byte of data is ready to read the
> RXFE bit will be cleared in the FR register. So you need:
>
> /* probably you want to actually detect EOF somehow but let's
>  * just read 16 bytes
>  */
> for (i = 0; i < 16; i++) {
>     while (*UART_FR & PL011_RXFE) {
>         /* loop until data available */
>     }
>     /* now read 1 byte, that's all we can be certain is there */
>     data[i] = *UART_DR;
>     /* ...and then go back and check RXFE again */
> }
>
> >> Are you saying that QEMU is looping round indefinitely calling
> >> pl011_can_receive() and never running the guest at all?
> >
> >
> > Yes, exactly when fifo is full, s->count = 16. pl011_can_recieve keeps
> > returning 0.
> > The guest program is blocked.
>
> Right, but if can_receive returns 0, then QEMU should decide
> "OK, can't do anything here" and run the guest.
>
> > I am using a windows named pipe to get the data from a window
> > host program, which uses ReadFile () in char_win.c
>
> OK, bugs in the windows-specific char backend would be
> unsurprising.
>
> I'm not entirely sure how the chardev layer works, but
> at the pl011 end if we return 0 from our can_receive
> function then the chardev layer should decide it has
> nothing to do until the pl011 later calls
> qemu_chr_fe_accept_input(), I think.
>
> I've cc'd Paolo and Marc-André Lureau as the chardev
> maintainers.
>
> thanks
> -- PMM
>

  reply	other threads:[~2017-03-21 18:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 16:32 [Qemu-devel] Guest application reading from pl011 without device driver Jiahuan Zhang
2017-03-21 16:39 ` Peter Maydell
2017-03-21 16:47   ` Jiahuan Zhang
2017-03-21 16:50     ` Peter Maydell
2017-03-21 16:59       ` Jiahuan Zhang
2017-03-21 17:10         ` Jiahuan Zhang
2017-03-21 17:16         ` Peter Maydell
2017-03-21 17:48           ` Jiahuan Zhang
2017-03-21 17:55             ` Peter Maydell
     [not found]               ` <CAJy91CZ4Ed-HGHLkzEc1dqQbo32d-eTE1S1ovO_ZwkDdTpkQXQ@mail.gmail.com>
     [not found]                 ` <CAJy91CaCV40FgSP55qWZeZgkQ=2+E8Cr7xdbu9pn5HLEo+6JJQ@mail.gmail.com>
2017-03-21 18:11                   ` Jiahuan Zhang
2017-03-21 18:28                     ` Peter Maydell
2017-03-21 18:33                       ` Jiahuan Zhang [this message]
2017-03-22  8:40                       ` Paolo Bonzini
2017-03-22  8:48                         ` Jiahuan Zhang
2017-03-22  9:37                           ` Paolo Bonzini
2017-03-22 10:28                             ` Jiahuan Zhang
2017-03-22 11:27                               ` Paolo Bonzini
2017-03-23 10:12                                 ` Jiahuan Zhang
2017-03-23 10:35                                   ` Paolo Bonzini
2017-03-23 17:28                                     ` Jiahuan Zhang
2017-03-23 17:31                                       ` Paolo Bonzini
2017-03-24  7:24                                         ` Jiahuan Zhang
2017-03-24 10:00                                           ` Jiahuan Zhang
2017-05-01 12:06                                             ` Jiahuan Zhang
2017-03-22 11:07                         ` Peter Maydell
2017-03-22 11:33                           ` Paolo Bonzini

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=CAJy91CbNq+1XNgGyvPv+2WHqHbOu3Ee7xcaLSKF0TKB5poAPSg@mail.gmail.com \
    --to=jiahuanzhang90@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).