Skip to content

Commit b0f2126

Browse files
jgross1Boris Ostrovsky
authored andcommitted
xen/grant-table: remove gnttab_*transfer*() functions
All grant table operations related to the "transfer" functionality are unused currently. There have been users in the old days of the "Xen-o-Linux" kernel, but those didn't make it upstream. So remove the "transfer" related functions. Signed-off-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 982e443 commit b0f2126

File tree

2 files changed

+2
-119
lines changed

2 files changed

+2
-119
lines changed

drivers/xen/grant-table.c

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct gnttab_ops {
109109
void (*unmap_frames)(void);
110110
/*
111111
* Introducing a valid entry into the grant table, granting the frame of
112-
* this grant entry to domain for accessing or transfering. Ref
112+
* this grant entry to domain for accessing. Ref
113113
* parameter is reference of this introduced grant entry, domid is id of
114114
* granted domain, frame is the page frame to be granted, and flags is
115115
* status of the grant entry to be updated.
@@ -125,14 +125,6 @@ struct gnttab_ops {
125125
* access for this entry and return success(==1).
126126
*/
127127
int (*end_foreign_access_ref)(grant_ref_t ref, int readonly);
128-
/*
129-
* Stop granting a grant entry to domain for transfer. Ref parameter is
130-
* reference of a grant entry whose grant transfer will be stopped. If
131-
* tranfer has not started, just reclaim the grant entry and return
132-
* failure(==0). Otherwise, wait for the transfer to complete and then
133-
* return the frame.
134-
*/
135-
unsigned long (*end_foreign_transfer_ref)(grant_ref_t ref);
136128
/*
137129
* Read the frame number related to a given grant reference.
138130
*/
@@ -230,10 +222,7 @@ static void put_free_entry(grant_ref_t ref)
230222
* Following applies to gnttab_update_entry_v1 and gnttab_update_entry_v2.
231223
* Introducing a valid entry into the grant table:
232224
* 1. Write ent->domid.
233-
* 2. Write ent->frame:
234-
* GTF_permit_access: Frame to which access is permitted.
235-
* GTF_accept_transfer: Pseudo-phys frame slot being filled by new
236-
* frame, or zero if none.
225+
* 2. Write ent->frame: Frame to which access is permitted.
237226
* 3. Write memory barrier (WMB).
238227
* 4. Write ent->flags, inc. valid type.
239228
*/
@@ -455,102 +444,6 @@ void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
455444
}
456445
EXPORT_SYMBOL_GPL(gnttab_end_foreign_access);
457446

458-
int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
459-
{
460-
int ref;
461-
462-
ref = get_free_entries(1);
463-
if (unlikely(ref < 0))
464-
return -ENOSPC;
465-
gnttab_grant_foreign_transfer_ref(ref, domid, pfn);
466-
467-
return ref;
468-
}
469-
EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer);
470-
471-
void gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid,
472-
unsigned long pfn)
473-
{
474-
gnttab_interface->update_entry(ref, domid, pfn, GTF_accept_transfer);
475-
}
476-
EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer_ref);
477-
478-
static unsigned long gnttab_end_foreign_transfer_ref_v1(grant_ref_t ref)
479-
{
480-
unsigned long frame;
481-
u16 flags;
482-
u16 *pflags;
483-
484-
pflags = &gnttab_shared.v1[ref].flags;
485-
486-
/*
487-
* If a transfer is not even yet started, try to reclaim the grant
488-
* reference and return failure (== 0).
489-
*/
490-
while (!((flags = *pflags) & GTF_transfer_committed)) {
491-
if (sync_cmpxchg(pflags, flags, 0) == flags)
492-
return 0;
493-
cpu_relax();
494-
}
495-
496-
/* If a transfer is in progress then wait until it is completed. */
497-
while (!(flags & GTF_transfer_completed)) {
498-
flags = *pflags;
499-
cpu_relax();
500-
}
501-
502-
rmb(); /* Read the frame number /after/ reading completion status. */
503-
frame = gnttab_shared.v1[ref].frame;
504-
BUG_ON(frame == 0);
505-
506-
return frame;
507-
}
508-
509-
static unsigned long gnttab_end_foreign_transfer_ref_v2(grant_ref_t ref)
510-
{
511-
unsigned long frame;
512-
u16 flags;
513-
u16 *pflags;
514-
515-
pflags = &gnttab_shared.v2[ref].hdr.flags;
516-
517-
/*
518-
* If a transfer is not even yet started, try to reclaim the grant
519-
* reference and return failure (== 0).
520-
*/
521-
while (!((flags = *pflags) & GTF_transfer_committed)) {
522-
if (sync_cmpxchg(pflags, flags, 0) == flags)
523-
return 0;
524-
cpu_relax();
525-
}
526-
527-
/* If a transfer is in progress then wait until it is completed. */
528-
while (!(flags & GTF_transfer_completed)) {
529-
flags = *pflags;
530-
cpu_relax();
531-
}
532-
533-
rmb(); /* Read the frame number /after/ reading completion status. */
534-
frame = gnttab_shared.v2[ref].full_page.frame;
535-
BUG_ON(frame == 0);
536-
537-
return frame;
538-
}
539-
540-
unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref)
541-
{
542-
return gnttab_interface->end_foreign_transfer_ref(ref);
543-
}
544-
EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer_ref);
545-
546-
unsigned long gnttab_end_foreign_transfer(grant_ref_t ref)
547-
{
548-
unsigned long frame = gnttab_end_foreign_transfer_ref(ref);
549-
put_free_entry(ref);
550-
return frame;
551-
}
552-
EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer);
553-
554447
void gnttab_free_grant_reference(grant_ref_t ref)
555448
{
556449
put_free_entry(ref);
@@ -1423,7 +1316,6 @@ static const struct gnttab_ops gnttab_v1_ops = {
14231316
.unmap_frames = gnttab_unmap_frames_v1,
14241317
.update_entry = gnttab_update_entry_v1,
14251318
.end_foreign_access_ref = gnttab_end_foreign_access_ref_v1,
1426-
.end_foreign_transfer_ref = gnttab_end_foreign_transfer_ref_v1,
14271319
.read_frame = gnttab_read_frame_v1,
14281320
};
14291321

@@ -1435,7 +1327,6 @@ static const struct gnttab_ops gnttab_v2_ops = {
14351327
.unmap_frames = gnttab_unmap_frames_v2,
14361328
.update_entry = gnttab_update_entry_v2,
14371329
.end_foreign_access_ref = gnttab_end_foreign_access_ref_v2,
1438-
.end_foreign_transfer_ref = gnttab_end_foreign_transfer_ref_v2,
14391330
.read_frame = gnttab_read_frame_v2,
14401331
};
14411332

include/xen/grant_table.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,6 @@ void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
125125
*/
126126
int gnttab_try_end_foreign_access(grant_ref_t ref);
127127

128-
int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
129-
130-
unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
131-
unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
132-
133128
/*
134129
* operations on reserved batches of grant references
135130
*/
@@ -162,9 +157,6 @@ static inline void gnttab_page_grant_foreign_access_ref_one(
162157
readonly);
163158
}
164159

165-
void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
166-
unsigned long pfn);
167-
168160
static inline void
169161
gnttab_set_map_op(struct gnttab_map_grant_ref *map, phys_addr_t addr,
170162
uint32_t flags, grant_ref_t ref, domid_t domid)

0 commit comments

Comments
 (0)