From patchwork Mon Jul 7 10:47:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 33144 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BDF0220C88 for ; Mon, 7 Jul 2014 10:49:28 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ij19sf15285529vcb.6 for ; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type; bh=gn9Hj/chIrCxsxB3wSNcHOMZJ4+zMAcrLElhAMfWOMA=; b=GbUZqrhDdiA7a2OFokGbjbfmK2CtXHo1c3bVnKMFoIOOsiRmT9APmJfjbA1uWePG7N x7HpTFOM5yfSg9AhU4UgtYTBpoWNDKgAHrqkufAW0wJoNQSXIN0B7jqvfP9Nv1oITIl1 H+O5wDAWwoZkZyTfKYoxpzdrDWOfuSEPmyo9jc7v91XAfEURCfb1HPOn9jxAgGiT2W25 er55jQbsF6xERNVJoHb6RAtVLa+WSWGIFpJKPGkSZLunCQB62C0V96cPOKHeO1HXKTP8 DddisuQPT/zeNQ4PMn4Wah7S4xLfd3GkrjCu4+nojjtVT2uR/54wjmVfSWePQHH1RgtV 3s7w== X-Gm-Message-State: ALoCoQm6jq3MzboSKJq3cbRgswQIoG5caQZfMUeCdeeVexVa/kB+9vRED2M/EP74egPnGBiQq15u X-Received: by 10.236.198.134 with SMTP id v6mr11795006yhn.49.1404730168581; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.40 with SMTP id m37ls1800288qgd.18.gmail; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) X-Received: by 10.58.188.199 with SMTP id gc7mr27013119vec.4.1404730168474; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id cl2si18628516vcb.98.2014.07.07.03.49.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Jul 2014 03:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id oy12so3930613veb.27 for ; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) X-Received: by 10.220.103.141 with SMTP id k13mr26882205vco.25.1404730168401; Mon, 07 Jul 2014 03:49:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp656113vcb; Mon, 7 Jul 2014 03:49:27 -0700 (PDT) X-Received: by 10.140.101.86 with SMTP id t80mr45507520qge.108.1404730167908; Mon, 07 Jul 2014 03:49:27 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i53si38709962qge.31.2014.07.07.03.49.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Jul 2014 03:49:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:49303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46UB-0001w7-Kn for patch@linaro.org; Mon, 07 Jul 2014 06:49:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46Si-0000cv-Tc for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:48:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X46Se-0006G4-In for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:47:56 -0400 Received: from smtp.citrix.com ([66.165.176.89]:56873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X46Se-0006Fs-Aw for qemu-devel@nongnu.org; Mon, 07 Jul 2014 06:47:52 -0400 X-IronPort-AV: E=Sophos;i="5.01,617,1400025600"; d="scan'208";a="150180794" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 07 Jul 2014 10:47:51 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Mon, 7 Jul 2014 06:47:51 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1X46SX-0000aJ-Oq; Mon, 07 Jul 2014 11:47:45 +0100 From: Stefano Stabellini To: Date: Mon, 7 Jul 2014 11:47:01 +0100 Message-ID: <1404730021-23411-2-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org, Stefano Stabellini Subject: [Qemu-devel] [PULL 2/2] xen: build on ARM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Collection of fixes to build QEMU with Xen support on ARM: - use xenstore_read_fe_uint64 to retrieve the page-ref (xenfb); - use xen_pfn_t instead of unsigned long in xenfb; - unsigned long/xenpfn_t in xen_remove_from_physmap; - in xen-mapcache.c use HOST_LONG_BITS to check for QEMU's address space size. Signed-off-by: Stefano Stabellini Reviewed-by: Peter Maydell --- hw/display/xenfb.c | 18 ++++++++++-------- xen-hvm.c | 2 +- xen-mapcache.c | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 032eb7a..07ddc9d 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -93,10 +93,12 @@ struct XenFB { static int common_bind(struct common *c) { - int mfn; + uint64_t mfn; - if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1) + if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1) return -1; + assert(mfn == (xen_pfn_t)mfn); + if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1) return -1; @@ -107,7 +109,7 @@ static int common_bind(struct common *c) return -1; xen_be_bind_evtchn(&c->xendev); - xen_be_printf(&c->xendev, 1, "ring mfn %d, remote-port %d, local-port %d\n", + xen_be_printf(&c->xendev, 1, "ring mfn %"PRIx64", remote-port %d, local-port %d\n", mfn, c->xendev.remote_port, c->xendev.local_port); return 0; @@ -409,7 +411,7 @@ static void input_event(struct XenDevice *xendev) /* -------------------------------------------------------------------- */ -static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src) +static void xenfb_copy_mfns(int mode, int count, xen_pfn_t *dst, void *src) { uint32_t *src32 = src; uint64_t *src64 = src; @@ -424,8 +426,8 @@ static int xenfb_map_fb(struct XenFB *xenfb) struct xenfb_page *page = xenfb->c.page; char *protocol = xenfb->c.xendev.protocol; int n_fbdirs; - unsigned long *pgmfns = NULL; - unsigned long *fbmfns = NULL; + xen_pfn_t *pgmfns = NULL; + xen_pfn_t *fbmfns = NULL; void *map, *pd; int mode, ret = -1; @@ -483,8 +485,8 @@ static int xenfb_map_fb(struct XenFB *xenfb) n_fbdirs = xenfb->fbpages * mode / 8; n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE; - pgmfns = g_malloc0(sizeof(unsigned long) * n_fbdirs); - fbmfns = g_malloc0(sizeof(unsigned long) * xenfb->fbpages); + pgmfns = g_malloc0(sizeof(xen_pfn_t) * n_fbdirs); + fbmfns = g_malloc0(sizeof(xen_pfn_t) * xenfb->fbpages); xenfb_copy_mfns(mode, n_fbdirs, pgmfns, pd); map = xc_map_foreign_pages(xen_xc, xenfb->c.xendev.dom, diff --git a/xen-hvm.c b/xen-hvm.c index bafdf12..c928b36 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -390,7 +390,7 @@ static int xen_remove_from_physmap(XenIOState *state, start_addr >>= TARGET_PAGE_BITS; phys_offset >>= TARGET_PAGE_BITS; for (i = 0; i < size; i++) { - unsigned long idx = start_addr + i; + xen_pfn_t idx = start_addr + i; xen_pfn_t gpfn = phys_offset + i; rc = xc_domain_add_to_physmap(xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn); diff --git a/xen-mapcache.c b/xen-mapcache.c index eda914a..66da1a6 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -33,10 +33,10 @@ # define DPRINTF(fmt, ...) do { } while (0) #endif -#if defined(__i386__) +#if HOST_LONG_BITS == 32 # define MCACHE_BUCKET_SHIFT 16 # define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */ -#elif defined(__x86_64__) +#else # define MCACHE_BUCKET_SHIFT 20 # define MCACHE_MAX_SIZE (1UL<<35) /* 32GB Cap */ #endif