Skip to content

Commit fb24ea5

Browse files
committed
drivers: Remove explicit invocations of mmiowb()
mmiowb() is now implied by spin_unlock() on architectures that require it, so there is no reason to call it from driver code. This patch was generated using coccinelle: @mmiowb@ @@ - mmiowb(); and invoked as: $ for d in drivers include/linux/qed sound; do \ spatch --include-headers --sp-file mmiowb.cocci --dir $d --in-place; done NOTE: mmiowb() has only ever guaranteed ordering in conjunction with spin_unlock(). However, pairing each mmiowb() removal in this patch with the corresponding call to spin_unlock() is not at all trivial, so there is a small chance that this change may regress any drivers incorrectly relying on mmiowb() to order MMIO writes between CPUs using lock-free synchronisation. If you've ended up bisecting to this commit, you can reintroduce the mmiowb() calls using wmb() instead, which should restore the old behaviour on all architectures other than some esoteric ia64 systems. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 949b8c7 commit fb24ea5

123 files changed

Lines changed: 1 addition & 508 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/crypto/cavium/nitrox/nitrox_reqmgr.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,6 @@ static void post_se_instr(struct nitrox_softreq *sr,
303303

304304
/* Ring doorbell with count 1 */
305305
writeq(1, cmdq->dbell_csr_addr);
306-
/* orders the doorbell rings */
307-
mmiowb();
308306

309307
cmdq->write_idx = incr_index(idx, 1, ndev->qlen);
310308

@@ -599,8 +597,6 @@ void pkt_slc_resp_tasklet(unsigned long data)
599597
* MSI-X interrupt generates if Completion count > Threshold
600598
*/
601599
writeq(slc_cnts.value, cmdq->compl_cnt_csr_addr);
602-
/* order the writes */
603-
mmiowb();
604600

605601
if (atomic_read(&cmdq->backlog_count))
606602
schedule_work(&cmdq->backlog_qflush);

‎drivers/dma/txx9dmac.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ static void txx9dmac_reset_chan(struct txx9dmac_chan *dc)
327327
channel_writel(dc, SAIR, 0);
328328
channel_writel(dc, DAIR, 0);
329329
channel_writel(dc, CCR, 0);
330-
mmiowb();
331330
}
332331

333332
/* Called with dc->lock held and bh disabled */
@@ -954,7 +953,6 @@ static void txx9dmac_chain_dynamic(struct txx9dmac_chan *dc,
954953
dma_sync_single_for_device(chan2parent(&dc->chan),
955954
prev->txd.phys, ddev->descsize,
956955
DMA_TO_DEVICE);
957-
mmiowb();
958956
if (!(channel_readl(dc, CSR) & TXX9_DMA_CSR_CHNEN) &&
959957
channel_read_CHAR(dc) == prev->txd.phys)
960958
/* Restart chain DMA */
@@ -1080,7 +1078,6 @@ static void txx9dmac_free_chan_resources(struct dma_chan *chan)
10801078
static void txx9dmac_off(struct txx9dmac_dev *ddev)
10811079
{
10821080
dma_writel(ddev, MCR, 0);
1083-
mmiowb();
10841081
}
10851082

10861083
static int __init txx9dmac_chan_probe(struct platform_device *pdev)

‎drivers/firewire/ohci.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,6 @@ static void set_multichannel_mask(struct fw_ohci *ohci, u64 channels)
29392939
reg_write(ohci, OHCI1394_IRMultiChanMaskLoClear, ~lo);
29402940
reg_write(ohci, OHCI1394_IRMultiChanMaskHiSet, hi);
29412941
reg_write(ohci, OHCI1394_IRMultiChanMaskLoSet, lo);
2942-
mmiowb();
29432942
ohci->mc_channels = channels;
29442943
}
29452944

‎drivers/gpu/drm/i915/intel_hdmi.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,13 @@ static void g4x_write_infoframe(struct intel_encoder *encoder,
182182

183183
I915_WRITE(VIDEO_DIP_CTL, val);
184184

185-
mmiowb();
186185
for (i = 0; i < len; i += 4) {
187186
I915_WRITE(VIDEO_DIP_DATA, *data);
188187
data++;
189188
}
190189
/* Write every possible data byte to force correct ECC calculation. */
191190
for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
192191
I915_WRITE(VIDEO_DIP_DATA, 0);
193-
mmiowb();
194192

195193
val |= g4x_infoframe_enable(type);
196194
val &= ~VIDEO_DIP_FREQ_MASK;
@@ -237,15 +235,13 @@ static void ibx_write_infoframe(struct intel_encoder *encoder,
237235

238236
I915_WRITE(reg, val);
239237

240-
mmiowb();
241238
for (i = 0; i < len; i += 4) {
242239
I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
243240
data++;
244241
}
245242
/* Write every possible data byte to force correct ECC calculation. */
246243
for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
247244
I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
248-
mmiowb();
249245

250246
val |= g4x_infoframe_enable(type);
251247
val &= ~VIDEO_DIP_FREQ_MASK;
@@ -298,15 +294,13 @@ static void cpt_write_infoframe(struct intel_encoder *encoder,
298294

299295
I915_WRITE(reg, val);
300296

301-
mmiowb();
302297
for (i = 0; i < len; i += 4) {
303298
I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
304299
data++;
305300
}
306301
/* Write every possible data byte to force correct ECC calculation. */
307302
for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
308303
I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
309-
mmiowb();
310304

311305
val |= g4x_infoframe_enable(type);
312306
val &= ~VIDEO_DIP_FREQ_MASK;
@@ -352,15 +346,13 @@ static void vlv_write_infoframe(struct intel_encoder *encoder,
352346

353347
I915_WRITE(reg, val);
354348

355-
mmiowb();
356349
for (i = 0; i < len; i += 4) {
357350
I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
358351
data++;
359352
}
360353
/* Write every possible data byte to force correct ECC calculation. */
361354
for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
362355
I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
363-
mmiowb();
364356

365357
val |= g4x_infoframe_enable(type);
366358
val &= ~VIDEO_DIP_FREQ_MASK;
@@ -406,7 +398,6 @@ static void hsw_write_infoframe(struct intel_encoder *encoder,
406398
val &= ~hsw_infoframe_enable(type);
407399
I915_WRITE(ctl_reg, val);
408400

409-
mmiowb();
410401
for (i = 0; i < len; i += 4) {
411402
I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder,
412403
type, i >> 2), *data);
@@ -416,7 +407,6 @@ static void hsw_write_infoframe(struct intel_encoder *encoder,
416407
for (; i < data_size; i += 4)
417408
I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder,
418409
type, i >> 2), 0);
419-
mmiowb();
420410

421411
val |= hsw_infoframe_enable(type);
422412
I915_WRITE(ctl_reg, val);

‎drivers/ide/tx4939ide.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ static u16 tx4939ide_check_error_ints(ide_hwif_t *hwif)
156156
u16 sysctl = tx4939ide_readw(base, TX4939IDE_Sys_Ctl);
157157

158158
tx4939ide_writew(sysctl | 0x4000, base, TX4939IDE_Sys_Ctl);
159-
mmiowb();
160159
/* wait 12GBUSCLK (typ. 60ns @ GBUS200MHz, max 270ns) */
161160
ndelay(270);
162161
tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl);
@@ -396,7 +395,6 @@ static void tx4939ide_init_hwif(ide_hwif_t *hwif)
396395

397396
/* Soft Reset */
398397
tx4939ide_writew(0x8000, base, TX4939IDE_Sys_Ctl);
399-
mmiowb();
400398
/* at least 20 GBUSCLK (typ. 100ns @ GBUS200MHz, max 450ns) */
401399
ndelay(450);
402400
tx4939ide_writew(0x0000, base, TX4939IDE_Sys_Ctl);

‎drivers/infiniband/hw/hfi1/chip.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8365,7 +8365,6 @@ static inline void clear_recv_intr(struct hfi1_ctxtdata *rcd)
83658365
struct hfi1_devdata *dd = rcd->dd;
83668366
u32 addr = CCE_INT_CLEAR + (8 * rcd->ireg);
83678367

8368-
mmiowb();
83698368
write_csr(dd, addr, rcd->imask);
83708369
/* force the above write on the chip and get a value back */
83718370
(void)read_csr(dd, addr);
@@ -11803,12 +11802,10 @@ void update_usrhead(struct hfi1_ctxtdata *rcd, u32 hd, u32 updegr, u32 egrhd,
1180311802
<< RCV_EGR_INDEX_HEAD_HEAD_SHIFT;
1180411803
write_uctxt_csr(dd, ctxt, RCV_EGR_INDEX_HEAD, reg);
1180511804
}
11806-
mmiowb();
1180711805
reg = ((u64)rcv_intr_count << RCV_HDR_HEAD_COUNTER_SHIFT) |
1180811806
(((u64)hd & RCV_HDR_HEAD_HEAD_MASK)
1180911807
<< RCV_HDR_HEAD_HEAD_SHIFT);
1181011808
write_uctxt_csr(dd, ctxt, RCV_HDR_HEAD, reg);
11811-
mmiowb();
1181211809
}
1181311810

1181411811
u32 hdrqempty(struct hfi1_ctxtdata *rcd)

‎drivers/infiniband/hw/hfi1/pio.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,6 @@ void hfi1_sc_wantpiobuf_intr(struct send_context *sc, u32 needint)
15781578
sc_del_credit_return_intr(sc);
15791579
trace_hfi1_wantpiointr(sc, needint, sc->credit_ctrl);
15801580
if (needint) {
1581-
mmiowb();
15821581
sc_return_credits(sc);
15831582
}
15841583
}

‎drivers/infiniband/hw/hns/hns_roce_hw_v1.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,8 +1750,6 @@ static int hns_roce_v1_post_mbox(struct hns_roce_dev *hr_dev, u64 in_param,
17501750

17511751
writel(val, hcr + 5);
17521752

1753-
mmiowb();
1754-
17551753
return 0;
17561754
}
17571755

‎drivers/infiniband/hw/mlx4/qp.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3744,12 +3744,6 @@ static int _mlx4_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
37443744
writel_relaxed(qp->doorbell_qpn,
37453745
to_mdev(ibqp->device)->uar_map + MLX4_SEND_DOORBELL);
37463746

3747-
/*
3748-
* Make sure doorbells don't leak out of SQ spinlock
3749-
* and reach the HCA out of order.
3750-
*/
3751-
mmiowb();
3752-
37533747
stamp_send_wqe(qp, ind + qp->sq_spare_wqes - 1);
37543748

37553749
qp->sq_next_wqe = ind;

‎drivers/infiniband/hw/mlx5/qp.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5123,7 +5123,6 @@ static int _mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
51235123
/* Make sure doorbells don't leak out of SQ spinlock
51245124
* and reach the HCA out of order.
51255125
*/
5126-
mmiowb();
51275126
bf->offset ^= bf->buf_size;
51285127
}
51295128

0 commit comments

Comments
 (0)