Received: by 2002:ac0:adb2:0:0:0:0:0 with SMTP id o47-v6csp10046imb; Wed, 5 Sep 2018 12:38:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaxOE89t8cUuyOWy7C7bxIJIw1FDvjeaeY6+wySwkcpglD5S4elfBszNGZmR8pGdAxsN1FX X-Received: by 2002:a63:1921:: with SMTP id z33-v6mr30456943pgl.302.1536176286072; Wed, 05 Sep 2018 12:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176286; cv=none; d=google.com; s=arc-20160816; b=fGOIB+P0m1157p7GaSPb6grhF7jVWQm8Hrc8ghQZVRNr7CtV6wD/8F4/df5WfwQdFi tMhVxRDoYSWLfsPt4zNLgZvucrMCqX7z5Lpnx8Gc0e+a805QTuoKzj4g+XLKVwwJ/E6H p83WLkF5IFHwOfl3qz+B4Xi8lKYWiEqX0MnbhsWHkfVVFUOyrjyB02GNZWBzuDfrO3xS f2up8xIm1tIkwBblO9cZ2ldXdTwCy3D2cX+aQyK1MafbIJaTwsKsfmu4+cN7pOitBZUo 5YHr33TIHZ4ZS9BNE2unjWFMbIQnUbHPal/eL/uhEz+Hxi9heZUlEA22DuQ7HlGHmjJi TczA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=tnXZ7weIwbCbDzSkcLbzCTwhUOCOB6DUHKYZwo25WEI=; b=lb6BbEbVxabqAiUg7C4XYoWbDQ4Uz4Mx8UOdmCkHmkjeX165HtMaHy+Wqrok5Gzw7A dbtF7ryxckFqfoLyoIgEtPrXhQ9R1uJtSCIJZCXPWnsqP686Kqmcv5MnuR89lR22xUTD B1kI0SDXtHFZ0zh6hUbgpMirynlxykAwz8IahOo1a3YW/iUxFWoWpnBFAKZT4G+lZV34 hW3lR6DJCwYQNMFOzk4iCoBkyppsb7kZh7iPoKGH077Dn+HgrmHZuVsm8r1ARk6a2RB9 x0zalTDmXeAxmJEa71oQY2VBNSyeeJuC7IQt7GCCb+HsWymg34SZMrxzRb0/h48VdK9D hXOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w8-v6si2809052plk.222.2018.09.05.12.37.43; Wed, 05 Sep 2018 12:38:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727848AbeIFAHX (ORCPT + 99 others); Wed, 5 Sep 2018 20:07:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57408 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727254AbeIFAHW (ORCPT ); Wed, 5 Sep 2018 20:07:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C30F5D668; Wed, 5 Sep 2018 19:35:45 +0000 (UTC) Received: from t450s.home (ovpn-116-77.phx2.redhat.com [10.3.116.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BF1617009; Wed, 5 Sep 2018 19:35:41 +0000 (UTC) Date: Wed, 5 Sep 2018 13:35:40 -0600 From: Alex Williamson To: Lu Baolu Cc: Joerg Roedel , David Woodhouse , Kirti Wankhede , ashok.raj@intel.com, sanjay.k.kumar@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, Jean-Philippe Brucker , yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com, tiwei.bie@intel.com, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jacob Pan Subject: Re: [RFC PATCH v2 02/10] iommu/vt-d: Add multiple domains per device query Message-ID: <20180905133540.5d7a7ea3@t450s.home> In-Reply-To: <20180830040922.30426-3-baolu.lu@linux.intel.com> References: <20180830040922.30426-1-baolu.lu@linux.intel.com> <20180830040922.30426-3-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Sep 2018 19:35:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Aug 2018 12:09:14 +0800 Lu Baolu wrote: > Add the response to IOMMU_CAP_AUX_DOMAIN capability query > through iommu_capable(). Return true if IOMMUs support the > scalable mode, return false otherwise. > > Cc: Ashok Raj > Cc: Jacob Pan > Cc: Kevin Tian > Cc: Liu Yi L > Signed-off-by: Lu Baolu > --- > drivers/iommu/intel-iommu.c | 31 +++++++++++++++++++++++++++++-- > 1 file changed, 29 insertions(+), 2 deletions(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 3e49d4029058..891ae70e7bf2 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -5193,12 +5193,39 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, > return phys; > } > > +static inline bool scalable_mode_support(void) > +{ > + struct dmar_drhd_unit *drhd; > + struct intel_iommu *iommu; > + bool ret = true; > + > + rcu_read_lock(); > + for_each_active_iommu(iommu, drhd) { > + if (!sm_supported(iommu)) { > + ret = false; > + break; > + } > + } > + rcu_read_unlock(); > + > + return ret; > +} > + > static bool intel_iommu_capable(enum iommu_cap cap) > { > - if (cap == IOMMU_CAP_CACHE_COHERENCY) > + switch (cap) { > + case IOMMU_CAP_CACHE_COHERENCY: > return domain_update_iommu_snooping(NULL) == 1; > - if (cap == IOMMU_CAP_INTR_REMAP) > + case IOMMU_CAP_INTR_REMAP: > return irq_remapping_enabled == 1; > + case IOMMU_CAP_AUX_DOMAIN: > + return scalable_mode_support(); > + case IOMMU_CAP_NOEXEC: > + /* PASSTHROUGH */ > + default: > + pr_info("Unsupported capability query %d\n", cap); > + break; Please don't do this, there's no reason to be noisy about a query of a capability that VT-d doesn't know about. We implement capabilities exactly so that relevant drivers can expose a feature and others can happily (and quietly) ignore them. Thanks, Alex