Skip to contentSkip to conversation

fsi: Remove old sbefifo driver

RFC PATCH Superseded Benjamin Herrenschmidt 1 participant 3 messages May 17, 2018

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/3 fsi: Remove old sbefifo driver

And remporarily disable build of fsi-occ

---
 drivers/fsi/Makefile        |    4 +-
 drivers/fsi/fsi-sbefifo.c   | 1071 -----------------------------------
 drivers/hwmon/occ/Makefile  |    2 +-
 include/linux/fsi-sbefifo.h |   30 -
 4 files changed, 3 insertions(+), 1104 deletions(-)
 delete mode 100644 drivers/fsi/fsi-sbefifo.c
 delete mode 100644 include/linux/fsi-sbefifo.h
drivers/fsi/Makefile +2 -2
index 75fdc6d8cfc4..61e8e420c7ed 100644
@@ -3,5 +3,5 @@ obj-$(CONFIG_FSI) += fsi-core.o
 obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o
 obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o
 obj-$(CONFIG_FSI_SCOM) += fsi-scom.o
-obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
-obj-$(CONFIG_FSI_OCC) += fsi-occ.o
+#obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
+#obj-$(CONFIG_FSI_OCC) += fsi-occ.o
drivers/fsi/fsi-sbefifo.c deleted +0 -1071

1,071 lines not on this page · raw message

drivers/hwmon/occ/Makefile +1 -1
index ab5c3e965ccb..ca6d25ae9da8 100644
@@ -1,7 +1,7 @@
 occ-hwmon-objs := common.o
 
 ifeq ($(CONFIG_SENSORS_OCC_P9_SBE), y)
-occ-hwmon-objs += p9_sbe.o
+#occ-hwmon-objs += p9_sbe.o
 endif
 
 ifeq ($(CONFIG_SENSORS_OCC_P8_I2C), y)
include/linux/fsi-sbefifo.h deleted +0 -30
deleted file mode 100644
index 8e55891963a5..000000000000
@@ -1,30 +0,0 @@
-/*
- * SBEFIFO FSI Client device driver
- *
- * Copyright (C) IBM Corporation 2017
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERGCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef LINUX_FSI_SBEFIFO_H
-#define LINUX_FSI_SBEFIFO_H
-
-struct device;
-struct sbefifo_client;
-
-extern struct sbefifo_client *sbefifo_drv_open(struct device *dev,
-					       unsigned long flags);
-extern int sbefifo_drv_read(struct sbefifo_client *client, char *buf,
-			    size_t len);
-extern int sbefifo_drv_write(struct sbefifo_client *client, const char *buf,
-			     size_t len);
-extern void sbefifo_drv_release(struct sbefifo_client *client);
-
-#endif /* LINUX_FSI_SBEFIFO_H */
Signature · 1 line
2.17.0
#1 lore raw

RFC PATCH 2/3 fsi/sbefifo: Add driver for the SBE FIFO

This driver provides an in-kernel and a user API for accessing the command FIFO of the SBE (Self Boot Engine) of the POWER9 processor, via the FSI bus.

It provides an in-kernel interface to submit command and receive responses, along with a helper to locate and analyse the response status block. It's a simple synchronous submit() type API.

The user interface uses the write/read interface that an earlier version of this driver already provided, however it has some specific limitations in order to keep the driver simple and avoid using up a lot of kernel memory:

- The user should perform a single write() with the command and a single read() to get the response (with a buffer big enough to hold the entire response).

- On a write() the command is simply "stored" into a kernel buffer, it is submitted as one operation on the subsequent read(). This allows to have the code write directly from the FIFO into the user buffer and avoid hogging the SBE between the write() and read() syscall as it's critical that the SBE be freed asap to respond to the host. An extra write() will simply replace the previously written command.

- A write of a single 4 bytes containing the value 0x52534554 in big endian will trigger a reset request. No read is necessary, the write() call will return when the reset has been acknowledged or times out.

- The command is limited to 4K bytes.

---
 drivers/fsi/Makefile        |   2 +-
 drivers/fsi/fsi-sbefifo.c   | 862 ++++++++++++++++++++++++++++++++++++
 include/linux/fsi-sbefifo.h |  26 ++
 3 files changed, 889 insertions(+), 1 deletion(-)
 create mode 100644 drivers/fsi/fsi-sbefifo.c
 create mode 100644 include/linux/fsi-sbefifo.h
drivers/fsi/Makefile +1 -1
index 61e8e420c7ed..f331e929423c 100644
@@ -3,5 +3,5 @@ obj-$(CONFIG_FSI) += fsi-core.o
 obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o
 obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o
 obj-$(CONFIG_FSI_SCOM) += fsi-scom.o
-#obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
+obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
 #obj-$(CONFIG_FSI_OCC) += fsi-occ.o
drivers/fsi/fsi-sbefifo.c new file +862 -0

862 lines not on this page · raw message

include/linux/fsi-sbefifo.h new file +26 -0
new file mode 100644
index 000000000000..15729b3194a2
@@ -0,0 +1,26 @@
+/*
+ * SBEFIFO FSI Client device driver
+ *
+ * Copyright (C) IBM Corporation 2017
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERGCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef LINUX_FSI_SBEFIFO_H
+#define LINUX_FSI_SBEFIFO_H
+
+struct device;
+
+int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
+		   __be32 *response, size_t *resp_len);
+
+int sbefifo_parse_status(u16 cmd, __be32 *response, size_t resp_len, size_t *data_len);
+
+#endif /* LINUX_FSI_SBEFIFO_H */
Signature · 1 line
2.17.0
#2 lore raw

RFC PATCH 3/3 fsi/fsi-occ: Simple conversion to new sbefifo driver

In reply to Benjamin Herrenschmidt

Replace open/close/write/read API with the simple submit() API and the helper to parse status.

This doesn't yet extract FFDC

---
 drivers/fsi/Makefile       |   2 +-
 drivers/fsi/fsi-occ.c      | 202 +++++++++++++++++--------------------
 drivers/hwmon/occ/Makefile |   2 +-
 3 files changed, 94 insertions(+), 112 deletions(-)
drivers/fsi/Makefile +1 -1
index f331e929423c..75fdc6d8cfc4 100644
@@ -4,4 +4,4 @@ obj-$(CONFIG_FSI_MASTER_HUB) += fsi-master-hub.o
 obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o
 obj-$(CONFIG_FSI_SCOM) += fsi-scom.o
 obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
-#obj-$(CONFIG_FSI_OCC) += fsi-occ.o
+obj-$(CONFIG_FSI_OCC) += fsi-occ.o
drivers/fsi/fsi-occ.c +92 -110

276 lines not on this page · raw message

drivers/hwmon/occ/Makefile +1 -1
index ca6d25ae9da8..ab5c3e965ccb 100644
@@ -1,7 +1,7 @@
 occ-hwmon-objs := common.o
 
 ifeq ($(CONFIG_SENSORS_OCC_P9_SBE), y)
-#occ-hwmon-objs += p9_sbe.o
+occ-hwmon-objs += p9_sbe.o
 endif
 
 ifeq ($(CONFIG_SENSORS_OCC_P8_I2C), y)
Signature · 1 line
2.17.0