* [PATCH v2] ftgmac100: fix dblac write test
@ 2020-06-28 14:26 erik-smit
2020-07-06 1:59 ` Andrew Jeffery
0 siblings, 1 reply; 5+ messages in thread
From: erik-smit @ 2020-06-28 14:26 UTC (permalink / raw)
To: erik.lucas.smit
Cc: Peter Maydell, Andrew Jeffery, Jason Wang,
open list:All patches CC here, open list:ASPEED BMCs,
Cédric Le Goater, Joel Stanley
The test of the write of the dblac register was testing the old value
instead of the new value. This would accept the write of an invalid value
but subsequently refuse any following valid writes.
Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
---
Changes since v1:
Changed %ld to HWADDR_PRIx to fix building on mingw
hw/net/ftgmac100.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 043ba61b86..b69e3dd14e 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -810,16 +810,18 @@ static void ftgmac100_write(void *opaque, hwaddr addr,
s->phydata = value & 0xffff;
break;
case FTGMAC100_DBLAC: /* DMA Burst Length and Arbitration Control */
- if (FTGMAC100_DBLAC_TXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
+ if (FTGMAC100_DBLAC_TXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
qemu_log_mask(LOG_GUEST_ERROR,
- "%s: transmit descriptor too small : %d bytes\n",
- __func__, FTGMAC100_DBLAC_TXDES_SIZE(s->dblac));
+ "%s: transmit descriptor too small: %" HWADDR_PRIx
+ " bytes\n", __func__,
+ FTGMAC100_DBLAC_TXDES_SIZE(value));
break;
}
- if (FTGMAC100_DBLAC_RXDES_SIZE(s->dblac) < sizeof(FTGMAC100Desc)) {
+ if (FTGMAC100_DBLAC_RXDES_SIZE(value) < sizeof(FTGMAC100Desc)) {
qemu_log_mask(LOG_GUEST_ERROR,
- "%s: receive descriptor too small : %d bytes\n",
- __func__, FTGMAC100_DBLAC_RXDES_SIZE(s->dblac));
+ "%s: receive descriptor too small : %" HWADDR_PRIx
+ " bytes\n", __func__,
+ FTGMAC100_DBLAC_RXDES_SIZE(value));
break;
}
s->dblac = value;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ftgmac100: fix dblac write test
2020-06-28 14:26 [PATCH v2] ftgmac100: fix dblac write test erik-smit
@ 2020-07-06 1:59 ` Andrew Jeffery
2020-07-07 7:42 ` Erik Smit
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jeffery @ 2020-07-06 1:59 UTC (permalink / raw)
To: erik-smit
Cc: Peter Maydell, Jason Wang, Cameron Esfahani via,
open list:ASPEED BMCs, Cédric Le Goater, Joel Stanley
On Sun, 28 Jun 2020, at 23:56, erik-smit wrote:
> The test of the write of the dblac register was testing the old value
> instead of the new value. This would accept the write of an invalid value
> but subsequently refuse any following valid writes.
>
> Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
> ---
> Changes since v1:
>
> Changed %ld to HWADDR_PRIx to fix building on mingw
Bit of a nitpick, but the type of the value argument is uint64_t, so shouldn't
the result of the expression captured by FTGMAC100_DBLAC_TXDES_SIZE() and
FTGMAC100_DBLAC_RXDES_SIZE() be printed with a straight PRIx64 rather than
HWADDR_PRIx?
Otherwise the change seems sensible, so:
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ftgmac100: fix dblac write test
2020-07-06 1:59 ` Andrew Jeffery
@ 2020-07-07 7:42 ` Erik Smit
2020-07-13 12:06 ` Cédric Le Goater
0 siblings, 1 reply; 5+ messages in thread
From: Erik Smit @ 2020-07-07 7:42 UTC (permalink / raw)
To: Andrew Jeffery
Cc: Peter Maydell, Jason Wang, Cameron Esfahani via,
open list:ASPEED BMCs, Cédric Le Goater, Joel Stanley
Hi Andrew,
On Mon, 6 Jul 2020 at 03:59, Andrew Jeffery <andrew@aj.id.au> wrote:
> On Sun, 28 Jun 2020, at 23:56, erik-smit wrote:
> > The test of the write of the dblac register was testing the old value
> > instead of the new value. This would accept the write of an invalid value
> > but subsequently refuse any following valid writes.
> >
> > Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
> > ---
> > Changes since v1:
> >
> > Changed %ld to HWADDR_PRIx to fix building on mingw
>
> Bit of a nitpick, but the type of the value argument is uint64_t, so shouldn't
> the result of the expression captured by FTGMAC100_DBLAC_TXDES_SIZE() and
> FTGMAC100_DBLAC_RXDES_SIZE() be printed with a straight PRIx64 rather than
> HWADDR_PRIx?
You are correct. I didn't understand the meaning of the PRI macros and
just grabbed the other PRI macro I saw getting used in the file.
--
Best regards,
Erik Smit
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ftgmac100: fix dblac write test
2020-07-07 7:42 ` Erik Smit
@ 2020-07-13 12:06 ` Cédric Le Goater
2020-07-14 9:04 ` Jason Wang
0 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2020-07-13 12:06 UTC (permalink / raw)
To: Erik Smit, Andrew Jeffery
Cc: Peter Maydell, Jason Wang, open list:ASPEED BMCs, Joel Stanley,
Cameron Esfahani via
On 7/7/20 9:42 AM, Erik Smit wrote:
> Hi Andrew,
>
> On Mon, 6 Jul 2020 at 03:59, Andrew Jeffery <andrew@aj.id.au> wrote:
>> On Sun, 28 Jun 2020, at 23:56, erik-smit wrote:
>>> The test of the write of the dblac register was testing the old value
>>> instead of the new value. This would accept the write of an invalid value
>>> but subsequently refuse any following valid writes.
>>>
>>> Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
>>> ---
>>> Changes since v1:
>>>
>>> Changed %ld to HWADDR_PRIx to fix building on mingw
>>
>> Bit of a nitpick, but the type of the value argument is uint64_t, so shouldn't
>> the result of the expression captured by FTGMAC100_DBLAC_TXDES_SIZE() and
>> FTGMAC100_DBLAC_RXDES_SIZE() be printed with a straight PRIx64 rather than
>> HWADDR_PRIx?
>
> You are correct. I didn't understand the meaning of the PRI macros and
> just grabbed the other PRI macro I saw getting used in the file.
With that fixed,
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ftgmac100: fix dblac write test
2020-07-13 12:06 ` Cédric Le Goater
@ 2020-07-14 9:04 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2020-07-14 9:04 UTC (permalink / raw)
To: Cédric Le Goater, Erik Smit, Andrew Jeffery
Cc: Peter Maydell, open list:ASPEED BMCs, Joel Stanley, Cameron Esfahani via
On 2020/7/13 下午8:06, Cédric Le Goater wrote:
> On 7/7/20 9:42 AM, Erik Smit wrote:
>> Hi Andrew,
>>
>> On Mon, 6 Jul 2020 at 03:59, Andrew Jeffery <andrew@aj.id.au> wrote:
>>> On Sun, 28 Jun 2020, at 23:56, erik-smit wrote:
>>>> The test of the write of the dblac register was testing the old value
>>>> instead of the new value. This would accept the write of an invalid value
>>>> but subsequently refuse any following valid writes.
>>>>
>>>> Signed-off-by: erik-smit <erik.lucas.smit@gmail.com>
>>>> ---
>>>> Changes since v1:
>>>>
>>>> Changed %ld to HWADDR_PRIx to fix building on mingw
>>> Bit of a nitpick, but the type of the value argument is uint64_t, so shouldn't
>>> the result of the expression captured by FTGMAC100_DBLAC_TXDES_SIZE() and
>>> FTGMAC100_DBLAC_RXDES_SIZE() be printed with a straight PRIx64 rather than
>>> HWADDR_PRIx?
>> You are correct. I didn't understand the meaning of the PRI macros and
>> just grabbed the other PRI macro I saw getting used in the file.
> With that fixed,
>
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
>
> Thanks,
>
> C.
Applied by switching to use PRIx64.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-07-14 9:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-28 14:26 [PATCH v2] ftgmac100: fix dblac write test erik-smit
2020-07-06 1:59 ` Andrew Jeffery
2020-07-07 7:42 ` Erik Smit
2020-07-13 12:06 ` Cédric Le Goater
2020-07-14 9:04 ` Jason Wang
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.