Re: [PATCH linux 3/4] drivers/fsi: Add On-Chip Controller (OCC) driver
Hi Edward, [auto build test ERROR on next-20170619] [cannot apply to linux/master linus/master robh/for-next v4.12-rc6 v4.12-rc5 v4.12-rc4 v4.12-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Eddie-James/drivers-fsi-Add-SBEFIFO-and-OCC-drivers/20170623-160949 config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sh All error/warnings (new ones prefixed by >>): drivers//fsi/occ.c: In function 'occ_open': >> drivers//fsi/occ.c:136:32: error: dereferencing pointer to incomplete type >> 'struct file' struct miscdevice *mdev = file->private_data; ^~ >> drivers//fsi/occ.c:147:22: error: 'O_NONBLOCK' undeclared (first use in this >> function) if (file->f_flags & O_NONBLOCK) ^~ drivers//fsi/occ.c:147:22: note: each undeclared identifier is reported only once for each function it appears in drivers//fsi/occ.c: At top level: >> drivers//fsi/occ.c:324:21: error: variable 'occ_fops' has initializer but >> incomplete type static const struct file_operations occ_fops = { ^~~ >> drivers//fsi/occ.c:325:2: error: unknown field 'owner' specified in >> initializer .owner = THIS_MODULE, ^ In file included from include/linux/linkage.h:6:0, from include/linux/kernel.h:6, from include/linux/unaligned/packed_struct.h:4, from include/linux/unaligned/le_struct.h:4, from include/asm-generic/unaligned.h:17, from arch/sh/include/asm/unaligned.h:9, from drivers//fsi/occ.c:10: include/linux/export.h:35:21: warning: excess elements in struct initializer #define THIS_MODULE (&__this_module) ^ >> drivers//fsi/occ.c:325:11: note: in expansion of macro 'THIS_MODULE' .owner = THIS_MODULE, ^~~ include/linux/export.h:35:21: note: (near initialization for 'occ_fops') #define THIS_MODULE (&__this_module) ^ >> drivers//fsi/occ.c:325:11: note: in expansion of macro 'THIS_MODULE' .owner = THIS_MODULE, ^~~ >> drivers//fsi/occ.c:326:2: error: unknown field 'open' specified in >> initializer .open = occ_open, ^ >> drivers//fsi/occ.c:326:10: warning: excess elements in struct initializer .open = occ_open, ^~~~ drivers//fsi/occ.c:326:10: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:327:2: error: unknown field 'read' specified in >> initializer .read = occ_read, ^ drivers//fsi/occ.c:327:10: warning: excess elements in struct initializer .read = occ_read, ^~~~ drivers//fsi/occ.c:327:10: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:328:2: error: unknown field 'write' specified in >> initializer .write = occ_write, ^ drivers//fsi/occ.c:328:11: warning: excess elements in struct initializer .write = occ_write, ^ drivers//fsi/occ.c:328:11: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:329:2: error: unknown field 'release' specified in >> initializer .release = occ_release, ^ drivers//fsi/occ.c:329:13: warning: excess elements in struct initializer .release = occ_release, ^~~ drivers//fsi/occ.c:329:13: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:324:37: error: storage size of 'occ_fops' isn't known static const struct file_operations occ_fops = { ^~~~ vim +/O_NONBLOCK +147 drivers//fsi/occ.c 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ 9 > 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include 19 #include 20 #include 21 #include 22 #include 23 #include 24 #include 25 #include 26 27 #define OCC_SRAM_BYTES 4096 28 #define OCC_CMD_DATA_BYTES 4090 29 #define OCC_RESP_DATA_BYTES 4089 30 31 struct occ { 32 struct device *sbefifo; 33 char name[32]; 34 int idx; 35 struct miscdevice mdev; 36 struct
Re: [PATCH linux 3/4] drivers/fsi: Add On-Chip Controller (OCC) driver
Hi Edward, [auto build test ERROR on next-20170619] [cannot apply to linux/master linus/master robh/for-next v4.12-rc6 v4.12-rc5 v4.12-rc4 v4.12-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Eddie-James/drivers-fsi-Add-SBEFIFO-and-OCC-drivers/20170623-160949 config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=sh All error/warnings (new ones prefixed by >>): drivers//fsi/occ.c: In function 'occ_open': >> drivers//fsi/occ.c:136:32: error: dereferencing pointer to incomplete type >> 'struct file' struct miscdevice *mdev = file->private_data; ^~ >> drivers//fsi/occ.c:147:22: error: 'O_NONBLOCK' undeclared (first use in this >> function) if (file->f_flags & O_NONBLOCK) ^~ drivers//fsi/occ.c:147:22: note: each undeclared identifier is reported only once for each function it appears in drivers//fsi/occ.c: At top level: >> drivers//fsi/occ.c:324:21: error: variable 'occ_fops' has initializer but >> incomplete type static const struct file_operations occ_fops = { ^~~ >> drivers//fsi/occ.c:325:2: error: unknown field 'owner' specified in >> initializer .owner = THIS_MODULE, ^ In file included from include/linux/linkage.h:6:0, from include/linux/kernel.h:6, from include/linux/unaligned/packed_struct.h:4, from include/linux/unaligned/le_struct.h:4, from include/asm-generic/unaligned.h:17, from arch/sh/include/asm/unaligned.h:9, from drivers//fsi/occ.c:10: include/linux/export.h:35:21: warning: excess elements in struct initializer #define THIS_MODULE (&__this_module) ^ >> drivers//fsi/occ.c:325:11: note: in expansion of macro 'THIS_MODULE' .owner = THIS_MODULE, ^~~ include/linux/export.h:35:21: note: (near initialization for 'occ_fops') #define THIS_MODULE (&__this_module) ^ >> drivers//fsi/occ.c:325:11: note: in expansion of macro 'THIS_MODULE' .owner = THIS_MODULE, ^~~ >> drivers//fsi/occ.c:326:2: error: unknown field 'open' specified in >> initializer .open = occ_open, ^ >> drivers//fsi/occ.c:326:10: warning: excess elements in struct initializer .open = occ_open, ^~~~ drivers//fsi/occ.c:326:10: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:327:2: error: unknown field 'read' specified in >> initializer .read = occ_read, ^ drivers//fsi/occ.c:327:10: warning: excess elements in struct initializer .read = occ_read, ^~~~ drivers//fsi/occ.c:327:10: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:328:2: error: unknown field 'write' specified in >> initializer .write = occ_write, ^ drivers//fsi/occ.c:328:11: warning: excess elements in struct initializer .write = occ_write, ^ drivers//fsi/occ.c:328:11: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:329:2: error: unknown field 'release' specified in >> initializer .release = occ_release, ^ drivers//fsi/occ.c:329:13: warning: excess elements in struct initializer .release = occ_release, ^~~ drivers//fsi/occ.c:329:13: note: (near initialization for 'occ_fops') >> drivers//fsi/occ.c:324:37: error: storage size of 'occ_fops' isn't known static const struct file_operations occ_fops = { ^~~~ vim +/O_NONBLOCK +147 drivers//fsi/occ.c 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 */ 9 > 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 #include 17 #include 18 #include 19 #include 20 #include 21 #include 22 #include 23 #include 24 #include 25 #include 26 27 #define OCC_SRAM_BYTES 4096 28 #define OCC_CMD_DATA_BYTES 4090 29 #define OCC_RESP_DATA_BYTES 4089 30 31 struct occ { 32 struct device *sbefifo; 33 char name[32]; 34 int idx; 35 struct miscdevice mdev; 36 struct
[PATCH linux 3/4] drivers/fsi: Add On-Chip Controller (OCC) driver
From: "Edward A. James"The OCC is a device embedded on a POWER processor that collects and aggregates sensor data from the processor and system. The OCC can provide the raw sensor data as well as perform thermal and power management on the system. This driver provides an atomic communications channel between a service processor (e.g. a BMC) and the OCC. The driver is dependent on the FSI SBEFIFO driver to get hardware access through the SBE to the OCC SRAM. Commands are issued to the SBE to send or fetch data to the SRAM. The format of communications to the OCC is writing a command to SRAM, followed by a sending a "doorbell" or attention to the OCC, followed by reading the response from OCC. All of this takes place atomically so that multiple users don't collide in the SRAM. Signed-off-by: Edward A. James --- .../devicetree/bindings/fsi/ibm,p9-occ.txt | 15 + drivers/fsi/Kconfig| 10 + drivers/fsi/Makefile | 1 + drivers/fsi/occ.c | 692 + 4 files changed, 718 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt create mode 100644 drivers/fsi/occ.c diff --git a/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt b/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file mode 100644 index 000..88002b9 --- /dev/null +++ b/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt @@ -0,0 +1,15 @@ +Device-tree bindings for FSI-based On-Chip Controller driver + + +Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = ;: index for the processor this OCC device is on + +Examples: + +occ@1 { +compatible = "ibm,p9-occ"; +reg = <1>; +}; diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index 8c4d903..9d59276 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -40,6 +40,16 @@ config FSI_SBEFIFO a pipe-like FSI device for communicating with the self boot engine (SBE) on POWER processors. +config OCCFIFO + tristate "OCC SBEFIFO client device driver" + depends on FSI_SBEFIFO + ---help--- + This option enables an SBEFIFO based On-Chip Controller (OCC) device + driver. The OCC is a device embedded on a POWER processor that collects + and aggregates sensor data from the processor and system. The OCC can + provide the raw sensor data as well as perform thermal and power + management on the system. + endif endmenu diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile index 851182e..7f5ca61 100644 --- a/drivers/fsi/Makefile +++ b/drivers/fsi/Makefile @@ -4,3 +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_OCCFIFO) += occ.o diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c new file mode 100644 index 000..a1e6e9b --- /dev/null +++ b/drivers/fsi/occ.c @@ -0,0 +1,692 @@ +/* + * Copyright 2017 IBM Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OCC_SRAM_BYTES 4096 +#define OCC_CMD_DATA_BYTES 4090 +#define OCC_RESP_DATA_BYTES4089 + +struct occ { + struct device *sbefifo; + char name[32]; + int idx; + struct miscdevice mdev; + struct list_head xfrs; + spinlock_t list_lock; + struct mutex occ_lock; + struct work_struct work; +}; + +#define to_occ(x) container_of((x), struct occ, mdev) + +struct occ_command { + u8 seq_no; + u8 cmd_type; + u16 data_length; + u8 data[OCC_CMD_DATA_BYTES]; + u16 checksum; +} __packed; + +struct occ_response { + u8 seq_no; + u8 cmd_type; + u8 return_status; + u16 data_length; + u8 data[OCC_RESP_DATA_BYTES]; + u16 checksum; +} __packed; + +/* + * transfer flags are NOT mutually exclusive + * + * Initial flags are none; transfer is created and queued from write(). All + * flags are cleared when the transfer is completed by closing the file or + * reading all of the available response data. + * XFR_IN_PROGRESS is set when a transfer is started from occ_worker_putsram, + * and cleared if the transfer fails or occ_worker_getsram completes. + * XFR_COMPLETE is set when a transfer fails or finishes occ_worker_getsram. + * XFR_CANCELED is set when the transfer's client is released. + * XFR_WAITING
[PATCH linux 3/4] drivers/fsi: Add On-Chip Controller (OCC) driver
From: "Edward A. James" The OCC is a device embedded on a POWER processor that collects and aggregates sensor data from the processor and system. The OCC can provide the raw sensor data as well as perform thermal and power management on the system. This driver provides an atomic communications channel between a service processor (e.g. a BMC) and the OCC. The driver is dependent on the FSI SBEFIFO driver to get hardware access through the SBE to the OCC SRAM. Commands are issued to the SBE to send or fetch data to the SRAM. The format of communications to the OCC is writing a command to SRAM, followed by a sending a "doorbell" or attention to the OCC, followed by reading the response from OCC. All of this takes place atomically so that multiple users don't collide in the SRAM. Signed-off-by: Edward A. James --- .../devicetree/bindings/fsi/ibm,p9-occ.txt | 15 + drivers/fsi/Kconfig| 10 + drivers/fsi/Makefile | 1 + drivers/fsi/occ.c | 692 + 4 files changed, 718 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt create mode 100644 drivers/fsi/occ.c diff --git a/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt b/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file mode 100644 index 000..88002b9 --- /dev/null +++ b/Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt @@ -0,0 +1,15 @@ +Device-tree bindings for FSI-based On-Chip Controller driver + + +Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = ;: index for the processor this OCC device is on + +Examples: + +occ@1 { +compatible = "ibm,p9-occ"; +reg = <1>; +}; diff --git a/drivers/fsi/Kconfig b/drivers/fsi/Kconfig index 8c4d903..9d59276 100644 --- a/drivers/fsi/Kconfig +++ b/drivers/fsi/Kconfig @@ -40,6 +40,16 @@ config FSI_SBEFIFO a pipe-like FSI device for communicating with the self boot engine (SBE) on POWER processors. +config OCCFIFO + tristate "OCC SBEFIFO client device driver" + depends on FSI_SBEFIFO + ---help--- + This option enables an SBEFIFO based On-Chip Controller (OCC) device + driver. The OCC is a device embedded on a POWER processor that collects + and aggregates sensor data from the processor and system. The OCC can + provide the raw sensor data as well as perform thermal and power + management on the system. + endif endmenu diff --git a/drivers/fsi/Makefile b/drivers/fsi/Makefile index 851182e..7f5ca61 100644 --- a/drivers/fsi/Makefile +++ b/drivers/fsi/Makefile @@ -4,3 +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_OCCFIFO) += occ.o diff --git a/drivers/fsi/occ.c b/drivers/fsi/occ.c new file mode 100644 index 000..a1e6e9b --- /dev/null +++ b/drivers/fsi/occ.c @@ -0,0 +1,692 @@ +/* + * Copyright 2017 IBM Corp. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define OCC_SRAM_BYTES 4096 +#define OCC_CMD_DATA_BYTES 4090 +#define OCC_RESP_DATA_BYTES4089 + +struct occ { + struct device *sbefifo; + char name[32]; + int idx; + struct miscdevice mdev; + struct list_head xfrs; + spinlock_t list_lock; + struct mutex occ_lock; + struct work_struct work; +}; + +#define to_occ(x) container_of((x), struct occ, mdev) + +struct occ_command { + u8 seq_no; + u8 cmd_type; + u16 data_length; + u8 data[OCC_CMD_DATA_BYTES]; + u16 checksum; +} __packed; + +struct occ_response { + u8 seq_no; + u8 cmd_type; + u8 return_status; + u16 data_length; + u8 data[OCC_RESP_DATA_BYTES]; + u16 checksum; +} __packed; + +/* + * transfer flags are NOT mutually exclusive + * + * Initial flags are none; transfer is created and queued from write(). All + * flags are cleared when the transfer is completed by closing the file or + * reading all of the available response data. + * XFR_IN_PROGRESS is set when a transfer is started from occ_worker_putsram, + * and cleared if the transfer fails or occ_worker_getsram completes. + * XFR_COMPLETE is set when a transfer fails or finishes occ_worker_getsram. + * XFR_CANCELED is set when the transfer's client is released. + * XFR_WAITING is set from read() if the transfer isn't