qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Cadence: gem: fix wraparound in 64bit descriptors
@ 2020-04-17 17:17 Ramon Fried
  2020-04-20  9:03 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Ramon Fried @ 2020-04-17 17:17 UTC (permalink / raw)
  To: edgar.iglesias, alistair, peter.maydell, jasowang, qemu-arm
  Cc: Edgar E . Iglesias, Ramon Fried, qemu-devel

Wraparound of TX descriptor cyclic buffer only updated
the low 32 bits of the descriptor.
Fix that by checking if we're working with 64bit descriptors.

Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
v2: Fix indention problem.

 hw/net/cadence_gem.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 51ec5a072d..b7b7985bf2 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -1238,7 +1238,14 @@ static void gem_transmit(CadenceGEMState *s)
             /* read next descriptor */
             if (tx_desc_get_wrap(desc)) {
                 tx_desc_set_last(desc);
-                packet_desc_addr = s->regs[GEM_TXQBASE];
+
+                if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) {
+                    packet_desc_addr = s->regs[GEM_TBQPH];
+                    packet_desc_addr <<= 32;
+                } else {
+                    packet_desc_addr = 0;
+                }
+                packet_desc_addr |= s->regs[GEM_TXQBASE];
             } else {
                 packet_desc_addr += 4 * gem_get_desc_len(s, false);
             }
-- 
2.26.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Cadence: gem: fix wraparound in 64bit descriptors
  2020-04-17 17:17 [PATCH v2] Cadence: gem: fix wraparound in 64bit descriptors Ramon Fried
@ 2020-04-20  9:03 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2020-04-20  9:03 UTC (permalink / raw)
  To: Ramon Fried
  Cc: Edgar E . Iglesias, Jason Wang, Alistair Francis, QEMU Developers,
	qemu-arm, Edgar E. Iglesias

On Fri, 17 Apr 2020 at 18:17, Ramon Fried <rfried.dev@gmail.com> wrote:
>
> Wraparound of TX descriptor cyclic buffer only updated
> the low 32 bits of the descriptor.
> Fix that by checking if we're working with 64bit descriptors.
>
> Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
> v2: Fix indention problem.
>
>  hw/net/cadence_gem.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)



Applied to target-arm.next for 5.1, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-20  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-17 17:17 [PATCH v2] Cadence: gem: fix wraparound in 64bit descriptors Ramon Fried
2020-04-20  9:03 ` Peter Maydell

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).