From patchwork Sun Feb 23 22:16:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 25157 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0F06120143 for ; Sun, 23 Feb 2014 22:18:46 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 142sf20401773ykq.0 for ; Sun, 23 Feb 2014 14:18:45 -0800 (PST) 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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=cKc7ucDlo9x5PBhbIuLYZq6LJaZVlgZCAZVY0BZWy9o=; b=hUChhUDIWRcFitIklcDu4VnjoW7f7nYIMT1ulqzuNNNCwJ/ndW8cyVcGQVipPCm4hm wxzB1hBvHhe90qmblZ3hcRs9SKgihaldp8lwgrmRgilIszaKoBemK4X+bM9JKU/s5siM rtT08SkRusC4pE7pfp2YyXOQUvVoCTM+svvwlyLn8OGvbHG1Y0R6Z+1CtN3qM3RxWKR/ XjWGs8SNqfV/Q/9K9L3gmmTkbfTCcFwg9C81DjZDw/yN47E8x/Xu7SI68U114DQ95+D/ PVwiGDmG42+wNGsUlmOWdlR/r+HSVxRTGgzAAWaBVwDzF5rKf1fVf2y0GeF3lle4Zse9 fl7Q== X-Gm-Message-State: ALoCoQl3KTiFhr9U/o+mN4wYej5drEXkSXdygHM6Kv/Esvw8xDNlpAC+h+BSn4BsVx1ctIXrnapT X-Received: by 10.236.126.170 with SMTP id b30mr8174552yhi.49.1393193925809; Sun, 23 Feb 2014 14:18:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.113 with SMTP id p104ls1767365qga.41.gmail; Sun, 23 Feb 2014 14:18:45 -0800 (PST) X-Received: by 10.220.67.18 with SMTP id p18mr10735753vci.14.1393193925708; Sun, 23 Feb 2014 14:18:45 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id cz20si5315726veb.15.2014.02.23.14.18.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Feb 2014 14:18:45 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id la4so4988968vcb.21 for ; Sun, 23 Feb 2014 14:18:45 -0800 (PST) X-Received: by 10.52.185.196 with SMTP id fe4mr8905018vdc.27.1393193925619; Sun, 23 Feb 2014 14:18:45 -0800 (PST) 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.220.174.196 with SMTP id u4csp20500vcz; Sun, 23 Feb 2014 14:18:45 -0800 (PST) X-Received: by 10.220.58.202 with SMTP id i10mr10678207vch.23.1393193925295; Sun, 23 Feb 2014 14:18:45 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id tt2si5282862vdc.139.2014.02.23.14.18.44 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 23 Feb 2014 14:18:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WHhLk-0006ob-Rt; Sun, 23 Feb 2014 22:16:40 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WHhLj-0006oK-Mz for xen-devel@lists.xenproject.org; Sun, 23 Feb 2014 22:16:39 +0000 Received: from [85.158.139.211:34533] by server-2.bemta-5.messagelabs.com id 14/C1-23037-6437A035; Sun, 23 Feb 2014 22:16:38 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1393193797!5730216!1 X-Originating-IP: [209.85.215.179] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5430 invoked from network); 23 Feb 2014 22:16:38 -0000 Received: from mail-ea0-f179.google.com (HELO mail-ea0-f179.google.com) (209.85.215.179) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 23 Feb 2014 22:16:38 -0000 Received: by mail-ea0-f179.google.com with SMTP id q10so2735045ead.38 for ; Sun, 23 Feb 2014 14:16:37 -0800 (PST) X-Received: by 10.15.76.135 with SMTP id n7mr5973863eey.36.1393193797762; Sun, 23 Feb 2014 14:16:37 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id g1sm55994749eet.6.2014.02.23.14.16.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Feb 2014 14:16:37 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Sun, 23 Feb 2014 22:16:18 +0000 Message-Id: <1393193792-20008-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1393193792-20008-1-git-send-email-julien.grall@linaro.org> References: <1393193792-20008-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Keir Fraser , Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v2 01/15] xen/common: grant-table: only call IOMMU if paging mode translate is disabled X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.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.220.176 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: >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 Reviewed-by: Jan Beulich Acked-by: Ian Campbell Cc: Keir Fraser --- 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);