DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] vhost_xen: fix compilation on 32 bits
Date: Sun, 10 Apr 2016 20:25:52 +0100	[thread overview]
Message-ID: <1460316352-16209-3-git-send-email-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <1460316352-16209-1-git-send-email-pablo.de.lara.guarch@intel.com>

Compilation fails on 32 bits on Vhost_xen sample app, due to wrong casting:

examples/vhost_xen/vhost_monitor.c: In function ‘new_device’:
examples/vhost_xen/vhost_monitor.c:288:62: error: cast from pointer to integer
                               of different size [-Werror=pointer-to-int-cast]
   gpa = new_ll_dev->dev.mem->regions[i].guest_phys_address = (uint64_t)guest->mempool[i].gva;

Fixes: 47bd46112b71 ("xen: import xenvirt pmd and vhost_xen")                                                              ^

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/vhost_xen/vhost_monitor.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c
index 605cd4d..fb9606b 100644
--- a/examples/vhost_xen/vhost_monitor.c
+++ b/examples/vhost_xen/vhost_monitor.c
@@ -285,9 +285,13 @@ virtio_net_config_ll *new_device(unsigned int virtio_idx, struct xen_guest *gues
 	new_ll_dev->dev.mem = malloc(sizeof(struct virtio_memory) + sizeof(struct virtio_memory_regions) * MAX_XENVIRT_MEMPOOL);
 	new_ll_dev->dev.mem->nregions = guest->pool_num;
 	for (i = 0; i < guest->pool_num; i++) {
-		gpa = new_ll_dev->dev.mem->regions[i].guest_phys_address = (uint64_t)guest->mempool[i].gva;
-		new_ll_dev->dev.mem->regions[i].guest_phys_address_end = gpa + guest->mempool[i].mempfn_num * getpagesize();
-		new_ll_dev->dev.mem->regions[i].address_offset = (uint64_t)guest->mempool[i].hva - gpa;
+		gpa = new_ll_dev->dev.mem->regions[i].guest_phys_address =
+				(uint64_t)((uintptr_t)guest->mempool[i].gva);
+		new_ll_dev->dev.mem->regions[i].guest_phys_address_end =
+				gpa + guest->mempool[i].mempfn_num * getpagesize();
+		new_ll_dev->dev.mem->regions[i].address_offset =
+				(uint64_t)((uintptr_t)guest->mempool[i].hva -
+					(uintptr_t)gpa);
 	}
 
 	new_ll_dev->next = NULL;
-- 
2.5.0

  parent reply	other threads:[~2016-04-10 19:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-10 19:25 [dpdk-dev] [PATCH 0/2] Fix Xen compilation for " Pablo de Lara
2016-04-10 19:25 ` [dpdk-dev] [PATCH 1/2] xen: fix compilation on " Pablo de Lara
2016-04-10 19:25 ` Pablo de Lara [this message]
2016-04-10 19:37 ` [dpdk-dev] [PATCH 0/2] Fix Xen compilation for " Thomas Monjalon

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=1460316352-16209-3-git-send-email-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    /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).