History log of /linux-master/drivers/misc/genwqe/card_base.h
Revision Date Author Comments
# b5fa3379 10-Aug-2023 Ivan Orlov <ivan.orlov0322@gmail.com>

misc: genwqe: make class_genwqe a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the class_genwqe structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time. Update the 'class_genwqe' field of the
'genwqe_dev' struct correspondingly.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230810182711.22664-1-ivan.orlov0322@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d7ef4857 11-Jun-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

genwq: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.

Cc: Frank Haverkamp <haver@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# eb3ae0aa 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 289

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 only
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 merchantability or
fitness for a particular purpose see the gnu general public license
for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 8 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.300923465@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0ab93e9c 13-Sep-2018 Eric W. Biederman <ebiederm@xmission.com>

signal/GenWQE: Fix sending of SIGKILL

The genweq_add_file and genwqe_del_file by caching current without
using reference counting embed the assumption that a file descriptor
will never be passed from one process to another. It even embeds the
assumption that the the thread that opened the file will be in
existence when the process terminates. Neither of which are
guaranteed to be true.

Therefore replace caching the task_struct of the opener with
pid of the openers thread group id. All the knowledge of the
opener is used for is as the target of SIGKILL and a SIGKILL
will kill the entire process group.

Rename genwqe_force_sig to genwqe_terminate, remove it's unncessary
signal argument, update it's ownly caller, and use kill_pid
instead of force_sig.

The work force_sig does in changing signal handling state is not
relevant to SIGKILL sent as SEND_SIG_PRIV. The exact same processess
will be killed just with less work, and less confusion. The work done
by force_sig is really only needed for handling syncrhonous
exceptions.

It will still be possible to cause genwqe_device_remove to wait
8 seconds by passing a file descriptor to another process but
the possible user after free is fixed.

Fixes: eaf4722d4645 ("GenWQE Character device and DDCB queue")
Cc: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Frank Haverkamp <haver@linux.vnet.ibm.com>
Cc: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
Cc: Michael Jung <mijung@gmx.net>
Cc: Michael Ruettger <michael@ibmra.de>
Cc: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Eberhard S. Amann <esa@linux.vnet.ibm.com>
Cc: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Cc: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>


# 7a927193 04-Aug-2018 Gustavo A. R. Silva <gustavo@embeddedor.com>

genwqe: card_base: Use true and false for boolean values

Return statements in functions returning bool should use true or false
instead of an integer value.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 658a494a 13-Dec-2017 Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>

genwqe: Remove unused parameter in some functions

This is a clean-up patch, no functional changes intended.

It removes the unused parameter of type "struct ddcb_requ*" from
the functions genwqe_user_vmap() and genwqe_user_vunmap().

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9d14e766 13-Dec-2017 Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>

genwqe: Make defines uppercase

This is a clean-up patch, no functional changes intended.

It makes all defines uppercase, following a "tradition"
that helps to make code clearer.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# de4ce2d1 20-Oct-2017 Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>

genwqe: Take R/W permissions into account when dealing with memory pages

Currently we assume userspace pages are always writable when doing
memory pinning. This is not true, specially since userspace applications
may allocate their memory the way they want, we have no control over it.
If a read-only page is set for pinning, currently the driver fails due
to get_user_pages_fast() refusing to map read-only pages as writable.

This patch changes this behavior, by taking the permission flags of the
pages into account in both pinning/unpinning process, as well as in the
DMA data copy-back to userpace (which we shouldn't try to do blindly,
since it will fail in case of read-only-pages).

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d3f45647 04-Oct-2016 Christoph Hellwig <hch@lst.de>

genwqe: use pci_irq_allocate_vectors

Simply the interrupt setup by using the new PCI layer helpers.

One odd thing about this driver is that it looks like it could request
multiple MSI vectors, but it will then only ever use a single one.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
Acked-by: Frank Haverkamp <haver@linux.vnet.ibm.com>=
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4d4896a5 30-Sep-2015 Geliang Tang <geliangtang@163.com>

misc: genwqe: fix a comment typo

Just fix a typo in the code comment.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0ecb3dff 29-Dec-2014 Fabian Frederick <fabf@skynet.be>

GenWQE: remove unnecessary version.h inclusion

Based on versioncheck.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1451f414 10-Sep-2014 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE: Support blocking when DDCB queue is busy

When the GenWQE hardware queue was busy, the driver returned simply
-EBUSY. This caused polling by applications which increased the load
on the already busy system. This change implements the possiblity to
sleep on a waitqueue instead when the DDCB queue is busy. The
requestor is woken up when there is free space on the queue again.
The old way to get -EBUSY is still available if the device is openend
with O_NONBLOCKING. The default is now blocking behavior.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 26d8f6f1 10-Sep-2014 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE: Update author information

Updated email address of co-author.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Michael Jung <mijung@gmx.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 95a8825c 10-Sep-2014 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE: Check pci_get_totalvfs return code

Currently the driver is using the pci_get_totalvfs() return code
directly in a loop. To avoid problems with potentially negative
returns in case of errors, we are adding some more sanity checking
code.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fb145456 04-Jun-2014 Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>

GenWQE: Add support for EEH error recovery

This patch implements the callbacks and functions necessary to have EEH
recovery support.

It adds a config option to enable or disable explicit calls to trigger
platform specific mechanisms on error recovery paths. This option is
enabled by default only on PPC64 systems and can be overritten via
debugfs. If this option is enabled, on the error recovery path the
driver will call pci_channel_offline() to check for error condition and
issue non-raw MMIO reads to trigger early EEH detection in case of
hardware failures. This is necessary since the driver MMIO helper
funtions use raw accessors.

Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 718f762e 20-Mar-2014 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE: Fix multithreading problems

When being used in a multithreaded application there were problems
with memory pages/cachelines accessed by multiple threads/cpus at the
same time, while doing DMA transfers to/from those. To avoid such
situations this fix is creating a copy of the first and the last page
if it is not fully used. The data is copied from user-space into those
pages and results are copied back when the DDCB-request is
successfully finished.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90b4e97e 07-Jan-2014 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE: Fix compile problems for Alpha

The header which contained the declaration for kcalloc() was not
inlcuded.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 12eb4683 09-Dec-2013 Frank Haverkamp <haver@linux.vnet.ibm.com>

GenWQE PCI support, health monitoring and recovery

Module initialization and PCIe setup. Card health monitoring and
recovery functionality. Character device creation and deletion are
controlled from here.

Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Co-authors: Joerg-Stephan Vogt <jsvogt@de.ibm.com>,
Michael Jung <MIJUNG@de.ibm.com>,
Michael Ruettger <michael@ibmra.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>