From patchwork Tue Mar 11 15:49:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 26037 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 467D520068 for ; Tue, 11 Mar 2014 15:52:00 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id il7sf13154087vcb.9 for ; Tue, 11 Mar 2014 08:52:00 -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: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=VJnyNBFy5KZgA2B2U86i1v3MQcwL/sda7v/0jMy0kkWPC2OvvYCO4tVtLCpSnWI5jP /ZrEUYe7PMQEiY8mkJ9/MshxpaQuO9PguQ+M4DPdFD2aVYTwpXgLwL6OMVCfy4iatMr7 xVXOa+5Sz1x8sQ1pEs48+NLgtewqobUasq7nBC1A28p4AB4yTzmJ/rcaqV8XGkG4swoq UGL48ZWFtthGLSBeLTfqTezu24XD6I8hiN447KzlJjTk59Bz9Fq3fq6wGlcG0wybpdvx VAxW/jTBpfRTJIUvgSiiYGFqpfq3IMtD+GikrfmVMeGrPBaruuxJKXY/nOGs0GJIo28t oxjw== X-Gm-Message-State: ALoCoQmaSeDnFxrv8VT43Mh/CxpcZzOBvKq7Q6sq0HN/y8SVSm/4b0PYA/t8UXh5N1bSmnNIiWE7 X-Received: by 10.236.121.4 with SMTP id q4mr15193193yhh.34.1394553120007; Tue, 11 Mar 2014 08:52:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.71 with SMTP id d65ls2713334qgf.60.gmail; Tue, 11 Mar 2014 08:51:59 -0700 (PDT) X-Received: by 10.58.57.42 with SMTP id f10mr16516136veq.1.1394553119875; Tue, 11 Mar 2014 08:51:59 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id fi2si6555446vdb.36.2014.03.11.08.51.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:51:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id lg15so2361653vcb.2 for ; Tue, 11 Mar 2014 08:51:59 -0700 (PDT) X-Received: by 10.220.81.71 with SMTP id w7mr40032vck.71.1394553119796; Tue, 11 Mar 2014 08:51:59 -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.220.78.9 with SMTP id i9csp215072vck; Tue, 11 Mar 2014 08:51:59 -0700 (PDT) X-Received: by 10.42.180.197 with SMTP id bv5mr11272459icb.47.1394553119031; Tue, 11 Mar 2014 08:51:59 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p2si42198199igg.15.2014.03.11.08.51.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:51:59 -0700 (PDT) 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 1WNOwW-0006la-5q; Tue, 11 Mar 2014 15:50:12 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WNOwU-0006kf-Rp for xen-devel@lists.xenproject.org; Tue, 11 Mar 2014 15:50:11 +0000 Received: from [85.158.143.35:20504] by server-2.bemta-4.messagelabs.com id BB/4C-06539-2B03F135; Tue, 11 Mar 2014 15:50:10 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1394553008!1274770!1 X-Originating-IP: [209.85.212.178] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21041 invoked from network); 11 Mar 2014 15:50:08 -0000 Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by server-8.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 11 Mar 2014 15:50:08 -0000 Received: by mail-wi0-f178.google.com with SMTP id n15so1098836wiw.5 for ; Tue, 11 Mar 2014 08:50:08 -0700 (PDT) X-Received: by 10.181.13.40 with SMTP id ev8mr3701285wid.0.1394553008527; Tue, 11 Mar 2014 08:50:08 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id bm8sm62454537wjc.12.2014.03.11.08.50.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Mar 2014 08:50:07 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 11 Mar 2014 15:49:47 +0000 Message-Id: <1394552999-14171-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1394552999-14171-1-git-send-email-julien.grall@linaro.org> References: <1394552999-14171-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 v3 01/13] 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.171 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);