All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/4] hw/char/pl011: implement a reset method
Date: Thu, 19 Jan 2023 22:57:23 +0100	[thread overview]
Message-ID: <b139bb17-4a1e-b393-d06f-67adc3310f46@linux.microsoft.com> (raw)
In-Reply-To: <CAFEAcA-0sUwRy_cME7TtrcV_oh9CEkRr1P2W6BC+=uscAyt+8Q@mail.gmail.com>


On 1/19/2023 14:27, Peter Maydell wrote:
> On Tue, 17 Jan 2023 at 22:05, Evgeny Iakovlev
> <eiakovlev@linux.microsoft.com> wrote:
>> PL011 currently lacks a reset method. Implement it.
>>
>> Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
>> ---
>>   hw/char/pl011.c | 31 ++++++++++++++++++++++++++-----
>>   1 file changed, 26 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/char/pl011.c b/hw/char/pl011.c
>> index 329cc6926d..404d52a3b8 100644
>> --- a/hw/char/pl011.c
>> +++ b/hw/char/pl011.c
>> @@ -397,11 +397,6 @@ static void pl011_init(Object *obj)
>>       s->clk = qdev_init_clock_in(DEVICE(obj), "clk", pl011_clock_update, s,
>>                                   ClockUpdate);
>>
>> -    s->read_trigger = 1;
>> -    s->ifl = 0x12;
>> -    s->cr = 0x300;
>> -    s->flags = 0x90;
>> -
>>       s->id = pl011_id_arm;
>>   }
>>
>> @@ -413,11 +408,37 @@ static void pl011_realize(DeviceState *dev, Error **errp)
>>                                pl011_event, NULL, s, NULL, true);
>>   }
>>
>> +static void pl011_reset(DeviceState *dev)
>> +{
>> +    PL011State *s = PL011(dev);
>> +    int i;
>> +
>> +    s->lcr = 0;
>> +    s->rsr = 0;
>> +    s->dmacr = 0;
>> +    s->int_enabled = 0;
>> +    s->int_level = 0;
>> +    s->ilpr = 0;
>> +    s->ibrd = 0;
>> +    s->fbrd = 0;
>> +    s->read_pos = 0;
>> +    s->read_count = 0;
>> +    s->read_trigger = 1;
>> +    s->ifl = 0x12;
>> +    s->cr = 0x300;
>> +    s->flags = 0x90;
>> +
>> +    for (i = 0; i < ARRAY_SIZE(s->irq); i++) {
>> +        qemu_irq_lower(s->irq[i]);
>> +    }
> Reset should never touch outbound qemu_irq lines.
> (The other end of the line will also reset and will end
> up in the correct "as if the input is 0" state.)


Really? I saw this reset happening on other devices in hw/char (don't 
remember which ones specifically), so i though it is needed.


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

  reply	other threads:[~2023-01-19 21:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 22:05 [PATCH v2 0/4] Series of fixes for PL011 char device Evgeny Iakovlev
2023-01-17 22:05 ` [PATCH v2 1/4] hw/char/pl011: refactor FIFO depth handling code Evgeny Iakovlev
2023-01-19 13:45   ` Peter Maydell
2023-01-19 22:02     ` Evgeny Iakovlev
2023-01-17 22:05 ` [PATCH v2 2/4] hw/char/pl011: implement a reset method Evgeny Iakovlev
2023-01-19 13:27   ` Peter Maydell
2023-01-19 21:57     ` Evgeny Iakovlev [this message]
2023-01-20 11:45       ` Peter Maydell
2023-01-20 15:05         ` eiakovlev
2023-01-17 22:05 ` [PATCH v2 3/4] hw/char/pl011: better handling of FIFO flags on LCR reset Evgeny Iakovlev
2023-01-19 13:30   ` Peter Maydell
2023-01-19 21:59     ` Evgeny Iakovlev
2023-01-17 22:05 ` [PATCH v2 4/4] hw/char/pl011: check if UART is enabled before RX or TX operation Evgeny Iakovlev
2023-01-19 13:31   ` Peter Maydell

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=b139bb17-4a1e-b393-d06f-67adc3310f46@linux.microsoft.com \
    --to=eiakovlev@linux.microsoft.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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 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.