Skip to content

Commit 10e19d4

Browse files
nicolincawilliam
authored andcommitted
vfio/ap: Pass in physical address of ind to ap_aqic()
The ap_aqic() is called by vfio_ap_irq_enable() where it passes in a virt value that's casted from a physical address "h_nib". Inside the ap_aqic(), it does virt_to_phys() again. Since ap_aqic() needs a physical address, let's just pass in a pa of ind directly. So change the "ind" to "pa_ind". Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Tested-by: Eric Farman <farman@linux.ibm.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Link: https://lore.kernel.org/r/20220723020256.30081-4-nicolinc@nvidia.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent 2c9e8c0 commit 10e19d4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

arch/s390/include/asm/ap.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,21 @@ struct ap_qirq_ctrl {
227227
* ap_aqic(): Control interruption for a specific AP.
228228
* @qid: The AP queue number
229229
* @qirqctrl: struct ap_qirq_ctrl (64 bit value)
230-
* @ind: The notification indicator byte
230+
* @pa_ind: Physical address of the notification indicator byte
231231
*
232232
* Returns AP queue status.
233233
*/
234234
static inline struct ap_queue_status ap_aqic(ap_qid_t qid,
235235
struct ap_qirq_ctrl qirqctrl,
236-
void *ind)
236+
phys_addr_t pa_ind)
237237
{
238238
unsigned long reg0 = qid | (3UL << 24); /* fc 3UL is AQIC */
239239
union {
240240
unsigned long value;
241241
struct ap_qirq_ctrl qirqctrl;
242242
struct ap_queue_status status;
243243
} reg1;
244-
unsigned long reg2 = virt_to_phys(ind);
244+
unsigned long reg2 = pa_ind;
245245

246246
reg1.qirqctrl = qirqctrl;
247247

drivers/s390/crypto/ap_queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static int ap_queue_enable_irq(struct ap_queue *aq, void *ind)
3434

3535
qirqctrl.ir = 1;
3636
qirqctrl.isc = AP_ISC;
37-
status = ap_aqic(aq->qid, qirqctrl, ind);
37+
status = ap_aqic(aq->qid, qirqctrl, virt_to_phys(ind));
3838
switch (status.response_code) {
3939
case AP_RESPONSE_NORMAL:
4040
case AP_RESPONSE_OTHERWISE_CHANGED:

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static struct ap_queue_status vfio_ap_irq_disable(struct vfio_ap_queue *q)
154154
int retries = 5;
155155

156156
do {
157-
status = ap_aqic(q->apqn, aqic_gisa, NULL);
157+
status = ap_aqic(q->apqn, aqic_gisa, 0);
158158
switch (status.response_code) {
159159
case AP_RESPONSE_OTHERWISE_CHANGED:
160160
case AP_RESPONSE_NORMAL:
@@ -245,7 +245,8 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
245245
struct kvm_s390_gisa *gisa;
246246
int nisc;
247247
struct kvm *kvm;
248-
unsigned long h_nib, g_pfn, h_pfn;
248+
unsigned long g_pfn, h_pfn;
249+
phys_addr_t h_nib;
249250
int ret;
250251

251252
/* Verify that the notification indicator byte address is valid */
@@ -290,7 +291,7 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
290291
aqic_gisa.ir = 1;
291292
aqic_gisa.gisa = (uint64_t)gisa >> 4;
292293

293-
status = ap_aqic(q->apqn, aqic_gisa, (void *)h_nib);
294+
status = ap_aqic(q->apqn, aqic_gisa, h_nib);
294295
switch (status.response_code) {
295296
case AP_RESPONSE_NORMAL:
296297
/* See if we did clear older IRQ configuration */

0 commit comments

Comments
 (0)