1
0
Fork 0
Commit Graph

20 Commits (62be257e986dab439537b3e1c19ef746a13e1860)

Author SHA1 Message Date
Laurence Rochfort 4ab7e05dd0 staging: gasket: Fix sparse "incorrect type in assignment" warnings.
Remove the coherent buffer __iomem cookie because the buffer is
allocated from dma_alloc_coherent().

warning: incorrect type in assignment (different address spaces)
   expected unsigned char [noderef] [usertype] <asn:2>*virt_base
   got void *[assigned] mem
warning: incorrect type in argument 3 (different address spaces)
   expected void *cpu_addr
   got unsigned char [noderef] [usertype] <asn:2>*virt_base

Signed-off-by: Laurence Rochfort <laurence.rochfort@gmail.com>
Reviewed-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-19 21:12:29 +02:00
Todd Poynor cca5dd8790 staging: gasket: interrupt: remove unimplemented interrupt types
Interrupt types PCI_MSI and PLATFORM_WIRE are unused and unimplemented.
Remove these.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 717264bab4 staging: gasket: core: switch to relaxed memory-mapped I/O
Use of readl() is deprecated; readl_relaxed() with appropriate memory
barriers is preferred.  Switch to relaxed reads and writes for better
performance as well.  Memory barriers required for I/O vs. normal
memory access on Apex devices have already been explicitly coded in the
page table routines.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 565eeedaa0 staging: gasket: core: remove sysfs setup and cleanup callbacks
Gasket device drivers now call into the gasket framework to initialize
and de-initialize, rather than the other way around.  The calling code
can perform sysfs setup and cleanup actions without callbacks from the
framework.  Remove the sysfs setup and cleanup callbacks.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:07 +02:00
Todd Poynor 4420ea9366 staging: gasket: core: delete device add and remove callbacks
Gasket device drivers are now in charge of orchestrating the device add
and removal sequences, so the callbacks from the framework to the device
drivers for these events are no longer needed.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:07 +02:00
Todd Poynor 39091410d0 staging: gasket: core: let device driver enable/disable gasket device
Move gasket device enable/disable functions from internal calls to
external calls from the gasket device drivers.  The device driver will
call these functions at appropriate times in its processing, placing
the device driver in control of this sequence and reducing the need for
callbacks from framework back to the device drivers during the
enable/disable sequences.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:07 +02:00
Todd Poynor 1b25e6e81a staging: gasket: core: remove device enable and disable callbacks
Device enable/disable operations are moving from being initiated through
the gasket framework to being initiated by the gasket device driver.
The driver can perform any processing needed for these operations before
or after the calls into the framework.  Neither of these callbacks are
implemented for the only gasket driver upstream today, apex.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:06 +02:00
Todd Poynor b7072b24fa staging: gasket: core: move core PCI calls to device drivers
Remove gasket wrapping of PCI probe, enable, disable, and remove
functions.  Replace with calls to add and remove PCI gasket devices,
to be called by the gasket device drivers.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:06 +02:00
Todd Poynor 1c65a2e2f6 staging: gasket: remove "reset type" param from framework
The "type of reset" parameter to the gasket device reset APIs isn't
required by the only gasket device submitted upstream, apex.

The framework documents the param as private to the device driver and a
pass-through at the gasket layer, but the gasket core calls the device
driver with a hardcoded reset type of zero, which is not documented as
having a predefined meaning.

In light of all this, remove the reset type parameter from the
framework.  Remove the reset ioctl reset type parameter, and bump the
framework version number to reflect the interface change.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-02 11:00:21 +02:00
Todd Poynor 88c8a377c0 staging: gasket: core: fix function param line continuation style
Fix multi-line alignment formatting to look like:
      int ret = long_function_name(device, VARIABLE1, VARIABLE2,
                                   VARIABLE3, VARIABLE4);

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-01 20:07:02 +02:00
Todd Poynor 6cefe675f1 staging: gasket: save struct device for a gasket device
Save the struct device pointer to a gasket device in gasket's metadata,
to facilitate use of standard logging calls and in anticipation of
non-PCI gasket devices in the future.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-27 17:09:16 +02:00
Todd Poynor 761d8db714 staging: gasket: top ioctl handler add __user annotations
Add __user annotation to gasket_core top-level ioctl handling pointer
arguments, for sparse checking.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:35 +02:00
Todd Poynor 563f3bb51f staging: gasket: fix multi-line comment syntax in gasket_core.h
Use consistent kernel-style multi-line comment syntax.

Reported-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:35 +02:00
Todd Poynor 72a23054a9 staging: gasket: gasket_wait_with_reschedule use 32 bits of retry count
Don't need a 64-bit retry counter.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-19 11:39:47 +02:00
Todd Poynor 920953ab4e staging: gasket: fix typo in gasket_core.h comments
Grammar fixup in gasket_core.h comments describing struct
gasket_interrupt_desc.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-19 11:39:46 +02:00
Greg Kroah-Hartman bfd727f3a5 staging: gasket: remove gasket_wait_sync()
This function is not called anywhere, so just remove it.

Also, as an added benifit, Arnd points out that it doesn't even work
properly:
	This code won't work correct during leap seconds or a concurrent
	settimeofday() call, and it probably doesn't do what the author intended
	even for the normal case, as it passes a timeout in nanoseconds but
	reads the time using a jiffies-granularity accessor.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-14 10:01:42 +02:00
Greg Kroah-Hartman bf9c7a8673 staging: gasket: remove redundant license information
Now that the SPDX tag is in all gasket files, that identifies the
license in a specific and legally-defined manner.  So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

Cc: Rob Springer <rspringer@google.com>
Cc: John Joseph <jnjoseph@google.com>
Cc: Ben Chan <benchan@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 21:48:30 +02:00
Greg Kroah-Hartman 2dec0644e0 staging: gasket: add SPDX identifiers to all files.
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Fix up the all of the staging gasket files to have a proper SPDX
identifier, based on the license text in the file itself.  The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.

Cc: Rob Springer <rspringer@google.com>
Cc: John Joseph <jnjoseph@google.com>
Cc: Ben Chan <benchan@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 21:48:30 +02:00
Dan Carpenter c37a192ef4 Staging: Gasket: shift wrapping bug in gasket_read_modify_write_64()
This function only has one caller so mask_width is 1 and mask_shift is
32.  Shifting an int by 32 bits is undefined, but I guess on GCC it
wraps to 0x1?  Anyway it's supposed to be 0x100000000.

Fixes: 9a69f5087c ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-06 17:35:42 +02:00
Simon Que 9a69f5087c drivers/staging: Gasket driver framework + Apex driver
The Gasket (Google ASIC Software, Kernel Extensions, and Tools) kernel
framework is a generic, flexible system that supports thin kernel
drivers. Gasket kernel drivers are expected to handle opening and
closing devices, mmap'ing BAR space as requested, a small selection of
ioctls, and handling page table translation (covered below). Any other
functions should be handled by userspace code.

The Gasket common module is not enough to run a device. In order to
customize the Gasket code for a given piece of hardware, a device
specific module must be created. At a minimum, this module must define a
struct gasket_driver_desc containing the device-specific data for use by
the framework; in addition, the module must declare an __init function
that calls gasket_register_device with the module's gasket_driver_desc
struct. Finally, the driver must define an exit function that calls
gasket_unregister_device with the module's gasket_driver_desc struct.

One of the core assumptions of the Gasket framework is that precisely
one process is allowed to have an open write handle to the device node
at any given time. (That process may, once it has one write handle, open
any number of additional write handles.) This is accomplished by
tracking open and close data for each driver instance.

Signed-off-by: Rob Springer <rspringer@google.com>
Signed-off-by: John Joseph <jnjoseph@google.com>
Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-02 09:01:49 +02:00