From: Andrew Jeffery <andrew@codeconstruct.com.au>
To: "Jamin Lin" <jamin_lin@aspeedtech.com>,
"Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>, "Joel Stanley" <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Troy Lee <troy_lee@aspeedtech.com>,
Yunlin Tang <yunlin.tang@aspeedtech.com>
Subject: Re: [PATCH 4/5] hw/gpio/aspeed: Add AST2700 support
Date: Wed, 25 Sep 2024 09:30:36 +0930 [thread overview]
Message-ID: <622300963fae35522af6d90248bb93a6a4d91121.camel@codeconstruct.com.au> (raw)
In-Reply-To: <SI2PR06MB504195FD5CE33E041514C46BFC682@SI2PR06MB5041.apcprd06.prod.outlook.com>
On Tue, 2024-09-24 at 06:48 +0000, Jamin Lin wrote:
> Hi Andrew,
>
> > Subject: RE: [PATCH 4/5] hw/gpio/aspeed: Add AST2700 support
> >
> > Hi Andrew,
> >
> > > Subject: Re: [PATCH 4/5] hw/gpio/aspeed: Add AST2700 support
> > >
> > > Hi Jamin,
> > >
> > >
> > > > + }
> > > > + set->int_status &= ~group_value;
> > >
> > > This feels like it misbehaves in the face of multiple pending interrupts.
> > >
> > > For example, say we have an interrupt pending for GPIOA0, where the
> > > following statements are true:
> > >
> > > set->int_status == 0b01
> > > s->pending == 1
> > >
> > > Before it is acknowledged, an interrupt becomes pending for GPIOA1:
> > >
> > > set->int_status == 0b11
> > > s->pending == 2
> > >
> > > A write is issued to acknowledge the interrupt for GPIOA0. This causes
> > > the following sequence:
> > >
> > > group_value == 0b11
> > > cleared == 2
> > > s->pending = 0
> > > set->int_status == 0b00
> > >
> > > It seems the pending interrupt for GPIOA1 is lost?
> > >
> > Thanks for review and input.
> > I should check "int_status" bit of write data in write callback function. If 1 clear
> > status flag(group value), else should not change group value.
> > I am checking and testing this issue and will update to you or directly resend
> > the new patch series.
>
> I appreciate your review and finding this issue.
> My changes as following.
> If you agree, I will add them in v2 patch.
> Thanks-Jamin
>
> static void aspeed_gpio_2700_write_control_reg(AspeedGPIOState *s,
> uint32_t pin, uint32_t type, uint64_t data)
> {
> ---
> /* interrupt status */
> if (SHARED_FIELD_EX32(data, GPIO_CONTROL_INT_STATUS)) {
> cleared = extract32(set->int_status, pin_idx, 1);
> if (cleared) {
> if (s->pending) {
> assert(s->pending >= cleared);
> s->pending -= cleared;
> }
> set->int_status = deposit32(set->int_status, pin_idx, 1, 0);
> }
> }
> ----
> }
The logic is easier to follow. Not sure about calling the value
extracted from set->int_status 'cleared' though, seems confusing on
first pass. It would feel more appropriate if it were called 'pending'.
I think 'cleared' is derived from `SHARED_FIELD_EX32(data,
GPIO_CONTROL_INT_STATUS)`. Anyway, that's just some quibbling over
names.
>
> By the way, I found the same issue in "aspeed_gpio_write_index_mode" and my changes as following.
> If you agree this change, I will create a new patch in v2 patch series.
>
> static void aspeed_gpio_write_index_mode(void *opaque, hwaddr offset,
> uint64_t data, uint32_t size)
> {
> ---
> case gpio_reg_idx_interrupt:
> if (FIELD_EX32(data, GPIO_INDEX_REG, INT_STATUS)) {
> cleared = extract32(set->int_status, pin_idx, 1);
> if (cleared) {
> if (s->pending) {
> assert(s->pending >= cleared);
> s->pending -= cleared;
> }
> set->int_status = deposit32(set->int_status, pin_idx, 1, 0);
> }
> }
> break;
> ---
> }
I'll take a look in v2.
Cheers,
Andrew
next prev parent reply other threads:[~2024-09-25 0:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 9:42 [PATCH 0/5] Support GPIO for AST2700 Jamin Lin via
2024-09-23 9:42 ` [PATCH 1/5] hw/gpio/aspeed: Fix coding style Jamin Lin via
2024-09-23 9:42 ` [PATCH 2/5] hw/gpio/aspeed: Support to set the different memory size Jamin Lin via
2024-09-23 9:42 ` [PATCH 3/5] hw/gpio/aspeed: Support different memory region ops Jamin Lin via
2024-09-23 9:42 ` [PATCH 4/5] hw/gpio/aspeed: Add AST2700 support Jamin Lin via
2024-09-24 1:11 ` Andrew Jeffery
2024-09-24 3:03 ` Jamin Lin
2024-09-24 6:48 ` Jamin Lin
2024-09-25 0:00 ` Andrew Jeffery [this message]
2024-09-25 2:54 ` Jamin Lin
2024-09-24 23:55 ` Andrew Jeffery
2024-09-25 2:55 ` Jamin Lin
2024-09-23 9:42 ` [PATCH 5/5] aspeed/soc: Support GPIO for AST2700 Jamin Lin via
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=622300963fae35522af6d90248bb93a6a4d91121.camel@codeconstruct.com.au \
--to=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
--cc=yunlin.tang@aspeedtech.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 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).