drivers/fsi: Add SBEFIFO and OCC client drivers
Subsystems (2)
v5 cover drivers/fsi: Add SBEFIFO and OCC client drivers
From: "Edward A. James" <eajames-r/[email protected]>
This series adds two FSI-based device drivers; one for the SBEFIFO and one for the On-Chip Controller (OCC).
IBM POWER9 processors contain some embedded hardware and software bits collectively referred to as the self boot engine (SBE). One role of the SBE is to act as a proxy that provides access to the registers of the POWER chip from other (embedded) systems.
The POWER9 chip contains a hardware frontend for communicating with the SBE from remote systems called the SBEFIFO. The SBEFIFO logic is contained within an FSI CFAM and as such the driver implements an FSI bus device.
The SBE expects to communicate using a defined wire protocol; however, the driver knows nothing of the protocol and only provides raw access to the fifo device to userspace applications wishing to communicate with the SBE using the wire protocol.
The SBEFIFO consists of two hardware fifos. The upstream fifo is used by the driver to transfer data to the SBE on the POWER chip, from the system hosting the driver. The downstream fifo is used by the driver to transfer data from the SBE on the power chip to the system hosting the 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.
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.
Changes since v4:
* Use irqsave/irqrestore for spinlocks.
* Put the OCC driver in the same patchset as it doesn't build without SBEFIFO.
* Switch to reference counting for OCC clients.
Changes since v3:
* Add reset procedure and use it if there is data in the FIFO at probe time.
* Add timeout for waiting for data to appear in the FIFO; if the SBE isn't running, then previously we would wait forever.
* Fix remove() order of operations for both drivers.
* Fix xfr memory leak for SBEFIFO.
* Formatting fixes.
Changes since v2:
* Rename occ.c and occ.h to fsi-occ.c and fsi-occ.h
* Improved remove() ordering in both drivers.
* Added cancel functionality to OCC driver to make sure no xfrs started during remove().
* Fix spin_unlock with spin_unlock_irq in OCC driver.
* Fix list_first_entry with list_first_entry_or_null in OCC worker function.
* Add OCC response definitions to OCC include file.
* Handle probe() failures better.
Changes since v1:
* Split bindings into separate patch and added SBEFIFO device binding
* Fixed #includes
* Fix SBEFIFO race condition between write() and poll_timer().
* Followed Rob's suggestion to just create one platform device for hwmon driver, instead of using the device tree.
* Also check for "command in progress" response from OCC and try a while
Edward A. James (8):
dt-bindings: fsi: Add SBEFIFO documentation drivers/fsi: Add SBEFIFO FSI client device driver drivers/fsi: sbefifo: Add miscdevice drivers/fsi: sbefifo: Add in-kernel API
dt-bindings: fsi: Add OCC documentation drivers/fsi: Add On-Chip Controller (OCC) driver drivers/fsi: occ: Add miscdevice drivers/fsi: occ: Add in-kernel API
.../devicetree/bindings/fsi/ibm,p9-occ.txt | 18 + .../devicetree/bindings/fsi/ibm,p9-sbefifo.txt | 35 + drivers/fsi/Kconfig | 17 + drivers/fsi/Makefile | 2 + drivers/fsi/fsi-occ.c | 876 +++++++++++++++++ drivers/fsi/fsi-sbefifo.c | 1027 ++++++++++++++++++++ include/linux/fsi-occ.h | 41 + include/linux/fsi-sbefifo.h | 30 + 8 files changed, 2046 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-sbefifo.txt create mode 100644 drivers/fsi/fsi-occ.c create mode 100644 drivers/fsi/fsi-sbefifo.c create mode 100644 include/linux/fsi-occ.h create mode 100644 include/linux/fsi-sbefifo.h
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 1/8 dt-bindings: fsi: Add SBEFIFO documentation
From: "Edward A. James" <[email protected]>
Document the bindings for the SBE CFAM device. SBE devices are located on a CFAM off an FSI bus.
--- .../devicetree/bindings/fsi/ibm,p9-sbefifo.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-sbefifo.txt
Documentation/devicetree/bindings/fsi/ibm,p9-sbefifo.txt new file +35 -0
@@ -0,0 +1,35 @@ +Device-tree bindings for P9 SBEFIFO CFAM device +----------------------------------------------- + +Required properties: + - compatible = "ibm,p9-sbefifo"; + - reg = < address size >; : FSI CFAM address for the SBE engine + and address space size. + - #address-cells = <1>; : Number of address cells in child + nodes. + - #size-cells = <0>; : Number of size cells in child nodes. + +Optional properties: + - <child nodes> : Devices that are accessible through + the SBEFIFO. Child nodes are "opaque" + to the SBEFIFO; the SBEFIFO needs no + information about a child node other + than if it exists or not. + +Child node optional properties: + - compatible = "dts-name" + - reg = < address >; : Meaningful only for the child node + +Examples: + + sbefifo@2400 { + compatible = "ibm,p9-sbefifo"; + reg = < 0x2400 0x400 >; + #address-cells = <1>; + #size-cells = <0>; + + occ@1 { + compatible = "ibm,p9-occ"; + reg = < 1 >; + }; + };
Signature · 1 line
1.8.3.1
Re: [PATCH v5 1/8] dt-bindings: fsi: Add SBEFIFO documentation
Quoted 10 lines · Eddie James
From: "Edward A. James" <[email protected]>
Document the bindings for the SBE CFAM device. SBE devices are located on a CFAM off an FSI bus.
Signed-off-by Edward A. James <[email protected]>--- .../devicetree/bindings/fsi/ibm,p9-sbefifo.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-sbefifo.txt
PATCH v5 2/8 drivers/fsi: Add SBEFIFO FSI client device driver
In reply to Eddie JamesFrom: "Edward A. James" <[email protected]>
IBM POWER9 processors contain some embedded hardware and software bits collectively referred to as the self boot engine (SBE). One role of the SBE is to act as a proxy that provides access to the registers of the POWER chip from other (embedded) systems.
The POWER9 chip contains a hardware frontend for communicating with the SBE from remote systems called the SBEFIFO. The SBEFIFO logic is contained within an FSI CFAM and as such the driver implements an FSI bus device.
The SBE expects to communicate using a defined wire protocol; however, the driver knows nothing of the protocol and only provides raw access to the fifo device to userspace applications wishing to communicate with the SBE using the wire protocol.
The SBEFIFO consists of two hardware fifos. The upstream fifo is used by the driver to transfer data to the SBE on the POWER chip, from the system hosting the driver. The downstream fifo is used by the driver to transfer data from the SBE on the power chip to the system hosting the driver.
Contributions from Brad Bishop <[email protected]>
--- drivers/fsi/Kconfig | 7 + drivers/fsi/Makefile | 1 + drivers/fsi/fsi-sbefifo.c | 577 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 585 insertions(+) create mode 100644 drivers/fsi/fsi-sbefifo.c
drivers/fsi/Kconfig +7 -0
@@ -33,6 +33,13 @@ config FSI_SCOM ---help--- This option enables an FSI based SCOM device driver. +config FSI_SBEFIFO + tristate "SBEFIFO FSI client device driver" + ---help--- + This option enables an FSI based SBEFIFO device driver. The SBEFIFO is + a pipe-like FSI device for communicating with the self boot engine + (SBE) on POWER processors. + endif endmenu
drivers/fsi/Makefile +1 -0
@@ -3,3 +3,4 @@ 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
drivers/fsi/fsi-sbefifo.c new file +577 -0
577 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 3/8 drivers/fsi: sbefifo: Add miscdevice
In reply to Eddie JamesFrom: "Edward A. James" <eajames-r/[email protected]>
Add a miscdevice for the sbefifo to allow userspace access through standard file operations.
--- drivers/fsi/fsi-sbefifo.c | 355 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 355 insertions(+)
drivers/fsi/fsi-sbefifo.c +355 -0
@@ -19,6 +19,7 @@#include <linux/kernel.h> #include <linux/kref.h> #include <linux/list.h> +#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/poll.h> #include <linux/sched.h>
@@ -54,6 +55,7 @@struct sbefifo {struct timer_list poll_timer;struct fsi_device *fsi_dev; +struct miscdevice mdev;wait_queue_head_t wait;struct list_head xfrs;struct kref kref;
@@ -256,6 +258,99 @@ static void sbefifo_put(struct sbefifo *sbefifo)kref_put (&sbefifo->kref, sbefifo_free); } +static struct sbefifo_xfr *sbefifo_enq_xfr (struct sbefifo_client *client) +{ +struct sbefifo *sbefifo = client->dev; +struct sbefifo_xfr *xfr; + +if (READ_ONCE (sbefifo->rc)) +return ERR_PTR (sbefifo->rc); + + xfr =kzalloc (sizeof (*xfr),GFP_KERNEL ); +if (!xfr) +return ERR_PTR (-ENOMEM ); + + xfr->rbuf = &client->rbuf; + xfr->wbuf = &client->wbuf; +list_add_tail (&xfr->xfrs, &sbefifo->xfrs); +list_add_tail (&xfr->client, &client->xfrs); + +return xfr; +} + +static bool sbefifo_xfr_rsp_pending (struct sbefifo_client *client) +{ +struct sbefifo_xfr *xfr =list_first_entry_or_null (&client->xfrs, + struct sbefifo_xfr, + client); + +if (xfr &&test_bit (SBEFIFO_XFR_RESP_PENDING , &xfr->flags)) +return true; + +return false; +} + +static struct sbefifo_client *sbefifo_new_client (struct sbefifo *sbefifo) +{ +struct sbefifo_client *client; + + client =kzalloc (sizeof (*client),GFP_KERNEL ); +if (!client) +return NULL ; + +kref_init (&client->kref); + client->dev = sbefifo; +sbefifo_buf_init (&client->rbuf); +sbefifo_buf_init (&client->wbuf); +INIT_LIST_HEAD (&client->xfrs); + +sbefifo_get (sbefifo); + +return client; +} + +static void sbefifo_client_release (struct kref *kref) +{ +struct sbefifo *sbefifo; +struct sbefifo_client *client; +struct sbefifo_xfr *xfr, *tmp; + + client = container_of(kref, struct sbefifo_client, kref); + sbefifo = client->dev; + +if (!READ_ONCE (sbefifo->rc)) { +list_for_each_entry_safe (xfr, tmp, &client->xfrs, client) { +if (test_bit (SBEFIFO_XFR_COMPLETE , &xfr->flags)) { +list_del (&xfr->client); +kfree (xfr); +continue ; + } + +/* +* The client left with pending or running xfrs. +* Cancel them. +*/ +set_bit (SBEFIFO_XFR_CANCEL , &xfr->flags); +sbefifo_get (sbefifo); +if (mod_timer (&client->dev->poll_timer, jiffies)) +sbefifo_put (sbefifo); + } + } + +sbefifo_put (sbefifo); +kfree (client); +} + +static void sbefifo_get_client (struct sbefifo_client *client) +{ +kref_get (&client->kref); +} + +static void sbefifo_put_client (struct sbefifo_client *client) +{ +kref_put (&client->kref, sbefifo_client_release); +} +static struct sbefifo_xfr *sbefifo_next_xfr (struct sbefifo *sbefifo) {struct sbefifo_xfr *xfr, *tmp;
@@ -430,6 +525,252 @@ static void sbefifo_poll_timer(unsigned long data)spin_unlock_irqrestore (&sbefifo->lock, flags); } +static int sbefifo_open (struct inode *inode,struct file *file) +{ +struct sbefifo *sbefifo =container_of (file->private_data, + struct sbefifo, mdev); +struct sbefifo_client *client; +int ret; + + ret =READ_ONCE (sbefifo->rc); +if (ret) +return ret; + + client =sbefifo_new_client (sbefifo); +if (!client) +return -ENOMEM ; + + file->private_data = client; + +return 0 ; +} + +static unsigned int sbefifo_poll (struct file *file,poll_table *wait) +{ +struct sbefifo_client *client = file->private_data; +struct sbefifo *sbefifo = client->dev; +unsigned int mask =0 ; + +poll_wait (file, &sbefifo->wait, wait); + +if (READ_ONCE (sbefifo->rc)) + mask |=POLLERR ; + +if (sbefifo_buf_nbreadable (&client->rbuf)) + mask |=POLLIN ; + +if (sbefifo_buf_nbwriteable (&client->wbuf)) + mask |=POLLOUT ; + +return mask; +} + +static bool sbefifo_read_ready (struct sbefifo *sbefifo, +struct sbefifo_client *client,size_t *n, +size_t *ret) +{ +struct sbefifo_xfr *xfr =list_first_entry_or_null (&client->xfrs, + struct sbefifo_xfr, + client); + + *n =sbefifo_buf_nbreadable (&client->rbuf); + *ret =READ_ONCE (sbefifo->rc); + +return *ret || *n || + (xfr &&test_bit (SBEFIFO_XFR_COMPLETE , &xfr->flags)); +} + +static ssize_t sbefifo_read (struct file *file,char __user *buf,size_t len, +loff_t *offset) +{ +struct sbefifo_client *client = file->private_data; +struct sbefifo *sbefifo = client->dev; +struct sbefifo_xfr *xfr; +size_t n; +ssize_t ret =0 ; + +if ((len >>2 ) <<2 != len) +return -EINVAL ; + +if ((file->f_flags &O_NONBLOCK ) && !sbefifo_xfr_rsp_pending (client)) +return -EAGAIN ; + +sbefifo_get_client (client); +if (wait_event_interruptible (sbefifo->wait, +sbefifo_read_ready (sbefifo, client, &n, + &ret))) { + ret = -ERESTARTSYS ; + goto out; + } + +if (ret) { +INIT_LIST_HEAD (&client->xfrs); + goto out; + } + + n =min_t (size_t, n, len); + +if (copy_to_user (buf,READ_ONCE (client->rbuf.rpos), n)) { + ret = -EFAULT ; + goto out; + } + +if (sbefifo_buf_readnb (&client->rbuf, n)) { + xfr =list_first_entry_or_null (&client->xfrs, + struct sbefifo_xfr, client); +if (!xfr) { +/* should be impossible to not have an xfr here */ +WARN_ONCE (1 ,"no xfr in queue" ); + ret = -EPROTO ; + goto out; + } + +if (!test_bit (SBEFIFO_XFR_COMPLETE , &xfr->flags)) { +/* Fill the read buffer back up. */ +sbefifo_get (sbefifo); +if (mod_timer (&client->dev->poll_timer, jiffies)) +sbefifo_put (sbefifo); + }else { +list_del (&xfr->client); +kfree (xfr); +wake_up_interruptible (&sbefifo->wait); + } + } + + ret = n; + +out: +sbefifo_put_client (client); +return ret; +} + +static bool sbefifo_write_ready (struct sbefifo *sbefifo, +struct sbefifo_xfr *xfr, +struct sbefifo_client *client,size_t *n) +{ +struct sbefifo_xfr *next =list_first_entry_or_null (&client->xfrs, + struct sbefifo_xfr, + client); + + *n =sbefifo_buf_nbwriteable (&client->wbuf); +return READ_ONCE (sbefifo->rc) || (next == xfr && *n); +} + +static ssize_t sbefifo_write (struct file *file,const char __user *buf, +size_t len,loff_t *offset) +{ +unsigned long flags; +struct sbefifo_client *client = file->private_data; +struct sbefifo *sbefifo = client->dev; +struct sbefifo_xfr *xfr; +ssize_t ret =0 ; +size_t n; + +if ((len >>2 ) <<2 != len) +return -EINVAL ; + +if (!len) +return 0 ; + +sbefifo_get_client (client); + n =sbefifo_buf_nbwriteable (&client->wbuf); + +spin_lock_irqsave (&sbefifo->lock, flags); + xfr =sbefifo_next_xfr (sbefifo);/* next xfr to be executed */ + +if ((file->f_flags &O_NONBLOCK ) && xfr && n < len) { +spin_unlock_irqrestore (&sbefifo->lock, flags); + ret = -EAGAIN ; + goto out; + } + + xfr =sbefifo_enq_xfr (client);/* this xfr queued up */ +if (IS_ERR (xfr)) { +spin_unlock_irqrestore (&sbefifo->lock, flags); + ret =PTR_ERR (xfr); + goto out; + } + +spin_unlock_irqrestore (&sbefifo->lock, flags); + +/* +* Partial writes are not really allowed in that EOT is sent exactly +* once per write. +*/ +while (len) { +if (wait_event_interruptible (sbefifo->wait, +sbefifo_write_ready (sbefifo, xfr, + client, + &n))) { +set_bit (SBEFIFO_XFR_CANCEL , &xfr->flags); +sbefifo_get (sbefifo); +if (mod_timer (&sbefifo->poll_timer, jiffies)) +sbefifo_put (sbefifo); + + ret = -ERESTARTSYS ; + goto out; + } + +if (sbefifo->rc) { +INIT_LIST_HEAD (&client->xfrs); + ret = sbefifo->rc; + goto out; + } + + n =min_t (size_t, n, len); + +if (copy_from_user (READ_ONCE (client->wbuf.wpos), buf, n)) { +set_bit (SBEFIFO_XFR_CANCEL , &xfr->flags); +sbefifo_get (sbefifo); +if (mod_timer (&sbefifo->poll_timer, jiffies)) +sbefifo_put (sbefifo); + ret = -EFAULT ; + goto out; + } + + buf += n; + +sbefifo_buf_wrotenb (&client->wbuf, n); + len -= n; + ret += n; + +/* +* Set this before starting timer to avoid race condition on +* this flag with the timer function writer. +*/ +if (!len) +set_bit (SBEFIFO_XFR_WRITE_DONE , &xfr->flags); + +/* Drain the write buffer. */ +sbefifo_get (sbefifo); +if (mod_timer (&client->dev->poll_timer, jiffies)) +sbefifo_put (sbefifo); + } + +out: +sbefifo_put_client (client); +return ret; +} + +static int sbefifo_release (struct inode *inode,struct file *file) +{ +struct sbefifo_client *client = file->private_data; +struct sbefifo *sbefifo = client->dev; + +sbefifo_put_client (client); + +return READ_ONCE (sbefifo->rc); +} + +static const struct file_operations sbefifo_fops = { + .owner =THIS_MODULE , + .open = sbefifo_open, + .read = sbefifo_read, + .write = sbefifo_write, + .poll = sbefifo_poll, + .release = sbefifo_release, +}; +static int sbefifo_request_reset (struct sbefifo *sbefifo) {int ret;
@@ -504,6 +845,18 @@ static int sbefifo_probe(struct device *dev)setup_timer (&sbefifo->poll_timer, sbefifo_poll_timer, (unsigned long )sbefifo); + sbefifo->mdev.minor =MISC_DYNAMIC_MINOR ; + sbefifo->mdev.fops = &sbefifo_fops; + sbefifo->mdev.name = sbefifo->name; + sbefifo->mdev.parent = dev; + ret =misc_register (&sbefifo->mdev); +if (ret) { +dev_err (dev,"failed to register miscdevice: %d\n" , ret); +ida_simple_remove (&sbefifo_ida, sbefifo->idx); +sbefifo_put (sbefifo); +return ret; + } +dev_set_drvdata (dev, sbefifo);return 0 ;
@@ -529,6 +882,8 @@ static int sbefifo_remove(struct device *dev)wake_up_all (&sbefifo->wait); +misc_deregister (&sbefifo->mdev); +ida_simple_remove (&sbefifo_ida, sbefifo->idx);if (del_timer_sync (&sbefifo->poll_timer))
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 4/8 drivers/fsi: sbefifo: Add in-kernel API
In reply to Eddie JamesFrom: "Edward A. James" <[email protected]>
Refactor the user interface of the SBEFIFO driver to allow for an in-kernel read/write API. Add exported functions for other drivers to call, and add an include file with those functions. Also parse the device tree for child nodes and create child platform devices accordingly.
--- drivers/fsi/fsi-sbefifo.c | 137 +++++++++++++++++++++++++++++++++++++------- include/linux/fsi-sbefifo.h | 30 ++++++++++ 2 files changed, 146 insertions(+), 21 deletions(-) create mode 100644 include/linux/fsi-sbefifo.h
drivers/fsi/fsi-sbefifo.c +116 -21
@@ -15,12 +15,16 @@#include <linux/errno.h> #include <linux/fs.h> #include <linux/fsi.h> +#include <linux/fsi-sbefifo.h> #include <linux/idr.h> #include <linux/kernel.h> #include <linux/kref.h> #include <linux/list.h> #include <linux/miscdevice.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> #include <linux/poll.h> #include <linux/sched.h> #include <linux/slab.h>
@@ -92,6 +96,7 @@ struct sbefifo_client {struct list_head xfrs;struct sbefifo *dev;struct kref kref; +unsigned long f_flags; };static DEFINE_IDA (sbefifo_ida);
@@ -541,6 +546,7 @@ static int sbefifo_open(struct inode *inode, struct file *file)return -ENOMEM ; file->private_data = client; + client->f_flags = file->f_flags;return 0 ; }
@@ -580,10 +586,9 @@ static bool sbefifo_read_ready(struct sbefifo *sbefifo, (xfr &&test_bit (SBEFIFO_XFR_COMPLETE , &xfr->flags)); } -static ssize_t sbefifo_read (struct file *file,char __user *buf,size_t len, -loff_t *offset) +static ssize_t sbefifo_read_common (struct sbefifo_client *client, +char __user *ubuf,char *kbuf,size_t len) { -struct sbefifo_client *client = file->private_data;struct sbefifo *sbefifo = client->dev;struct sbefifo_xfr *xfr;size_t n;
@@ -592,7 +597,7 @@ static ssize_t sbefifo_read(struct file *file, char __user *buf, size_t len,if ((len >>2 ) <<2 != len)return -EINVAL ; -if ((file->f_flags &O_NONBLOCK ) && !sbefifo_xfr_rsp_pending (client)) +if ((client->f_flags &O_NONBLOCK ) && !sbefifo_xfr_rsp_pending (client))return -EAGAIN ;sbefifo_get_client (client);
@@ -610,9 +615,13 @@ static ssize_t sbefifo_read(struct file *file, char __user *buf, size_t len, n =min_t (size_t, n, len); -if (copy_to_user (buf,READ_ONCE (client->rbuf.rpos), n)) { - ret = -EFAULT ; - goto out; +if (ubuf) { +if (copy_to_user (ubuf,READ_ONCE (client->rbuf.rpos), n)) { + ret = -EFAULT ; + goto out; + } + }else { +memcpy (kbuf,READ_ONCE (client->rbuf.rpos), n); }if (sbefifo_buf_readnb (&client->rbuf, n)) {
@@ -644,6 +653,14 @@ static ssize_t sbefifo_read(struct file *file, char __user *buf, size_t len,return ret; } +static ssize_t sbefifo_read (struct file *file,char __user *buf,size_t len, +loff_t *offset) +{ +struct sbefifo_client *client = file->private_data; + +return sbefifo_read_common (client, buf,NULL , len); +} +static bool sbefifo_write_ready (struct sbefifo *sbefifo,struct sbefifo_xfr *xfr,struct sbefifo_client *client,size_t *n)
@@ -656,11 +673,11 @@ static bool sbefifo_write_ready(struct sbefifo *sbefifo,return READ_ONCE (sbefifo->rc) || (next == xfr && *n); } -static ssize_t sbefifo_write (struct file *file,const char __user *buf, -size_t len,loff_t *offset) +static ssize_t sbefifo_write_common (struct sbefifo_client *client, +const char __user *ubuf,const char *kbuf, +size_t len) {unsigned long flags; -struct sbefifo_client *client = file->private_data;struct sbefifo *sbefifo = client->dev;struct sbefifo_xfr *xfr;ssize_t ret =0 ;
@@ -678,7 +695,7 @@ static ssize_t sbefifo_write(struct file *file, const char __user *buf,spin_lock_irqsave (&sbefifo->lock, flags); xfr =sbefifo_next_xfr (sbefifo);/* next xfr to be executed */ -if ((file->f_flags &O_NONBLOCK ) && xfr && n < len) { +if ((client->f_flags &O_NONBLOCK ) && xfr && n < len) {spin_unlock_irqrestore (&sbefifo->lock, flags); ret = -EAGAIN ; goto out;
@@ -719,16 +736,22 @@ static ssize_t sbefifo_write(struct file *file, const char __user *buf, n =min_t (size_t, n, len); -if (copy_from_user (READ_ONCE (client->wbuf.wpos), buf, n)) { -set_bit (SBEFIFO_XFR_CANCEL , &xfr->flags); -sbefifo_get (sbefifo); -if (mod_timer (&sbefifo->poll_timer, jiffies)) -sbefifo_put (sbefifo); - ret = -EFAULT ; - goto out; - } +if (ubuf) { +if (copy_from_user (READ_ONCE (client->wbuf.wpos), ubuf, + n)) { +set_bit (SBEFIFO_XFR_CANCEL , &xfr->flags); +sbefifo_get (sbefifo); +if (mod_timer (&sbefifo->poll_timer, jiffies)) +sbefifo_put (sbefifo); + ret = -EFAULT ; + goto out; + } - buf += n; + ubuf += n; + }else { +memcpy (READ_ONCE (client->wbuf.wpos), kbuf, n); + kbuf += n; + }sbefifo_buf_wrotenb (&client->wbuf, n); len -= n;
@@ -752,6 +775,14 @@ static ssize_t sbefifo_write(struct file *file, const char __user *buf,return ret; } +static ssize_t sbefifo_write (struct file *file,const char __user *buf, +size_t len,loff_t *offset) +{ +struct sbefifo_client *client = file->private_data; + +return sbefifo_write_common (client, buf,NULL , len); +} +static int sbefifo_release (struct inode *inode,struct file *file) {struct sbefifo_client *client = file->private_data;
@@ -771,6 +802,56 @@ static int sbefifo_release(struct inode *inode, struct file *file) .release = sbefifo_release, }; +struct sbefifo_client *sbefifo_drv_open (struct device *dev, +unsigned long flags) +{ +struct sbefifo_client *client; +struct sbefifo *sbefifo =dev_get_drvdata (dev); + +if (!sbefifo) +return NULL ; + + client =sbefifo_new_client (sbefifo); +if (client) + client->f_flags = flags; + +return client; +} +EXPORT_SYMBOL_GPL (sbefifo_drv_open); + +int sbefifo_drv_read (struct sbefifo_client *client,char *buf,size_t len) +{ +return sbefifo_read_common (client,NULL , buf, len); +} +EXPORT_SYMBOL_GPL (sbefifo_drv_read); + +int sbefifo_drv_write (struct sbefifo_client *client,const char *buf, +size_t len) +{ +return sbefifo_write_common (client,NULL , buf, len); +} +EXPORT_SYMBOL_GPL (sbefifo_drv_write); + +void sbefifo_drv_release (struct sbefifo_client *client) +{ +if (!client) +return ; + +sbefifo_put_client (client); +} +EXPORT_SYMBOL_GPL (sbefifo_drv_release); + +static int sbefifo_unregister_child (struct device *dev,void *data) +{ +struct platform_device *child =to_platform_device (dev); + +of_device_unregister (child); +if (dev->of_node) +of_node_clear_flag (dev->of_node,OF_POPULATED ); + +return 0 ; +} +static int sbefifo_request_reset (struct sbefifo *sbefifo) {int ret;
@@ -805,8 +886,11 @@ static int sbefifo_probe(struct device *dev) {struct fsi_device *fsi_dev =to_fsi_dev (dev);struct sbefifo *sbefifo; +struct device_node *np; +struct platform_device *child; +char child_name[32 ];u32 up, down; -int ret; +int ret, child_idx =0 ;dev_dbg (dev,"Found sbefifo device\n" ); sbefifo =kzalloc (sizeof (*sbefifo),GFP_KERNEL );
@@ -857,6 +941,16 @@ static int sbefifo_probe(struct device *dev)return ret; } +/* create platform devs for dts child nodes (occ, etc) */ +for_each_available_child_of_node (dev->of_node, np) { +snprintf (child_name,sizeof (child_name),"%s-dev%d" , + sbefifo->name, child_idx++); + child =of_platform_device_create (np, child_name, dev); +if (!child) +dev_warn (dev,"failed to create child %s dev\n" , + child_name); + } +dev_set_drvdata (dev, sbefifo);return 0 ;
@@ -883,6 +977,7 @@ static int sbefifo_remove(struct device *dev)wake_up_all (&sbefifo->wait);misc_deregister (&sbefifo->mdev); +device_for_each_child (dev,NULL , sbefifo_unregister_child);ida_simple_remove (&sbefifo_ida, sbefifo->idx);
include/linux/fsi-sbefifo.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* 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
1.8.3.1
kbuild test robot
build botRe: [PATCH v5 4/8] drivers/fsi: sbefifo: Add in-kernel API
Thank you for the patch! Yet something to improve:
Hi Edward,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.14 next-20171122]
[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-client-drivers/20171123-041813
config: um-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce:
# save the attached .config to linux build tree
make ARCH=um All errors (new ones prefixed by >>):
arch/um/drivers/vde.o: In function `vde_open_real':
(.text+0x951): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking (.text+0x79c): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking (.text+0xab5): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoaddr':
(.text+0xdef5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametonetaddr':
(.text+0xdf95): warning: Using 'getnetbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoproto':
(.text+0xe1b5): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoport':
(.text+0xdfe7): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking drivers/auxdisplay/img-ascii-lcd.o: In function `img_ascii_lcd_probe':
img-ascii-lcd.c:(.text+0x771): undefined reference to `devm_ioremap_resource'
drivers/fsi/fsi-sbefifo.o: In function `sbefifo_probe':
>> fsi-sbefifo.c:(.text+0x2666): undefined reference to `of_platform_device_create'
collect2: error: ld returned 1 exit status
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v5 5/8 dt-bindings: fsi: Add OCC documentation
In reply to Eddie JamesFrom: "Edward A. James" <eajames-r/[email protected]>
Document the bindings for the P9 OCC device. OCC devices are accessed through the SBEFIFO.
--- Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +18 -0
@@ -0,0 +1,18 @@ +Device-tree bindings for P9 On-Chip Controller +---------------------------------------------- + +The POWER9 On-Chip Controller is accessed through the SBEFIFO. All OCC nodes +must be child nodes of SBEFIFO devices (see ibm,p9-sbefifo.txt). + +Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = <processor index>; : Index for the processor this OCC is on. + +Examples: + + occ@1 { + compatible = "ibm,p9-occ"; + reg = <1>; + };
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
maintainerRe: [PATCH v5 5/8] dt-bindings: fsi: Add OCC documentation
Quoted 18 lines · Eddie James
From: "Edward A. James" <eajames-r/[email protected]>
Document the bindings for the P9 OCC device. OCC devices are accessed through the SBEFIFO.
Signed-off-by Edward A. James <eajames-r/[email protected]>--- Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/fsi/ibm,p9-occ.txtDocumentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +1
-0@@ -0,0 +1,18 @@ +Device-tree bindings for P9 On-Chip Controller
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt line 11
Quoted 10 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +10
-0+---------------------------------------------- + +The POWER9 On-Chip Controller is accessed through the SBEFIFO. All OCC nodes +must be child nodes of SBEFIFO devices (see ibm,p9-sbefifo.txt). + +Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = <processor index>; : Index for the processor this OCC is on.
reg should be how the parent (SBEFIFO) addresses this device. Would all of these child devices be a unique processor?
I think a phandle to the cpu node would be more appropriate here.
Quoted 10 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +7
-0+ +Examples: + + occ@1 { + compatible = "ibm,p9-occ"; + reg = <1>; + };Signature · 1 line
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 5/8] dt-bindings: fsi: Add OCC documentation
Quoted 23 lines · Rob Herring
Quoted 22 lines · Eddie James
From: "Edward A. James" <[email protected]>
Document the bindings for the P9 OCC device. OCC devices are accessed through the SBEFIFO.
Signed-off-by Edward A. James <[email protected]>--- Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)create mode 100644
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txtDocumentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +5
-0@@ -0,0 +1,18 @@ +Device-tree bindings for P9 On-Chip Controller +---------------------------------------------- + +The POWER9 On-Chip Controller is accessed through the SBEFIFO. All OCC nodes +must be child nodes of SBEFIFO devices (see ibm,p9-sbefifo.txt).
Quoted 8 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt line 11
Quoted 6 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +6
-0+ +Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = <processor index>; : Index for the processor this OCC is on.reg should be how the parent (SBEFIFO) addresses this device. Would all of these child devices be a unique processor?
Yes. The "processor" here is indicating which P9 processor in the system, not whatever processor(s) this kernel is running on. We use this device tree on the service processor, which can be talking to multiple P9 chips (over SBEFIFO). This could probably be clarified by saying "P9 chip" or something.
Quoted 2 lines
I think a phandle to the cpu node would be more appropriate here.
No phandle available; see above, the processor being referenced is a separate entity in the system.
Thanks for the quick feedback.
Eddie
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +7
-0+ +Examples: + + occ@1 { + compatible = "ibm,p9-occ"; + reg = <1>; + };Signature · 1 line
1.8.3.1
Re: [PATCH v5 5/8] dt-bindings: fsi: Add OCC documentation
Quoted 42 lines · Eddie James
Quoted 29 lines · Rob Herring
Quoted 27 lines · Eddie James
From: "Edward A. James" <eajames-r/[email protected]>
Document the bindings for the P9 OCC device. OCC devices are accessed through the SBEFIFO.
Signed-off-by Edward A. James <eajames-r/[email protected]>--- Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)create mode 100644
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txtDocumentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +4
-0@@ -0,0 +1,18 @@ +Device-tree bindings for P9 On-Chip Controller +---------------------------------------------- + +The POWER9 On-Chip Controller is accessed through the SBEFIFO. All OCCnodes
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +2
-0+must be child nodes of SBEFIFO devices (see ibm,p9-sbefifo.txt). +Quoted 8 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt line 11
Quoted 5 lines
Documentation/devicetree/bindings/fsi/ibm,p9-occ.txt new file +5
-0+Required properties: + - compatible = "ibm,p9-occ"; + +Optional properties: + - reg = <processor index>; : Index for the processor this OCC is on.reg should be how the parent (SBEFIFO) addresses this device. Would all of these child devices be a unique processor?
Quoted 4 lines
Yes. The "processor" here is indicating which P9 processor in the system, not whatever processor(s) this kernel is running on. We use this device tree on the service processor, which can be talking to multiple P9 chips (over SBEFIFO). This could probably be clarified by saying "P9 chip" or something.
Ah, okay.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 6/8 drivers/fsi: Add On-Chip Controller (OCC) driver
In reply to Eddie JamesFrom: "Edward A. James" <eajames-r/[email protected]>
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.
--- drivers/fsi/Kconfig | 10 + drivers/fsi/Makefile | 1 + drivers/fsi/fsi-occ.c | 518 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 529 insertions(+) create mode 100644 drivers/fsi/fsi-occ.c
drivers/fsi/Kconfig +10 -0
@@ -40,6 +40,16 @@ config FSI_SBEFIFO a pipe-like FSI device for communicating with the self boot engine (SBE) on POWER processors. +config FSI_OCC + 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
drivers/fsi/Makefile +1 -0
@@ -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_FSI_OCC) += fsi-occ.o
drivers/fsi/fsi-occ.c new file +518 -0
518 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 7/8 drivers/fsi: occ: Add miscdevice
In reply to Eddie JamesFrom: "Edward A. James" <[email protected]>
Add a miscdevice for the occ to allow userspace access through standard file operations.
--- drivers/fsi/fsi-occ.c | 264 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 264 insertions(+)
drivers/fsi/fsi-occ.c +264 -0
@@ -16,6 +16,7 @@#include <linux/idr.h> #include <linux/kernel.h> #include <linux/list.h> +#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/of.h>
@@ -40,6 +41,7 @@ struct occ {struct device *sbefifo;char name[32 ];int idx; +struct miscdevice mdev;struct list_head xfrs;spinlock_t list_lock;/* lock access to the xfrs list */ struct mutex occ_lock;/* lock access to the hardware */
@@ -113,6 +115,29 @@ struct occ_client {static DEFINE_IDA (occ_ida); +static int occ_enqueue_xfr (struct occ_xfr *xfr) +{ +int empty; +unsigned long flags; +struct occ_client *client =to_client (xfr); +struct occ *occ = client->occ; + +if (occ->cancel) +return -ENODEV ; + +spin_lock_irqsave (&occ->list_lock, flags); + + empty =list_empty (&occ->xfrs); +list_add_tail (&xfr->link, &occ->xfrs); + +spin_unlock_irqrestore (&occ->list_lock, flags); + +if (empty) +queue_work (occ_wq, &occ->work); + +return 0 ; +} +static void occ_get_client (struct occ_client *client) {kref_get (&client->kref);
@@ -131,6 +156,230 @@ static void occ_put_client(struct occ_client *client)kref_put (&client->kref, occ_client_release); } +static int occ_open (struct inode *inode,struct file *file) +{ +struct miscdevice *mdev = file->private_data; +struct occ *occ =to_occ (mdev); +struct occ_client *client =kzalloc (sizeof (*client),GFP_KERNEL ); + +if (!client) +return -ENOMEM ; + + client->occ = occ; +kref_init (&client->kref); +spin_lock_init (&client->lock); +init_waitqueue_head (&client->wait); + +if (file->f_flags &O_NONBLOCK ) +set_bit (CLIENT_NONBLOCKING , &client->flags); + + file->private_data = client; + +return 0 ; +} + +static inline bool occ_read_ready (struct occ_xfr *xfr,struct occ *occ) +{ +return test_bit (XFR_COMPLETE , &xfr->flags) || +test_bit (XFR_CANCELED , &xfr->flags) || occ->cancel; +} + +static ssize_t occ_read (struct file *file,char __user *buf,size_t len, +loff_t *offset) +{ +int rc; +unsigned long flags; +size_t bytes; +struct occ_xfr *xfr; +struct occ *occ; +struct occ_client *client = file->private_data; + +if (!client) +return -ENODEV ; + +if (len >OCC_SRAM_BYTES ) +return -EINVAL ; + +occ_get_client (client); + xfr = &client->xfr; + occ = client->occ; + +spin_lock_irqsave (&client->lock, flags); + +if (!test_bit (CLIENT_XFR_PENDING , &client->flags)) { +/* we just finished reading all data, return 0 */ +if (client->read_offset) { + rc =0 ; + client->read_offset =0 ; + }else { + rc = -ENOMSG ; + } + + goto done; + } + +if (!test_bit (XFR_COMPLETE , &xfr->flags)) { +if (test_bit (CLIENT_NONBLOCKING , &client->flags)) { + rc = -EAGAIN ; + goto done; + } + +spin_unlock_irqrestore (&client->lock, flags); + + rc =wait_event_interruptible (client->wait, +occ_read_ready (xfr, occ)); + +spin_lock_irqsave (&client->lock, flags); + +if (!test_bit (XFR_COMPLETE , &xfr->flags)) { +if (occ->cancel ||test_bit (XFR_CANCELED , &xfr->flags)) + rc = -ENODEV ; +else + rc = -EINTR ; + + goto done; + } + } + +if (xfr->rc) { + rc = xfr->rc; + goto done; + } + + bytes =min (len, xfr->resp_data_length - client->read_offset); +if (copy_to_user (buf, &xfr->buf[client->read_offset], bytes)) { + rc = -EFAULT ; + goto done; + } + + client->read_offset += bytes; + +/* xfr done */ +if (client->read_offset == xfr->resp_data_length) +clear_bit (CLIENT_XFR_PENDING , &client->flags); + + rc = bytes; + +done: +spin_unlock_irqrestore (&client->lock, flags); +occ_put_client (client); +return rc; +} + +static ssize_t occ_write (struct file *file,const char __user *buf, +size_t len,loff_t *offset) +{ +int rc; +unsigned long flags; +unsigned int i; +u16 data_length, checksum =0 ; +struct occ_xfr *xfr; +struct occ_client *client = file->private_data; + +if (!client) +return -ENODEV ; + +if (len > (OCC_CMD_DATA_BYTES +3 ) || len <3 ) +return -EINVAL ; + +occ_get_client (client); + xfr = &client->xfr; + +spin_lock_irqsave (&client->lock, flags); + +if (test_bit (CLIENT_XFR_PENDING , &client->flags)) { + rc = -EBUSY ; + goto done; + } + +memset (xfr,0 ,sizeof (*xfr));/* clear out the transfer */ + xfr->buf[0 ] =1 ;/* occ sequence number */ + +/* +* Assume user data follows the occ command format. +* byte 0: command type +* bytes 1-2: data length (msb first) +* bytes 3-n: data +*/ +if (copy_from_user (&xfr->buf[1 ], buf, len)) { + rc = -EFAULT ; + goto done; + } + + data_length = (xfr->buf[2 ] <<8 ) + xfr->buf[3 ]; +if (data_length >OCC_CMD_DATA_BYTES ) { + rc = -EINVAL ; + goto done; + } + +for (i =0 ; i < data_length +4 ; ++i) + checksum += xfr->buf[i]; + + xfr->buf[data_length +4 ] = checksum >>8 ; + xfr->buf[data_length +5 ] = checksum &0xFF ; + + xfr->cmd_data_length = data_length +6 ; + client->read_offset =0 ; + + rc =occ_enqueue_xfr (xfr); +if (rc) + goto done; + +set_bit (CLIENT_XFR_PENDING , &client->flags); + rc = len; + +done: +spin_unlock_irqrestore (&client->lock, flags); +occ_put_client (client); +return rc; +} + +static int occ_release (struct inode *inode,struct file *file) +{ +unsigned long flags; +struct occ *occ; +struct occ_xfr *xfr; +struct occ_client *client = file->private_data; + +if (!client) +return -ENODEV ; + + xfr = &client->xfr; + occ = client->occ; + +spin_lock_irqsave (&client->lock, flags); + +set_bit (XFR_CANCELED , &xfr->flags); +if (!test_bit (CLIENT_XFR_PENDING , &client->flags)) + goto done; + +spin_lock (&occ->list_lock); + +if (!test_bit (XFR_IN_PROGRESS , &xfr->flags)) { +/* already deleted from list if complete */ +if (!test_bit (XFR_COMPLETE , &xfr->flags)) +list_del (&xfr->link); + } + +spin_unlock (&occ->list_lock); + +wake_up_all (&client->wait); + +done: +spin_unlock_irqrestore (&client->lock, flags); + +occ_put_client (client); +return 0 ; +} + +static const struct file_operations occ_fops = { + .owner =THIS_MODULE , + .open = occ_open, + .read = occ_read, + .write = occ_write, + .release = occ_release, +}; +static int occ_write_sbefifo (struct sbefifo_client *client,const char *buf,ssize_t len) {
@@ -450,6 +699,19 @@ static int occ_probe(struct platform_device *pdev) occ->idx =ida_simple_get (&occ_ida,1 ,INT_MAX ,GFP_KERNEL ); } +snprintf (occ->name,sizeof (occ->name),"occ%d" , occ->idx); + occ->mdev.fops = &occ_fops; + occ->mdev.minor =MISC_DYNAMIC_MINOR ; + occ->mdev.name = occ->name; + occ->mdev.parent = dev; + + rc =misc_register (&occ->mdev); +if (rc) { +dev_err (dev,"failed to register miscdevice: %d\n" , rc); +ida_simple_remove (&occ_ida, occ->idx); +return rc; + } +platform_set_drvdata (pdev, occ);return 0 ;
@@ -471,6 +733,8 @@ static int occ_remove(struct platform_device *pdev) }spin_unlock_irqrestore (&occ->list_lock, flags); +misc_deregister (&occ->mdev); +cancel_work_sync (&occ->work);ida_simple_remove (&occ_ida, occ->idx);
Signature · 1 line
1.8.3.1
PATCH v5 8/8 drivers/fsi: occ: Add in-kernel API
In reply to Eddie JamesFrom: "Edward A. James" <[email protected]>
Add an in-kernel read/write API with exported functions. This is necessary for other drivers which want to directly interact with the OCC. Also add a child platform device node for the associated hwmon device.
--- drivers/fsi/fsi-occ.c | 138 ++++++++++++++++++++++++++++++++++++++++-------- include/linux/fsi-occ.h | 41 ++++++++++++++ 2 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 include/linux/fsi-occ.h
drivers/fsi/fsi-occ.c +116 -22
@@ -19,7 +19,9 @@#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/mutex.h> +#include <linux/fsi-occ.h> #include <linux/of.h> +#include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/slab.h>
@@ -32,8 +34,6 @@#define OCC_CMD_DATA_BYTES 4090#define OCC_RESP_DATA_BYTES 4089 -#define OCC_RESP_CMD_IN_PRG 0xFF -#define OCC_TIMEOUT_MS 1000#define OCC_CMD_IN_PRG_WAIT_MS 50
@@ -156,23 +156,34 @@ static void occ_put_client(struct occ_client *client)kref_put (&client->kref, occ_client_release); } -static int occ_open (struct inode *inode,struct file *file) +static struct occ_client *occ_open_common (struct occ *occ,unsigned long flags) { -struct miscdevice *mdev = file->private_data; -struct occ *occ =to_occ (mdev);struct occ_client *client =kzalloc (sizeof (*client),GFP_KERNEL );if (!client) -return -ENOMEM ; +return NULL ; client->occ = occ;kref_init (&client->kref);spin_lock_init (&client->lock);init_waitqueue_head (&client->wait); -if (file->f_flags &O_NONBLOCK ) +if (flags &O_NONBLOCK )set_bit (CLIENT_NONBLOCKING , &client->flags); +return client; +} + +static int occ_open (struct inode *inode,struct file *file) +{ +struct occ_client *client; +struct miscdevice *mdev = file->private_data; +struct occ *occ =to_occ (mdev); + + client =occ_open_common (occ, file->f_flags); +if (!client) +return -ENOMEM ; + file->private_data = client;return 0 ;
@@ -184,15 +195,14 @@ static inline bool occ_read_ready(struct occ_xfr *xfr, struct occ *occ)test_bit (XFR_CANCELED , &xfr->flags) || occ->cancel; } -static ssize_t occ_read (struct file *file,char __user *buf,size_t len, -loff_t *offset) +static ssize_t occ_read_common (struct occ_client *client,char __user *ubuf, +char *kbuf,size_t len) {int rc;unsigned long flags;size_t bytes;struct occ_xfr *xfr;struct occ *occ; -struct occ_client *client = file->private_data;if (!client)return -ENODEV ;
@@ -247,9 +257,14 @@ static ssize_t occ_read(struct file *file, char __user *buf, size_t len, } bytes =min (len, xfr->resp_data_length - client->read_offset); -if (copy_to_user (buf, &xfr->buf[client->read_offset], bytes)) { - rc = -EFAULT ; - goto done; +if (ubuf) { +if (copy_to_user (ubuf, &xfr->buf[client->read_offset], + bytes)) { + rc = -EFAULT ; + goto done; + } + }else { +memcpy (kbuf, &xfr->buf[client->read_offset], bytes); } client->read_offset += bytes;
@@ -266,15 +281,23 @@ static ssize_t occ_read(struct file *file, char __user *buf, size_t len,return rc; } -static ssize_t occ_write (struct file *file,const char __user *buf, -size_t len,loff_t *offset) +static ssize_t occ_read (struct file *file,char __user *buf,size_t len, +loff_t *offset) +{ +struct occ_client *client = file->private_data; + +return occ_read_common (client, buf,NULL , len); +} + +static ssize_t occ_write_common (struct occ_client *client, +const char __user *ubuf,const char *kbuf, +size_t len) {int rc;unsigned long flags;unsigned int i;u16 data_length, checksum =0 ;struct occ_xfr *xfr; -struct occ_client *client = file->private_data;if (!client)return -ENODEV ;
@@ -301,9 +324,13 @@ static ssize_t occ_write(struct file *file, const char __user *buf,* bytes 1-2: data length (msb first) * bytes 3-n: data */ -if (copy_from_user (&xfr->buf[1 ], buf, len)) { - rc = -EFAULT ; - goto done; +if (ubuf) { +if (copy_from_user (&xfr->buf[1 ], ubuf, len)) { + rc = -EFAULT ; + goto done; + } + }else { +memcpy (&xfr->buf[1 ], kbuf, len); } data_length = (xfr->buf[2 ] <<8 ) + xfr->buf[3 ];
@@ -334,12 +361,19 @@ static ssize_t occ_write(struct file *file, const char __user *buf,return rc; } -static int occ_release (struct inode *inode,struct file *file) +static ssize_t occ_write (struct file *file,const char __user *buf, +size_t len,loff_t *offset) +{ +struct occ_client *client = file->private_data; + +return occ_write_common (client, buf,NULL , len); +} + +static int occ_release_common (struct occ_client *client) {unsigned long flags;struct occ *occ;struct occ_xfr *xfr; -struct occ_client *client = file->private_data;if (!client)return -ENODEV ;
@@ -372,6 +406,13 @@ static int occ_release(struct inode *inode, struct file *file)return 0 ; } +static int occ_release (struct inode *inode,struct file *file) +{ +struct occ_client *client = file->private_data; + +return occ_release_common (client); +} +static const struct file_operations occ_fops = { .owner =THIS_MODULE , .open = occ_open,
@@ -665,12 +706,55 @@ static void occ_worker(struct work_struct *work) goto again; } +struct occ_client *occ_drv_open (struct device *dev,unsigned long flags) +{ +struct occ *occ =dev_get_drvdata (dev); + +if (!occ) +return NULL ; + +return occ_open_common (occ, flags); +} +EXPORT_SYMBOL_GPL (occ_drv_open); + +int occ_drv_read (struct occ_client *client,char *buf,size_t len) +{ +return occ_read_common (client,NULL , buf, len); +} +EXPORT_SYMBOL_GPL (occ_drv_read); + +int occ_drv_write (struct occ_client *client,const char *buf,size_t len) +{ +return occ_write_common (client,NULL , buf, len); +} +EXPORT_SYMBOL_GPL (occ_drv_write); + +void occ_drv_release (struct occ_client *client) +{ +occ_release_common (client); +} +EXPORT_SYMBOL_GPL (occ_drv_release); + +static int occ_unregister_child (struct device *dev,void *data) +{ +struct platform_device *child =to_platform_device (dev); + +of_device_unregister (child); +if (dev->of_node) +of_node_clear_flag (dev->of_node,OF_POPULATED ); + +return 0 ; +} +static int occ_probe (struct platform_device *pdev) { -int rc; +int rc, child_idx =0 ;u32 reg;struct occ *occ; +struct device_node *np; +struct platform_device *child;struct device *dev = &pdev->dev; +char child_name[32 ]; occ =devm_kzalloc (dev,sizeof (*occ),GFP_KERNEL );if (!occ)
@@ -712,6 +796,15 @@ static int occ_probe(struct platform_device *pdev)return rc; } +/* create platform devs for dts child nodes (hwmon, etc) */ +for_each_available_child_of_node (dev->of_node, np) { +snprintf (child_name,sizeof (child_name),"occ%d-dev%d" , + occ->idx, child_idx++); + child =of_platform_device_create (np, child_name, dev); +if (!child) +dev_warn (dev,"failed to create child node dev\n" ); + } +platform_set_drvdata (pdev, occ);return 0 ;
@@ -734,6 +827,7 @@ static int occ_remove(struct platform_device *pdev)spin_unlock_irqrestore (&occ->list_lock, flags);misc_deregister (&occ->mdev); +device_for_each_child (&pdev->dev,NULL , occ_unregister_child);cancel_work_sync (&occ->work);
include/linux/fsi-occ.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.8.3.1
kbuild test robot
build botRe: [PATCH v5 8/8] drivers/fsi: occ: Add in-kernel API
Thank you for the patch! Yet something to improve:
Hi Edward,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.14 next-20171122]
[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-client-drivers/20171123-041813
config: um-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce:
# save the attached .config to linux build tree
make ARCH=um All errors (new ones prefixed by >>):
WARNING: "memcpy" [drivers/net/phy/xilinx_gmii2rgmii.ko] has no CRC!
WARNING: "memcpy" [drivers/net/phy/micrel.ko] has no CRC!
WARNING: "memcpy" [drivers/net/phy/mdio-gpio.ko] has no CRC!
WARNING: "memcpy" [drivers/net/phy/marvell.ko] has no CRC!
WARNING: "memcpy" [drivers/net/phy/bcm-phy-lib.ko] has no CRC!
WARNING: "memcpy" [drivers/net/netconsole.ko] has no CRC!
WARNING: "memcpy" [drivers/net/macvlan.ko] has no CRC!
WARNING: "memcpy" [drivers/net/macsec.ko] has no CRC!
WARNING: "memcpy" [drivers/net/ipvlan/ipvlan.ko] has no CRC!
WARNING: "memcpy" [drivers/net/hamradio/yam.ko] has no CRC!
WARNING: "memcpy" [drivers/net/hamradio/mkiss.ko] has no CRC!
WARNING: "memcpy" [drivers/net/hamradio/hdlcdrv.ko] has no CRC!
WARNING: "memcpy" [drivers/net/hamradio/bpqether.ko] has no CRC!
WARNING: "memcpy" [drivers/net/hamradio/6pack.ko] has no CRC!
WARNING: "memcpy" [drivers/net/geneve.ko] has no CRC!
WARNING: "memcpy" [drivers/net/ethernet/qualcomm/rmnet/rmnet.ko] has no CRC!
WARNING: "memcpy" [drivers/net/ethernet/qualcomm/qcauart.ko] has no CRC!
WARNING: "memcpy" [drivers/net/ethernet/mellanox/mlxsw/mlxsw_i2c.ko] has no CRC!
WARNING: "memcpy" [drivers/net/ethernet/mellanox/mlxsw/mlxsw_core.ko] has no CRC!
WARNING: "memcpy" [drivers/net/dummy.ko] has no CRC!
WARNING: "memcpy" [drivers/net/dsa/mv88e6xxx/mv88e6xxx.ko] has no CRC!
WARNING: "memcpy" [drivers/net/dsa/microchip/ksz_common.ko] has no CRC!
WARNING: "memcpy" [drivers/net/dsa/dsa_loop.ko] has no CRC!
WARNING: "memcpy" [drivers/net/dsa/b53/b53_common.ko] has no CRC!
WARNING: "memcpy" [drivers/net/can/slcan.ko] has no CRC!
WARNING: "memcpy" [drivers/net/can/can-dev.ko] has no CRC!
WARNING: "memcpy" [drivers/net/caif/caif_serial.ko] has no CRC!
WARNING: "memcpy" [drivers/net/caif/caif_hsi.ko] has no CRC!
WARNING: "memcpy" [drivers/net/bonding/bonding.ko] has no CRC!
WARNING: "memcpy" [drivers/net/appletalk/ipddp.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/ubi/ubi.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/tests/mtd_pagetest.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/tests/mtd_nandecctest.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/tests/mtd_nandbiterrs.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/spi-nor/spi-nor.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/sm_ftl.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/nftl.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/nand/nandsim.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/nand/nand.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/mtdswap.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/mtdblock.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/mtd.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/lpddr/qinfo_probe.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/lpddr/lpddr_cmds.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/inftl.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/map_rom.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/map_ram.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/jedec_probe.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/gen_probe.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/cfi_util.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/cfi_probe.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0020.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0002.ko] has no CRC!
WARNING: "memcpy" [drivers/mtd/chips/cfi_cmdset_0001.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/ti-st/st_drv.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/lkdtm.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/eeprom/max6875.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/eeprom/idt_89hpesx.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/eeprom/eeprom.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/eeprom/at24.ko] has no CRC!
WARNING: "memcpy" [drivers/misc/echo/echo.ko] has no CRC!
WARNING: "memcpy" [drivers/memstick/core/mspro_block.ko] has no CRC!
WARNING: "memcpy" [drivers/memstick/core/memstick.ko] has no CRC!
WARNING: "memcpy" [drivers/md/raid456.ko] has no CRC!
WARNING: "memcpy" [drivers/md/raid10.ko] has no CRC!
WARNING: "memcpy" [drivers/md/raid1.ko] has no CRC!
WARNING: "memcpy" [drivers/md/persistent-data/dm-persistent-data.ko] has no CRC!
WARNING: "memcpy" [drivers/md/md-mod.ko] has no CRC!
WARNING: "memcpy" [drivers/md/md-cluster.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-zoned.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-verity.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-thin-pool.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-snapshot.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-mod.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-log.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-log-writes.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-log-userspace.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-integrity.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-era.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-crypt.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-cache.ko] has no CRC!
WARNING: "memcpy" [drivers/md/dm-bio-prison.ko] has no CRC!
WARNING: "memcpy" [drivers/md/bcache/bcache.ko] has no CRC!
WARNING: "memcpy" [drivers/leds/leds-tca6507.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/light/tsl2583.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/industrialio.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/humidity/hts221_i2c.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/health/max30102.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/adc/ti-ads1015.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/accel/mma9551_core.ko] has no CRC!
WARNING: "memcpy" [drivers/iio/accel/bmc150-accel-core.ko] has no CRC!
WARNING: "memcpy" [drivers/i2c/muxes/i2c-mux-gpio.ko] has no CRC!
WARNING: "memcpy" [drivers/i2c/i2c-slave-eeprom.ko] has no CRC!
WARNING: "memcpy" [drivers/i2c/i2c-core.ko] has no CRC!
WARNING: "memcpy" [drivers/gpio/gpio-pca953x.ko] has no CRC!
ERROR: "of_platform_device_create" [drivers/fsi/fsi-sbefifo.ko] undefined!
WARNING: "memcpy" [drivers/fsi/fsi-sbefifo.ko] has no CRC!
>> ERROR: "of_platform_device_create" [drivers/fsi/fsi-occ.ko] undefined!
WARNING: "memcpy" [drivers/fsi/fsi-occ.ko] has no CRC!
WARNING: "memcpy" [drivers/fsi/fsi-core.ko] has no CRC!
WARNING: "memcpy" [drivers/fmc/fmc.ko] has no CRC!
WARNING: "memcpy" [drivers/fmc/fmc-fakedev.ko] has no CRC!
WARNING: "memcpy" [drivers/connector/cn.ko] has no CRC!
WARNING: "memcpy" [drivers/cdrom/cdrom.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/hci_vhci.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/hci_uart.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/btwilink.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/btqca.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/btmrvl.ko] has no CRC!
WARNING: "memcpy" [drivers/bluetooth/btintel.ko] has no CRC!
WARNING: "memcpy" [drivers/block/rbd.ko] has no CRC!
WARNING: "memcpy" [drivers/block/null_blk.ko] has no CRC!
WARNING: "memcpy" [drivers/block/nbd.ko] has no CRC!
WARNING: "memcpy" [drivers/block/loop.ko] has no CRC!
WARNING: "memcpy" [drivers/block/drbd/drbd.ko] has no CRC!
WARNING: "memcpy" [drivers/block/cryptoloop.ko] has no CRC!
WARNING: "memcpy" [drivers/block/brd.ko] has no CRC!
WARNING: "memcpy" [drivers/block/aoe/aoe.ko] has no CRC!
WARNING: "memcpy" [drivers/base/firmware_class.ko] has no CRC!
ERROR: "devm_ioremap_resource" [drivers/auxdisplay/img-ascii-lcd.ko] undefined!
WARNING: "memcpy" [drivers/auxdisplay/img-ascii-lcd.ko] has no CRC!
WARNING: "memcpy" [drivers/atm/atmtcp.ko] has no CRC!
WARNING: "memcpy" [crypto/xcbc.ko] has no CRC!
WARNING: "memcpy" [crypto/wp512.ko] has no CRC!
WARNING: "memcpy" [crypto/vmac.ko] has no CRC!
WARNING: "memcpy" [crypto/tgr192.ko] has no CRC!
WARNING: "memcpy" [crypto/sm3_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/sha512_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/sha3_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/salsa20_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/rmd320.ko] has no CRC!
WARNING: "memcpy" [crypto/rmd256.ko] has no CRC!
WARNING: "memcpy" [crypto/rmd160.ko] has no CRC!
WARNING: "memcpy" [crypto/rmd128.ko] has no CRC!
WARNING: "memcpy" [crypto/poly1305_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/pcbc.ko] has no CRC!
WARNING: "memcpy" [crypto/michael_mic.ko] has no CRC!
WARNING: "memcpy" [crypto/md4.ko] has no CRC!
WARNING: "memcpy" [crypto/mcryptd.ko] has no CRC!
WARNING: "memcpy" [crypto/lrw.ko] has no CRC!
WARNING: "memcpy" [crypto/keywrap.ko] has no CRC!
WARNING: "memcpy" [crypto/fcrypt.ko] has no CRC!
WARNING: "memcpy" [crypto/echainiv.ko] has no CRC!
WARNING: "memcpy" [crypto/ecdh_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/des_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/cts.ko] has no CRC!
WARNING: "memcpy" [crypto/cryptd.ko] has no CRC!
WARNING: "memcpy" [crypto/cmac.ko] has no CRC!
WARNING: "memcpy" [crypto/chacha20poly1305.ko] has no CRC!
WARNING: "memcpy" [crypto/chacha20_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/ccm.ko] has no CRC!
WARNING: "memcpy" [crypto/cast6_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/cast5_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/camellia_generic.ko] has no CRC!
WARNING: "memcpy" [crypto/async_tx/async_memcpy.ko] has no CRC!
WARNING: "memcpy" [crypto/ansi_cprng.ko] has no CRC!
WARNING: "memcpy" [crypto/af_alg.ko] has no CRC!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v5 8/8] drivers/fsi: occ: Add in-kernel API
In reply to Eddie JamesThank you for the patch! Yet something to improve:
Hi Edward,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v4.14 next-20171122]
[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-client-drivers/20171123-041813
config: um-allyesconfig (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce:
# save the attached .config to linux build tree
make ARCH=um All errors (new ones prefixed by >>):
arch/um/drivers/vde.o: In function `vde_open_real':
(.text+0x951): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking (.text+0x79c): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking (.text+0xab5): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoaddr':
(.text+0xdef5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametonetaddr':
(.text+0xdf95): warning: Using 'getnetbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoproto':
(.text+0xe1b5): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking arch/um/drivers/pcap.o: In function `pcap_nametoport':
(.text+0xdfe7): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking drivers/auxdisplay/img-ascii-lcd.o: In function `img_ascii_lcd_probe':
img-ascii-lcd.c:(.text+0x771): undefined reference to `devm_ioremap_resource'
drivers/fsi/fsi-sbefifo.o: In function `sbefifo_probe':
fsi-sbefifo.c:(.text+0x2666): undefined reference to `of_platform_device_create'
drivers/fsi/fsi-occ.o: In function `occ_probe':
>> fsi-occ.c:(.text+0x1561): undefined reference to `of_platform_device_create'
collect2: error: ld returned 1 exit status
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation