Re: [PATCH v8 03/16] s390/vfio-ap: manage link between queue struct and matrix mdev

From: Tony Krowiak
Date: Wed Jun 17 2020 - 08:10:34 EST




On 6/16/20 1:50 PM, Christian Borntraeger wrote:

On 05.06.20 23:39, Tony Krowiak wrote:
[...]
+static void vfio_ap_mdev_link_queues(struct ap_matrix_mdev *matrix_mdev,
+ enum qlink_type type,
+ unsigned long qlink_id)
+{
+ unsigned long id;
+ struct vfio_ap_queue *q;
+
+ switch (type) {
+ case LINK_APID:
+ case UNLINK_APID:
+ for_each_set_bit_inv(id, matrix_mdev->matrix.aqm,
+ matrix_mdev->matrix.aqm_max + 1) {
+ q = vfio_ap_get_queue(AP_MKQID(qlink_id, id));
+ if (q) {
+ if (type == LINK_APID)
+ q->matrix_mdev = matrix_mdev;
+ else
+ q->matrix_mdev = NULL;> + }
+ }
+ break;
+ default:
Can you rather use
case LINK_APQI:
case UNLINK_APQI:

and add a default case with a WARN_ON_ONCE?

Yes I can.


+ for_each_set_bit_inv(id, matrix_mdev->matrix.apm,
+ matrix_mdev->matrix.apm_max + 1) {
+ q = vfio_ap_get_queue(AP_MKQID(id, qlink_id));
+ if (q) {
+ if (type == LINK_APQI)
+ q->matrix_mdev = matrix_mdev;
+ else
+ q->matrix_mdev = NULL;
+ }
+ }
+ break;
+ }
+}
+