* [PATCH 00/15] fsi: Fixes and improvements
@ 2024-09-17 17:16 Eddie James
2024-09-17 17:16 ` [PATCH 01/15] fsi: hub: Set master index to link number plus one Eddie James
` (14 more replies)
0 siblings, 15 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
This series adds a number of fixes to the FSI drivers, improves
tracing, and adds clock calculations so that FSI client drivers
(i2c, spi, etc) might calculate their own bus clocks properly.
Much of this series was included in the previous interrupt support
series, but I'm sending this part first now so that the other
subsystem updates can be sent independently.
Eddie James (15):
fsi: hub: Set master index to link number plus one
fsi: Move slave definitions to fsi-slave.h
fsi: Fix slave addressing after break command
fsi: core: Use a defined value for default echo delay
fsi: core: Calculate local bus clock frequency
fsi: core: Improve master read/write/error traces
fsi: core: Add slave error trace
fsi: core: Reset errors instead of clearing interrupts
fsi: core: Add slave spinlock
fsi: core: Allow cfam device type aliases
fsi: scom: Update compatible string to match documentation
fsi: occ: Get device number from FSI minor number API
fsi: occ: Find next available child rather than node name match
fsi: sbefifo: Prevent async FFDC collection for Odyssey SBEFIFOs
fsi: i2cr: Reduce status checks for read operations
drivers/fsi/fsi-core.c | 185 ++++++++++++++++------------------
drivers/fsi/fsi-master-hub.c | 3 +
drivers/fsi/fsi-master-i2cr.c | 9 +-
drivers/fsi/fsi-master.h | 2 +
drivers/fsi/fsi-occ.c | 50 +++------
drivers/fsi/fsi-sbefifo.c | 37 +++++++
drivers/fsi/fsi-scom.c | 1 +
drivers/fsi/fsi-slave.h | 97 ++++++++++++++++++
include/linux/fsi.h | 1 +
include/trace/events/fsi.h | 131 ++++++++++--------------
10 files changed, 303 insertions(+), 213 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/15] fsi: hub: Set master index to link number plus one
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 02/15] fsi: Move slave definitions to fsi-slave.h Eddie James
` (13 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
This makes the hub master indexing more deterministic.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-master-hub.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 6568fed7db3c..3bfd0cea6f77 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include "fsi-master.h"
+#include "fsi-slave.h"
#define FSI_ENGID_HUB_MASTER 0x1c
@@ -229,6 +230,7 @@ static int hub_master_probe(struct device *dev)
hub->master.dev.release = hub_master_release;
hub->master.dev.of_node = of_node_get(dev_of_node(dev));
+ hub->master.idx = fsi_dev->slave->link + 1;
hub->master.n_links = links;
hub->master.read = hub_master_read;
hub->master.write = hub_master_write;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/15] fsi: Move slave definitions to fsi-slave.h
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
2024-09-17 17:16 ` [PATCH 01/15] fsi: hub: Set master index to link number plus one Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 03/15] fsi: Fix slave addressing after break command Eddie James
` (12 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Master drivers may need access to the slave definitions.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 35 -----------------
drivers/fsi/fsi-slave.h | 84 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 35 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index e2e1e9df6115..b50ed849f924 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -45,41 +45,6 @@
static const int engine_page_size = 0x400;
-#define FSI_SLAVE_BASE 0x800
-
-/*
- * FSI slave engine control register offsets
- */
-#define FSI_SMODE 0x0 /* R/W: Mode register */
-#define FSI_SISC 0x8 /* R/W: Interrupt condition */
-#define FSI_SSTAT 0x14 /* R : Slave status */
-#define FSI_SLBUS 0x30 /* W : LBUS Ownership */
-#define FSI_LLMODE 0x100 /* R/W: Link layer mode register */
-
-/*
- * SMODE fields
- */
-#define FSI_SMODE_WSC 0x80000000 /* Warm start done */
-#define FSI_SMODE_ECRC 0x20000000 /* Hw CRC check */
-#define FSI_SMODE_SID_SHIFT 24 /* ID shift */
-#define FSI_SMODE_SID_MASK 3 /* ID Mask */
-#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */
-#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */
-#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */
-#define FSI_SMODE_SD_MASK 0xf /* Send delay mask */
-#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */
-#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */
-
-/*
- * SLBUS fields
- */
-#define FSI_SLBUS_FORCE 0x80000000 /* Force LBUS ownership */
-
-/*
- * LLMODE fields
- */
-#define FSI_LLMODE_ASYNC 0x1
-
#define FSI_SLAVE_SIZE_23b 0x800000
static DEFINE_IDA(master_ida);
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index 1d63a585829d..dba65bd4e083 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -7,6 +7,90 @@
#include <linux/cdev.h>
#include <linux/device.h>
+#define FSI_SLAVE_BASE 0x800
+
+/*
+ * FSI slave engine control register offsets
+ */
+#define FSI_SMODE 0x0 /* R/W: Mode register */
+#define FSI_SISC 0x8 /* R : Interrupt condition */
+#define FSI_SCISC 0x8 /* C : Clear interrupt condition */
+#define FSI_SISM 0xc /* R/W: Interrupt mask */
+#define FSI_SISS 0x10 /* R : Interrupt status */
+#define FSI_SSISM 0x10 /* S : Set interrupt mask */
+#define FSI_SCISM 0x14 /* C : Clear interrupt mask */
+#define FSI_SSTAT 0x14 /* R : Slave status */
+#define FSI_SI1S 0x1c /* R : Slave interrupt 1 status */
+#define FSI_SSI1M 0x1c /* S : Set slave interrupt 1 mask */
+#define FSI_SCI1M 0x20 /* C : Clear slave interrupt 1 mask */
+#define FSI_SLBUS 0x30 /* W : LBUS Ownership */
+#define FSI_SRSIC0 0x68 /* C : Clear remote interrupt condition */
+#define FSI_SRSIC4 0x6c /* C : Clear remote interrupt condition */
+#define FSI_SRSIM0 0x70 /* R/W: Remote interrupt mask */
+#define FSI_SRSIM4 0x74 /* R/W: Remote interrupt mask */
+#define FSI_SRSIS0 0x78 /* R : Remote interrupt status */
+#define FSI_SRSIS4 0x7c /* R : Remote interrupt status */
+#define FSI_LLMODE 0x100 /* R/W: Link layer mode register */
+
+/*
+ * SMODE fields
+ */
+#define FSI_SMODE_WSC 0x80000000 /* Warm start done */
+#define FSI_SMODE_ECRC 0x20000000 /* Hw CRC check */
+#define FSI_SMODE_SID_SHIFT 24 /* ID shift */
+#define FSI_SMODE_SID_MASK 3 /* ID Mask */
+#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */
+#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */
+#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */
+#define FSI_SMODE_SD_MASK 0xf /* Send delay mask */
+#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */
+#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */
+
+/*
+ * SISS fields
+ */
+#define FSI_SISS_CRC_ERROR BIT(31)
+#define FSI_SISS_PROTO_ERROR BIT(30)
+#define FSI_SISS_LBUS_PARITY_ERROR BIT(29)
+#define FSI_SISS_LBUS_PROTO_ERROR BIT(28)
+#define FSI_SISS_ACCESS_ERROR BIT(27)
+#define FSI_SISS_LBUS_OWNERSHIP_ERROR BIT(26)
+#define FSI_SISS_LBUS_OWNERSHIP_CHANGE BIT(25)
+#define FSI_SISS_ASYNC_MODE_ERROR BIT(14)
+#define FSI_SISS_OPB_ACCESS_ERROR BIT(13)
+#define FSI_SISS_OPB_FENCED BIT(12)
+#define FSI_SISS_OPB_PARITY_ERROR BIT(11)
+#define FSI_SISS_OPB_PROTO_ERROR BIT(10)
+#define FSI_SISS_OPB_TIMEOUT BIT(9)
+#define FSI_SISS_OPB_ERROR_ACK BIT(8)
+#define FSI_SISS_MFSI_MASTER_ERROR BIT(3)
+#define FSI_SISS_MFSI_PORT_ERROR BIT(2)
+#define FSI_SISS_MFSI_HP BIT(1)
+#define FSI_SISS_MFSI_CR_PARITY_ERROR BIT(0)
+#define FSI_SISS_ALL 0xfe007f00
+
+/*
+ * SI1S fields
+ */
+#define FSI_SI1S_SLAVE_BIT 31
+#define FSI_SI1S_SHIFT_BIT 30
+#define FSI_SI1S_SCOM_BIT 29
+#define FSI_SI1S_SCRATCH_BIT 28
+#define FSI_SI1S_I2C_BIT 27
+#define FSI_SI1S_SPI_BIT 26
+#define FSI_SI1S_SBEFIFO_BIT 25
+#define FSI_SI1S_MBOX_BIT 24
+
+/*
+ * SLBUS fields
+ */
+#define FSI_SLBUS_FORCE 0x80000000 /* Force LBUS ownership */
+
+/*
+ * LLMODE fields
+ */
+#define FSI_LLMODE_ASYNC 0x1
+
struct fsi_master;
struct fsi_slave {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/15] fsi: Fix slave addressing after break command
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
2024-09-17 17:16 ` [PATCH 01/15] fsi: hub: Set master index to link number plus one Eddie James
2024-09-17 17:16 ` [PATCH 02/15] fsi: Move slave definitions to fsi-slave.h Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 04/15] fsi: core: Use a defined value for default echo delay Eddie James
` (11 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
After a break command, the slave ID is set to 0x3, which means the
FSI driver should use that ID when communicating with the slave, until
SMODE is programmed with the new ID (forced to 0 for 23 bit addressing in
the current implementation). This worked previously due to a feature of
newer FSI slaves that don't enforce this requirement. Since hub masters
and I2C responders cannot address non-zero slave IDs, disable this
behavior for slaves off those masters.
Fixes: 2b545cd8e1b2 ("drivers/fsi: Implement slave initialisation")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 20 ++++++++++----------
drivers/fsi/fsi-master-hub.c | 1 +
drivers/fsi/fsi-master-i2cr.c | 1 +
drivers/fsi/fsi-master.h | 1 +
drivers/fsi/fsi-slave.h | 1 +
5 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index b50ed849f924..788b721a7d60 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -217,7 +217,7 @@ static uint32_t fsi_slave_smode(int id, u8 t_senddly, u8 t_echodly)
| fsi_smode_lbcrr(0x8);
}
-static int fsi_slave_set_smode(struct fsi_slave *slave)
+static int fsi_slave_set_smode(struct fsi_slave *slave, uint8_t id)
{
uint32_t smode;
__be32 data;
@@ -228,8 +228,7 @@ static int fsi_slave_set_smode(struct fsi_slave *slave)
smode = fsi_slave_smode(slave->id, slave->t_send_delay, slave->t_echo_delay);
data = cpu_to_be32(smode);
- return fsi_master_write(slave->master, slave->link, slave->id,
- FSI_SLAVE_BASE + FSI_SMODE,
+ return fsi_master_write(slave->master, slave->link, id, FSI_SLAVE_BASE + FSI_SMODE,
&data, sizeof(data));
}
@@ -281,7 +280,7 @@ static int fsi_slave_handle_error(struct fsi_slave *slave, bool write,
slave->t_send_delay = send_delay;
slave->t_echo_delay = echo_delay;
- rc = fsi_slave_set_smode(slave);
+ rc = fsi_slave_set_smode(slave, FSI_SMODE_SID_BREAK);
if (rc)
return rc;
@@ -773,7 +772,7 @@ static ssize_t slave_send_echo_store(struct device *dev,
slave->t_send_delay = val;
slave->t_echo_delay = val;
- rc = fsi_slave_set_smode(slave);
+ rc = fsi_slave_set_smode(slave, slave->id);
if (rc < 0)
return rc;
if (master->link_config)
@@ -945,6 +944,8 @@ EXPORT_SYMBOL_GPL(fsi_free_minor);
static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
{
+ const uint8_t break_id = (master->flags & FSI_MASTER_FLAG_NO_BREAK_SID) ? 0 :
+ FSI_SMODE_SID_BREAK;
uint32_t cfam_id;
struct fsi_slave *slave;
uint8_t crc;
@@ -957,7 +958,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
if (id != 0)
return -EINVAL;
- rc = fsi_master_read(master, link, id, 0, &data, sizeof(data));
+ rc = fsi_master_read(master, link, break_id, 0, &data, sizeof(data));
if (rc) {
dev_dbg(&master->dev, "can't read slave %02x:%02x %d\n",
link, id, rc);
@@ -981,9 +982,8 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
*/
if (master->flags & FSI_MASTER_FLAG_SWCLOCK) {
llmode = cpu_to_be32(FSI_LLMODE_ASYNC);
- rc = fsi_master_write(master, link, id,
- FSI_SLAVE_BASE + FSI_LLMODE,
- &llmode, sizeof(llmode));
+ rc = fsi_master_write(master, link, break_id, FSI_SLAVE_BASE + FSI_LLMODE, &llmode,
+ sizeof(llmode));
if (rc)
dev_warn(&master->dev,
"can't set llmode on slave:%02x:%02x %d\n",
@@ -1028,7 +1028,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
"can't set slbus on slave:%02x:%02x %d\n", link, id,
rc);
- rc = fsi_slave_set_smode(slave);
+ rc = fsi_slave_set_smode(slave, break_id);
if (rc) {
dev_warn(&master->dev,
"can't set smode on slave:%02x:%02x %d\n",
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 3bfd0cea6f77..40a288b7342b 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -232,6 +232,7 @@ static int hub_master_probe(struct device *dev)
hub->master.idx = fsi_dev->slave->link + 1;
hub->master.n_links = links;
+ hub->master.flags = FSI_MASTER_FLAG_NO_BREAK_SID;
hub->master.read = hub_master_read;
hub->master.write = hub_master_write;
hub->master.send_break = hub_master_break;
diff --git a/drivers/fsi/fsi-master-i2cr.c b/drivers/fsi/fsi-master-i2cr.c
index 40f1f4d231e5..61e55740946b 100644
--- a/drivers/fsi/fsi-master-i2cr.c
+++ b/drivers/fsi/fsi-master-i2cr.c
@@ -273,6 +273,7 @@ static int i2cr_probe(struct i2c_client *client)
i2cr->master.dev.release = i2cr_release;
i2cr->master.n_links = 1;
+ i2cr->master.flags = FSI_MASTER_FLAG_NO_BREAK_SID;
i2cr->master.read = i2cr_read;
i2cr->master.write = i2cr_write;
diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h
index 967622c1cabf..a0d7ad0f0f7c 100644
--- a/drivers/fsi/fsi-master.h
+++ b/drivers/fsi/fsi-master.h
@@ -111,6 +111,7 @@
/* fsi-master definition and flags */
#define FSI_MASTER_FLAG_SWCLOCK 0x1
+#define FSI_MASTER_FLAG_NO_BREAK_SID 0x2
/*
* Structures and function prototypes
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index dba65bd4e083..f6cca04131a9 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -39,6 +39,7 @@
#define FSI_SMODE_ECRC 0x20000000 /* Hw CRC check */
#define FSI_SMODE_SID_SHIFT 24 /* ID shift */
#define FSI_SMODE_SID_MASK 3 /* ID Mask */
+#define FSI_SMODE_SID_BREAK 3 /* ID after break command */
#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */
#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */
#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/15] fsi: core: Use a defined value for default echo delay
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (2 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 03/15] fsi: Fix slave addressing after break command Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 05/15] fsi: core: Calculate local bus clock frequency Eddie James
` (10 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Avoid hardcoding '16' several times.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 6 +++---
drivers/fsi/fsi-slave.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 788b721a7d60..3ddf518c6a19 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1008,8 +1008,8 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
slave->link = link;
slave->id = id;
slave->size = FSI_SLAVE_SIZE_23b;
- slave->t_send_delay = 16;
- slave->t_echo_delay = 16;
+ slave->t_send_delay = FSI_SMODE_SD_DEFAULT;
+ slave->t_echo_delay = FSI_SMODE_ED_DEFAULT;
/* Get chip ID if any */
slave->chip_id = -1;
@@ -1160,7 +1160,7 @@ static int fsi_master_break(struct fsi_master *master, int link)
if (master->send_break)
rc = master->send_break(master, link);
if (master->link_config)
- master->link_config(master, link, 16, 16);
+ master->link_config(master, link, FSI_SMODE_SD_DEFAULT, FSI_SMODE_ED_DEFAULT);
return rc;
}
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index f6cca04131a9..45190b06fa02 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -42,8 +42,10 @@
#define FSI_SMODE_SID_BREAK 3 /* ID after break command */
#define FSI_SMODE_ED_SHIFT 20 /* Echo delay shift */
#define FSI_SMODE_ED_MASK 0xf /* Echo delay mask */
+#define FSI_SMODE_ED_DEFAULT 16 /* Default echo delay */
#define FSI_SMODE_SD_SHIFT 16 /* Send delay shift */
#define FSI_SMODE_SD_MASK 0xf /* Send delay mask */
+#define FSI_SMODE_SD_DEFAULT 16 /* Default send delay */
#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */
#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/15] fsi: core: Calculate local bus clock frequency
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (3 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 04/15] fsi: core: Use a defined value for default echo delay Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 06/15] fsi: core: Improve master read/write/error traces Eddie James
` (9 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Instead of a hardcoded local bus clock divider, calculate the responder
local bus frequency from the FSI bus frequency. This will allow FSI
engine drivers to set and calculate their bus (I2C, SPI, etc) frequencies.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 22 +++++++++++++++++++---
drivers/fsi/fsi-master.h | 1 +
drivers/fsi/fsi-slave.h | 2 ++
include/linux/fsi.h | 1 +
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 3ddf518c6a19..1abbde4a9783 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -109,6 +109,12 @@ int fsi_device_peek(struct fsi_device *dev, void *val)
return fsi_slave_read(dev->slave, addr, val, sizeof(uint32_t));
}
+unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev)
+{
+ return dev->slave->master->clock_frequency / dev->slave->clock_div;
+}
+EXPORT_SYMBOL_GPL(fsi_device_local_bus_frequency);
+
static void fsi_device_release(struct device *_device)
{
struct fsi_device *device = to_fsi_dev(_device);
@@ -209,12 +215,12 @@ static inline uint32_t fsi_smode_sid(int x)
return (x & FSI_SMODE_SID_MASK) << FSI_SMODE_SID_SHIFT;
}
-static uint32_t fsi_slave_smode(int id, u8 t_senddly, u8 t_echodly)
+static uint32_t fsi_slave_smode(int id, int div, u8 t_senddly, u8 t_echodly)
{
return FSI_SMODE_WSC | FSI_SMODE_ECRC
| fsi_smode_sid(id)
| fsi_smode_echodly(t_echodly - 1) | fsi_smode_senddly(t_senddly - 1)
- | fsi_smode_lbcrr(0x8);
+ | fsi_smode_lbcrr(div - 1);
}
static int fsi_slave_set_smode(struct fsi_slave *slave, uint8_t id)
@@ -225,7 +231,8 @@ static int fsi_slave_set_smode(struct fsi_slave *slave, uint8_t id)
/* set our smode register with the slave ID field to 0; this enables
* extended slave addressing
*/
- smode = fsi_slave_smode(slave->id, slave->t_send_delay, slave->t_echo_delay);
+ smode = fsi_slave_smode(slave->id, slave->clock_div, slave->t_send_delay,
+ slave->t_echo_delay);
data = cpu_to_be32(smode);
return fsi_master_write(slave->master, slave->link, id, FSI_SLAVE_BASE + FSI_SMODE,
@@ -950,6 +957,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
struct fsi_slave *slave;
uint8_t crc;
__be32 data, llmode, slbus;
+ u32 clock;
int rc;
/* Currently, we only support single slaves on a link, and use the
@@ -1003,6 +1011,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
slave->dev.of_node = fsi_slave_find_of_node(master, link, id);
slave->dev.release = fsi_slave_release;
device_initialize(&slave->dev);
+ slave->clock_div = FSI_SMODE_LBCRR_DEFAULT;
slave->cfam_id = cfam_id;
slave->master = master;
slave->link = link;
@@ -1020,6 +1029,10 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
}
+ if (master->clock_frequency && !device_property_read_u32(&slave->dev, "clock-frequency",
+ &clock) && clock)
+ slave->clock_div = DIV_ROUND_UP(master->clock_frequency, clock);
+
slbus = cpu_to_be32(FSI_SLBUS_FORCE);
rc = fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SLBUS,
&slbus, sizeof(slbus));
@@ -1289,6 +1302,9 @@ int fsi_master_register(struct fsi_master *master)
if (!dev_name(&master->dev))
dev_set_name(&master->dev, "fsi%d", master->idx);
+ if (master->flags & FSI_MASTER_FLAG_SWCLOCK)
+ master->clock_frequency = 100000000; // POWER reference clock
+
master->dev.class = &fsi_master_class;
mutex_lock(&master->scan_lock);
diff --git a/drivers/fsi/fsi-master.h b/drivers/fsi/fsi-master.h
index a0d7ad0f0f7c..ff23983ea84c 100644
--- a/drivers/fsi/fsi-master.h
+++ b/drivers/fsi/fsi-master.h
@@ -121,6 +121,7 @@
struct fsi_master {
struct device dev;
+ unsigned long clock_frequency;
int idx;
int n_links;
int flags;
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index 45190b06fa02..fabc0b66d5bf 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -48,6 +48,7 @@
#define FSI_SMODE_SD_DEFAULT 16 /* Default send delay */
#define FSI_SMODE_LBCRR_SHIFT 8 /* Clk ratio shift */
#define FSI_SMODE_LBCRR_MASK 0xf /* Clk ratio mask */
+#define FSI_SMODE_LBCRR_DEFAULT 2 /* Default clk ratio */
/*
* SISS fields
@@ -104,6 +105,7 @@ struct fsi_slave {
int id; /* FSI address */
int link; /* FSI link# */
u32 cfam_id;
+ u32 clock_div;
int chip_id;
uint32_t size; /* size of slave address space */
u8 t_send_delay;
diff --git a/include/linux/fsi.h b/include/linux/fsi.h
index 8c5eef808788..bf27b50652a5 100644
--- a/include/linux/fsi.h
+++ b/include/linux/fsi.h
@@ -24,6 +24,7 @@ extern int fsi_device_read(struct fsi_device *dev, uint32_t addr,
extern int fsi_device_write(struct fsi_device *dev, uint32_t addr,
const void *val, size_t size);
extern int fsi_device_peek(struct fsi_device *dev, void *val);
+extern unsigned long fsi_device_local_bus_frequency(struct fsi_device *dev);
struct fsi_device_id {
u8 engine_type;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/15] fsi: core: Improve master read/write/error traces
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (4 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 05/15] fsi: core: Calculate local bus clock frequency Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 07/15] fsi: core: Add slave error trace Eddie James
` (8 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Consolidate the master read and write traces into one trace and
change the result trace into an error trace for less spam.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 26 +++++----
include/trace/events/fsi.h | 112 ++++++++++++-------------------------
2 files changed, 51 insertions(+), 87 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 1abbde4a9783..5200078af8fd 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1116,14 +1116,15 @@ static int fsi_master_read(struct fsi_master *master, int link,
{
int rc;
- trace_fsi_master_read(master, link, slave_id, addr, size);
-
rc = fsi_check_access(addr, size);
- if (!rc)
+ if (!rc) {
rc = master->read(master, link, slave_id, addr, val, size);
-
- trace_fsi_master_rw_result(master, link, slave_id, addr, size,
- false, val, rc);
+ if (rc)
+ trace_fsi_master_error(master->idx, link, slave_id, addr, size, val, rc,
+ true);
+ else
+ trace_fsi_master_xfer(master->idx, link, slave_id, addr, size, val, true);
+ }
return rc;
}
@@ -1133,14 +1134,15 @@ static int fsi_master_write(struct fsi_master *master, int link,
{
int rc;
- trace_fsi_master_write(master, link, slave_id, addr, size, val);
-
rc = fsi_check_access(addr, size);
- if (!rc)
+ if (!rc) {
rc = master->write(master, link, slave_id, addr, val, size);
-
- trace_fsi_master_rw_result(master, link, slave_id, addr, size,
- true, val, rc);
+ if (rc)
+ trace_fsi_master_error(master->idx, link, slave_id, addr, size, val, rc,
+ false);
+ else
+ trace_fsi_master_xfer(master->idx, link, slave_id, addr, size, val, false);
+ }
return rc;
}
diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h
index 5ff15126ad9d..fed8835f438e 100644
--- a/include/trace/events/fsi.h
+++ b/include/trace/events/fsi.h
@@ -8,101 +8,63 @@
#include <linux/tracepoint.h>
-TRACE_EVENT(fsi_master_read,
- TP_PROTO(const struct fsi_master *master, int link, int id,
- uint32_t addr, size_t size),
- TP_ARGS(master, link, id, addr, size),
+TRACE_EVENT(fsi_master_xfer,
+ TP_PROTO(int master_idx, int link, int id, uint32_t addr, size_t size, const void *data,
+ bool read),
+ TP_ARGS(master_idx, link, id, addr, size, data, read),
TP_STRUCT__entry(
- __field(int, master_idx)
- __field(int, link)
- __field(int, id)
- __field(__u32, addr)
- __field(size_t, size)
+ __field(int, master_idx)
+ __field(int, link)
+ __field(int, id)
+ __field(uint32_t, addr)
+ __field(int, size)
+ __field(uint32_t, data)
+ __field(bool, read)
),
TP_fast_assign(
- __entry->master_idx = master->idx;
+ __entry->master_idx = master_idx;
__entry->link = link;
__entry->id = id;
__entry->addr = addr;
- __entry->size = size;
- ),
- TP_printk("fsi%d:%02d:%02d %08x[%zu]",
- __entry->master_idx,
- __entry->link,
- __entry->id,
- __entry->addr,
- __entry->size
- )
-);
-
-TRACE_EVENT(fsi_master_write,
- TP_PROTO(const struct fsi_master *master, int link, int id,
- uint32_t addr, size_t size, const void *data),
- TP_ARGS(master, link, id, addr, size, data),
- TP_STRUCT__entry(
- __field(int, master_idx)
- __field(int, link)
- __field(int, id)
- __field(__u32, addr)
- __field(size_t, size)
- __field(__u32, data)
- ),
- TP_fast_assign(
- __entry->master_idx = master->idx;
- __entry->link = link;
- __entry->id = id;
- __entry->addr = addr;
- __entry->size = size;
+ __entry->size = (int)size;
__entry->data = 0;
memcpy(&__entry->data, data, size);
+ __entry->read = read;
),
- TP_printk("fsi%d:%02d:%02d %08x[%zu] <= {%*ph}",
- __entry->master_idx,
- __entry->link,
- __entry->id,
- __entry->addr,
- __entry->size,
- (int)__entry->size, &__entry->data
- )
+ TP_printk("fsi%d:%02d:%02d %s %08x {%*ph}", __entry->master_idx, __entry->link,
+ __entry->id, __entry->read ? "read" : "write", __entry->addr, __entry->size,
+ &__entry->data)
);
-TRACE_EVENT(fsi_master_rw_result,
- TP_PROTO(const struct fsi_master *master, int link, int id,
- uint32_t addr, size_t size,
- bool write, const void *data, int ret),
- TP_ARGS(master, link, id, addr, size, write, data, ret),
+TRACE_EVENT(fsi_master_error,
+ TP_PROTO(int master_idx, int link, int id, uint32_t addr, size_t size, const void *data,
+ int ret, bool read),
+ TP_ARGS(master_idx, link, id, addr, size, data, ret, read),
TP_STRUCT__entry(
- __field(int, master_idx)
- __field(int, link)
- __field(int, id)
- __field(__u32, addr)
- __field(size_t, size)
- __field(bool, write)
- __field(__u32, data)
- __field(int, ret)
+ __field(int, master_idx)
+ __field(int, link)
+ __field(int, id)
+ __field(uint32_t, addr)
+ __field(int, size)
+ __field(uint32_t, data)
+ __field(int, ret)
+ __field(bool, read)
),
TP_fast_assign(
- __entry->master_idx = master->idx;
+ __entry->master_idx = master_idx;
__entry->link = link;
__entry->id = id;
__entry->addr = addr;
- __entry->size = size;
- __entry->write = write;
+ __entry->size = (int)size;
__entry->data = 0;
- __entry->ret = ret;
- if (__entry->write || !__entry->ret)
+ if (!read)
memcpy(&__entry->data, data, size);
+ __entry->ret = ret;
+ __entry->read = read;
),
- TP_printk("fsi%d:%02d:%02d %08x[%zu] %s {%*ph} ret %d",
- __entry->master_idx,
- __entry->link,
- __entry->id,
- __entry->addr,
- __entry->size,
- __entry->write ? "<=" : "=>",
- (int)__entry->size, &__entry->data,
- __entry->ret
- )
+ TP_printk("fsi%d:%02d:%02d %s %08x {%*ph} %d", __entry->master_idx, __entry->link,
+ __entry->id, __entry->read ? "read" : "write", __entry->addr, __entry->size,
+ &__entry->data, __entry->ret)
);
TRACE_EVENT(fsi_master_break,
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/15] fsi: core: Add slave error trace
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (5 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 06/15] fsi: core: Improve master read/write/error traces Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 08/15] fsi: core: Reset errors instead of clearing interrupts Eddie James
` (7 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Trace out the FSI slave status and interrupt status.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 1 +
include/trace/events/fsi.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 5200078af8fd..8ce187bbaf22 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -185,6 +185,7 @@ static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave)
dev_dbg(&slave->dev, "status: 0x%08x, sisc: 0x%08x\n",
be32_to_cpu(stat), be32_to_cpu(irq));
+ trace_fsi_slave_error(slave, be32_to_cpu(irq), be32_to_cpu(stat));
/* clear interrupts */
return fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SISC,
diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h
index fed8835f438e..5509afc98ee8 100644
--- a/include/trace/events/fsi.h
+++ b/include/trace/events/fsi.h
@@ -115,6 +115,25 @@ TRACE_EVENT(fsi_master_unregister,
TP_printk("fsi%d (%d links)", __entry->master_idx, __entry->n_links)
);
+TRACE_EVENT(fsi_slave_error,
+ TP_PROTO(const struct fsi_slave *slave, uint32_t sisc, uint32_t sstat),
+ TP_ARGS(slave, sisc, sstat),
+ TP_STRUCT__entry(
+ __field(int, master_idx)
+ __field(int, link)
+ __field(uint32_t, sisc)
+ __field(uint32_t, sstat)
+ ),
+ TP_fast_assign(
+ __entry->master_idx = slave->master->idx;
+ __entry->link = slave->link;
+ __entry->sisc = sisc;
+ __entry->sstat = sstat;
+ ),
+ TP_printk("fsi%d:%02d sisc:%08x sstat:%08x", __entry->master_idx, __entry->link,
+ __entry->sisc, __entry->sstat)
+);
+
TRACE_EVENT(fsi_slave_init,
TP_PROTO(const struct fsi_slave *slave),
TP_ARGS(slave),
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/15] fsi: core: Reset errors instead of clearing interrupts
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (6 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 07/15] fsi: core: Add slave error trace Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 09/15] fsi: core: Add slave spinlock Eddie James
` (6 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
The proper way to clear error conditions is to use the SRES
register rather than simple clearing SISC.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 9 +++++----
drivers/fsi/fsi-slave.h | 6 ++++++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 8ce187bbaf22..53d61ea46a4f 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -166,7 +166,7 @@ static int fsi_slave_calc_addr(struct fsi_slave *slave, uint32_t *addrp,
static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave)
{
struct fsi_master *master = slave->master;
- __be32 irq, stat;
+ __be32 irq, reset, stat;
int rc, link;
uint8_t id;
@@ -187,9 +187,10 @@ static int fsi_slave_report_and_clear_errors(struct fsi_slave *slave)
be32_to_cpu(stat), be32_to_cpu(irq));
trace_fsi_slave_error(slave, be32_to_cpu(irq), be32_to_cpu(stat));
- /* clear interrupts */
- return fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SISC,
- &irq, sizeof(irq));
+ /* reset errors */
+ reset = cpu_to_be32(FSI_SRES_ERRS);
+ return fsi_master_write(master, link, id, FSI_SLAVE_BASE + FSI_SRES, &reset,
+ sizeof(reset));
}
/* Encode slave local bus echo delay */
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index fabc0b66d5bf..e9fd4be6f376 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -24,6 +24,7 @@
#define FSI_SSI1M 0x1c /* S : Set slave interrupt 1 mask */
#define FSI_SCI1M 0x20 /* C : Clear slave interrupt 1 mask */
#define FSI_SLBUS 0x30 /* W : LBUS Ownership */
+#define FSI_SRES 0x34 /* W : Reset */
#define FSI_SRSIC0 0x68 /* C : Clear remote interrupt condition */
#define FSI_SRSIC4 0x6c /* C : Clear remote interrupt condition */
#define FSI_SRSIM0 0x70 /* R/W: Remote interrupt mask */
@@ -90,6 +91,11 @@
*/
#define FSI_SLBUS_FORCE 0x80000000 /* Force LBUS ownership */
+/*
+ * SRES fields
+ */
+#define FSI_SRES_ERRS 0x40000000 /* Reset FSI slave errors */
+
/*
* LLMODE fields
*/
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/15] fsi: core: Add slave spinlock
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (7 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 08/15] fsi: core: Reset errors instead of clearing interrupts Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 10/15] fsi: core: Allow cfam device type aliases Eddie James
` (5 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
FSI slave operations were not locked, meaning that during slave
error recovery operations, other slave accesses may take place,
resulting in incorrect recovery and additional errors. Make the
slave access and error recovery atomic with a spinlock. Don't
use a mutex for future interrupt handling support.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 7 +++++++
drivers/fsi/fsi-slave.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 53d61ea46a4f..eea5bbdb00b6 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -304,6 +304,7 @@ static int fsi_slave_handle_error(struct fsi_slave *slave, bool write,
int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
void *val, size_t size)
{
+ unsigned long flags;
uint8_t id = slave->id;
int rc, err_rc, i;
@@ -311,6 +312,7 @@ int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
if (rc)
return rc;
+ spin_lock_irqsave(&slave->lock, flags);
for (i = 0; i < slave_retries; i++) {
rc = fsi_master_read(slave->master, slave->link,
id, addr, val, size);
@@ -321,6 +323,7 @@ int fsi_slave_read(struct fsi_slave *slave, uint32_t addr,
if (err_rc)
break;
}
+ spin_unlock_irqrestore(&slave->lock, flags);
return rc;
}
@@ -329,6 +332,7 @@ EXPORT_SYMBOL_GPL(fsi_slave_read);
int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
const void *val, size_t size)
{
+ unsigned long flags;
uint8_t id = slave->id;
int rc, err_rc, i;
@@ -336,6 +340,7 @@ int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
if (rc)
return rc;
+ spin_lock_irqsave(&slave->lock, flags);
for (i = 0; i < slave_retries; i++) {
rc = fsi_master_write(slave->master, slave->link,
id, addr, val, size);
@@ -346,6 +351,7 @@ int fsi_slave_write(struct fsi_slave *slave, uint32_t addr,
if (err_rc)
break;
}
+ spin_unlock_irqrestore(&slave->lock, flags);
return rc;
}
@@ -1007,6 +1013,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
if (!slave)
return -ENOMEM;
+ spin_lock_init(&slave->lock);
dev_set_name(&slave->dev, "slave@%02x:%02x", link, id);
slave->dev.type = &cfam_type;
slave->dev.parent = &master->dev;
diff --git a/drivers/fsi/fsi-slave.h b/drivers/fsi/fsi-slave.h
index e9fd4be6f376..0468ec1c60db 100644
--- a/drivers/fsi/fsi-slave.h
+++ b/drivers/fsi/fsi-slave.h
@@ -6,6 +6,7 @@
#include <linux/cdev.h>
#include <linux/device.h>
+#include <linux/spinlock.h>
#define FSI_SLAVE_BASE 0x800
@@ -107,6 +108,7 @@ struct fsi_slave {
struct device dev;
struct fsi_master *master;
struct cdev cdev;
+ spinlock_t lock; /* atomic access and error recovery */
int cdev_idx;
int id; /* FSI address */
int link; /* FSI link# */
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/15] fsi: core: Allow cfam device type aliases
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (8 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 09/15] fsi: core: Add slave spinlock Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 11/15] fsi: scom: Update compatible string to match documentation Eddie James
` (4 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Other FSI devices can uses aliases for the device numbering, so
modify the function to get a new minor to allow the cfam type
to use aliases too.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 59 +++++++++++++++++++++---------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index eea5bbdb00b6..7e73dd035b4e 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -884,12 +884,37 @@ static int fsi_adjust_index(int index)
#endif
}
-static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type,
- dev_t *out_dev, int *out_index)
+static const char *const fsi_dev_type_names[] = {
+ "cfam",
+ "sbefifo",
+ "scom",
+ "occ",
+};
+
+static int __fsi_get_new_minor(struct fsi_slave *slave, struct device_node *np,
+ enum fsi_dev_type type, dev_t *out_dev, int *out_index)
{
int cid = slave->chip_id;
int id;
+ if (np && type < 4) {
+ int aid = of_alias_get_id(np, fsi_dev_type_names[type]);
+
+ if (aid >= 0) {
+ /* Use the same scheme as the legacy numbers. */
+ id = (aid << 2) | type;
+ id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL);
+ if (id >= 0) {
+ *out_index = aid;
+ *out_dev = fsi_base_dev + id;
+ return 0;
+ }
+
+ if (id != -ENOSPC)
+ return id;
+ }
+ }
+
/* Check if we qualify for legacy numbering */
if (cid >= 0 && cid < 16 && type < 4) {
/*
@@ -918,36 +943,10 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type,
return 0;
}
-static const char *const fsi_dev_type_names[] = {
- "cfam",
- "sbefifo",
- "scom",
- "occ",
-};
-
int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type,
dev_t *out_dev, int *out_index)
{
- if (fdev->dev.of_node) {
- int aid = of_alias_get_id(fdev->dev.of_node, fsi_dev_type_names[type]);
-
- if (aid >= 0) {
- /* Use the same scheme as the legacy numbers. */
- int id = (aid << 2) | type;
-
- id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL);
- if (id >= 0) {
- *out_index = aid;
- *out_dev = fsi_base_dev + id;
- return 0;
- }
-
- if (id != -ENOSPC)
- return id;
- }
- }
-
- return __fsi_get_new_minor(fdev->slave, type, out_dev, out_index);
+ return __fsi_get_new_minor(fdev->slave, fdev->dev.of_node, type, out_dev, out_index);
}
EXPORT_SYMBOL_GPL(fsi_get_new_minor);
@@ -1059,7 +1058,7 @@ static int fsi_slave_init(struct fsi_master *master, int link, uint8_t id)
}
/* Allocate a minor in the FSI space */
- rc = __fsi_get_new_minor(slave, fsi_dev_cfam, &slave->dev.devt,
+ rc = __fsi_get_new_minor(slave, slave->dev.of_node, fsi_dev_cfam, &slave->dev.devt,
&slave->cdev_idx);
if (rc)
goto err_free;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/15] fsi: scom: Update compatible string to match documentation
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (9 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 10/15] fsi: core: Allow cfam device type aliases Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
` (3 subsequent siblings)
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Use p9-scom instead of fsi2pib.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Ninad Palsule <ninad@linux.ibm.com>
---
drivers/fsi/fsi-scom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 411ddc018cd8..8f27bccb8746 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -590,6 +590,7 @@ static int scom_remove(struct device *dev)
static const struct of_device_id scom_of_ids[] = {
{ .compatible = "ibm,fsi2pib" },
+ { .compatible = "ibm,p9-scom" },
{ }
};
MODULE_DEVICE_TABLE(of, scom_of_ids);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (10 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 11/15] fsi: scom: Update compatible string to match documentation Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-20 11:50 ` kernel test robot
` (2 more replies)
2024-09-17 17:16 ` [PATCH 13/15] fsi: occ: Find next available child rather than node name match Eddie James
` (2 subsequent siblings)
14 siblings, 3 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Remove the IDA indexing for OCC devices and instead use the FSI
minor number API. This will make the OCC numbering consistent
with other FSI engines and make the "reg" device tree property
unnecessary.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Ninad Palsule <ninad@linux.ibm.com>
---
drivers/fsi/fsi-occ.c | 48 ++++++++++---------------------------------
1 file changed, 11 insertions(+), 37 deletions(-)
diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index f58b158d097c..11e090da0590 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -4,9 +4,9 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/fsi.h>
#include <linux/fsi-sbefifo.h>
#include <linux/gfp.h>
-#include <linux/idr.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
@@ -44,6 +44,7 @@ struct occ {
struct device *sbefifo;
char name[32];
int idx;
+ dev_t devt;
bool platform_hwmon;
u8 sequence_number;
void *buffer;
@@ -75,8 +76,6 @@ struct occ_client {
#define to_client(x) container_of((x), struct occ_client, xfr)
-static DEFINE_IDA(occ_ida);
-
static int occ_open(struct inode *inode, struct file *file)
{
struct occ_client *client = kzalloc(sizeof(*client), GFP_KERNEL);
@@ -622,7 +621,6 @@ static int occ_unregister_of_child(struct device *dev, void *data)
static int occ_probe(struct platform_device *pdev)
{
int rc;
- u32 reg;
char child_name[32];
struct occ *occ;
struct platform_device *hwmon_dev = NULL;
@@ -637,6 +635,10 @@ static int occ_probe(struct platform_device *pdev)
if (!occ)
return -ENOMEM;
+ rc = fsi_get_new_minor(to_fsi_dev(dev->parent), fsi_dev_occ, &occ->devt, &occ->idx);
+ if (rc)
+ return rc;
+
/* SBE words are always four bytes */
occ->buffer = kvmalloc(OCC_MAX_RESP_WORDS * 4, GFP_KERNEL);
if (!occ->buffer)
@@ -651,23 +653,6 @@ static int occ_probe(struct platform_device *pdev)
*/
occ->sequence_number = (u8)((jiffies % 0xff) + 1);
mutex_init(&occ->occ_lock);
-
- if (dev->of_node) {
- rc = of_property_read_u32(dev->of_node, "reg", ®);
- if (!rc) {
- /* make sure we don't have a duplicate from dts */
- occ->idx = ida_alloc_range(&occ_ida, reg, reg,
- GFP_KERNEL);
- if (occ->idx < 0)
- occ->idx = ida_alloc_min(&occ_ida, 1,
- GFP_KERNEL);
- } else {
- occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL);
- }
- } else {
- occ->idx = ida_alloc_min(&occ_ida, 1, GFP_KERNEL);
- }
-
platform_set_drvdata(pdev, occ);
snprintf(occ->name, sizeof(occ->name), "occ%d", occ->idx);
@@ -679,7 +664,7 @@ static int occ_probe(struct platform_device *pdev)
rc = misc_register(&occ->mdev);
if (rc) {
dev_err(dev, "failed to register miscdevice: %d\n", rc);
- ida_free(&occ_ida, occ->idx);
+ fsi_free_minor(occ->devt);
kvfree(occ->buffer);
return rc;
}
@@ -718,7 +703,9 @@ static void occ_remove(struct platform_device *pdev)
else
device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);
- ida_free(&occ_ida, occ->idx);
+ fsi_free_minor(occ->devt);
+
+ return 0;
}
static const struct of_device_id occ_match[] = {
@@ -743,20 +730,7 @@ static struct platform_driver occ_driver = {
.remove_new = occ_remove,
};
-static int occ_init(void)
-{
- return platform_driver_register(&occ_driver);
-}
-
-static void occ_exit(void)
-{
- platform_driver_unregister(&occ_driver);
-
- ida_destroy(&occ_ida);
-}
-
-module_init(occ_init);
-module_exit(occ_exit);
+module_platform_driver(occ_driver);
MODULE_AUTHOR("Eddie James <eajames@linux.ibm.com>");
MODULE_DESCRIPTION("BMC P9 OCC driver");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 13/15] fsi: occ: Find next available child rather than node name match
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (11 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 14/15] fsi: sbefifo: Prevent async FFDC collection for Odyssey SBEFIFOs Eddie James
2024-09-17 17:16 ` [PATCH 15/15] fsi: i2cr: Reduce status checks for read operations Eddie James
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
There's no reason to restrict the creation of the hwmon device to
a matching child node name. Just get the first available one. There
should only be one child node anyway.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Ninad Palsule <ninad@linux.ibm.com>
---
drivers/fsi/fsi-occ.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index 11e090da0590..d3feba43c029 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -669,7 +669,7 @@ static int occ_probe(struct platform_device *pdev)
return rc;
}
- hwmon_node = of_get_child_by_name(dev->of_node, hwmon_dev_info.name);
+ hwmon_node = of_get_next_available_child(dev->of_node, NULL);
if (hwmon_node) {
snprintf(child_name, sizeof(child_name), "%s.%d", hwmon_dev_info.name, occ->idx);
hwmon_dev = of_platform_device_create(hwmon_node, child_name, dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 14/15] fsi: sbefifo: Prevent async FFDC collection for Odyssey SBEFIFOs
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (12 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 13/15] fsi: occ: Find next available child rather than node name match Eddie James
@ 2024-09-17 17:16 ` Eddie James
2024-09-17 17:16 ` [PATCH 15/15] fsi: i2cr: Reduce status checks for read operations Eddie James
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
Newer SBEs will return any async FFDC in the next transaction, so
collecting the FFDC is unnecessary and results in unexpected behavior.
Turn off the async collection for newer SBEFIFOs.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-sbefifo.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 0385476bfb03..b8add20e05ec 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -125,6 +125,7 @@ struct sbefifo {
struct mutex lock;
bool broken;
bool dead;
+ bool need_async;
bool async_ffdc;
bool timed_out;
u32 timeout_in_cmd_ms;
@@ -141,6 +142,10 @@ struct sbefifo_user {
u32 read_timeout_ms;
};
+struct sbefifo_data {
+ bool need_async;
+};
+
static DEFINE_MUTEX(sbefifo_ffdc_mutex);
static ssize_t timeout_show(struct device *dev, struct device_attribute *attr,
@@ -317,6 +322,10 @@ static int sbefifo_check_sbe_state(struct sbefifo *sbefifo)
return -ESHUTDOWN;
}
+ /* Newer SBEFIFOs don't need async FFDC collection */
+ if (!sbefifo->need_async)
+ return 0;
+
/* Is there async FFDC available ? Remember it */
if (sbm & CFAM_SBM_SBE_ASYNC_FFDC)
sbefifo->async_ffdc = true;
@@ -1031,6 +1040,7 @@ static void sbefifo_free(struct device *dev)
static int sbefifo_probe(struct device *dev)
{
+ const struct sbefifo_data *md = of_device_get_match_data(dev);
struct fsi_device *fsi_dev = to_fsi_dev(dev);
struct sbefifo *sbefifo;
struct device_node *np;
@@ -1044,6 +1054,11 @@ static int sbefifo_probe(struct device *dev)
if (!sbefifo)
return -ENOMEM;
+ if (md)
+ sbefifo->need_async = md->need_async;
+ else
+ sbefifo->need_async = true;
+
/* Grab a reference to the device (parent of our cdev), we'll drop it later */
if (!get_device(dev)) {
kfree(sbefifo);
@@ -1128,6 +1143,27 @@ static int sbefifo_remove(struct device *dev)
return 0;
}
+static const struct sbefifo_data p9_sbefifo_data = {
+ .need_async = true,
+};
+
+static const struct sbefifo_data odyssey_sbefifo_data = {
+ .need_async = false,
+};
+
+static const struct of_device_id sbefifo_of_ids[] = {
+ {
+ .compatible = "ibm,p9-sbefifo",
+ .data = &p9_sbefifo_data,
+ },
+ {
+ .compatible = "ibm,odyssey-sbefifo",
+ .data = &odyssey_sbefifo_data,
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, sbefifo_of_ids);
+
static const struct fsi_device_id sbefifo_ids[] = {
{
.engine_type = FSI_ENGID_SBE,
@@ -1141,6 +1177,7 @@ static struct fsi_driver sbefifo_drv = {
.drv = {
.name = DEVICE_NAME,
.bus = &fsi_bus_type,
+ .of_match_table = sbefifo_of_ids,
.probe = sbefifo_probe,
.remove = sbefifo_remove,
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 15/15] fsi: i2cr: Reduce status checks for read operations
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
` (13 preceding siblings ...)
2024-09-17 17:16 ` [PATCH 14/15] fsi: sbefifo: Prevent async FFDC collection for Odyssey SBEFIFOs Eddie James
@ 2024-09-17 17:16 ` Eddie James
14 siblings, 0 replies; 19+ messages in thread
From: Eddie James @ 2024-09-17 17:16 UTC (permalink / raw)
To: linux-fsi; +Cc: linux-kernel, alistair, joel, jk, andrew, eajames, ninad
As an optimization, only check the status register if the eight
byte i2c read operation returns 0xffffffffffffffff. This indicates
that the I2C Responder operation failed and the status register
will provide the reason. Otherwise, the operation was successful,
so no status check is necessary.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-master-i2cr.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/fsi/fsi-master-i2cr.c b/drivers/fsi/fsi-master-i2cr.c
index 61e55740946b..44dbc7029942 100644
--- a/drivers/fsi/fsi-master-i2cr.c
+++ b/drivers/fsi/fsi-master-i2cr.c
@@ -145,9 +145,11 @@ int fsi_master_i2cr_read(struct fsi_master_i2cr *i2cr, u32 addr, u64 *data)
if (ret)
goto unlock;
- ret = i2cr_check_status(i2cr->client);
- if (ret)
- goto unlock;
+ if (*data == 0xffffffffffffffffull) {
+ ret = i2cr_check_status(i2cr->client);
+ if (ret)
+ goto unlock;
+ }
trace_i2cr_read(i2cr->client, command, data);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
@ 2024-09-20 11:50 ` kernel test robot
2024-09-20 13:54 ` kernel test robot
2024-09-20 19:03 ` kernel test robot
2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-09-20 11:50 UTC (permalink / raw)
To: Eddie James, linux-fsi
Cc: oe-kbuild-all, linux-kernel, alistair, joel, jk, andrew, eajames,
ninad
Hi Eddie,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.11 next-20240920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eddie-James/fsi-hub-Set-master-index-to-link-number-plus-one/20240918-012109
base: linus/master
patch link: https://lore.kernel.org/r/20240917171647.1403910-13-eajames%40linux.ibm.com
patch subject: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
config: arc-randconfig-002-20240920 (https://download.01.org/0day-ci/archive/20240920/202409201954.IYcZNCSj-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240920/202409201954.IYcZNCSj-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409201954.IYcZNCSj-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/fsi/fsi-occ.c: In function 'occ_remove':
>> drivers/fsi/fsi-occ.c:708:16: warning: 'return' with a value, in function returning void [-Wreturn-type]
708 | return 0;
| ^
drivers/fsi/fsi-occ.c:690:13: note: declared here
690 | static void occ_remove(struct platform_device *pdev)
| ^~~~~~~~~~
vim +/return +708 drivers/fsi/fsi-occ.c
689
690 static void occ_remove(struct platform_device *pdev)
691 {
692 struct occ *occ = platform_get_drvdata(pdev);
693
694 misc_deregister(&occ->mdev);
695
696 mutex_lock(&occ->occ_lock);
697 kvfree(occ->buffer);
698 occ->buffer = NULL;
699 mutex_unlock(&occ->occ_lock);
700
701 if (occ->platform_hwmon)
702 device_for_each_child(&pdev->dev, NULL, occ_unregister_platform_child);
703 else
704 device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);
705
706 fsi_free_minor(occ->devt);
707
> 708 return 0;
709 }
710
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
2024-09-20 11:50 ` kernel test robot
@ 2024-09-20 13:54 ` kernel test robot
2024-09-20 19:03 ` kernel test robot
2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-09-20 13:54 UTC (permalink / raw)
To: Eddie James, linux-fsi
Cc: oe-kbuild-all, linux-kernel, alistair, joel, jk, andrew, eajames,
ninad
Hi Eddie,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11 next-20240920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eddie-James/fsi-hub-Set-master-index-to-link-number-plus-one/20240918-012109
base: linus/master
patch link: https://lore.kernel.org/r/20240917171647.1403910-13-eajames%40linux.ibm.com
patch subject: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
config: arm-randconfig-002-20240920 (https://download.01.org/0day-ci/archive/20240920/202409202101.tu2dHrK3-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240920/202409202101.tu2dHrK3-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409202101.tu2dHrK3-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/fsi/fsi-occ.c: In function 'occ_remove':
>> drivers/fsi/fsi-occ.c:708:16: error: 'return' with a value, in function returning void [-Wreturn-mismatch]
708 | return 0;
| ^
drivers/fsi/fsi-occ.c:690:13: note: declared here
690 | static void occ_remove(struct platform_device *pdev)
| ^~~~~~~~~~
vim +/return +708 drivers/fsi/fsi-occ.c
689
690 static void occ_remove(struct platform_device *pdev)
691 {
692 struct occ *occ = platform_get_drvdata(pdev);
693
694 misc_deregister(&occ->mdev);
695
696 mutex_lock(&occ->occ_lock);
697 kvfree(occ->buffer);
698 occ->buffer = NULL;
699 mutex_unlock(&occ->occ_lock);
700
701 if (occ->platform_hwmon)
702 device_for_each_child(&pdev->dev, NULL, occ_unregister_platform_child);
703 else
704 device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);
705
706 fsi_free_minor(occ->devt);
707
> 708 return 0;
709 }
710
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
2024-09-20 11:50 ` kernel test robot
2024-09-20 13:54 ` kernel test robot
@ 2024-09-20 19:03 ` kernel test robot
2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-09-20 19:03 UTC (permalink / raw)
To: Eddie James, linux-fsi
Cc: llvm, oe-kbuild-all, linux-kernel, alistair, joel, jk, andrew,
eajames, ninad
Hi Eddie,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.11 next-20240920]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Eddie-James/fsi-hub-Set-master-index-to-link-number-plus-one/20240918-012109
base: linus/master
patch link: https://lore.kernel.org/r/20240917171647.1403910-13-eajames%40linux.ibm.com
patch subject: [PATCH 12/15] fsi: occ: Get device number from FSI minor number API
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240921/202409210200.8czVX7S4-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 8663a75fa2f31299ab8d1d90288d9df92aadee88)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240921/202409210200.8czVX7S4-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409210200.8czVX7S4-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/fsi/fsi-occ.c:3:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:181:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2237:
include/linux/vmstat.h:503:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
503 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
504 | item];
| ~~~~
include/linux/vmstat.h:510:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
510 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
511 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:523:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
523 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
524 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/fsi/fsi-occ.c:708:2: warning: void function 'occ_remove' should not return a value [-Wreturn-mismatch]
708 | return 0;
| ^ ~
5 warnings generated.
vim +/occ_remove +708 drivers/fsi/fsi-occ.c
689
690 static void occ_remove(struct platform_device *pdev)
691 {
692 struct occ *occ = platform_get_drvdata(pdev);
693
694 misc_deregister(&occ->mdev);
695
696 mutex_lock(&occ->occ_lock);
697 kvfree(occ->buffer);
698 occ->buffer = NULL;
699 mutex_unlock(&occ->occ_lock);
700
701 if (occ->platform_hwmon)
702 device_for_each_child(&pdev->dev, NULL, occ_unregister_platform_child);
703 else
704 device_for_each_child(&pdev->dev, NULL, occ_unregister_of_child);
705
706 fsi_free_minor(occ->devt);
707
> 708 return 0;
709 }
710
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-09-20 19:03 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 17:16 [PATCH 00/15] fsi: Fixes and improvements Eddie James
2024-09-17 17:16 ` [PATCH 01/15] fsi: hub: Set master index to link number plus one Eddie James
2024-09-17 17:16 ` [PATCH 02/15] fsi: Move slave definitions to fsi-slave.h Eddie James
2024-09-17 17:16 ` [PATCH 03/15] fsi: Fix slave addressing after break command Eddie James
2024-09-17 17:16 ` [PATCH 04/15] fsi: core: Use a defined value for default echo delay Eddie James
2024-09-17 17:16 ` [PATCH 05/15] fsi: core: Calculate local bus clock frequency Eddie James
2024-09-17 17:16 ` [PATCH 06/15] fsi: core: Improve master read/write/error traces Eddie James
2024-09-17 17:16 ` [PATCH 07/15] fsi: core: Add slave error trace Eddie James
2024-09-17 17:16 ` [PATCH 08/15] fsi: core: Reset errors instead of clearing interrupts Eddie James
2024-09-17 17:16 ` [PATCH 09/15] fsi: core: Add slave spinlock Eddie James
2024-09-17 17:16 ` [PATCH 10/15] fsi: core: Allow cfam device type aliases Eddie James
2024-09-17 17:16 ` [PATCH 11/15] fsi: scom: Update compatible string to match documentation Eddie James
2024-09-17 17:16 ` [PATCH 12/15] fsi: occ: Get device number from FSI minor number API Eddie James
2024-09-20 11:50 ` kernel test robot
2024-09-20 13:54 ` kernel test robot
2024-09-20 19:03 ` kernel test robot
2024-09-17 17:16 ` [PATCH 13/15] fsi: occ: Find next available child rather than node name match Eddie James
2024-09-17 17:16 ` [PATCH 14/15] fsi: sbefifo: Prevent async FFDC collection for Odyssey SBEFIFOs Eddie James
2024-09-17 17:16 ` [PATCH 15/15] fsi: i2cr: Reduce status checks for read operations Eddie James
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.