From patchwork Fri Feb 7 17:43:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 24300 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C06AB2096A for ; Fri, 7 Feb 2014 17:43:26 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id jt11sf6239136pbb.10 for ; Fri, 07 Feb 2014 09:43:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=jqxoPLhffLdddCuXl7gJ26I+N3MoJPCQWDLv9+DRoO4=; b=alQWB8zOHCPvR2yr1gNBdB8QrUJ82/i7UNxw+uAQHiHcXhSTzM0QlL2oER0mItYdwu /2VcobffEOcHi0zEKwNMy8nBdctyRBzLl+IySygZzitI/6EvkvmcM6V0huYgR5V70Arb bl97UL2JSQg+7+qsegn1hIE2nssk7VJphZgULaRCp47YNxHOxG//WqmZv4DbBS44P9LK qnt9y6O4rJ5m7939Thx9h49EN9WmxUcNVa1XPvQOQCM017j6vOAuIS62mpzcsEKGVmGo D9XC2MrM/9Wd5CxJ3F4Fj3IRhT3JMIQJMZOGLPEyDiTgKTs890aU9ul8K9oCfnZE1dq1 3i8Q== X-Gm-Message-State: ALoCoQnsDPyYHgV2iqbLOK5rEY7A+KfBultyxx8LFrc93iEjApAfKzVLmSq9+Al/xfDTnvmBY7D6 X-Received: by 10.68.197.73 with SMTP id is9mr6350507pbc.0.1391795005919; Fri, 07 Feb 2014 09:43:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.137 with SMTP id l9ls1146501qgf.40.gmail; Fri, 07 Feb 2014 09:43:25 -0800 (PST) X-Received: by 10.58.123.70 with SMTP id ly6mr7125606veb.26.1391795005763; Fri, 07 Feb 2014 09:43:25 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id fb12si1544498veb.90.2014.02.07.09.43.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 09:43:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id oy12so3035807veb.37 for ; Fri, 07 Feb 2014 09:43:25 -0800 (PST) X-Received: by 10.58.90.202 with SMTP id by10mr11086305veb.6.1391795005697; Fri, 07 Feb 2014 09:43:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp123574vcz; Fri, 7 Feb 2014 09:43:24 -0800 (PST) X-Received: by 10.14.177.1 with SMTP id c1mr18229371eem.8.1391795004174; Fri, 07 Feb 2014 09:43:24 -0800 (PST) Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com [209.85.215.180]) by mx.google.com with ESMTPS id h44si9594232eew.80.2014.02.07.09.43.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Feb 2014 09:43:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.180 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.180; Received: by mail-ea0-f180.google.com with SMTP id o10so1726696eaj.11 for ; Fri, 07 Feb 2014 09:43:23 -0800 (PST) X-Received: by 10.14.203.197 with SMTP id f45mr4543131eeo.90.1391795003688; Fri, 07 Feb 2014 09:43:23 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id 8sm18849063eef.1.2014.02.07.09.43.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Feb 2014 09:43:23 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, Julien Grall , Keir Fraser Subject: [RFC for-4.5 01/12] xen/common: grant-table: only call IOMMU if paging mode translate is disabled Date: Fri, 7 Feb 2014 17:43:00 +0000 Message-Id: <1391794991-5919-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391794991-5919-1-git-send-email-julien.grall@linaro.org> References: <1391794991-5919-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , >From Xen point of view, ARM guests are PV guest with paging auto translate enabled. When IOMMU support will be added for ARM, mapping grant ref will always crash Xen due to the BUG_ON in __gnttab_map_grant_ref. On x86: - PV guests always have paging mode translate disabled - PVH and HVM guests have always paging mode translate enabled It means that we can safely replace the check that the domain is a PV guests by checking if the guest has paging mode translate enabled. Signed-off-by: Julien Grall Cc: Keir Fraser Acked-by: Ian Campbell --- xen/common/grant_table.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 107b000..778bdb7 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -721,12 +721,10 @@ __gnttab_map_grant_ref( double_gt_lock(lgt, rgt); - if ( is_pv_domain(ld) && need_iommu(ld) ) + if ( !paging_mode_translate(ld) && need_iommu(ld) ) { unsigned int wrc, rdc; int err = 0; - /* Shouldn't happen, because you can't use iommu in a HVM domain. */ - BUG_ON(paging_mode_translate(ld)); /* We're not translated, so we know that gmfns and mfns are the same things, so the IOMMU entry is always 1-to-1. */ mapcount(lgt, rd, frame, &wrc, &rdc); @@ -931,11 +929,10 @@ __gnttab_unmap_common( act->pin -= GNTPIN_hstw_inc; } - if ( is_pv_domain(ld) && need_iommu(ld) ) + if ( !paging_mode_translate(ld) && need_iommu(ld) ) { unsigned int wrc, rdc; int err = 0; - BUG_ON(paging_mode_translate(ld)); mapcount(lgt, rd, op->frame, &wrc, &rdc); if ( (wrc + rdc) == 0 ) err = iommu_unmap_page(ld, op->frame);