Skip to content

Commit c94b731

Browse files
jgross1Boris Ostrovsky
authored andcommitted
xen/grant-table: remove readonly parameter from functions
The gnttab_end_foreign_access() family of functions is taking a "readonly" parameter, which isn't used. Remove it from the function parameters. Signed-off-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Beulich <[email protected]> Acked-by: Christian Schoenebeck <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent b0f2126 commit c94b731

File tree

16 files changed

+48
-57
lines changed

16 files changed

+48
-57
lines changed

drivers/block/xen-blkfront.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
12231223
list_del(&persistent_gnt->node);
12241224
if (persistent_gnt->gref != GRANT_INVALID_REF) {
12251225
gnttab_end_foreign_access(persistent_gnt->gref,
1226-
0, 0UL);
1226+
0UL);
12271227
rinfo->persistent_gnts_c--;
12281228
}
12291229
if (info->feature_persistent)
@@ -1246,7 +1246,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
12461246
rinfo->shadow[i].req.u.rw.nr_segments;
12471247
for (j = 0; j < segs; j++) {
12481248
persistent_gnt = rinfo->shadow[i].grants_used[j];
1249-
gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
1249+
gnttab_end_foreign_access(persistent_gnt->gref, 0UL);
12501250
if (info->feature_persistent)
12511251
__free_page(persistent_gnt->page);
12521252
kfree(persistent_gnt);
@@ -1261,7 +1261,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
12611261

12621262
for (j = 0; j < INDIRECT_GREFS(segs); j++) {
12631263
persistent_gnt = rinfo->shadow[i].indirect_grants[j];
1264-
gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
1264+
gnttab_end_foreign_access(persistent_gnt->gref, 0UL);
12651265
__free_page(persistent_gnt->page);
12661266
kfree(persistent_gnt);
12671267
}
@@ -1284,7 +1284,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
12841284
/* Free resources associated with old device channel. */
12851285
for (i = 0; i < info->nr_ring_pages; i++) {
12861286
if (rinfo->ring_ref[i] != GRANT_INVALID_REF) {
1287-
gnttab_end_foreign_access(rinfo->ring_ref[i], 0, 0);
1287+
gnttab_end_foreign_access(rinfo->ring_ref[i], 0);
12881288
rinfo->ring_ref[i] = GRANT_INVALID_REF;
12891289
}
12901290
}

drivers/char/tpm/xen-tpmfront.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void ring_free(struct tpm_private *priv)
332332
return;
333333

334334
if (priv->ring_ref)
335-
gnttab_end_foreign_access(priv->ring_ref, 0,
335+
gnttab_end_foreign_access(priv->ring_ref,
336336
(unsigned long)priv->shr);
337337
else
338338
free_page((unsigned long)priv->shr);

drivers/gpu/drm/xen/xen_drm_front_evtchnl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void evtchnl_free(struct xen_drm_front_info *front_info,
148148

149149
/* end access and free the page */
150150
if (evtchnl->gref != GRANT_INVALID_REF)
151-
gnttab_end_foreign_access(evtchnl->gref, 0, page);
151+
gnttab_end_foreign_access(evtchnl->gref, page);
152152

153153
memset(evtchnl, 0, sizeof(*evtchnl));
154154
}

drivers/input/misc/xen-kbdfront.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
481481
error_evtchan:
482482
xenbus_free_evtchn(dev, evtchn);
483483
error_grant:
484-
gnttab_end_foreign_access(info->gref, 0, 0UL);
484+
gnttab_end_foreign_access(info->gref, 0UL);
485485
info->gref = -1;
486486
return ret;
487487
}
@@ -492,7 +492,7 @@ static void xenkbd_disconnect_backend(struct xenkbd_info *info)
492492
unbind_from_irqhandler(info->irq, info);
493493
info->irq = -1;
494494
if (info->gref >= 0)
495-
gnttab_end_foreign_access(info->gref, 0, 0UL);
495+
gnttab_end_foreign_access(info->gref, 0UL);
496496
info->gref = -1;
497497
}
498498

drivers/net/xen-netfront.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static bool xennet_tx_buf_gc(struct netfront_queue *queue)
425425
skb = queue->tx_skbs[id];
426426
queue->tx_skbs[id] = NULL;
427427
if (unlikely(!gnttab_end_foreign_access_ref(
428-
queue->grant_tx_ref[id], GNTMAP_readonly))) {
428+
queue->grant_tx_ref[id]))) {
429429
dev_alert(dev,
430430
"Grant still in use by backend domain\n");
431431
goto err;
@@ -1029,7 +1029,7 @@ static int xennet_get_responses(struct netfront_queue *queue,
10291029
goto next;
10301030
}
10311031

1032-
if (!gnttab_end_foreign_access_ref(ref, 0)) {
1032+
if (!gnttab_end_foreign_access_ref(ref)) {
10331033
dev_alert(dev,
10341034
"Grant still in use by backend domain\n");
10351035
queue->info->broken = true;
@@ -1388,7 +1388,6 @@ static void xennet_release_tx_bufs(struct netfront_queue *queue)
13881388
queue->tx_skbs[i] = NULL;
13891389
get_page(queue->grant_tx_page[i]);
13901390
gnttab_end_foreign_access(queue->grant_tx_ref[i],
1391-
GNTMAP_readonly,
13921391
(unsigned long)page_address(queue->grant_tx_page[i]));
13931392
queue->grant_tx_page[i] = NULL;
13941393
queue->grant_tx_ref[i] = GRANT_INVALID_REF;
@@ -1421,7 +1420,7 @@ static void xennet_release_rx_bufs(struct netfront_queue *queue)
14211420
* foreign access is ended (which may be deferred).
14221421
*/
14231422
get_page(page);
1424-
gnttab_end_foreign_access(ref, 0,
1423+
gnttab_end_foreign_access(ref,
14251424
(unsigned long)page_address(page));
14261425
queue->grant_rx_ref[id] = GRANT_INVALID_REF;
14271426

@@ -1763,7 +1762,7 @@ static void xennet_end_access(int ref, void *page)
17631762
{
17641763
/* This frees the page as a side-effect */
17651764
if (ref != GRANT_INVALID_REF)
1766-
gnttab_end_foreign_access(ref, 0, (unsigned long)page);
1765+
gnttab_end_foreign_access(ref, (unsigned long)page);
17671766
}
17681767

17691768
static void xennet_disconnect_backend(struct netfront_info *info)
@@ -1980,14 +1979,14 @@ static int setup_netfront(struct xenbus_device *dev,
19801979
*/
19811980
fail:
19821981
if (queue->rx_ring_ref != GRANT_INVALID_REF) {
1983-
gnttab_end_foreign_access(queue->rx_ring_ref, 0,
1982+
gnttab_end_foreign_access(queue->rx_ring_ref,
19841983
(unsigned long)rxs);
19851984
queue->rx_ring_ref = GRANT_INVALID_REF;
19861985
} else {
19871986
free_page((unsigned long)rxs);
19881987
}
19891988
if (queue->tx_ring_ref != GRANT_INVALID_REF) {
1990-
gnttab_end_foreign_access(queue->tx_ring_ref, 0,
1989+
gnttab_end_foreign_access(queue->tx_ring_ref,
19911990
(unsigned long)txs);
19921991
queue->tx_ring_ref = GRANT_INVALID_REF;
19931992
} else {

drivers/pci/xen-pcifront.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ static void free_pdev(struct pcifront_device *pdev)
755755
xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
756756

757757
if (pdev->gnt_ref != INVALID_GRANT_REF)
758-
gnttab_end_foreign_access(pdev->gnt_ref, 0 /* r/w page */,
758+
gnttab_end_foreign_access(pdev->gnt_ref,
759759
(unsigned long)pdev->sh_info);
760760
else
761761
free_page((unsigned long)pdev->sh_info);

drivers/scsi/xen-scsifront.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ static int scsifront_alloc_ring(struct vscsifrnt_info *info)
757757
free_irq:
758758
unbind_from_irqhandler(info->irq, info);
759759
free_gnttab:
760-
gnttab_end_foreign_access(info->ring_ref, 0,
760+
gnttab_end_foreign_access(info->ring_ref,
761761
(unsigned long)info->ring.sring);
762762

763763
return err;
@@ -766,7 +766,7 @@ static int scsifront_alloc_ring(struct vscsifrnt_info *info)
766766
static void scsifront_free_ring(struct vscsifrnt_info *info)
767767
{
768768
unbind_from_irqhandler(info->irq, info);
769-
gnttab_end_foreign_access(info->ring_ref, 0,
769+
gnttab_end_foreign_access(info->ring_ref,
770770
(unsigned long)info->ring.sring);
771771
}
772772

drivers/usb/host/xen-hcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,14 +1075,14 @@ static void xenhcd_destroy_rings(struct xenhcd_info *info)
10751075
info->irq = 0;
10761076

10771077
if (info->urb_ring_ref != GRANT_INVALID_REF) {
1078-
gnttab_end_foreign_access(info->urb_ring_ref, 0,
1078+
gnttab_end_foreign_access(info->urb_ring_ref,
10791079
(unsigned long)info->urb_ring.sring);
10801080
info->urb_ring_ref = GRANT_INVALID_REF;
10811081
}
10821082
info->urb_ring.sring = NULL;
10831083

10841084
if (info->conn_ring_ref != GRANT_INVALID_REF) {
1085-
gnttab_end_foreign_access(info->conn_ring_ref, 0,
1085+
gnttab_end_foreign_access(info->conn_ring_ref,
10861086
(unsigned long)info->conn_ring.sring);
10871087
info->conn_ring_ref = GRANT_INVALID_REF;
10881088
}

drivers/xen/gntalloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void __del_gref(struct gntalloc_gref *gref)
192192
if (gref->gref_id) {
193193
if (gref->page) {
194194
addr = (unsigned long)page_to_virt(gref->page);
195-
gnttab_end_foreign_access(gref->gref_id, 0, addr);
195+
gnttab_end_foreign_access(gref->gref_id, addr);
196196
} else
197197
gnttab_free_grant_reference(gref->gref_id);
198198
}

drivers/xen/gntdev-dmabuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static void dmabuf_imp_end_foreign_access(u32 *refs, int count)
533533

534534
for (i = 0; i < count; i++)
535535
if (refs[i] != GRANT_INVALID_REF)
536-
gnttab_end_foreign_access(refs[i], 0, 0UL);
536+
gnttab_end_foreign_access(refs[i], 0UL);
537537
}
538538

539539
static void dmabuf_imp_free_storage(struct gntdev_dmabuf *gntdev_dmabuf)

drivers/xen/grant-table.c

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,12 @@ struct gnttab_ops {
118118
unsigned long frame, unsigned flags);
119119
/*
120120
* Stop granting a grant entry to domain for accessing. Ref parameter is
121-
* reference of a grant entry whose grant access will be stopped,
122-
* readonly is not in use in this function. If the grant entry is
123-
* currently mapped for reading or writing, just return failure(==0)
124-
* directly and don't tear down the grant access. Otherwise, stop grant
125-
* access for this entry and return success(==1).
121+
* reference of a grant entry whose grant access will be stopped.
122+
* If the grant entry is currently mapped for reading or writing, just
123+
* return failure(==0) directly and don't tear down the grant access.
124+
* Otherwise, stop grant access for this entry and return success(==1).
126125
*/
127-
int (*end_foreign_access_ref)(grant_ref_t ref, int readonly);
126+
int (*end_foreign_access_ref)(grant_ref_t ref);
128127
/*
129128
* Read the frame number related to a given grant reference.
130129
*/
@@ -270,7 +269,7 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
270269
}
271270
EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
272271

273-
static int gnttab_end_foreign_access_ref_v1(grant_ref_t ref, int readonly)
272+
static int gnttab_end_foreign_access_ref_v1(grant_ref_t ref)
274273
{
275274
u16 flags, nflags;
276275
u16 *pflags;
@@ -286,7 +285,7 @@ static int gnttab_end_foreign_access_ref_v1(grant_ref_t ref, int readonly)
286285
return 1;
287286
}
288287

289-
static int gnttab_end_foreign_access_ref_v2(grant_ref_t ref, int readonly)
288+
static int gnttab_end_foreign_access_ref_v2(grant_ref_t ref)
290289
{
291290
gnttab_shared.v2[ref].hdr.flags = 0;
292291
mb(); /* Concurrent access by hypervisor. */
@@ -309,14 +308,14 @@ static int gnttab_end_foreign_access_ref_v2(grant_ref_t ref, int readonly)
309308
return 1;
310309
}
311310

312-
static inline int _gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly)
311+
static inline int _gnttab_end_foreign_access_ref(grant_ref_t ref)
313312
{
314-
return gnttab_interface->end_foreign_access_ref(ref, readonly);
313+
return gnttab_interface->end_foreign_access_ref(ref);
315314
}
316315

317-
int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly)
316+
int gnttab_end_foreign_access_ref(grant_ref_t ref)
318317
{
319-
if (_gnttab_end_foreign_access_ref(ref, readonly))
318+
if (_gnttab_end_foreign_access_ref(ref))
320319
return 1;
321320
pr_warn("WARNING: g.e. %#x still in use!\n", ref);
322321
return 0;
@@ -336,7 +335,6 @@ static unsigned long gnttab_read_frame_v2(grant_ref_t ref)
336335
struct deferred_entry {
337336
struct list_head list;
338337
grant_ref_t ref;
339-
bool ro;
340338
uint16_t warn_delay;
341339
struct page *page;
342340
};
@@ -360,7 +358,7 @@ static void gnttab_handle_deferred(struct timer_list *unused)
360358
break;
361359
list_del(&entry->list);
362360
spin_unlock_irqrestore(&gnttab_list_lock, flags);
363-
if (_gnttab_end_foreign_access_ref(entry->ref, entry->ro)) {
361+
if (_gnttab_end_foreign_access_ref(entry->ref)) {
364362
put_free_entry(entry->ref);
365363
pr_debug("freeing g.e. %#x (pfn %#lx)\n",
366364
entry->ref, page_to_pfn(entry->page));
@@ -386,8 +384,7 @@ static void gnttab_handle_deferred(struct timer_list *unused)
386384
spin_unlock_irqrestore(&gnttab_list_lock, flags);
387385
}
388386

389-
static void gnttab_add_deferred(grant_ref_t ref, bool readonly,
390-
struct page *page)
387+
static void gnttab_add_deferred(grant_ref_t ref, struct page *page)
391388
{
392389
struct deferred_entry *entry;
393390
gfp_t gfp = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL;
@@ -405,7 +402,6 @@ static void gnttab_add_deferred(grant_ref_t ref, bool readonly,
405402
unsigned long flags;
406403

407404
entry->ref = ref;
408-
entry->ro = readonly;
409405
entry->page = page;
410406
entry->warn_delay = 60;
411407
spin_lock_irqsave(&gnttab_list_lock, flags);
@@ -423,7 +419,7 @@ static void gnttab_add_deferred(grant_ref_t ref, bool readonly,
423419

424420
int gnttab_try_end_foreign_access(grant_ref_t ref)
425421
{
426-
int ret = _gnttab_end_foreign_access_ref(ref, 0);
422+
int ret = _gnttab_end_foreign_access_ref(ref);
427423

428424
if (ret)
429425
put_free_entry(ref);
@@ -432,15 +428,13 @@ int gnttab_try_end_foreign_access(grant_ref_t ref)
432428
}
433429
EXPORT_SYMBOL_GPL(gnttab_try_end_foreign_access);
434430

435-
void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
436-
unsigned long page)
431+
void gnttab_end_foreign_access(grant_ref_t ref, unsigned long page)
437432
{
438433
if (gnttab_try_end_foreign_access(ref)) {
439434
if (page != 0)
440435
put_page(virt_to_page(page));
441436
} else
442-
gnttab_add_deferred(ref, readonly,
443-
page ? virt_to_page(page) : NULL);
437+
gnttab_add_deferred(ref, page ? virt_to_page(page) : NULL);
444438
}
445439
EXPORT_SYMBOL_GPL(gnttab_end_foreign_access);
446440

drivers/xen/pvcalls-front.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ static void pvcalls_front_free_map(struct pvcalls_bedata *bedata,
238238
spin_unlock(&bedata->socket_lock);
239239

240240
for (i = 0; i < (1 << PVCALLS_RING_ORDER); i++)
241-
gnttab_end_foreign_access(map->active.ring->ref[i], 0, 0);
242-
gnttab_end_foreign_access(map->active.ref, 0, 0);
241+
gnttab_end_foreign_access(map->active.ring->ref[i], 0);
242+
gnttab_end_foreign_access(map->active.ref, 0);
243243
free_page((unsigned long)map->active.ring);
244244

245245
kfree(map);
@@ -1117,7 +1117,7 @@ static int pvcalls_front_remove(struct xenbus_device *dev)
11171117
}
11181118
}
11191119
if (bedata->ref != -1)
1120-
gnttab_end_foreign_access(bedata->ref, 0, 0);
1120+
gnttab_end_foreign_access(bedata->ref, 0);
11211121
kfree(bedata->ring.sring);
11221122
kfree(bedata);
11231123
xenbus_switch_state(dev, XenbusStateClosed);

drivers/xen/xen-front-pgdir-shbuf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ void xen_front_pgdir_shbuf_free(struct xen_front_pgdir_shbuf *buf)
143143

144144
for (i = 0; i < buf->num_grefs; i++)
145145
if (buf->grefs[i] != GRANT_INVALID_REF)
146-
gnttab_end_foreign_access(buf->grefs[i],
147-
0, 0UL);
146+
gnttab_end_foreign_access(buf->grefs[i], 0UL);
148147
}
149148
kfree(buf->grefs);
150149
kfree(buf->directory);

include/xen/grant_table.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
9797
* longer in use. Return 1 if the grant entry was freed, 0 if it is still in
9898
* use.
9999
*/
100-
int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
100+
int gnttab_end_foreign_access_ref(grant_ref_t ref);
101101

102102
/*
103103
* Eventually end access through the given grant reference, and once that
@@ -114,8 +114,7 @@ int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
114114
* gnttab_end_foreign_access() are done via alloc_pages_exact() (and freeing
115115
* via free_pages_exact()) in order to avoid high order pages.
116116
*/
117-
void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
118-
unsigned long page);
117+
void gnttab_end_foreign_access(grant_ref_t ref, unsigned long page);
119118

120119
/*
121120
* End access through the given grant reference, iff the grant entry is

net/9p/trans_xen.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ static void xen_9pfs_front_free(struct xen_9pfs_front_priv *priv)
279279
grant_ref_t ref;
280280

281281
ref = priv->rings[i].intf->ref[j];
282-
gnttab_end_foreign_access(ref, 0, 0);
282+
gnttab_end_foreign_access(ref, 0);
283283
}
284284
free_pages_exact(priv->rings[i].data.in,
285285
1UL << (priv->rings[i].intf->ring_order +
286286
XEN_PAGE_SHIFT));
287287
}
288-
gnttab_end_foreign_access(priv->rings[i].ref, 0, 0);
288+
gnttab_end_foreign_access(priv->rings[i].ref, 0);
289289
free_page((unsigned long)priv->rings[i].intf);
290290
}
291291
kfree(priv->rings);
@@ -353,10 +353,10 @@ static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev,
353353
out:
354354
if (bytes) {
355355
for (i--; i >= 0; i--)
356-
gnttab_end_foreign_access(ring->intf->ref[i], 0, 0);
356+
gnttab_end_foreign_access(ring->intf->ref[i], 0);
357357
free_pages_exact(bytes, 1UL << (order + XEN_PAGE_SHIFT));
358358
}
359-
gnttab_end_foreign_access(ring->ref, 0, 0);
359+
gnttab_end_foreign_access(ring->ref, 0);
360360
free_page((unsigned long)ring->intf);
361361
return ret;
362362
}

sound/xen/xen_snd_front_evtchnl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static void evtchnl_free(struct xen_snd_front_info *front_info,
168168

169169
/* End access and free the page. */
170170
if (channel->gref != GRANT_INVALID_REF)
171-
gnttab_end_foreign_access(channel->gref, 0, page);
171+
gnttab_end_foreign_access(channel->gref, page);
172172
else
173173
free_page(page);
174174

0 commit comments

Comments
 (0)