Skip to content

Commit b0d1fe9

Browse files
habetsm-xilinxdavem330
authored andcommitted
sfc: Cleanups in io.h
Most of the Falcon locking description does not apply to EF10. Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com> Acked-by: Edward Cree <ecree.xilinx@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ae9d445 commit b0d1fe9

File tree

2 files changed

+9
-80
lines changed

2 files changed

+9
-80
lines changed

drivers/net/ethernet/sfc/io.h

Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,22 @@
1717
*
1818
**************************************************************************
1919
*
20-
* Notes on locking strategy for the Falcon architecture:
21-
*
22-
* Many CSRs are very wide and cannot be read or written atomically.
23-
* Writes from the host are buffered by the Bus Interface Unit (BIU)
24-
* up to 128 bits. Whenever the host writes part of such a register,
25-
* the BIU collects the written value and does not write to the
26-
* underlying register until all 4 dwords have been written. A
27-
* similar buffering scheme applies to host access to the NIC's 64-bit
28-
* SRAM.
29-
*
30-
* Writes to different CSRs and 64-bit SRAM words must be serialised,
31-
* since interleaved access can result in lost writes. We use
32-
* efx_nic::biu_lock for this.
33-
*
34-
* We also serialise reads from 128-bit CSRs and SRAM with the same
35-
* spinlock. This may not be necessary, but it doesn't really matter
36-
* as there are no such reads on the fast path.
20+
* The EF10 architecture exposes very few registers to the host and
21+
* most of them are only 32 bits wide. The only exceptions are the MC
22+
* doorbell register pair, which has its own latching, and
23+
* TX_DESC_UPD.
3724
*
38-
* The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
39-
* 128-bit but are special-cased in the BIU to avoid the need for
40-
* locking in the host:
25+
* The TX_DESC_UPD DMA descriptor pointer is 128-bits but is a special
26+
* case in the BIU to avoid the need for locking in the host:
4127
*
42-
* - They are write-only.
43-
* - The semantics of writing to these registers are such that
28+
* - It is write-only.
29+
* - The semantics of writing to this register is such that
4430
* replacing the low 96 bits with zero does not affect functionality.
45-
* - If the host writes to the last dword address of such a register
31+
* - If the host writes to the last dword address of the register
4632
* (i.e. the high 32 bits) the underlying register will always be
4733
* written. If the collector and the current write together do not
4834
* provide values for all 128 bits of the register, the low 96 bits
4935
* will be written as zero.
50-
* - If the host writes to the address of any other part of such a
51-
* register while the collector already holds values for some other
52-
* register, the write is discarded and the collector maintains its
53-
* current state.
54-
*
55-
* The EF10 architecture exposes very few registers to the host and
56-
* most of them are only 32 bits wide. The only exceptions are the MC
57-
* doorbell register pair, which has its own latching, and
58-
* TX_DESC_UPD, which works in a similar way to the Falcon
59-
* architecture.
6036
*/
6137

6238
#if BITS_PER_LONG == 64
@@ -125,27 +101,6 @@ static inline void efx_writeo(struct efx_nic *efx, const efx_oword_t *value,
125101
spin_unlock_irqrestore(&efx->biu_lock, flags);
126102
}
127103

128-
/* Write 64-bit SRAM through the supplied mapping, locking as appropriate. */
129-
static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase,
130-
const efx_qword_t *value, unsigned int index)
131-
{
132-
unsigned int addr = index * sizeof(*value);
133-
unsigned long flags __attribute__ ((unused));
134-
135-
netif_vdbg(efx, hw, efx->net_dev,
136-
"writing SRAM address %x with " EFX_QWORD_FMT "\n",
137-
addr, EFX_QWORD_VAL(*value));
138-
139-
spin_lock_irqsave(&efx->biu_lock, flags);
140-
#ifdef EFX_USE_QWORD_IO
141-
__raw_writeq((__force u64)value->u64[0], membase + addr);
142-
#else
143-
__raw_writel((__force u32)value->u32[0], membase + addr);
144-
__raw_writel((__force u32)value->u32[1], membase + addr + 4);
145-
#endif
146-
spin_unlock_irqrestore(&efx->biu_lock, flags);
147-
}
148-
149104
/* Write a 32-bit CSR or the last dword of a special 128-bit CSR */
150105
static inline void efx_writed(struct efx_nic *efx, const efx_dword_t *value,
151106
unsigned int reg)
@@ -176,27 +131,6 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value,
176131
EFX_OWORD_VAL(*value));
177132
}
178133

179-
/* Read 64-bit SRAM through the supplied mapping, locking as appropriate. */
180-
static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase,
181-
efx_qword_t *value, unsigned int index)
182-
{
183-
unsigned int addr = index * sizeof(*value);
184-
unsigned long flags __attribute__ ((unused));
185-
186-
spin_lock_irqsave(&efx->biu_lock, flags);
187-
#ifdef EFX_USE_QWORD_IO
188-
value->u64[0] = (__force __le64)__raw_readq(membase + addr);
189-
#else
190-
value->u32[0] = (__force __le32)__raw_readl(membase + addr);
191-
value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4);
192-
#endif
193-
spin_unlock_irqrestore(&efx->biu_lock, flags);
194-
195-
netif_vdbg(efx, hw, efx->net_dev,
196-
"read from SRAM address %x, got "EFX_QWORD_FMT"\n",
197-
addr, EFX_QWORD_VAL(*value));
198-
}
199-
200134
/* Read a 32-bit CSR or SRAM */
201135
static inline void efx_readd(struct efx_nic *efx, efx_dword_t *value,
202136
unsigned int reg)

drivers/net/ethernet/sfc/nic.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,6 @@ void efx_nic_get_regs(struct efx_nic *efx, void *buf)
272272
case 4: /* 32-bit SRAM */
273273
efx_readd(efx, buf, table->offset + 4 * i);
274274
break;
275-
case 8: /* 64-bit SRAM */
276-
efx_sram_readq(efx,
277-
efx->membase + table->offset,
278-
buf, i);
279-
break;
280275
case 16: /* 128-bit-readable register */
281276
efx_reado_table(efx, buf, table->offset, i);
282277
break;

0 commit comments

Comments
 (0)