From patchwork Tue Apr 22 13:14:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 28799 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7AC49203AC for ; Tue, 22 Apr 2014 13:16:05 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf34386773obb.10 for ; Tue, 22 Apr 2014 06:16:04 -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=cVxcB9Wyl/tgcOrDUBd9Z7WhBBcKpdSFPb3YVQIfrjQVWmFYHnJNPZgdptRGNYNmUB 0pfDKrc0IFHVhTuEftGlpMT2hdUNsEqpMlZy3LfVKdf4VlbLvdKM+kkTR0tcC9R4fJty pzzfq/wYAcMUYUI8G5vgocOYDAjaNyHs+W3WvYnEuGk45z8mRRFUeKd0AWh6C1JeVOH6 CdjXJM7CSAninR7cC1a7I91RlZE0l+IUq3huZTKyyRg8dj1tpbNQK9dncxBWtAztsp7T 4TZTkx1jKDMU4z++nnwDXAbr9S8qB4SUkF5JJy8OcPRNlGowsiS38eLPyTkpVEVhkzlQ kiWg== X-Gm-Message-State: ALoCoQlqlBtkREZps3Evxxudi9YGDr6KEjBxiFch5CkI89PZx2LRWSS0Kys9ovelIzCsxf8vxten X-Received: by 10.43.88.73 with SMTP id az9mr18000699icc.5.1398172564826; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.229 with SMTP id t92ls91738qgd.9.gmail; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) X-Received: by 10.58.122.164 with SMTP id lt4mr40018534veb.2.1398172564723; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id s7si6900304vev.2.2014.04.22.06.16.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so9824338veb.30 for ; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) X-Received: by 10.58.39.129 with SMTP id p1mr27850vek.69.1398172564624; Tue, 22 Apr 2014 06:16:04 -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.221.72 with SMTP id ib8csp23829vcb; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) X-Received: by 10.224.79.194 with SMTP id q2mr26681611qak.57.1398172564144; Tue, 22 Apr 2014 06:16:04 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id s101si5203232qge.46.2014.04.22.06.16.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:04 -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 1WcaXE-0005rA-Hs; Tue, 22 Apr 2014 13:14:52 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXC-0005pl-Kj for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 13:14:50 +0000 Received: from [85.158.139.211:21988] by server-13.bemta-5.messagelabs.com id F2/21-16341-94B66535; Tue, 22 Apr 2014 13:14:49 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1398172489!5817191!1 X-Originating-IP: [74.125.83.46] 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 1921 invoked from network); 22 Apr 2014 13:14:49 -0000 Received: from mail-ee0-f46.google.com (HELO mail-ee0-f46.google.com) (74.125.83.46) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2014 13:14:49 -0000 Received: by mail-ee0-f46.google.com with SMTP id t10so4548938eei.5 for ; Tue, 22 Apr 2014 06:14:49 -0700 (PDT) X-Received: by 10.14.7.137 with SMTP id 9mr2150239eep.114.1398172488960; Tue, 22 Apr 2014 06:14:48 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id 45sm112969867eeh.9.2014.04.22.06.14.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 06:14:48 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 Apr 2014 14:14:19 +0100 Message-Id: <1398172475-27873-6-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> References: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> Cc: Keir Fraser , ian.campbell@citrix.com, Julien Grall , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich Subject: [Xen-devel] [PATCH v4 05/21] 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.128.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);