Commit 5c4c2126 authored by Christian Borntraeger's avatar Christian Borntraeger Committed by Vasily Gorbik

s390: vfio-ap: fix irq registration

vfio_ap_free_aqic_resources is called in two places:
- during registration to have a "known state"
- during interrupt disable

We must not clear q->matrix_mdev in the registration phase as this will
mess up the reference counting and can lead to some warning and other
bugs.

Fixes: ec89b55e ("s390: ap: implement PAPQ AQIC interception in kernel")
Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 820bace7
...@@ -115,7 +115,6 @@ static void vfio_ap_wait_for_irqclear(int apqn) ...@@ -115,7 +115,6 @@ static void vfio_ap_wait_for_irqclear(int apqn)
* Unregisters the ISC in the GIB when the saved ISC not invalid. * Unregisters the ISC in the GIB when the saved ISC not invalid.
* Unpin the guest's page holding the NIB when it exist. * Unpin the guest's page holding the NIB when it exist.
* Reset the saved_pfn and saved_isc to invalid values. * Reset the saved_pfn and saved_isc to invalid values.
* Clear the pointer to the matrix mediated device.
* *
*/ */
static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q) static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q)
...@@ -127,7 +126,6 @@ static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q) ...@@ -127,7 +126,6 @@ static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q)
&q->saved_pfn, 1); &q->saved_pfn, 1);
q->saved_pfn = 0; q->saved_pfn = 0;
q->saved_isc = VFIO_AP_ISC_INVALID; q->saved_isc = VFIO_AP_ISC_INVALID;
q->matrix_mdev = NULL;
} }
/** /**
...@@ -179,6 +177,7 @@ struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q) ...@@ -179,6 +177,7 @@ struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q)
status.response_code); status.response_code);
end_free: end_free:
vfio_ap_free_aqic_resources(q); vfio_ap_free_aqic_resources(q);
q->matrix_mdev = NULL;
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment