Thread (23 messages) 23 messages, 3 authors, 2023-07-26

Re: [PATCH v2 07/11] bus: rifsc: introduce RIFSC firewall controller driver

From: Gatien CHEVALLIER <gatien.chevallier@foss.st.com>
Date: 2023-07-26 10:33:39
Also in: alsa-devel, dmaengine, linux-crypto, linux-devicetree, linux-i2c, linux-iio, linux-media, linux-mmc, linux-phy, linux-serial, linux-spi, linux-usb, lkml


On 7/26/23 12:26, Simon Horman wrote:
On Tue, Jul 25, 2023 at 06:41:00PM +0200, Gatien Chevallier wrote:

...
quoted
diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c
...
quoted
+static int stm32_rif_acquire_semaphore(struct stm32_firewall_controller *stm32_firewall_controller,
+				       int id)
+{
+	void __iomem *addr = stm32_firewall_controller->mmio + RIFSC_RISC_PER0_SEMCR + 0x8 * id;
+
+	__set_bit(SEMCR_MUTEX, addr);
Hi Gatien,

Sparse seem a bit unhappy about this.

  .../stm32_rifsc.c:83:9: warning: cast removes address space '__iomem' of expression
  .../stm32_rifsc.c:83:9: warning: incorrect type in argument 2 (different address spaces)
  .../stm32_rifsc.c:83:9:    expected unsigned long volatile *addr
  .../stm32_rifsc.c:83:9:    got void [noderef] __iomem *addr
  .../stm32_rifsc.c:83:9: warning: incorrect type in argument 2 (different address spaces)
  .../stm32_rifsc.c:83:9:    expected unsigned long volatile *addr
  .../stm32_rifsc.c:83:9:    got void [noderef] __iomem *addr

But it's not immediately apparent to me what a good solution is.
Hi Simon,

This is indeed incorrect, set_bit is used to modify bit fields, not
writing to a register. I'll change to writel, as in
stm32_rif_release_semaphore(). Thank you for pointing this out.

Best regards,
Gatien
quoted
+
+	/* Check that CID1 has the semaphore */
+	if (stm32_rifsc_is_semaphore_available(addr) ||
+	    FIELD_GET(RIFSC_RISC_SCID_MASK, readl(addr)) != RIF_CID1)
+		return -EACCES;
+
+	return 0;
+}
...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help