All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Wei Xu <xuwei5@hisilicon.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Linuxarm <linuxarm@huawei.com>,
	Rob Herring <rob.herring@linaro.org>,
	Daode Huang <huangdaode@hisilicon.com>,
	"Chenxin (Charles)" <charles.chenxin@huawei.com>,
	Zhangyi ac <zhangyi.ac@huawei.com>,
	"Liguozhu (Kenneth)" <liguozhu@hisilicon.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
	"Liuxinliang (Matthew Liu)" <z.liuxinliang@hisilicon.com>,
	tiantao6@huawei.com, Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH] pl011: do not put into fifo before enabled the interruption
Date: Fri, 26 Jan 2018 17:15:16 +0000	[thread overview]
Message-ID: <CAFEAcA-N-pjHwqrStf-qK+EOmGYyR-4dfY=sL5kLzeodgYUiRw@mail.gmail.com> (raw)
In-Reply-To: <5A6B5FCA.2080009@hisilicon.com>

On 26 January 2018 at 17:05, Wei Xu <xuwei5@hisilicon.com> wrote:
> On 2018/1/26 16:36, Peter Maydell wrote:
>> If the user presses keys before interrupts are enabled,
>> what ought to happen is:
>>  * we put the key in the FIFO, and update the int_level flags
>>  * when the FIFO is full, can_receive starts returning 0 and
>>    QEMU stops passing us new characters
>>  * when the guest driver for the pl011 initializes the
>>    device and enables interrupts then either:
>>     (a) it does something that clears the FIFO, which will
>>     mean can_receive starts allowing new chars again, or
>>     (b) it leaves the FIFO as it is, and we should thus
>>     immediately raise an interrupt for the characters still
>>     in the FIFO; when the guest handles this interrupt and
>>     gets the characters, can_receive will permit new ones
>>
>
> Yes, now it is handled like b.
>
>> What is happening in your situation that means this is not
>> working as expected ?
>
> But in the kernel side, the pll011 is triggered as a level interruption.
> During the booting, if any key is pressed ,the call stack is as below:
> QEMU side:
> pl011_update
> -->qemu_set_irq(level as 0)
> ---->kvm_arm_gic_set_irq
>
> Kernel side:
> kvm_vm_ioctl_irq_line
> -->kvm_vgic_inject_irq
> ---->vgic_validate_injection (if level did not change, return)
> ---->vgic_queue_irq_unlock
>
> Without above changes, in the vgic_validate_injection, because the
> interruption level is always 0, this irq will not be queued into vgic.
> And the guest will not read the pl011 fifo.

The pl011 code should call qemu_set_irq(..., 1) when the
guest enables interrupts on the device by writing to the int_enabled
(UARTIMSC) register. That will be a 0-to-1 level change and the KVM
VGIC should report the interrupt to the guest.

thanks
-- PMM

  reply	other threads:[~2018-01-26 17:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 16:00 [Qemu-devel] [Qemu-arm] [PATCH] pl011: do not put into fifo before enabled the interruption Wei Xu
2018-01-26 16:36 ` Peter Maydell
2018-01-26 17:05   ` Wei Xu
2018-01-26 17:15     ` Peter Maydell [this message]
2018-01-26 17:33       ` Wei Xu
2018-01-26 18:01         ` Peter Maydell
2018-01-29 10:29           ` Andrew Jones
2018-01-29 11:10             ` Peter Maydell
2018-01-29 11:37             ` Wei Xu
2018-01-29 12:57               ` Andrew Jones
2018-01-29 12:18           ` Wei Xu
2018-01-29 13:36             ` Peter Maydell
2018-01-26 18:14 ` no-reply

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='CAFEAcA-N-pjHwqrStf-qK+EOmGYyR-4dfY=sL5kLzeodgYUiRw@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=charles.chenxin@huawei.com \
    --cc=huangdaode@hisilicon.com \
    --cc=liguozhu@hisilicon.com \
    --cc=linuxarm@huawei.com \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rob.herring@linaro.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=tiantao6@huawei.com \
    --cc=xuwei5@hisilicon.com \
    --cc=z.liuxinliang@hisilicon.com \
    --cc=zhangyi.ac@huawei.com \
    /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.