Skip to content
Permalink
Giovanni-Cabid…
Switch branches/tags

Commits on Nov 10, 2021

  1. crypto: qat - improve logging of PFVF messages

    Improve and simplify logging of PFVF messages.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  2. crypto: qat - fix VF IDs in PFVF log messages

    PFVF debug messages use a mix of zero and one based VF IDs.
    Switch to zero based VF numbers in all log messages.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  3. crypto: qat - do not rely on min version

    Remove min_iov_compat_ver field as for now all versions are compatible.
    
    Compatibility is determined by a series of rules and dynamic conditions
    such as specific configurations.
    In any case the minimum version requirement for compatibility is
    an inadequate and obsolete approach which should be removed.
    
    At this time compatibility can be assured across the currently available
    versions.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  4. crypto: qat - refactor pfvf version request messages

    Refactor version handling logic for ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ
    and ADF_VF2PF_MSGTYPE_VERSION_REQ on the PF.
    Response messages are now filled only after fully parsing the request,
    in a consisted way with the rest of the PFVF codebase.
    
    This patch also fixes a harmless double setting for VERSION in the
    response for ADF_VF2PF_MSGTYPE_VERSION_REQ.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  5. crypto: qat - pass the PF2VF responses back to the callers

    Currently, any PF response to a VF request is fully parsed during the
    interrupt handling. This way the individual response values are stored
    into the accel_dev structure, preventing the caller to access and decode
    the full response message itself.
    
    Change this behavior, by letting the API return back the entire message
    to the caller, in order to:
      - keep correlated code together, that is, the (building of the)
        request and the (decoding of the) response;
      - avoid polluting the accel_dev data structure with unnecessary and at
        times temporary values; only the entire message is stored in a
        temporary buffer.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  6. crypto: qat - use enums for PFVF protocol codes

    Replace PFVF constants with enumerations for valid protocol codes.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  7. crypto: qat - reorganize PFVF protocol definitions

    Organize PFVF protocol definitions by type rather than direction, by
    keeping related fields close.
    Also, make sure the order is consistent for both PF and VF definitions.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  8. crypto: qat - reorganize PFVF code

    Reorganize the structure of the PFVF code by moving the content of
    adf_pf2vf_msg.c and adf_vf2pf_msg.c.
    
    The logic that handles high level messages has been moved to
    adf_pfvf_pf_msg.c and adf_pfvf_vf_msg.c.
    The implementation of low level communication primitives and the
    protocol is now included in adf_pfvf_pf_proto.c and adf_pfvf_vf_proto.c.
    
    In addition, the file adf_pf2vf_msg.h has been renamed in adf_pfvf_msg.h
    since it common to PF and VF and the copyright date for the touched
    files has been updated.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  9. crypto: qat - abstract PFVF receive logic

    Refactor the PFVF receive logic so it is common between PF and VF and
    make it device specific.
    
    This is in preparation for the introduction of PFVF support in the
    qat_4xxx driver since the receive logic differs between QAT GEN2 and
    QAT GEN4 devices.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Co-developed-by: Marco Chiappero <marco.chiappero@intel.com>
    Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021
  10. crypto: qat - abstract PFVF send function

    Make the PFVF send function device specific.
    
    This is in preparation for the introduction of PFVF support in the
    qat_4xxx driver since the send logic differs between QAT GEN2 and
    QAT GEN4 devices.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  11. crypto: qat - differentiate between pf2vf and vf2pf offset

    Add the function get_vf2pf_offset() to adf_pfvf_ops to differentiate the
    CSRs used for pf2vf and vf2pf.
    
    Offsets may or may not be direction specific depending on QAT
    generation. Since in QAT GEN2 the CSR is not direction specific, i.e.
    there is a single mailbox register shared for pf2vf and vf2pf, both
    get_vf2pf_offset() and get_vf2pf_offset() will return the same offset.
    
    This change is to make the direction explicit, so it is easier to
    understand and debug and also in preparation for the introduction of
    PFVF support in the qat_4xxx driver since QAT GEN4 devices have a
    separate CSR for pf2vf and vf2pf communications.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  12. crypto: qat - add pfvf_ops

    Add pfvf_ops structure to isolate PFVF related functions inside the
    adf_hw_device_data structure.
    
    For GEN2, the structure is populated using one of the two helper
    functions, adf_gen2_init_pf_pfvf_ops() or adf_gen2_init_vf_pfvf_ops(),
    for the PF and VF driver respectively.
    
    For the DH895XCC PF driver, the structure is populated using
    adf_gen2_init_pf_pfvf_ops() but some of the functions are then
    overwritten.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  13. crypto: qat - relocate PFVF disabled function

    Move the function pfvf_comms_disabled() from the qat_4xxx module to
    intel_qat as it will be used by other components to keep the PFVF
    feature disabled.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021
  14. crypto: qat - relocate PFVF VF related logic

    Move device specific PFVF logic related to the VF to the newly created
    adf_gen2_pfvf.c.
    This refactory is done to isolate the GEN2 PFVF code into its own file
    in preparation for the introduction of support for PFVF for GEN4
    devices.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  15. crypto: qat - relocate PFVF PF related logic

    Move device specific PFVF logic related to the PF to the newly created
    adf_gen2_pfvf.c.
    This refactory is done to isolate the GEN2 PFVF code into its own file
    in preparation for the introduction of support for PFVF for GEN4
    devices.
    
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  16. crypto: qat - handle retries due to collisions in adf_iov_putmsg()

    Rework __adf_iov_putmsg() to handle retries due to collisions
    internally, removing the need for an external retry loop.
    The functions __adf_iov_putmsg() and adf_iov_putmsg() have been merged
    together maintaining the adf_iov_putmsg() name.
    
    This will allow to use this function only for GEN2 devices, since
    collision are peculiar of this generation and therefore should be
    confined to the actual implementation of the transport/medium access.
    
    Note that now adf_iov_putmsg() will retry to send a message only in case
    of collisions and will now fail if an ACK is not received from the
    remote function.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  17. crypto: qat - split PFVF message decoding from handling

    Refactor the receive and handle logic to separate the parsing and
    handling of the PFVF message from the initial retrieval and ACK.
    
    This is to allow the intoduction of the recv function in a subsequent
    patch.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  18. crypto: qat - re-enable interrupts for legacy PFVF messages

    If a PFVF message with MSGORIGIN_SYSTEM not set is received, re-enable
    interrupts allowing the processing of new messages.
    This is to simplify the refactoring of the recv function in a subsequent
    patch.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021
  19. crypto: qat - change PFVF ACK behaviour

    Change the PFVF receipt flow on the VF side to read, ack and handle the
    message instead of read, handle and ack.
    This is done for (1) consistency with the PF side, see the function
    adf_recv_and_handle_vf2pf_msg() in adf_pf2vf_msg.c, and (2) performance
    reasons, to avoid keeping the CSR busy while parsing the message.
    
    In addition, do not ACK PFVF legacy messages, as this driver is not
    capable of handling PFVF legacy messages.
    If a PFVF message with MSGORIGIN not set is received, do nothing.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021
  20. crypto: qat - move interrupt code out of the PFVF handler

    Move the interrupt handling call from the PF specific protocol file,
    adf_pf2vf_msg.c, to adf_sriov.c to maintain the PFVF files focused on
    the protocol handling.
    
    The function adf_vf2pf_req_hndl() has been renamed as
    adf_recv_and_handle_vf2pf_msg() to reflect its actual purpose and
    maintain consistency with the VF side. This function now returns a
    boolean indicating to the caller if interrupts need to be re-enabled or
    not.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  21. crypto: qat - move VF message handler to adf_vf2pf_msg.c

    Move the reading and parsing of a PF2VF message from the bottom half
    function in adf_vf_isr.c, adf_pf2vf_bh_handler(), to the PFVF protocol
    file adf_vf2pf_msg.c, for better code organization.
    
    The receive and handle logic has been moved to a new function called
    adf_recv_and_handle_pf2vf_msg() which returns a boolean indicating if
    interrupts need to be re-enabled or not.
    A slight refactoring has been done to avoid calculating the PF2VF CSR
    offset twice and repeating the clearing of the PF2VFINT bit.
    
    The "PF restarting" logic, now defined in the function
    adf_pf2vf_handle_pf_restaring(), has been kept in adf_vf_isr.c due to
    the dependencies with the adf_vf_stop_wq workqueue.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  22. crypto: qat - move vf2pf interrupt helpers

    Move vf2pf interrupt enable and disable functions from adf_pf2vf_msg.c
    to adf_isr.c
    This it to separate the interrupt related code from the PFVF protocol
    logic.
    
    With this change, the function adf_disable_vf2pf_interrupts_irq() is
    only called from adf_isr.c and it has been marked as static.
    
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021
  23. crypto: qat - refactor PF top half for PFVF

    Move logic associated to handling VF2PF interrupt to its own function.
    This will simplify the handling of multiple interrupt sources in the
    function adf_msix_isr_ae() in the future.
    
    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>
    intmc authored and intel-lab-lkp committed Nov 10, 2021
  24. crypto: qat - fix undetected PFVF timeout in ACK loop

    If the remote function did not ACK the reception of a message, the
    function __adf_iov_putmsg() could detect it as a collision.
    
    This was due to the fact that the collision and the timeout checks after
    the ACK loop were in the wrong order. The timeout must be checked at the
    end of the loop, so fix by swapping the order of the two checks.
    
    Fixes: 9b768e8 ("crypto: qat - detect PFVF collision after ACK")
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
    Co-developed-by: Marco Chiappero <marco.chiappero@intel.com>
    Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
    gcabiddu authored and intel-lab-lkp committed Nov 10, 2021

Commits on Nov 9, 2021

  1. crypto: api - Fix boot-up crash when crypto manager is disabled

    When the crypto manager is disabled, we need to explicitly set
    the crypto algorithms' tested status so that they can be used.
    
    Fixes: cad439f ("crypto: api - Do not create test larvals if...")
    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Reported-by: Ido Schimmel <idosch@idosch.org>
    Reported-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Tested-by: Ido Schimmel <idosch@nvidia.com>
    Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    herbertx committed Nov 9, 2021

Commits on Oct 29, 2021

  1. crypto: testmgr - fix wrong key length for pkcs1pad

    Fix wrong test data at testmgr.h, it seems to be caused
    by ignoring the last '\0' when calling sizeof.
    
    Signed-off-by: Lei He <helei.sig11@bytedance.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Lei He authored and herbertx committed Oct 29, 2021
  2. crypto: pcrypt - Delay write to padata->info

    These three events can race when pcrypt is used multiple times in a
    template ("pcrypt(pcrypt(...))"):
    
      1.  [taskA] The caller makes the crypto request via crypto_aead_encrypt()
      2.  [kworkerB] padata serializes the inner pcrypt request
      3.  [kworkerC] padata serializes the outer pcrypt request
    
    3 might finish before the call to crypto_aead_encrypt() returns in 1,
    resulting in two possible issues.
    
    First, a use-after-free of the crypto request's memory when, for
    example, taskA writes to the outer pcrypt request's padata->info in
    pcrypt_aead_enc() after kworkerC completes the request.
    
    Second, the outer pcrypt request overwrites the inner pcrypt request's
    return code with -EINPROGRESS, making a successful request appear to
    fail.  For instance, kworkerB writes the outer pcrypt request's
    padata->info in pcrypt_aead_done() and then taskA overwrites it
    in pcrypt_aead_enc().
    
    Avoid both situations by delaying the write of padata->info until after
    the inner crypto request's return code is checked.  This prevents the
    use-after-free by not touching the crypto request's memory after the
    next-inner crypto request is made, and stops padata->info from being
    overwritten.
    
    Fixes: 5068c7a ("crypto: pcrypt - Add pcrypt crypto parallelization wrapper")
    Reported-by: syzbot+b187b77c8474f9648fae@syzkaller.appspotmail.com
    Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    danieljordan10 authored and herbertx committed Oct 29, 2021
  3. crypto: ccp - Make use of the helper macro kthread_run()

    Repalce kthread_create/wake_up_process() with kthread_run()
    to simplify the code.
    
    Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Cai Huoqing authored and herbertx committed Oct 29, 2021
  4. crypto: sa2ul - Use the defined variable to clean code

    Use the defined variable "dev" to make the code cleaner.
    
    Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Tang Bin authored and herbertx committed Oct 29, 2021
  5. crypto: s5p-sss - Add error handling in s5p_aes_probe()

    The function s5p_aes_probe() does not perform sufficient error
    checking after executing platform_get_resource(), thus fix it.
    
    Fixes: c2afad6 ("crypto: s5p-sss - Add HASH support for Exynos")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
    Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Tang Bin authored and herbertx committed Oct 29, 2021
  6. crypto: keembay-ocs-ecc - Add Keem Bay OCS ECC Driver

    The Intel Keem Bay SoC can provide hardware acceleration of Elliptic
    Curve Cryptography (ECC) by means of its Offload and Crypto Subsystem
    (OCS).
    
    Add the Keem Bay OCS ECC driver which leverages such hardware
    capabilities to provide hardware-acceleration of ECDH-256 and ECDH-384.
    
    Signed-off-by: Prabhjot Khurana <prabhjot.khurana@intel.com>
    Co-developed-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    PrabhjotKhuranaIntel authored and herbertx committed Oct 29, 2021
  7. dt-bindings: crypto: Add Keem Bay ECC bindings

    Add Keem Bay Offload and Crypto Subsystem (OCS) Elliptic Curve
    Cryptography (ECC) device tree bindings.
    
    Signed-off-by: Prabhjot Khurana <prabhjot.khurana@intel.com>
    Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Reviewed-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    PrabhjotKhuranaIntel authored and herbertx committed Oct 29, 2021
  8. crypto: ecc - Export additional helper functions

    Export the following additional ECC helper functions:
    - ecc_alloc_point()
    - ecc_free_point()
    - vli_num_bits()
    - ecc_point_is_zero()
    
    This is done to allow future ECC device drivers to re-use existing code,
    thus simplifying their implementation.
    
    Functions are exported using EXPORT_SYMBOL() (instead of
    EXPORT_SYMBOL_GPL()) to be consistent with the functions already
    exported by crypto/ecc.c.
    
    Exported functions are documented in include/crypto/internal/ecc.h.
    
    Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    dalessan authored and herbertx committed Oct 29, 2021
  9. crypto: ecc - Move ecc.h to include/crypto/internal

    Move ecc.h header file to 'include/crypto/internal' so that it can be
    easily imported from everywhere in the kernel tree.
    
    This change is done to allow crypto device drivers to re-use the symbols
    exported by 'crypto/ecc.c', thus avoiding code duplication.
    
    Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    dalessan authored and herbertx committed Oct 29, 2021
  10. crypto: engine - Add KPP Support to Crypto Engine

    Add KPP support to the crypto engine queue manager, so that it can be
    used to simplify the logic of KPP device drivers as done for other
    crypto drivers.
    
    Signed-off-by: Prabhjot Khurana <prabhjot.khurana@intel.com>
    Signed-off-by: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    PrabhjotKhuranaIntel authored and herbertx committed Oct 29, 2021
Older