Re: [PATCH] net-tg3: Initialize REG_BASE_ADDR at PCI config offset120 to 0

From: Michael Chan
Date: Wed Dec 11 2013 - 18:23:16 EST


On Tue, 2013-12-10 at 22:23 -0500, David Miller wrote:
> Ok, that may be true, but I'd like to consider the much larger issue
> at hand.
>
> If the indirect mechanism is enabled, some of the offsets that may be
> in there might be value, but would be entirely undesirable to be read
> because the read has side effects.
>
> What if the interrupt status register is what gets read if the user
> scans config space at just the wrong moment, and therefore an
> interrupt gets lost?
>
I did a quick audit of the driver to see if we are seriously exposed to
this problem. Only very old chips (5700 to 5703) use indirect register
access as workarounds for various issues. I looked at the IRQ path
which uses status block to determine if there is work to do. If status
block contains no new data, we check the PCI_STATE register and the bits
don't get cleared on read. MAC status register which is used to
determine link status does not have bits that are cleared on read. So
we should be ok.

We use the statistics block for counters on these older chips so there
is no conflict. On newer chips, we read counters from registers which
get cleared on read, but we never use indirect methods to read these
counters.

On all new chips, indirect method is not used except to download
firmware (on 57766 only). Userspace read will not interfere with
firmware download.

So it looks to me that we are in good shape. Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/