Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474566

[PATCH 6/9] Add comment about why 32-bit read/modify/write isn't safe.

From Bjorn Helgaas <bhelgaas@google.com>
Newsgroups linux.kernel
Subject [PATCH 6/9] Add comment about why 32-bit read/modify/write isn't safe.
Date 2016-09-01 18:50 +0200
Message-ID <scDlF-4lf-71@gated-at.bofh.it> (permalink)
References <scDlD-4lf-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


---
 drivers/pci/host/pcie-rockchip.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 17612e5..33bf2e1 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -282,6 +282,11 @@ static int rockchip_pcie_wr_own_conf(struct rockchip_pcie *rockchip,
 
 	mask = ~(((1 << (size * 8)) - 1) << ((where & 0x3) * 8));
 
+	/*
+	 * N.B. This read/modify/write isn't safe in general because it can
+	 * corrupt RW1C bits in adjacent registers.  But the hardware
+	 * doesn't support smaller writes.
+	 */
 	tmp = readl(rockchip->apb_base + PCIE_RC_CONFIG_BASE + offset) & mask;
 	tmp |= val << ((where & 0x3) * 8);
 	writel(tmp, rockchip->apb_base + PCIE_RC_CONFIG_BASE + offset);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] PCI: rockchip: Cleanups against v10 Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 4/9] Rename struct rockchip_pcie_port to struct  rockchip_pcie. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 9/9] Move msleeps to address Guenter's comments. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 5/9] Use a local "dev" to avoid repetition of  "rockchip->dev". Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 7/9] Simplify the confusing HIWORD_UPDATE scheme. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  [PATCH 6/9] Add comment about why 32-bit read/modify/write isn't  safe. Bjorn Helgaas <bhelgaas@google.com> - 2016-09-01 18:50 +0200
  Re: [PATCH 0/9] PCI: rockchip: Cleanups against v10 Arnd Bergmann <arnd@arndb.de> - 2016-09-01 23:20 +0200

csiph-web