NULL
};
-static void vfio_ap_mdev_copy_masks(struct ap_matrix_mdev *matrix_mdev)
-{
- int nbytes;
- unsigned long *apm, *aqm, *adm;
- struct kvm_s390_crypto_cb *crycb = matrix_mdev->kvm->arch.crypto.crycb;
-
- switch (matrix_mdev->kvm->arch.crypto.crycbd & CRYCB_FORMAT_MASK) {
- case CRYCB_FORMAT2:
- apm = (unsigned long *)crycb->apcb1.apm;
- aqm = (unsigned long *)crycb->apcb1.aqm;
- adm = (unsigned long *)crycb->apcb1.adm;
- break;
- case CRYCB_FORMAT1:
- case CRYCB_FORMAT0:
- apm = (unsigned long *)crycb->apcb0.apm;
- aqm = (unsigned long *)crycb->apcb0.aqm;
- adm = (unsigned long *)crycb->apcb0.adm;
- break;
- default:
- /* cannot happen */
- return;
- }
-
- nbytes = DIV_ROUND_UP(matrix_mdev->matrix.apm_max + 1, BITS_PER_BYTE);
- memcpy(apm, matrix_mdev->matrix.apm, nbytes);
- nbytes = DIV_ROUND_UP(matrix_mdev->matrix.aqm_max + 1, BITS_PER_BYTE);
- memcpy(aqm, matrix_mdev->matrix.aqm, nbytes);
- nbytes = DIV_ROUND_UP(matrix_mdev->matrix.adm_max + 1, BITS_PER_BYTE);
- memcpy(adm, matrix_mdev->matrix.adm, nbytes);
-}
-
/**
* vfio_ap_mdev_set_kvm
*
if (!matrix_mdev->kvm->arch.crypto.crycbd)
return NOTIFY_DONE;
- vfio_ap_mdev_copy_masks(matrix_mdev);
+ kvm_arch_crypto_set_masks(matrix_mdev->kvm, matrix_mdev->matrix.apm,
+ matrix_mdev->matrix.aqm,
+ matrix_mdev->matrix.adm);
return NOTIFY_OK;
}