mbox series

[0/2] hw/net/pcnet-pci: Convert away from old_mmio accessors

Message ID 20180802174042.29234-1-peter.maydell@linaro.org
Headers show
Series hw/net/pcnet-pci: Convert away from old_mmio accessors | expand

Message

Peter Maydell Aug. 2, 2018, 5:40 p.m. UTC
This patchset converts the pcnet-pci's MMIO BAR MemoryRegionOps
away from the old_mmio accessors.

It does it in two stages:
 * patch 1 is a no-behaviour-change patch which replaces the old
   split byte/word/long accessor functions with single read and
   write functions which take the size, and look suspiciously
   similar but not identical to the existing pcnet_ioport_read/write
   functions
 * patch 2 then drops the new read and write functions and just
   uses the ioport read/write functions

My reason for structuring it like this is that I'm pretty sure
that the discrepancy between the MMIO BAR accessors and the
IO BAR accessors is just a bug (one which we fixed for the
IO BAR accessors in commit 7ba79741970 in 2011). But if I'm
wrong I want us to be able to revert the behaviour change
easily without that bringing back a use of the old_mmio accessors
(which might not even compile if we need to revert after we've
finally managed to drop those entirely).

The bug as fixed in patch 2 is that for the MMIO BAR we were
not honouring the DWIO bit (which indicates whether the device
is in 16-bit or 32-bit IO mode) when doing accesses to the
aprom range 0x0..0xf. We were already honouring DWIO for accesses
to the 0x10..0x1f range, and my trawling through datasheets
indicates that DWIO applies identically to MMIO and IO BARs
(see patch 2's commit message for details and references).

This is awkwardly hard to test, though, because Linux's
pcnet driver only uses port IO as far as I can tell. (Likely
this is why the bug has remained unnoticed for so long.)

thanks
-- PMM

Peter Maydell (2):
  hw/net/pcnet-pci: Convert away from old_mmio accessors
  hw/net/pcnet-pci: Unify pcnet_ioport_read/write and
    pcnet_mmio_read/write

 hw/net/pcnet-pci.c  | 98 +++------------------------------------------
 hw/net/trace-events |  6 ---
 2 files changed, 6 insertions(+), 98 deletions(-)

-- 
2.17.1

Comments

Richard Henderson Aug. 4, 2018, 1:20 a.m. UTC | #1
On 08/02/2018 10:40 AM, Peter Maydell wrote:
> Peter Maydell (2):

>   hw/net/pcnet-pci: Convert away from old_mmio accessors

>   hw/net/pcnet-pci: Unify pcnet_ioport_read/write and

>     pcnet_mmio_read/write


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
Peter Maydell Sept. 25, 2018, 10:40 a.m. UTC | #2
On 4 August 2018 at 02:20, Richard Henderson
<richard.henderson@linaro.org> wrote:
> On 08/02/2018 10:40 AM, Peter Maydell wrote:

>> Peter Maydell (2):

>>   hw/net/pcnet-pci: Convert away from old_mmio accessors

>>   hw/net/pcnet-pci: Unify pcnet_ioport_read/write and

>>     pcnet_mmio_read/write

>

> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


Thanks for the review. I can put these in via target-arm,
though they don't really have anything to do with arm, since
nobody else seems very interested in this patchset...

thanks
-- PMM