• Harald Freudenberger's avatar
    s390/ap: Fix CCA crypto card behavior within protected execution environment · 78f636e8
    Harald Freudenberger authored
    A crypto card comes in 3 flavors: accelerator, CCA co-processor or
    EP11 co-processor. Within a protected execution environment only the
    accelerator and EP11 co-processor is supported. However, it is
    possible to set up a KVM guest with a CCA card and run it as a
    protected execution guest. There is nothing at the host side which
    prevents this. Within such a guest, a CCA card is shown as "illicit"
    and you can't do anything with such a crypto card.
    
    Regardless of the unsupported CCA card within a protected execution
    guest there are a couple of user space applications which
    unconditional try to run crypto requests to the zcrypt device
    driver. There was a bug within the AP bus code which allowed such a
    request to be forwarded to a CCA card where it is finally
    rejected and the driver reacts with -ENODEV but also triggers an AP
    bus scan. Together with a retry loop this caused some kind of "hang"
    of the KVM guest. On startup it caused timeouts and finally led the
    KVM guest startup fail. Fix that by closing the gap and make sure a
    CCA card is not usable within a protected execution environment.
    
    Another behavior within an protected execution environment with CCA
    cards was that the se_bind and se_associate AP queue sysfs attributes
    where shown. The implementation unconditional always added these
    attributes. Fix that by checking if the card mode is supported within
    a protected execution environment and only if valid, add the attribute
    group.
    Signed-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
    Reviewed-by: default avatarHolger Dengler <dengler@linux.ibm.com>
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    78f636e8
ap_bus.h 13.6 KB