Giovanni Cabiddu
93b2f5799c
crypto: qat - rename and relocate GEN2 config function
...
Rename qat_crypto_dev_config() in adf_gen2_dev_config() and relocate it
to the newly created file adf_gen2_config.c.
This function is specific to QAT GEN2 devices and will be used also to
configure the compression service.
In addition change the drivers to use the dev_config() in the hardware
data structure (which for GEN2 devices now points to
adf_gen2_dev_config()), for consistency.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com >
Reviewed-by: Adam Guerin <adam.guerin@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2022-12-09 18:44:59 +08:00
Uwe Kleine-König
8f5c335e34
crypto: qat - simplify adf_enable_aer()
...
A struct pci_driver is shared across all device instances, so assigning
pci_driver.err_handler once per device isn't really sensible.
Set adf_driver.err_handler statically instead of in adf_enable_aer().
This removes a use of pci_dev->driver, which is a step toward removing
pci_dev->driver altogether.
Since adf_enable_aer() returns zero unconditionally, make it a void
function.
Link: https://lore.kernel.org/r/20211004125935.2300113-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2021-10-12 17:37:15 -05:00
Christophe JAILLET
3660f25186
crypto: qat - disable AER if an error occurs in probe functions
...
If an error occurs after a 'adf_enable_aer()' call, it must be undone by a
corresponding 'adf_disable_aer()' call, as already done in the remove
function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2021-08-21 15:44:54 +08:00
Giovanni Cabiddu
ae1f5043e2
crypto: qat - set DMA mask to 48 bits for Gen2
...
Change the DMA mask from 64 to 48 for Gen2 devices as they cannot handle
addresses greater than 48 bits.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2021-08-21 15:44:54 +08:00
Christophe JAILLET
6e422ccea4
crypto: qat - simplify code and axe the use of a deprecated API
...
The wrappers in include/linux/pci-dma-compat.h should go away.
Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent
and less verbose 'dma_set_mask_and_coherent()' call.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2021-08-21 15:44:53 +08:00
Marco Chiappero
ad1332aa67
crypto: qat - add support for capability detection
...
Add logic to detect device capabilities for c62x, c3xxx and dh895xcc.
Read fuses, straps and legfuses CSRs and build the device capabilities
mask. This will be used to understand if a certain service is supported
by a device.
This patch is based on earlier work done by Conor McLoughlin.
Signed-off-by: Marco Chiappero <marco.chiappero@intel.com >
Co-developed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com >
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-10-30 17:34:54 +11:00
Giovanni Cabiddu
7b07ed5042
crypto: qat - mask device capabilities with soft straps
...
Enable acceleration engines (AEs) and accelerators based on soft straps
and fuses. When looping with a number of AEs or accelerators, ignore the
ones that are disabled.
This patch is based on earlier work done by Conor McLoughlin.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com >
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-10-30 17:34:46 +11:00
Giovanni Cabiddu
789f900b70
crypto: qat - drop input parameter from adf_enable_aer()
...
Remove pointer to struct pci_driver from function adf_enable_aer() as it
is possible to get it directly from pdev->driver.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com >
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-10-08 16:38:06 +11:00
Giovanni Cabiddu
37b15fa97e
crypto: qat - use PCI_VDEVICE
...
Build pci_device_id structure using the PCI_VDEVICE macro.
This removes any references to the ADF_SYSTEM_DEVICE macro.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-09-18 17:20:10 +10:00
Giovanni Cabiddu
92db319899
crypto: qat - replace device ids defines
...
Replace device ids defined in the QAT drivers with the ones in
include/linux/pci_ids.h.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com >
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-09-18 17:20:10 +10:00
Giovanni Cabiddu
4eb3f795bd
crypto: qat - include domain in top level debugfs path
...
Use pci_name() when creating debugfs entries in order to include PCI
domain in the path.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-09-11 14:39:18 +10:00
Giovanni Cabiddu
1532e31f50
crypto: qat - convert to SPDX License Identifiers
...
Replace License Headers with SPDX License Identifiers.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2020-06-18 17:19:44 +10:00
Greg Kroah-Hartman
f0fcf9ade4
crypto: qat - 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: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Cc: Herbert Xu <herbert@gondor.apana.org.au >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Conor McLoughlin <conor.mcloughlin@intel.com >
Cc: Waiman Long <longman@redhat.com >
Cc: qat-linux@intel.com
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2019-02-01 14:42:03 +08:00
Waiman Long
ba439a6cbf
crypto: qat - Fix KASAN stack-out-of-bounds bug in adf_probe()
...
The following KASAN warning was printed when booting a 64-bit kernel
on some systems with Intel CPUs:
[ 44.512826] ==================================================================
[ 44.520165] BUG: KASAN: stack-out-of-bounds in find_first_bit+0xb0/0xc0
[ 44.526786] Read of size 8 at addr ffff88041e02fc50 by task kworker/0:2/124
[ 44.535253] CPU: 0 PID: 124 Comm: kworker/0:2 Tainted: G X --------- --- 4.18.0-12.el8.x86_64+debug #1
[ 44.545858] Hardware name: Intel Corporation PURLEY/PURLEY, BIOS BKVDTRL1.86B.0005.D08.1712070559 12/07/2017
[ 44.555682] Workqueue: events work_for_cpu_fn
[ 44.560043] Call Trace:
[ 44.562502] dump_stack+0x9a/0xe9
[ 44.565832] print_address_description+0x65/0x22e
[ 44.570683] ? find_first_bit+0xb0/0xc0
[ 44.570689] kasan_report.cold.6+0x92/0x19f
[ 44.578726] find_first_bit+0xb0/0xc0
[ 44.578737] adf_probe+0x9eb/0x19a0 [qat_c62x]
[ 44.578751] ? adf_remove+0x110/0x110 [qat_c62x]
[ 44.591490] ? mark_held_locks+0xc8/0x140
[ 44.591498] ? _raw_spin_unlock+0x30/0x30
[ 44.591505] ? trace_hardirqs_on_caller+0x381/0x570
[ 44.604418] ? adf_remove+0x110/0x110 [qat_c62x]
[ 44.604427] local_pci_probe+0xd4/0x180
[ 44.604432] ? pci_device_shutdown+0x110/0x110
[ 44.617386] work_for_cpu_fn+0x51/0xa0
[ 44.621145] process_one_work+0x8fe/0x16e0
[ 44.625263] ? pwq_dec_nr_in_flight+0x2d0/0x2d0
[ 44.629799] ? lock_acquire+0x14c/0x400
[ 44.633645] ? move_linked_works+0x12e/0x2a0
[ 44.637928] worker_thread+0x536/0xb50
[ 44.641690] ? __kthread_parkme+0xb6/0x180
[ 44.645796] ? process_one_work+0x16e0/0x16e0
[ 44.650160] kthread+0x30c/0x3d0
[ 44.653400] ? kthread_create_worker_on_cpu+0xc0/0xc0
[ 44.658457] ret_from_fork+0x3a/0x50
[ 44.663557] The buggy address belongs to the page:
[ 44.668350] page:ffffea0010780bc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
[ 44.676356] flags: 0x17ffffc0000000()
[ 44.680023] raw: 0017ffffc0000000 ffffea0010780bc8 ffffea0010780bc8 0000000000000000
[ 44.687769] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
[ 44.695510] page dumped because: kasan: bad access detected
[ 44.702578] Memory state around the buggy address:
[ 44.707372] ffff88041e02fb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 44.714593] ffff88041e02fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 44.721810] >ffff88041e02fc00: 00 00 00 00 00 00 f1 f1 f1 f1 04 f2 f2 f2 f2 f2
[ 44.729028] ^
[ 44.734864] ffff88041e02fc80: f2 f2 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00
[ 44.742082] ffff88041e02fd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 44.749299] ==================================================================
Looking into the code:
int ret, bar_mask;
:
for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask,
It is casting a 32-bit integer pointer to a 64-bit unsigned long
pointer. There are two problems here. First, the 32-bit pointer address
may not be 64-bit aligned. Secondly, it is accessing an extra 4 bytes.
This is fixed by changing the bar_mask type to unsigned long.
Cc: <stable@vger.kernel.org >
Signed-off-by: Waiman Long <longman@redhat.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2018-09-28 12:45:37 +08:00
Conor McLoughlin
1ebe6da2f9
crypto: qat - Add MODULE_FIRMWARE for all qat drivers
...
Signed-off-by: Conor McLoughlin <conor.mcloughlin@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2018-05-31 00:13:51 +08:00
Pablo Marcos Oltra
21aad0b6ca
crypto: qat - modify format of dev top level debugfs entries
...
Remove leading zeros in pci function number to be consistent
with output from lspci.
Signed-off-by: Pablo Marcos Oltra <pablo.marcos.oltra@intel.com >
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2016-12-30 19:52:34 +08:00
Giovanni Cabiddu
4f78ce870a
crypto: qat - fix bar discovery for c62x
...
Some accelerators of the c62x series have only two bars.
This patch skips BAR0 if the accelerator does not have it.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2016-12-30 19:52:27 +08:00
Tadeusz Struk
f1420ceef3
crypto: qat - changed adf_dev_stop to void
...
It returns always zero anyway.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2016-04-05 20:35:54 +08:00
Tadeusz Struk
a6dabee6c8
crypto: qat - add support for c62x accel type
...
Add support for qat c62x accel type
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com >
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au >
2015-12-09 20:03:53 +08:00