summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/xen-scsifront.c
diff options
context:
space:
mode:
authorJulien Grall <julien.grall@citrix.com>2015-08-07 12:34:37 -0400
committerJulien Grall <julien.grall@citrix.com>2015-09-08 13:03:49 -0400
commit0df4f266b3af90442bbeb5e685a84a80745beba0 (patch)
tree6516dbebc85a0e204b1e619466b3fbff6d14c3f3 /drivers/scsi/xen-scsifront.c
parent5192b35de47e47a0f736fe30da199f32030680e7 (diff)
xen: Use correctly the Xen memory terminologies
Based on include/xen/mm.h [1], Linux is mistakenly using MFN when GFN is meant, I suspect this is because the first support for Xen was for PV. This resulted in some misimplementation of helpers on ARM and confused developers about the expected behavior. For instance, with pfn_to_mfn, we expect to get an MFN based on the name. Although, if we look at the implementation on x86, it's returning a GFN. For clarity and avoid new confusion, replace any reference to mfn with gfn in any helpers used by PV drivers. The x86 code will still keep some reference of pfn_to_mfn which may be used by all kind of guests No changes as been made in the hypercall field, even though they may be invalid, in order to keep the same as the defintion in xen repo. Note that page_to_mfn has been renamed to xen_page_to_gfn to avoid a name to close to the KVM function gfn_to_page. Take also the opportunity to simplify simple construction such as pfn_to_mfn(page_to_pfn(page)) into xen_page_to_gfn. More complex clean up will come in follow-up patches. [1] http://xenbits.xen.org/gitweb/?p=xen.git;a=commitdiff;h=e758ed14f390342513405dd766e874934573e6cb Signed-off-by: Julien Grall <julien.grall@citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/scsi/xen-scsifront.c')
-rw-r--r--drivers/scsi/xen-scsifront.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index fad22caf0eff..9dc8687bf048 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -377,7 +377,6 @@ static int map_data_for_request(struct vscsifrnt_info *info,
377 unsigned int data_len = scsi_bufflen(sc); 377 unsigned int data_len = scsi_bufflen(sc);
378 unsigned int data_grants = 0, seg_grants = 0; 378 unsigned int data_grants = 0, seg_grants = 0;
379 struct scatterlist *sg; 379 struct scatterlist *sg;
380 unsigned long mfn;
381 struct scsiif_request_segment *seg; 380 struct scsiif_request_segment *seg;
382 381
383 ring_req->nr_segments = 0; 382 ring_req->nr_segments = 0;
@@ -420,9 +419,9 @@ static int map_data_for_request(struct vscsifrnt_info *info,
420 ref = gnttab_claim_grant_reference(&gref_head); 419 ref = gnttab_claim_grant_reference(&gref_head);
421 BUG_ON(ref == -ENOSPC); 420 BUG_ON(ref == -ENOSPC);
422 421
423 mfn = pfn_to_mfn(page_to_pfn(page));
424 gnttab_grant_foreign_access_ref(ref, 422 gnttab_grant_foreign_access_ref(ref,
425 info->dev->otherend_id, mfn, 1); 423 info->dev->otherend_id,
424 xen_page_to_gfn(page), 1);
426 shadow->gref[ref_cnt] = ref; 425 shadow->gref[ref_cnt] = ref;
427 ring_req->seg[ref_cnt].gref = ref; 426 ring_req->seg[ref_cnt].gref = ref;
428 ring_req->seg[ref_cnt].offset = (uint16_t)off; 427 ring_req->seg[ref_cnt].offset = (uint16_t)off;
@@ -454,9 +453,10 @@ static int map_data_for_request(struct vscsifrnt_info *info,
454 ref = gnttab_claim_grant_reference(&gref_head); 453 ref = gnttab_claim_grant_reference(&gref_head);
455 BUG_ON(ref == -ENOSPC); 454 BUG_ON(ref == -ENOSPC);
456 455
457 mfn = pfn_to_mfn(page_to_pfn(page));
458 gnttab_grant_foreign_access_ref(ref, 456 gnttab_grant_foreign_access_ref(ref,
459 info->dev->otherend_id, mfn, grant_ro); 457 info->dev->otherend_id,
458 xen_page_to_gfn(page),
459 grant_ro);
460 460
461 shadow->gref[ref_cnt] = ref; 461 shadow->gref[ref_cnt] = ref;
462 seg->gref = ref; 462 seg->gref = ref;