[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] Re: [PATCH 2/3] xen-fbfront: Use grant references when requested
> + int be_id = dev->otherend_id; > + int i, ref; > + unsigned long mfn; > + grant_ref_t gref_head; > + int allpages = info->nr_pages + ((info->nr_pages + epd - 1) / epd) + 1; > + > + int grants = 0; > + xenbus_scanf(XBT_NIL, dev->otherend, "feature-grants", "%d", &grants); > + > + if (grants) { > + int err = gnttab_alloc_grant_references(allpages, &gref_head); > + if (err < 0) { > + xenbus_dev_fatal(dev, err, "fbdev grant refs"); > + info->page_gref = -ENOSPC; > + } else { > + ref = gnttab_claim_grant_reference(&gref_head); > + mfn = virt_to_mfn(info->page); > + BUG_ON(ref == -ENOSPC); > + gnttab_grant_foreign_access_ref(ref, be_id, mfn, 0); > + info->page_gref = ref; > + } > + } else > + info->page_gref = -ENOENT; > > for (i = 0; i < info->nr_pages; i++) > - info->mfns[i] = vmalloc_to_mfn(info->fb + i * PAGE_SIZE); > + { > + mfn = vmalloc_to_mfn(info->fb + i * PAGE_SIZE); > + if (grants) { > + ref = gnttab_claim_grant_reference(&gref_head); > + BUG_ON(ref == -ENOSPC); > + gnttab_grant_foreign_access_ref(ref, be_id, mfn, 1); > + info->mfns[i] = ref; > + } else > + info->mfns[i] = mfn; > + } > > for (i = 0; i * epd < info->nr_pages; i++) > - info->page->pd[i] = vmalloc_to_mfn(&info->mfns[i * epd]); > + { > + mfn = vmalloc_to_mfn(&info->mfns[i * epd]); > + if (grants) { > + ref = gnttab_claim_grant_reference(&gref_head); > + BUG_ON(ref == -ENOSPC); > + gnttab_grant_foreign_access_ref(ref, be_id, mfn, 1); > + info->page->pd[i] = ref; > + } else > + info->page->pd[i] = mfn; > + } Shouldn't we in xenfb_remove also cleanup (unclaim and wholesale free the grant reference lot?) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |