* [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4
@ 2025-07-22 15:07 Giovanni Cabiddu
2025-07-23 4:33 ` Sasha Levin
2025-08-18 11:29 ` Giovanni Cabiddu
0 siblings, 2 replies; 5+ messages in thread
From: Giovanni Cabiddu @ 2025-07-22 15:07 UTC (permalink / raw)
To: stable
Cc: gregkh, qat-linux, Giovanni Cabiddu, Damian Muszynski,
Tero Kristo, Herbert Xu, Ahsan Atta
[ Upstream commit a238487f7965d102794ed9f8aff0b667cd2ae886 ]
The 4xxx drivers hardcode the ring to service mapping. However, when
additional configurations where added to the driver, the mappings were
not updated. This implies that an incorrect mapping might be reported
through pfvf for certain configurations.
This is a backport of the upstream commit with modifications, as the
original patch does not apply cleanly to kernel v6.1.x. The logic has
been simplified to reflect the limited configurations of the QAT driver
in this version: crypto-only and compression.
Instead of dynamically computing the ring to service mappings, these are
now hardcoded to simplify the backport.
Fixes: 0cec19c761e5 ("crypto: qat - add support for compression for 4xxx")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry-picked from commit a238487f7965d102794ed9f8aff0b667cd2ae886)
[Giovanni: backport to 6.1.y, conflict resolved simplifying the logic
in the function get_ring_to_svc_map() as the QAT driver in v6.1 supports
only limited configurations (crypto only and compression). Differs from
upstream as the ring to service mapping is hardcoded rather than being
dynamically computed.]
Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
Tested-by: Ahsan Atta <ahsan.atta@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
V1 -> V2: changed signed-off-by area:
* added (cherry-picked from ...) after last tag from upstream commit
* added a note explaining how this backport differs from the original patch
* added a new Signed-off-by tag for the backport author.
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 13 +++++++++++++
drivers/crypto/qat/qat_common/adf_accel_devices.h | 1 +
drivers/crypto/qat/qat_common/adf_gen4_hw_data.h | 6 ++++++
drivers/crypto/qat/qat_common/adf_init.c | 3 +++
4 files changed, 23 insertions(+)
diff --git a/drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c b/drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
index fda5f699ff57..65b52c692add 100644
--- a/drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
+++ b/drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c
@@ -297,6 +297,18 @@ static char *uof_get_name(struct adf_accel_dev *accel_dev, u32 obj_num)
return NULL;
}
+static u16 get_ring_to_svc_map(struct adf_accel_dev *accel_dev)
+{
+ switch (get_service_enabled(accel_dev)) {
+ case SVC_CY:
+ return ADF_GEN4_DEFAULT_RING_TO_SRV_MAP;
+ case SVC_DC:
+ return ADF_GEN4_DEFAULT_RING_TO_SRV_MAP_DC;
+ }
+
+ return 0;
+}
+
static u32 uof_get_ae_mask(struct adf_accel_dev *accel_dev, u32 obj_num)
{
switch (get_service_enabled(accel_dev)) {
@@ -353,6 +365,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data)
hw_data->uof_get_ae_mask = uof_get_ae_mask;
hw_data->set_msix_rttable = set_msix_default_rttable;
hw_data->set_ssm_wdtimer = adf_gen4_set_ssm_wdtimer;
+ hw_data->get_ring_to_svc_map = get_ring_to_svc_map;
hw_data->disable_iov = adf_disable_sriov;
hw_data->ring_pair_reset = adf_gen4_ring_pair_reset;
hw_data->enable_pm = adf_gen4_enable_pm;
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h
index ad01d99e6e2b..7993d0f82dea 100644
--- a/drivers/crypto/qat/qat_common/adf_accel_devices.h
+++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h
@@ -176,6 +176,7 @@ struct adf_hw_device_data {
void (*get_arb_info)(struct arb_info *arb_csrs_info);
void (*get_admin_info)(struct admin_info *admin_csrs_info);
enum dev_sku_info (*get_sku)(struct adf_hw_device_data *self);
+ u16 (*get_ring_to_svc_map)(struct adf_accel_dev *accel_dev);
int (*alloc_irq)(struct adf_accel_dev *accel_dev);
void (*free_irq)(struct adf_accel_dev *accel_dev);
void (*enable_error_correction)(struct adf_accel_dev *accel_dev);
diff --git a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h
index 4fb4b3df5a18..5e653ec755e6 100644
--- a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h
+++ b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h
@@ -95,6 +95,12 @@ do { \
ADF_RING_BUNDLE_SIZE * (bank) + \
ADF_RING_CSR_RING_SRV_ARB_EN, (value))
+#define ADF_GEN4_DEFAULT_RING_TO_SRV_MAP_DC \
+ (COMP << ADF_CFG_SERV_RING_PAIR_0_SHIFT | \
+ COMP << ADF_CFG_SERV_RING_PAIR_1_SHIFT | \
+ COMP << ADF_CFG_SERV_RING_PAIR_2_SHIFT | \
+ COMP << ADF_CFG_SERV_RING_PAIR_3_SHIFT)
+
/* Default ring mapping */
#define ADF_GEN4_DEFAULT_RING_TO_SRV_MAP \
(ASYM << ADF_CFG_SERV_RING_PAIR_0_SHIFT | \
diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c
index 2e3481270c4b..49f07584f8c9 100644
--- a/drivers/crypto/qat/qat_common/adf_init.c
+++ b/drivers/crypto/qat/qat_common/adf_init.c
@@ -95,6 +95,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
return -EFAULT;
}
+ if (hw_data->get_ring_to_svc_map)
+ hw_data->ring_to_svc_map = hw_data->get_ring_to_svc_map(accel_dev);
+
if (adf_ae_init(accel_dev)) {
dev_err(&GET_DEV(accel_dev),
"Failed to initialise Acceleration Engine\n");
--
2.50.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4
2025-07-22 15:07 [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4 Giovanni Cabiddu
@ 2025-07-23 4:33 ` Sasha Levin
2025-07-24 13:44 ` Giovanni Cabiddu
2025-08-18 11:29 ` Giovanni Cabiddu
1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2025-07-23 4:33 UTC (permalink / raw)
To: stable, giovanni.cabiddu; +Cc: Sasha Levin
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
⚠️ Found follow-up fixes in mainline
The upstream commit SHA1 provided is correct: a238487f7965d102794ed9f8aff0b667cd2ae886
Status in newer kernel trees:
6.15.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: 82e4aa18bb6d)
Found fixes commits:
df018f82002a crypto: qat - fix ring to service map for dcc in 4xxx
Note: The patch differs from the upstream commit:
---
1: a238487f7965 < -: ------------ crypto: qat - fix ring to service map for QAT GEN4
-: ------------ > 1: 58ce42abb968 crypto: qat - fix ring to service map for QAT GEN4
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| origin/linux-6.1.y | Success | Success |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4
2025-07-23 4:33 ` Sasha Levin
@ 2025-07-24 13:44 ` Giovanni Cabiddu
0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Cabiddu @ 2025-07-24 13:44 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, giovanni.cabiddu, ahsan.atta, qat-linux
Hi Sasha,
On Wed, Jul 23, 2025 at 12:33:49AM -0400, Sasha Levin wrote:
> [ Sasha's backport helper bot ]
>
> Hi,
>
> Summary of potential issues:
> ⚠️ Found follow-up fixes in mainline
>
> The upstream commit SHA1 provided is correct: a238487f7965d102794ed9f8aff0b667cd2ae886
>
> Status in newer kernel trees:
> 6.15.y | Present (exact SHA1)
> 6.12.y | Present (exact SHA1)
> 6.6.y | Present (different SHA1: 82e4aa18bb6d)
>
> Found fixes commits:
> df018f82002a crypto: qat - fix ring to service map for dcc in 4xxx
>
> Note: The patch differs from the upstream commit:
> ---
> 1: a238487f7965 < -: ------------ crypto: qat - fix ring to service map for QAT GEN4
> -: ------------ > 1: 58ce42abb968 crypto: qat - fix ring to service map for QAT GEN4
>
> ---
>
> Results of testing on various branches:
>
> | Branch | Patch Apply | Build Test |
> |---------------------------|-------------|------------|
> | origin/linux-6.1.y | Success | Success |
>
Here is a summary of the reply in v1 [1]:
* This patch applies only to Kernel v6.1.y.
* The follow-up fix (df018f82002a crypto: qat - fix ring to service
map for dcc in 4xxx) is not required as the `dcc service` is not
supported by the QAT driver in v6.1.
* This is a cherry pick with modifications. The fix has been
simplified as (1) the QAT driver in v6.1 supports only two services
(crypto only and compression) and (2) there is low value in brining all
the dependencies required to port the algorithm that builds the ring
to service map dynamically.
[1] https://lore.kernel.org/stable/aHnvq5RvK%2FUC7h15@gcabiddu-mobl.ger.corp.intel.com/
Regards,
--
Giovanni
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4
2025-07-22 15:07 [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4 Giovanni Cabiddu
2025-07-23 4:33 ` Sasha Levin
@ 2025-08-18 11:29 ` Giovanni Cabiddu
2025-08-18 11:41 ` Greg KH
1 sibling, 1 reply; 5+ messages in thread
From: Giovanni Cabiddu @ 2025-08-18 11:29 UTC (permalink / raw)
To: stable, gregkh, sashal
Cc: qat-linux, Damian Muszynski, Herbert Xu, Ahsan Atta
Hi Greg and Sasha,
On Tue, Jul 22, 2025 at 04:07:09PM +0100, Giovanni Cabiddu wrote:
> [ Upstream commit a238487f7965d102794ed9f8aff0b667cd2ae886 ]
>
> The 4xxx drivers hardcode the ring to service mapping. However, when
> additional configurations where added to the driver, the mappings were
> not updated. This implies that an incorrect mapping might be reported
> through pfvf for certain configurations.
>
> This is a backport of the upstream commit with modifications, as the
> original patch does not apply cleanly to kernel v6.1.x. The logic has
> been simplified to reflect the limited configurations of the QAT driver
> in this version: crypto-only and compression.
>
> Instead of dynamically computing the ring to service mappings, these are
> now hardcoded to simplify the backport.
>
> Fixes: 0cec19c761e5 ("crypto: qat - add support for compression for 4xxx")
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
> Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> (cherry-picked from commit a238487f7965d102794ed9f8aff0b667cd2ae886)
> [Giovanni: backport to 6.1.y, conflict resolved simplifying the logic
> in the function get_ring_to_svc_map() as the QAT driver in v6.1 supports
> only limited configurations (crypto only and compression). Differs from
> upstream as the ring to service mapping is hardcoded rather than being
> dynamically computed.]
> Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
> Tested-by: Ahsan Atta <ahsan.atta@intel.com>
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> ---
> V1 -> V2: changed signed-off-by area:
> * added (cherry-picked from ...) after last tag from upstream commit
> * added a note explaining how this backport differs from the original patch
> * added a new Signed-off-by tag for the backport author.
Just following up on this patch as I haven't seen any activity on it yet.
Was it possibly missed, or is there anything I should do to move it
forward?
Thanks,
--
Giovanni
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4
2025-08-18 11:29 ` Giovanni Cabiddu
@ 2025-08-18 11:41 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2025-08-18 11:41 UTC (permalink / raw)
To: Giovanni Cabiddu
Cc: stable, sashal, qat-linux, Damian Muszynski, Herbert Xu,
Ahsan Atta
On Mon, Aug 18, 2025 at 12:29:13PM +0100, Giovanni Cabiddu wrote:
> Hi Greg and Sasha,
>
> On Tue, Jul 22, 2025 at 04:07:09PM +0100, Giovanni Cabiddu wrote:
> > [ Upstream commit a238487f7965d102794ed9f8aff0b667cd2ae886 ]
> >
> > The 4xxx drivers hardcode the ring to service mapping. However, when
> > additional configurations where added to the driver, the mappings were
> > not updated. This implies that an incorrect mapping might be reported
> > through pfvf for certain configurations.
> >
> > This is a backport of the upstream commit with modifications, as the
> > original patch does not apply cleanly to kernel v6.1.x. The logic has
> > been simplified to reflect the limited configurations of the QAT driver
> > in this version: crypto-only and compression.
> >
> > Instead of dynamically computing the ring to service mappings, these are
> > now hardcoded to simplify the backport.
> >
> > Fixes: 0cec19c761e5 ("crypto: qat - add support for compression for 4xxx")
> > Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> > Reviewed-by: Damian Muszynski <damian.muszynski@intel.com>
> > Reviewed-by: Tero Kristo <tero.kristo@linux.intel.com>
> > Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> > (cherry-picked from commit a238487f7965d102794ed9f8aff0b667cd2ae886)
> > [Giovanni: backport to 6.1.y, conflict resolved simplifying the logic
> > in the function get_ring_to_svc_map() as the QAT driver in v6.1 supports
> > only limited configurations (crypto only and compression). Differs from
> > upstream as the ring to service mapping is hardcoded rather than being
> > dynamically computed.]
> > Reviewed-by: Ahsan Atta <ahsan.atta@intel.com>
> > Tested-by: Ahsan Atta <ahsan.atta@intel.com>
> > Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> > ---
> > V1 -> V2: changed signed-off-by area:
> > * added (cherry-picked from ...) after last tag from upstream commit
> > * added a note explaining how this backport differs from the original patch
> > * added a new Signed-off-by tag for the backport author.
>
> Just following up on this patch as I haven't seen any activity on it yet.
>
> Was it possibly missed, or is there anything I should do to move it
> forward?
It's in a pending queue of hundreds of stable backports I have yet to
get to. That's what I get for trying to take a vacation... :)
Don't worry, it's not lost, just that we have to process patches for the
newer stable kernels first, as that's where we have the most users.
This, and many others, will be gotten to in a week or so.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-18 11:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 15:07 [PATCH 6.1 v2] crypto: qat - fix ring to service map for QAT GEN4 Giovanni Cabiddu
2025-07-23 4:33 ` Sasha Levin
2025-07-24 13:44 ` Giovanni Cabiddu
2025-08-18 11:29 ` Giovanni Cabiddu
2025-08-18 11:41 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).