From patchwork Wed May 25 11:41:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 68579 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1161509qge; Wed, 25 May 2016 04:42:57 -0700 (PDT) X-Received: by 10.31.85.3 with SMTP id j3mr2007242vkb.156.1464176577188; Wed, 25 May 2016 04:42:57 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u145si6170685vkb.50.2016.05.25.04.42.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 04:42:57 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5XBt-0001vl-MG; Wed, 25 May 2016 11:41:33 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b5XBs-0001va-5m for xen-devel@lists.xen.org; Wed, 25 May 2016 11:41:32 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id 34/55-06361-B6F85475; Wed, 25 May 2016 11:41:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTTe73zX cYF+lxZKPi1kcGD2O7v7NFMAYxZqZl5RfkcCaMef3TJaCiyIV5798Ym9gfMLfxcjFISSwiVHi 0dyTTBDOaUaJe8t7WLoYOTnYBDQl7nz+xARiiwhIS1z7fJkRpIhZ4BWjRMv0JWBFwgIJEs1NK 8FsFgFVicP3ljKC2LwCLhJvFk9iA7ElBOQkTh6bzApicwq4Shy9dQYsLgRU8/bPC+YJjNwLGB lWMaoXpxaVpRbpGuklFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgT6lwEIdjAu++t 0iFGSg0lJlNenzjVciC8pP6UyI7E4I76oNCe1+BCjDAeHkgSvTR9QTrAoNT21Ii0zBxhoMGkJ Dh4lEV5hkDRvcUFibnFmOkTqFKOilDivJUhCACSRUZoH1wYL7kuMslLCvIxAhwjxFKQW5WaWo Mq/YhTnYFQS5jUGmcKTmVcCNx0YgEA3i/D6f3EGWVySiJCSamBU2Smyxfn//Secr850Hu3nrV i/uft+7S2LN7dfpf2asHOTrciOZK6T2g80Z0xY82EWxxeFefNKX591uvVG4sQH0QnxnGxBjsf uNRvUnvfPa3569OD3qOoZTy+l8XTXzGR+NiGzX/XIqxOPjpzTXnshddP1FS6Tqkwrt8Q5fTF/ t9i8r/XpyvX/2ZVYijMSDbWYi4oTAcSpukNpAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1464176490!15796810!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48015 invoked from network); 25 May 2016 11:41:30 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-21.messagelabs.com with SMTP; 25 May 2016 11:41:30 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B680E435; Wed, 25 May 2016 04:41:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 68F053F218; Wed, 25 May 2016 04:41:28 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 25 May 2016 12:41:18 +0100 Message-Id: <1464176479-14669-2-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464176479-14669-1-git-send-email-julien.grall@arm.com> References: <1464176479-14669-1-git-send-email-julien.grall@arm.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, andrew.cooper3@citrix.com, Ian.Jackson@eu.citrix.com, george.dunlap@citrix.com, tim@xen.org, Julien Grall , shannon.zhao@linaro.org Subject: [Xen-devel] [for-4.7 1/2] xen: XENMEM_add_physmap_batch: Mark 'foreign_id' as reserved for dev_mmio X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The field 'foreign_id' is not used when the space is dev_mmio. As the space is not yet part of the stable ABI, the field is marked as reserved for future use. The value should always be 0, other values will return -ENOSYS. Note that the code would need some rework (such as renaming the field 'foreign_id' to a generic name), however the release of Xen 4.7 is really close. The rework will be done for the next release. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 4 ++++ xen/common/memory.c | 6 ++++-- xen/include/public/memory.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b46e23e..83edfa1 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1143,6 +1143,10 @@ int xenmem_add_to_physmap_one( break; } case XENMAPSPACE_dev_mmio: + /* The field 'foreign_domid' is reserved for future use */ + if ( foreign_domid ) + return -ENOSYS; + rc = map_dev_mmio_region(d, gpfn, 1, idx); return rc; diff --git a/xen/common/memory.c b/xen/common/memory.c index 644f81a..6bc52ac 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -639,9 +639,11 @@ static int xenmem_add_to_physmap(struct domain *d, { unsigned int done = 0; long rc = 0; + /* The field 'foreign_id' should be 0 when mapping MMIO. */ + domid_t inv = (xatp->space != XENMAPSPACE_dev_mmio) ? DOMID_INVALID : 0; if ( xatp->space != XENMAPSPACE_gmfn_range ) - return xenmem_add_to_physmap_one(d, xatp->space, DOMID_INVALID, + return xenmem_add_to_physmap_one(d, xatp->space, inv, xatp->idx, xatp->gpfn); if ( xatp->size < start ) @@ -658,7 +660,7 @@ static int xenmem_add_to_physmap(struct domain *d, while ( xatp->size > done ) { - rc = xenmem_add_to_physmap_one(d, xatp->space, DOMID_INVALID, + rc = xenmem_add_to_physmap_one(d, xatp->space, inv, xatp->idx, xatp->gpfn); if ( rc < 0 ) break; diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h index fe52ee1..b023046 100644 --- a/xen/include/public/memory.h +++ b/xen/include/public/memory.h @@ -259,7 +259,7 @@ struct xen_add_to_physmap_batch { /* Number of pages to go through */ uint16_t size; - domid_t foreign_domid; /* IFF gmfn_foreign */ + domid_t foreign_domid; /* IFF gmfn_foreign. Should be 0 for other spaces. */ /* Indexes into space being mapped. */ XEN_GUEST_HANDLE(xen_ulong_t) idxs;