From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43FCAC433F5 for ; Wed, 5 Sep 2018 19:35:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7BB720645 for ; Wed, 5 Sep 2018 19:35:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7BB720645 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbeIFAHX (ORCPT ); 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