lkml.org 
[lkml]   [2018]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/5] powerpc/ftw: Implement a simple FTW driver
From
Date
On 01/16/18 18:50, Sukadev Bhattiprolu wrote:
> The Fast Thread Wake-up (FTW) driver provides user space applications an
> interface to the low latency Core-to-Core wakeup functionality in POWER9.
>
> This mechanism allows a thread on one core to efficiently send a message
> to a "waiting thread" on another core on the same chip, using the Virtual
> Accelrator Switchboard (VAS) subsystem.
>
> This initial FTW driver implements the ioctl and mmap operations on an
> FTW device node. Using these operations, a pair of application threads
> can establish a "communication channel" and use the COPY, PASTE and WAIT
> instructions to wait/wake up.
>
> PATCH 5/5 documents the API and includes an example of the usage.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
> Changelog[v2]
> - [Michael Neuling] Rename from drop "nx" from name "nx-ftw".
> - [Michael Neuling] Use a single VAS_FTW_SETUP ioctl to simplify
> interface.
> - [Michael Ellerman] To work with paste emulation patch, mark
> PTE dirty in ->mmap() to ensure there is no fault on paste
> (the emulation patch must disable pagefaults when updating
> thread reconfig registers).
> - Check return value from set_thread_tidr().
> - Move driver drivers/misc/ftw.
>
> ---
> drivers/misc/Kconfig | 1 +
> drivers/misc/Makefile | 1 +
> drivers/misc/ftw/Kconfig | 16 +++
> drivers/misc/ftw/Makefile | 4 +
> drivers/misc/ftw/ftw.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 368 insertions(+)
> create mode 100644 drivers/misc/ftw/Kconfig
> create mode 100644 drivers/misc/ftw/Makefile
> create mode 100644 drivers/misc/ftw/ftw.c

> +static long ftw_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
> +{
> + switch (cmd) {
> +
> + case FTW_SETUP:
> + return ftw_ioc_ftw_setup(fp, arg);
> +
> + default:
> + return -EINVAL;
> + }
> +}

Nit: some versions of gcc (or maybe clang) complain about a typed function
not always having a return value in code like above, so it is often done as:

> +static long ftw_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
> +{
> + switch (cmd) {
> +
> + case FTW_SETUP:
> + return ftw_ioc_ftw_setup(fp, arg);
> +
> + default:
> + break;
> + }

return -EINVAL;
> +}

Do you expect to implement more ioctls? If not, just change the switch to
an if ().

--
~Randy

\
 
 \ /
  Last update: 2018-01-18 00:21    [W:0.074 / U:1.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site