Re: [PATCH v4 00/14] Fixes for DP8393X SONIC device emulation

2020-02-18 Thread Finn Thain
On Tue, 18 Feb 2020, Aleksandar Markovic wrote: > On Wednesday, January 29, 2020, Finn Thain > wrote: > > > Hi All, > > > > There are bugs in the emulated dp8393x device that can stop packet > > reception in a Linux/m68k guest (q800 machine). > > > &

[PATCH 02/10] dp8393x: Clean up endianness hacks

2019-12-13 Thread Finn Thain
The in_use field is no different to the other words handled using dp8393x_put() and dp8393x_get(). Use the same technique for in_use that is used everywhere else. Signed-off-by: Finn Thain --- Laurent tells me that this clean-up has been tried before. He referred me to commit c744cf7879

[PATCH 04/10] dp8393x: Don't advance RX descriptor twice

2019-12-13 Thread Finn Thain
Follow the algorithm given in the National Semiconductor DP83932C datasheet in sections 3.4.5 and 3.4.6. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 462f8646e0..49d7d9769e

[PATCH 05/10] dp8393x: Update LLFA register

2019-12-13 Thread Finn Thain
If the chip used QEMU's algorithm it would need an extra word-sized register just to recheck the EOL bit, which would be a waste of silicon. Do it the way the chip would do it. No functional change. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 3 ++- 1 file changed, 2 insertions(

[PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-13 Thread Finn Thain
only been tested with Linux/m68k guests. It needs further testing with MIPS Jazz guests such as NetBSD or Windows NT. Thanks. Finn Thain (10): dp8393x: Mask EOL bit from descriptor addresses dp8393x: Clean up endianness hacks dp8393x: Have dp8393x_receive() return the packet size dp8393x

[PATCH 03/10] dp8393x: Have dp8393x_receive() return the packet size

2019-12-13 Thread Finn Thain
This function re-uses its 'size' argument as a scratch variable. Instead, declare a local 'size' variable for that purpose so that the function result doesn't get messed up. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 9 + 1 file changed, 5 insertions(+), 4

[PATCH 10/10] dp8393x: Don't clobber packet checksum

2019-12-13 Thread Finn Thain
. Fix this. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 8e66b1f5de..9f4162c98c 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -810,6 +810,7 @@ static ssize_t dp8393x_receive(NetClientStat

[PATCH 06/10] dp8393x: Clear RRRA command register bit only when appropriate

2019-12-13 Thread Finn Thain
It doesn't make sense to clear the command register bit unless the command was actually issued. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 494deb42bf..3fdc6cc6f9 100644

[PATCH 07/10] dp8393x: Implement TBWC0 and TBWC1 registers to restore buffer state

2019-12-13 Thread Finn Thain
Restore the receive buffer state when the SONIC runs out of receive descriptors. Otherwise it may write the next packet past the end of the buffer and corrupt guest memory. This implements behaviour described in section 3.4.6.2 in the datasheet. Signed-off-by: Finn Thain --- hw/net/dp8393x.c

[PATCH 09/10] dp8393x: Don't stop reception upon RBE interrupt assertion

2019-12-13 Thread Finn Thain
e RBE interrupt until it receives another packet. But that won't happen if can_receive returns false. So the SONIC becomes deaf (until reset). Fix this with a new flag to indicate actual receive buffer exhaustion. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 12 ++-- 1 file ch

[PATCH 01/10] dp8393x: Mask EOL bit from descriptor addresses

2019-12-13 Thread Finn Thain
The LSB of descriptor address registers is used as an EOL flag. It has to be masked when those registers are to be used as actual addresses for copying memory around. But when the registers are to be updated the EOL bit should not be masked. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 8

[PATCH 08/10] dp8393x: Implement packet size limit and RBAE interrupt

2019-12-13 Thread Finn Thain
them. Linux uses that interrupt to count dropped packets. Signed-off-by: Finn Thain --- QEMU passes short packets to dp8393x_receive(). But a real SONIC rejects packets shorter than 64 bytes. For dp8393x, the effective limit is 60 bytes because packets passed to dp8393x_receive() lack a frame che

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-13 Thread Finn Thain
On Fri, 13 Dec 2019, no-re...@patchew.org wrote: > === OUTPUT BEGIN === > 1/10 Checking commit 9c9ffc38e9b9 (dp8393x: Mask EOL bit from descriptor > addresses) > ERROR: return is not a function, parentheses are not required > #24: FILE: hw/net/dp8393x.c:200: > +return (s->regs[SONIC_URDA] <<

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-14 Thread Finn Thain
On Sat, 14 Dec 2019, Aleksandar Markovic wrote: > On Saturday, December 14, 2019, Finn Thain > wrote: > > > Hi All, > > > > There is a bug in the DP8393X emulation that can stop packet reception. > > > > > Can you provide the details of your test scen

Re: [PATCH 01/10] dp8393x: Mask EOL bit from descriptor addresses

2019-12-14 Thread Finn Thain
On Sat, 14 Dec 2019, Philippe Mathieu-Daud? wrote: > Hi Finn, > > On 12/14/19 2:25 AM, Finn Thain wrote: > > The LSB of descriptor address registers is used as an EOL flag. > > It has to be masked when those registers are to be used as actual > > addresses for copying

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-15 Thread Finn Thain
On Sun, 15 Dec 2019, Finn Thain wrote: > I test the qemu build like this, > > qemu-system-m68k -M q800 -m 512M -serial none -serial mon:stdio -g 800x600x4 > -net nic,model=dp83932,addr=00:00:00:01:02:03 > -net bridge,helper=/opt/qemu/libexec/qemu-bridge-helper,br=br0 &

Re: [PATCH v1 0/9] hw/mos6522: VIA timer emulation fixes and improvements

2021-11-16 Thread Finn Thain
VIA1 timer. This approach should help mitigate the clock drift > problem as well as assist with CONFIG_GENERIC_CLOCKEVENTS adoption, > which would enable CONFIG_NO_HZ_IDLE etc. > > [2] https://github.com/mcayland/qemu/commits/q800.upstream > > [3] https://github.com/fthain/qemu/

Re: [PATCH v1 0/9] hw/mos6522: VIA timer emulation fixes and improvements

2021-11-19 Thread Finn Thain
On Thu, 18 Nov 2021, Mark Cave-Ayland wrote: > > Hi Finn, > > I've not forgotten about this series - we're now in 6.2 freeze, but it's > on my TODO list to revisit in the next development cycle this along with > the ESP stress-ng changes which I've also been looking at. As mentioned > in my p

Re: [PATCH v1 0/9] hw/mos6522: VIA timer emulation fixes and improvements

2021-11-20 Thread Finn Thain
On Sat, 20 Nov 2021, Mark Cave-Ayland wrote: > On 19/11/2021 08:39, Finn Thain wrote: > > > On Thu, 18 Nov 2021, Mark Cave-Ayland wrote: > > > >> > >> Hi Finn, > >> > >> I've not forgotten about this series - we're now in

Re: [PATCH v1 0/9] hw/mos6522: VIA timer emulation fixes and improvements

2021-11-22 Thread Finn Thain
On Mon, 22 Nov 2021, Peter Maydell wrote: > On Sat, 20 Nov 2021 at 23:40, Finn Thain wrote: > > Anyway, thanks for taking the time to write. A competent reviewer has to > > do much more than that, but I'm not paying for competence so I suppose I'm > > asking too

[PATCH v1 1/9] hw/mos6522: Remove get_load_time() methods and functions

2021-09-23 Thread Finn Thain
This code appears to be unnecessary. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/misc/mos6522.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1c57332b40..a478c1ca43 100644 --- a/hw

[PATCH v1 3/9] hw/mos6522: Remove redundant mos6522_timer1_update() calls

2021-09-23 Thread Finn Thain
Reads and writes to the TL and TC registers have no immediate effect on a running timer, with the exception of a write to TCH. Hence these mos6522_timer_update() calls are not needed. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/hw

[PATCH v1 5/9] hw/mos6522: Fix initial timer counter reload

2021-09-23 Thread Finn Thain
reloaded when it wraps. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index c0d6bee4cc..6bd60f2118 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -63,15 +63,16

[PATCH v1 2/9] hw/mos6522: Remove get_counter_value() methods and functions

2021-09-23 Thread Finn Thain
This code appears to be unnecessary. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/misc/mos6522.c | 22 ++ 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index a478c1ca43..ff246b5437 100644 --- a

[PATCH v1 4/9] hw/mos6522: Rename timer callback functions

2021-09-23 Thread Finn Thain
This improves readability. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/misc/mos6522.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1d4a56077e..c0d6bee4cc 100644 --- a/hw/misc/mos6522.c +++ b

[PATCH v1 0/9] hw/mos6522: VIA timer emulation fixes and improvements

2021-09-23 Thread Finn Thain
rter than 20 ms. --- Changed since RFC: - Added Reviewed-by tags. - Re-ordered some patches to make fixes available earlier in the series. - Dropped patch 5/10 "Don't clear T1 interrupt flag on latch write". - Rebased on v6.1.0 release. Finn Thain (9): hw/mos6522: Remove get_lo

[PATCH v1 7/9] hw/mos6522: Avoid using discrepant QEMU clock values

2021-09-23 Thread Finn Thain
mos6522_read() and mos6522_write() may call various functions to determine timer irq state, timer counter value and QEMUTimer deadline. All called functions must use the same value for the present time. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- Changed since RFC - Moved

[PATCH v1 6/9] hw/mos6522: Call mos6522_update_irq() when appropriate

2021-09-23 Thread Finn Thain
It necessary to call mos6522_update_irq() when the interrupt flags change and unnecessary when they haven't. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/misc/mos6522.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/misc/mos6522.c b/hw

[PATCH v1 9/9] hw/mos6522: Implement oneshot mode

2021-09-23 Thread Finn Thain
Timer 1 has two modes: continuous interrupt and oneshot. Signed-off-by: Finn Thain --- Changed since RFC: - Moved to end of series. This patch is quite a bit shorter here. --- hw/misc/mos6522.c | 6 -- include/hw/misc/mos6522.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions

[PATCH v1 8/9] hw/mos6522: Synchronize timer interrupt and timer counter

2021-09-23 Thread Finn Thain
Signed-off-by: Finn Thain --- Changed since RFC: - Improved code commentary and commit log text. - Removed qemu_clock_get_ns() call from set_counter() for simplicity. - Moved the changes to the QEMUTimer callbacks from the previous patch into this one because they relate more to syncronizati

Re: [PULL V2 01/23] dp8393x: Mask EOL bit from descriptor addresses

2020-03-03 Thread Finn Thain
ge conflicts were resolved. The conflicts were apparently caused by commit 19f7034773 ("Avoid address_space_rw() with a constant is_write argument"). Regards, Finn On Tue, 3 Mar 2020, Jason Wang wrote: > From: Finn Thain > > The Least Significant bit of a descriptor addre

[PATCH] dp8393x: Mask EOL bit from descriptor addresses, take 2

2020-03-03 Thread Finn Thain
A portion of a recent patch got lost due to a merge snafu. That patch is now commit 88f632fbb1 ("dp8393x: Mask EOL bit from descriptor addresses"). This patch restores the portion that got lost. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 4 ++-- 1 file changed, 2 insert

Re: [PATCH 00/78] Patch Round-up for stable 4.2.1, freeze on 2020-06-22

2020-06-19 Thread Finn Thain
Hi Michael, On Tue, 16 Jun 2020, Michael Roth wrote: > > Finn Thain (14): > dp8393x: Mask EOL bit from descriptor addresses > dp8393x: Always use 32-bit accesses > dp8393x: Clean up endianness hacks > dp8393x: Have dp8393x_receive() return the packet si

Re: [PATCH 00/78] Patch Round-up for stable 4.2.1, freeze on 2020-06-22

2020-06-19 Thread Finn Thain
On Sat, 20 Jun 2020, Finn Thain wrote: > > Thanks for picking these fixes. When the maintainer originally merged this > series of patches, the first patch got slightly damaged. This was remedied > in a subsequent patch[1]. That is, mainline commit a0cf4297d6 ("dp8393x: &g

[PATCH v3 07/14] dp8393x: Implement packet size limit and RBAE interrupt

2020-01-19 Thread Finn Thain
them. Linux uses that interrupt to count dropped packets. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v1: - Perform length check after Recieve Control Register initialization. --- hw/net/dp8393x.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/net/dp83

[PATCH v3 13/14] dp8393x: Don't reset Silicon Revision register

2020-01-19 Thread Finn Thain
quot;net/dp8393x: fix hardware reset") Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 1b73a8703b..71af0fad51 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -591,6 +591,10 @@ st

[PATCH v3 11/14] dp8393x: Clear descriptor in_use field to release packet

2020-01-19 Thread Finn Thain
RXpkt.in_use field. The packet can now be processed by the host, so raise a PKTRX interrupt, just like the normal case. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v2: - Assert PKTRX interrupt when releasing withheld packet. --- hw/net/dp8393x.c | 10 ++ 1

[PATCH v3 02/14] dp8393x: Always use 32-bit accesses

2020-01-19 Thread Finn Thain
Linux 'jazzsonic' driver working, and avoids the need for prior hacks to make the NetBSD 'sn' driver work. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 47 +-- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/hw/ne

[PATCH v3 05/14] dp8393x: Update LLFA and CRDA registers from rx descriptor

2020-01-19 Thread Finn Thain
of descriptors in this way. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v1: - Update CRDA register from LLFA register after EOL is cleared. --- hw/net/dp8393x.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net

[PATCH v3 09/14] dp8393x: Use long-word-aligned RRA pointers in 32-bit mode

2020-01-19 Thread Finn Thain
word boundary (A0 and A1 are always zero). This constraint has been implemented for 16-bit mode; implement it for 32-bit mode too. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net

[PATCH v3 00/14] Fixes for DP8393X SONIC device emulation

2020-01-19 Thread Finn Thain
patches. Finn Thain (14): dp8393x: Mask EOL bit from descriptor addresses dp8393x: Always use 32-bit accesses dp8393x: Clean up endianness hacks dp8393x: Have dp8393x_receive() return the packet size dp8393x: Update LLFA and CRDA registers from rx descriptor dp8393x: Clear RRRA command

[PATCH v3 04/14] dp8393x: Have dp8393x_receive() return the packet size

2020-01-19 Thread Finn Thain
This function re-uses its 'size' argument as a scratch variable. Instead, declare a local 'size' variable for that purpose so that the function result doesn't get messed up. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier

[PATCH v3 06/14] dp8393x: Clear RRRA command register bit only when appropriate

2020-01-19 Thread Finn Thain
It doesn't make sense to clear the command register bit unless the command was actually issued. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/h

[PATCH v3 08/14] dp8393x: Don't clobber packet checksum

2020-01-19 Thread Finn Thain
. Fix this. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 0309365fda..947ceef37c 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -

[PATCH v3 10/14] dp8393x: Pad frames to word or long word boundary

2020-01-19 Thread Finn Thain
word (16-bit mode) or long word (32-bit mode) if the last byte did not end on a word or long word boundary respectively. The fill byte will be 0FFh. Implement buffer padding so that buffer limits are correctly enforced. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- hw/net

[PATCH v3 03/14] dp8393x: Clean up endianness hacks

2020-01-19 Thread Finn Thain
According to the datasheet, section 3.4.4, "in 32-bit mode ... the SONIC always writes long words". Therefore, use the same technique for the 'in_use' field that is used everywhere else, and write the full long word. Signed-off-by: Finn Thain Tested-by: Laurent Vivier

[PATCH v3 01/14] dp8393x: Mask EOL bit from descriptor addresses

2020-01-19 Thread Finn Thain
The Least Significant bit of a descriptor address register is used as an EOL flag. It has to be masked when the register value is to be used as an actual address for copying memory around. But when the registers are to be updated the EOL bit should not be masked. Signed-off-by: Finn Thain Tested

[PATCH v3 12/14] dp8393x: Always update RRA pointers and sequence numbers

2020-01-19 Thread Finn Thain
These operations have to take place regardless of whether or not rx descriptors have been used up (that is, EOL flag was observed). The algorithm is the now the same for a packet that was withheld as for a packet that was not. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- hw/net

[PATCH v3 14/14] dp8393x: Don't stop reception upon RBE interrupt assertion

2020-01-19 Thread Finn Thain
turns false. This bug causes the SONIC to become deaf (until reset). Fix this with a new flag to indicate actual receive buffer exhaustion. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v2: - Don't use can_receive to suspend packet reception. - Don't misuse th

[PATCH] .mailmap: Update my email address

2021-05-25 Thread Finn Thain
Signed-off-by: Finn Thain --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index a1bd659817..772f3e16cf 100644 --- a/.mailmap +++ b/.mailmap @@ -91,6 +91,7 @@ Erik Smit Fabrice Desclaux Fernando Luis Vázquez Cao Fernando Luis Vázquez Cao +Finn Thain

Re: [PATCH v3 00/14] Fixes for DP8393X SONIC device emulation

2020-01-27 Thread Finn Thain
On Mon, 20 Jan 2020, Finn Thain wrote: > Hi All, > > There are bugs in the emulated dp8393x device that can stop packet > reception in a Linux/m68k guest (q800 machine). > > With a Linux/mips guest (magnum machine), the driver fails to probe > the dp8393x device. >

Re: [PATCH v3 13/14] dp8393x: Don't reset Silicon Revision register

2020-01-28 Thread Finn Thain
On Tue, 28 Jan 2020, Philippe Mathieu-Daud? wrote: > On 1/19/20 11:59 PM, Finn Thain wrote: > > The jazzsonic driver in Linux uses the Silicon Revision register value > > to probe the chip. The driver fails unless the SR register contains 4. > > Unfortunately, reading

Re: [PATCH v3 01/14] dp8393x: Mask EOL bit from descriptor addresses

2020-01-28 Thread Finn Thain
On Tue, 28 Jan 2020, Philippe Mathieu-Daudé wrote: > Hi Finn, > > On 1/19/20 11:59 PM, Finn Thain wrote: > > The Least Significant bit of a descriptor address register is used as > > an EOL flag. It has to be masked when the register value is to be used > > as an

Re: [PATCH v3 13/14] dp8393x: Don't reset Silicon Revision register

2020-01-28 Thread Finn Thain
On Wed, 29 Jan 2020, Philippe Mathieu-Daudé wrote: > > > > This would allow the host to change the value of the Silicon Revision > > register. > How the guest can modify it? We have: > > 589 static void dp8393x_write(void *opaque, hwaddr addr, uint64_t data, > 590 unsi

[PATCH v4 06/14] dp8393x: Clear RRRA command register bit only when appropriate

2020-01-29 Thread Finn Thain
It doesn't make sense to clear the command register bit unless the command was actually issued. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/h

[PATCH v4 09/14] dp8393x: Use long-word-aligned RRA pointers in 32-bit mode

2020-01-29 Thread Finn Thain
word boundary (A0 and A1 are always zero). This constraint has been implemented for 16-bit mode; implement it for 32-bit mode too. Signed-off-by: Finn Thain Tested-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé --- hw/net/dp8393x.c | 8 ++-- 1 file changed, 6 insertions(+), 2

[PATCH v4 08/14] dp8393x: Don't clobber packet checksum

2020-01-29 Thread Finn Thain
. Fix this. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 0309365fda..947ceef37c 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -

[PATCH v4 04/14] dp8393x: Have dp8393x_receive() return the packet size

2020-01-29 Thread Finn Thain
This function re-uses its 'size' argument as a scratch variable. Instead, declare a local 'size' variable for that purpose so that the function result doesn't get messed up. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier

[PATCH v4 05/14] dp8393x: Update LLFA and CRDA registers from rx descriptor

2020-01-29 Thread Finn Thain
of descriptors in this way. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v1: - Update CRDA register from LLFA register after EOL is cleared. --- hw/net/dp8393x.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net

[PATCH v4 11/14] dp8393x: Clear descriptor in_use field to release packet

2020-01-29 Thread Finn Thain
RXpkt.in_use field. The packet can now be processed by the host, so raise a PKTRX interrupt, just like the normal case. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v2: - Assert PKTRX interrupt when releasing withheld packet. --- hw/net/dp8393x.c | 10 ++ 1

[PATCH v4 02/14] dp8393x: Always use 32-bit accesses

2020-01-29 Thread Finn Thain
Linux 'jazzsonic' driver working, and avoids the need for prior hacks to make the NetBSD 'sn' driver work. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- hw/net/dp8393x.c | 47 +-- 1 file changed, 29 insertions(+), 18 deleti

[PATCH v4 13/14] dp8393x: Don't reset Silicon Revision register

2020-01-29 Thread Finn Thain
quot;net/dp8393x: fix hardware reset") Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Finn Thain --- Changed since v3: - Simplified as per suggestion from Philippe Mathieu-Daudé. --- hw/net/dp8393x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/

[PATCH v4 07/14] dp8393x: Implement packet size limit and RBAE interrupt

2020-01-29 Thread Finn Thain
them. Linux uses that interrupt to count dropped packets. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v1: - Perform length check after Recieve Control Register initialization. --- hw/net/dp8393x.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/net/dp83

[PATCH v4 01/14] dp8393x: Mask EOL bit from descriptor addresses

2020-01-29 Thread Finn Thain
The Least Significant bit of a descriptor address register is used as an EOL flag. It has to be masked when the register value is to be used as an actual address for copying memory around. But when the registers are to be updated the EOL bit should not be masked. Signed-off-by: Finn Thain Tested

[PATCH v4 14/14] dp8393x: Don't stop reception upon RBE interrupt assertion

2020-01-29 Thread Finn Thain
turns false. This bug causes the SONIC to become deaf (until reset). Fix this with a new flag to indicate actual receive buffer exhaustion. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- Changed since v2: - Don't use can_receive to suspend packet reception. - Don't misuse th

[PATCH v4 00/14] Fixes for DP8393X SONIC device emulation

2020-01-29 Thread Finn Thain
Added 2 new patches. Changed since v3: - Replaced patch 13/14 with patch suggested by Philippe Mathieu-Daudé. Finn Thain (14): dp8393x: Mask EOL bit from descriptor addresses dp8393x: Always use 32-bit accesses dp8393x: Clean up endianness hacks dp8393x: Have dp8393x_receive() retur

[PATCH v4 10/14] dp8393x: Pad frames to word or long word boundary

2020-01-29 Thread Finn Thain
word (16-bit mode) or long word (32-bit mode) if the last byte did not end on a word or long word boundary respectively. The fill byte will be 0FFh. Implement buffer padding so that buffer limits are correctly enforced. Signed-off-by: Finn Thain Tested-by: Laurent Vivier Reviewed-by

[PATCH v4 12/14] dp8393x: Always update RRA pointers and sequence numbers

2020-01-29 Thread Finn Thain
These operations need to take place regardless of whether or not rx descriptors have been used up (that is, EOL flag was observed). The algorithm is now the same for a packet that was withheld as for a packet that was not. Signed-off-by: Finn Thain Tested-by: Laurent Vivier --- hw/net

[PATCH v4 03/14] dp8393x: Clean up endianness hacks

2020-01-29 Thread Finn Thain
According to the datasheet, section 3.4.4, "in 32-bit mode ... the SONIC always writes long words". Therefore, use the same technique for the 'in_use' field that is used everywhere else, and write the full long word. Signed-off-by: Finn Thain Tested-by: Laurent Vivier R

Re: [PATCH v2 02/13] dp8393x: Clean up endianness hacks

2020-01-07 Thread Finn Thain
On Tue, 7 Jan 2020, Philippe Mathieu-Daud? wrote: > On 1/6/20 11:19 PM, Finn Thain wrote: > > On Fri, 20 Dec 2019, Finn Thain wrote: > > > > > The in_use field is no different to the other words handled using > > > dp8393x_put() and dp8393x_get(). Use the same t

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-19 Thread Finn Thain
On Mon, 16 Dec 2019, Finn Thain wrote: > 00:15:29.341601 IP truncated-ip - 52 bytes missing! 192.168.66.1 > > 192.168.66.111: ICMP echo request, id 23957, seq 12, length 64 ... > > Sniffing br0 on the host shows no sign of the truncated packet at all > which leaves a

[PATCH v2 03/13] dp8393x: Have dp8393x_receive() return the packet size

2019-12-19 Thread Finn Thain
This function re-uses its 'size' argument as a scratch variable. Instead, declare a local 'size' variable for that purpose so that the function result doesn't get messed up. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/net/dp8393x.c | 9 +++

[PATCH v2 00/13] Fixes for DP8393X SONIC device emulation

2019-12-19 Thread Finn Thain
: - Minor revisions described in patch descriptions. - Dropped patches 4/10 and 7/10. - Added 5 new patches. Finn Thain (13): dp8393x: Mask EOL bit from descriptor addresses dp8393x: Clean up endianness hacks dp8393x: Have dp8393x_receive() return the packet size dp8393x: Update LLFA and

[PATCH v2 08/13] dp8393x: Don't clobber packet checksum

2019-12-19 Thread Finn Thain
. Fix this. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/net/dp8393x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 46b92ebf65..d722bbe8c1 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -813,6 +813,7 @@ static ss

[PATCH v2 02/13] dp8393x: Clean up endianness hacks

2019-12-19 Thread Finn Thain
The in_use field is no different to the other words handled using dp8393x_put() and dp8393x_get(). Use the same technique for in_use that is used everywhere else. Signed-off-by: Finn Thain --- Changed since v1: - Use existing 'address' variable rather than declare a new one. Lauren

[PATCH v2 04/13] dp8393x: Update LLFA and CRDA registers from rx descriptor

2019-12-19 Thread Finn Thain
of descriptors in this way. Signed-off-by: Finn Thain --- Changed since v1: - Update CRDA register from LLFA register after EOL is cleared. --- hw/net/dp8393x.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index a3e3a82ff4

[PATCH v2 10/13] dp8393x: Pad frames to word or long word boundary

2019-12-19 Thread Finn Thain
word (16-bit mode) or long word (32-bit mode) if the last byte did not end on a word or long word boundary respectively. The fill byte will be 0FFh. Implement buffer padding so that buffer limits are correctly enforced. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 39

[PATCH v2 13/13] dp8393x: Correctly advance RRP

2019-12-19 Thread Finn Thain
: Finn Thain --- hw/net/dp8393x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index bd92fa28f6..92a30f9f69 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -340,7 +340,7 @@ static void dp8393x_do_read_rra(dp8393xState *s) s

[PATCH v2 11/13] dp8393x: Clear descriptor in_use field when necessary

2019-12-19 Thread Finn Thain
This is in accordance with section 3.4.7 of the datasheet: When the system appends more descriptors, the SONIC releases ownership of the descriptor after writing h to the RXpkt.in_use field. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 9 + 1 file changed, 9 insertions

[PATCH v2 06/13] dp8393x: Implement packet size limit and RBAE interrupt

2019-12-19 Thread Finn Thain
them. Linux uses that interrupt to count dropped packets. Signed-off-by: Finn Thain --- Changed since v1: - Perform length check after Recieve Control Register initialization. --- hw/net/dp8393x.c | 9 + 1 file changed, 9 insertions(+) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c

[PATCH v2 12/13] dp8393x: Always update RRA pointers and sequence numbers

2019-12-19 Thread Finn Thain
These operations have to take place regardless of whether or not rx descriptors have been used up (that is, EOL flag was observed). Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c

[PATCH v2 01/13] dp8393x: Mask EOL bit from descriptor addresses

2019-12-19 Thread Finn Thain
The LSB of descriptor address registers is used as an EOL flag. It has to be masked when those registers are to be used as actual addresses for copying memory around. But when the registers are to be updated the EOL bit should not be masked. Signed-off-by: Finn Thain --- Changed since v1

[PATCH v2 05/13] dp8393x: Clear RRRA command register bit only when appropriate

2019-12-19 Thread Finn Thain
It doesn't make sense to clear the command register bit unless the command was actually issued. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé --- hw/net/dp8393x.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp83

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-19 Thread Finn Thain
On Sun, 15 Dec 2019, Aleksandar Markovic wrote: > > Herve, > > Is there any way for us to come up with an equivalent or at least > approximate scenario for Jazz machines? > > Regards, > Aleksandar > That would be useful in general, but in this case I think it might be better to test NetBSD,

[PATCH v2 09/13] dp8393x: Use long-word-aligned RRA pointers in 32-bit mode

2019-12-19 Thread Finn Thain
word boundary (A0 and A1 are always zero). This constraint has been implemented for 16-bit mode; implement it for 32-bit mode too. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index

[PATCH v2 07/13] dp8393x: Don't stop reception upon RBE interrupt assertion

2019-12-19 Thread Finn Thain
e RBE interrupt until it receives another packet. But that won't happen if can_receive returns false. So the SONIC becomes deaf (until reset). Fix this with a new flag to indicate actual receive buffer exhaustion. Signed-off-by: Finn Thain --- hw/net/dp8393x.c | 12 ++-- 1 file ch

Re: [PATCH v2 13/13] dp8393x: Correctly advance RRP

2019-12-20 Thread Finn Thain
after I've finished debugging the Linux sonic driver. On Fri, 20 Dec 2019, Finn Thain wrote: > The last entry in the RRA is at the address given by the REA register. > The address wrap-around logic is off-by-one entry. The last resource > never gets used and RRP can jump over the

Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-20 Thread Finn Thain
On Fri, 20 Dec 2019, Laurent Vivier wrote: > Le 20/12/2019 ? 12:38, Aleksandar Markovic a ?crit?: > > On Sat, Dec 14, 2019 at 2:29 AM Finn Thain > > wrote: > >> > >> Hi All, > >> > >> There is a bug in the DP8393X emulation that can stop packet

NetBSD/arc on MIPS Magnum, was Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-23 Thread Finn Thain
On Mon, 23 Dec 2019, Philippe Mathieu-Daud? wrote: > Hi Finn, > > On 12/20/19 5:24 AM, Finn Thain wrote: > > On Sun, 15 Dec 2019, Aleksandar Markovic wrote: > > > > > > > > Herve, > > > > > > Is there any way for us to come up with an e

Re: NetBSD/arc on MIPS Magnum, was Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2019-12-23 Thread Finn Thain
On Tue, 24 Dec 2019, Finn Thain wrote: > > I know precious little about NetBSD installation and MIPS Magnum. What I > wrote above was guesswork. Hence this could be a NetBSD bug or user > error. > It was bugs and user error. The user error was not using the serial console.

Re: NetBSD/arc on MIPS Magnum, was Re: [PATCH 00/10] Fixes for DP8393X SONIC device emulation

2020-01-06 Thread Finn Thain
On Tue, 24 Dec 2019, hpous...@reactos.org wrote: > > > > I haven't tried the latest iso (9.0-rc1). > > I found that NetBSD 9.0-rc1 has the same regressions. > > Hello Finn, > > Thanks for finding the required steps to boot NetBSD on MIPS Magnum. I > was trying to find how to let it work on

Re: [PATCH v2 02/13] dp8393x: Clean up endianness hacks

2020-01-06 Thread Finn Thain
On Fri, 20 Dec 2019, Finn Thain wrote: > The in_use field is no different to the other words handled using > dp8393x_put() and dp8393x_get(). Use the same technique for in_use > that is used everywhere else. > > Signed-off-by: Finn Thain > --- > Changed since v1: >

[RFC 00/10] hw/mos6522: VIA timer emulation fixes and improvements

2021-08-24 Thread Finn Thain
/github.com/fthain/qemu/commits/via-timer/ [4] This theoretical 20 ms deadline is not missed prior to every backwards jump in the clocksource counter. AFAICT, that's because the true deadline is somewhat shorter than 20 ms. Finn Thain (10): hw/mos6522: Remove get_load_time() me

[RFC 01/10] hw/mos6522: Remove get_load_time() methods and functions

2021-08-24 Thread Finn Thain
This code appears to be unnecessary. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1c57332b40..a478c1ca43 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522

[RFC 02/10] hw/mos6522: Remove get_counter_value() methods and functions

2021-08-24 Thread Finn Thain
This code appears to be unnecessary. Also, these routines don't return the counter value but a time interval between counter values, so they are misnamed. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 22 ++ 1 file changed, 2 insertions(+), 20 deletions(-) diff --

[RFC 04/10] hw/mos6522: Rename timer callback functions

2021-08-24 Thread Finn Thain
This improves readability. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1d4a56077e..c0d6bee4cc 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -154,7 +154,7

[RFC 05/10] hw/mos6522: Don't clear T1 interrupt flag on latch write

2021-08-24 Thread Finn Thain
The Synertek datasheet says, "A write to T1L-H loads an 8-bit count value into the latch. A read of T1L-H transfers the contents of the latch to the data bus. Neither operation has an affect [sic] on the interrupt flag." Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 1 - 1 file

[RFC 03/10] hw/mos6522: Remove redundant mos6522_timer1_update() calls

2021-08-24 Thread Finn Thain
Reads and writes to the TL and TC registers have no immediate effect on a running timer, with the exception of a write to TCH. Hence these mos6522_timer_update() calls are not needed. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/hw

[RFC 07/10] hw/mos6522: Fix initial timer counter reload

2021-08-24 Thread Finn Thain
reloaded when it wraps. Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 5b1657ac0d..0a241fe9f8 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -63,15 +63,16

[RFC 06/10] hw/mos6522: Implement oneshot mode

2021-08-24 Thread Finn Thain
Signed-off-by: Finn Thain --- hw/misc/mos6522.c | 19 --- include/hw/misc/mos6522.h | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 8991f4..5b1657ac0d 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc

  1   2   >