From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Ian.Campbell@eu.citrix.com, xen-devel@lists.xensource.com,
Stefano.Stabellini@eu.citrix.com
Subject: Re: [PATCH 2/3] xen-fbfront: Use grant references when requested
Date: Wed, 9 Mar 2011 16:53:38 -0500 [thread overview]
Message-ID: <20110309215338.GA18343@dumpdata.com> (raw)
In-Reply-To: <1299528672-5299-3-git-send-email-dgdegra@tycho.nsa.gov>
> + 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?)
next prev parent reply other threads:[~2011-03-09 21:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-07 20:11 [PATCH v2] Add grant references for fbfront/kbdfront Daniel De Graaf
2011-03-07 20:11 ` [PATCH 1/3] xen-fbfront: Read width/height from backend Daniel De Graaf
2011-03-07 20:11 ` [PATCH 2/3] xen-fbfront: Use grant references when requested Daniel De Graaf
2011-03-09 21:53 ` Konrad Rzeszutek Wilk [this message]
2011-03-09 22:36 ` [PATCH 2/3 v2] " Daniel De Graaf
2011-03-07 20:11 ` [PATCH 3/3] xen-kbdfront: Add grant reference for shared page Daniel De Graaf
2011-03-08 10:44 ` [PATCH v2] Add grant references for fbfront/kbdfront Ian Campbell
2011-03-08 21:03 ` Daniel De Graaf
2011-03-09 10:31 ` Ian Campbell
-- strict thread matches above, loose matches on Subject: below --
2011-01-07 16:12 [PATCH] " dgdegra
2011-01-07 16:12 ` [PATCH 2/3] xen-fbfront: Use grant references when requested dgdegra
2011-01-07 20:44 ` Ian Campbell
2011-01-07 21:02 ` Daniel De Graaf
2011-01-07 21:41 ` Daniel De Graaf
2011-01-07 21:56 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110309215338.GA18343@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).