matrix_mdev        48 drivers/s390/crypto/vfio_ap_ops.c 					struct ap_matrix_mdev *matrix_mdev,
matrix_mdev        54 drivers/s390/crypto/vfio_ap_ops.c 	if (!test_bit_inv(AP_QID_CARD(apqn), matrix_mdev->matrix.apm))
matrix_mdev        56 drivers/s390/crypto/vfio_ap_ops.c 	if (!test_bit_inv(AP_QID_QUEUE(apqn), matrix_mdev->matrix.aqm))
matrix_mdev        64 drivers/s390/crypto/vfio_ap_ops.c 	q->matrix_mdev = matrix_mdev;
matrix_mdev       122 drivers/s390/crypto/vfio_ap_ops.c 	if (q->saved_isc != VFIO_AP_ISC_INVALID && q->matrix_mdev)
matrix_mdev       123 drivers/s390/crypto/vfio_ap_ops.c 		kvm_s390_gisc_unregister(q->matrix_mdev->kvm, q->saved_isc);
matrix_mdev       124 drivers/s390/crypto/vfio_ap_ops.c 	if (q->saved_pfn && q->matrix_mdev)
matrix_mdev       125 drivers/s390/crypto/vfio_ap_ops.c 		vfio_unpin_pages(mdev_dev(q->matrix_mdev->mdev),
matrix_mdev       180 drivers/s390/crypto/vfio_ap_ops.c 	q->matrix_mdev = NULL;
matrix_mdev       212 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_pin_pages(mdev_dev(q->matrix_mdev->mdev), &g_pfn, 1,
matrix_mdev       222 drivers/s390/crypto/vfio_ap_ops.c 	kvm = q->matrix_mdev->kvm;
matrix_mdev       241 drivers/s390/crypto/vfio_ap_ops.c 		vfio_unpin_pages(mdev_dev(q->matrix_mdev->mdev), &g_pfn, 1);
matrix_mdev       282 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev;
matrix_mdev       293 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev = container_of(vcpu->kvm->arch.crypto.pqap_hook,
matrix_mdev       296 drivers/s390/crypto/vfio_ap_ops.c 	q = vfio_ap_get_queue(matrix_mdev, apqn);
matrix_mdev       326 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev;
matrix_mdev       331 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev = kzalloc(sizeof(*matrix_mdev), GFP_KERNEL);
matrix_mdev       332 drivers/s390/crypto/vfio_ap_ops.c 	if (!matrix_mdev) {
matrix_mdev       337 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->mdev = mdev;
matrix_mdev       338 drivers/s390/crypto/vfio_ap_ops.c 	vfio_ap_matrix_init(&matrix_dev->info, &matrix_mdev->matrix);
matrix_mdev       339 drivers/s390/crypto/vfio_ap_ops.c 	mdev_set_drvdata(mdev, matrix_mdev);
matrix_mdev       340 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->pqap_hook.hook = handle_pqap;
matrix_mdev       341 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->pqap_hook.owner = THIS_MODULE;
matrix_mdev       343 drivers/s390/crypto/vfio_ap_ops.c 	list_add(&matrix_mdev->node, &matrix_dev->mdev_list);
matrix_mdev       351 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       353 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       358 drivers/s390/crypto/vfio_ap_ops.c 	list_del(&matrix_mdev->node);
matrix_mdev       361 drivers/s390/crypto/vfio_ap_ops.c 	kfree(matrix_mdev);
matrix_mdev       506 drivers/s390/crypto/vfio_ap_ops.c vfio_ap_mdev_verify_queues_reserved_for_apid(struct ap_matrix_mdev *matrix_mdev,
matrix_mdev       511 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long nbits = matrix_mdev->matrix.aqm_max + 1;
matrix_mdev       513 drivers/s390/crypto/vfio_ap_ops.c 	if (find_first_bit_inv(matrix_mdev->matrix.aqm, nbits) >= nbits)
matrix_mdev       516 drivers/s390/crypto/vfio_ap_ops.c 	for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm, nbits) {
matrix_mdev       536 drivers/s390/crypto/vfio_ap_ops.c static int vfio_ap_mdev_verify_no_sharing(struct ap_matrix_mdev *matrix_mdev)
matrix_mdev       543 drivers/s390/crypto/vfio_ap_ops.c 		if (matrix_mdev == lstdev)
matrix_mdev       553 drivers/s390/crypto/vfio_ap_ops.c 		if (!bitmap_and(apm, matrix_mdev->matrix.apm,
matrix_mdev       557 drivers/s390/crypto/vfio_ap_ops.c 		if (!bitmap_and(aqm, matrix_mdev->matrix.aqm,
matrix_mdev       606 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       609 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       616 drivers/s390/crypto/vfio_ap_ops.c 	if (apid > matrix_mdev->matrix.apm_max)
matrix_mdev       626 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_ap_mdev_verify_queues_reserved_for_apid(matrix_mdev, apid);
matrix_mdev       630 drivers/s390/crypto/vfio_ap_ops.c 	set_bit_inv(apid, matrix_mdev->matrix.apm);
matrix_mdev       632 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_ap_mdev_verify_no_sharing(matrix_mdev);
matrix_mdev       640 drivers/s390/crypto/vfio_ap_ops.c 	clear_bit_inv(apid, matrix_mdev->matrix.apm);
matrix_mdev       672 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       675 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       682 drivers/s390/crypto/vfio_ap_ops.c 	if (apid > matrix_mdev->matrix.apm_max)
matrix_mdev       686 drivers/s390/crypto/vfio_ap_ops.c 	clear_bit_inv((unsigned long)apid, matrix_mdev->matrix.apm);
matrix_mdev       694 drivers/s390/crypto/vfio_ap_ops.c vfio_ap_mdev_verify_queues_reserved_for_apqi(struct ap_matrix_mdev *matrix_mdev,
matrix_mdev       699 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long nbits = matrix_mdev->matrix.apm_max + 1;
matrix_mdev       701 drivers/s390/crypto/vfio_ap_ops.c 	if (find_first_bit_inv(matrix_mdev->matrix.apm, nbits) >= nbits)
matrix_mdev       704 drivers/s390/crypto/vfio_ap_ops.c 	for_each_set_bit_inv(apid, matrix_mdev->matrix.apm, nbits) {
matrix_mdev       752 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       753 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long max_apqi = matrix_mdev->matrix.aqm_max;
matrix_mdev       756 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       767 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_ap_mdev_verify_queues_reserved_for_apqi(matrix_mdev, apqi);
matrix_mdev       771 drivers/s390/crypto/vfio_ap_ops.c 	set_bit_inv(apqi, matrix_mdev->matrix.aqm);
matrix_mdev       773 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_ap_mdev_verify_no_sharing(matrix_mdev);
matrix_mdev       781 drivers/s390/crypto/vfio_ap_ops.c 	clear_bit_inv(apqi, matrix_mdev->matrix.aqm);
matrix_mdev       814 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       817 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       824 drivers/s390/crypto/vfio_ap_ops.c 	if (apqi > matrix_mdev->matrix.aqm_max)
matrix_mdev       828 drivers/s390/crypto/vfio_ap_ops.c 	clear_bit_inv((unsigned long)apqi, matrix_mdev->matrix.aqm);
matrix_mdev       858 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       861 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       868 drivers/s390/crypto/vfio_ap_ops.c 	if (id > matrix_mdev->matrix.adm_max)
matrix_mdev       877 drivers/s390/crypto/vfio_ap_ops.c 	set_bit_inv(id, matrix_mdev->matrix.adm);
matrix_mdev       907 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       908 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long max_domid =  matrix_mdev->matrix.adm_max;
matrix_mdev       911 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm)
matrix_mdev       921 drivers/s390/crypto/vfio_ap_ops.c 	clear_bit_inv(domid, matrix_mdev->matrix.adm);
matrix_mdev       937 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       938 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long max_domid = matrix_mdev->matrix.adm_max;
matrix_mdev       941 drivers/s390/crypto/vfio_ap_ops.c 	for_each_set_bit_inv(id, matrix_mdev->matrix.adm, max_domid + 1) {
matrix_mdev       956 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev       962 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long napm_bits = matrix_mdev->matrix.apm_max + 1;
matrix_mdev       963 drivers/s390/crypto/vfio_ap_ops.c 	unsigned long naqm_bits = matrix_mdev->matrix.aqm_max + 1;
matrix_mdev       967 drivers/s390/crypto/vfio_ap_ops.c 	apid1 = find_first_bit_inv(matrix_mdev->matrix.apm, napm_bits);
matrix_mdev       968 drivers/s390/crypto/vfio_ap_ops.c 	apqi1 = find_first_bit_inv(matrix_mdev->matrix.aqm, naqm_bits);
matrix_mdev       973 drivers/s390/crypto/vfio_ap_ops.c 		for_each_set_bit_inv(apid, matrix_mdev->matrix.apm, napm_bits) {
matrix_mdev       974 drivers/s390/crypto/vfio_ap_ops.c 			for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm,
matrix_mdev       983 drivers/s390/crypto/vfio_ap_ops.c 		for_each_set_bit_inv(apid, matrix_mdev->matrix.apm, napm_bits) {
matrix_mdev       989 drivers/s390/crypto/vfio_ap_ops.c 		for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm, naqm_bits) {
matrix_mdev      1035 drivers/s390/crypto/vfio_ap_ops.c static int vfio_ap_mdev_set_kvm(struct ap_matrix_mdev *matrix_mdev,
matrix_mdev      1043 drivers/s390/crypto/vfio_ap_ops.c 		if ((m != matrix_mdev) && (m->kvm == kvm)) {
matrix_mdev      1049 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->kvm = kvm;
matrix_mdev      1051 drivers/s390/crypto/vfio_ap_ops.c 	kvm->arch.crypto.pqap_hook = &matrix_mdev->pqap_hook;
matrix_mdev      1071 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev;
matrix_mdev      1073 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev = container_of(nb, struct ap_matrix_mdev, iommu_notifier);
matrix_mdev      1079 drivers/s390/crypto/vfio_ap_ops.c 		vfio_unpin_pages(mdev_dev(matrix_mdev->mdev), &g_pfn, 1);
matrix_mdev      1090 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev;
matrix_mdev      1095 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev = container_of(nb, struct ap_matrix_mdev, group_notifier);
matrix_mdev      1098 drivers/s390/crypto/vfio_ap_ops.c 		matrix_mdev->kvm = NULL;
matrix_mdev      1102 drivers/s390/crypto/vfio_ap_ops.c 	ret = vfio_ap_mdev_set_kvm(matrix_mdev, data);
matrix_mdev      1107 drivers/s390/crypto/vfio_ap_ops.c 	if (!matrix_mdev->kvm->arch.crypto.crycbd)
matrix_mdev      1110 drivers/s390/crypto/vfio_ap_ops.c 	kvm_arch_crypto_set_masks(matrix_mdev->kvm, matrix_mdev->matrix.apm,
matrix_mdev      1111 drivers/s390/crypto/vfio_ap_ops.c 				  matrix_mdev->matrix.aqm,
matrix_mdev      1112 drivers/s390/crypto/vfio_ap_ops.c 				  matrix_mdev->matrix.adm);
matrix_mdev      1166 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev      1168 drivers/s390/crypto/vfio_ap_ops.c 	for_each_set_bit_inv(apid, matrix_mdev->matrix.apm,
matrix_mdev      1169 drivers/s390/crypto/vfio_ap_ops.c 			     matrix_mdev->matrix.apm_max + 1) {
matrix_mdev      1170 drivers/s390/crypto/vfio_ap_ops.c 		for_each_set_bit_inv(apqi, matrix_mdev->matrix.aqm,
matrix_mdev      1171 drivers/s390/crypto/vfio_ap_ops.c 				     matrix_mdev->matrix.aqm_max + 1) {
matrix_mdev      1189 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev      1197 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->group_notifier.notifier_call = vfio_ap_mdev_group_notifier;
matrix_mdev      1201 drivers/s390/crypto/vfio_ap_ops.c 				     &events, &matrix_mdev->group_notifier);
matrix_mdev      1207 drivers/s390/crypto/vfio_ap_ops.c 	matrix_mdev->iommu_notifier.notifier_call = vfio_ap_mdev_iommu_notifier;
matrix_mdev      1210 drivers/s390/crypto/vfio_ap_ops.c 				     &events, &matrix_mdev->iommu_notifier);
matrix_mdev      1215 drivers/s390/crypto/vfio_ap_ops.c 				 &matrix_mdev->group_notifier);
matrix_mdev      1222 drivers/s390/crypto/vfio_ap_ops.c 	struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
matrix_mdev      1225 drivers/s390/crypto/vfio_ap_ops.c 	if (matrix_mdev->kvm) {
matrix_mdev      1226 drivers/s390/crypto/vfio_ap_ops.c 		kvm_arch_crypto_clear_masks(matrix_mdev->kvm);
matrix_mdev      1227 drivers/s390/crypto/vfio_ap_ops.c 		matrix_mdev->kvm->arch.crypto.pqap_hook = NULL;
matrix_mdev      1229 drivers/s390/crypto/vfio_ap_ops.c 		kvm_put_kvm(matrix_mdev->kvm);
matrix_mdev      1230 drivers/s390/crypto/vfio_ap_ops.c 		matrix_mdev->kvm = NULL;
matrix_mdev      1235 drivers/s390/crypto/vfio_ap_ops.c 				 &matrix_mdev->iommu_notifier);
matrix_mdev      1237 drivers/s390/crypto/vfio_ap_ops.c 				 &matrix_mdev->group_notifier);
matrix_mdev        97 drivers/s390/crypto/vfio_ap_private.h 	struct ap_matrix_mdev *matrix_mdev;