Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp32925imm; Wed, 5 Sep 2018 17:57:55 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaZRKOuS6OdpmHX1NnHv9q6D4Iq9ZxUy+o6k+qk9DbetmWV8uAGV0FuEc89y6WvHasfm5+t X-Received: by 2002:a63:3dc6:: with SMTP id k189-v6mr300079pga.191.1536195475714; Wed, 05 Sep 2018 17:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536195475; cv=none; d=google.com; s=arc-20160816; b=VZJuYMR66sSFMrt9CcQQgPOAg5cbFhPur7LYmE/H4qCJSVRXN0xxDr4VDsqcGveM9Y VjFhJNFsdufs3M/UEzY4XRwkx0GrcHwKEstrq41gf2cRh9j/EM2q+MFBL1K5UY/Y9fi/ x/PIbvDzbBJGrQgpxb1N+SKmI1NETSn9AEWe+frWgbQAukG063W2meDgnPxD9icMlxOE IHCKpd+tJw2hhUNSdTKGh40tGX7KFTsfzR1Th75KTjjj1NAu8fy0U9Ohj5iD8zmkTmoT nRl3ShIhJHSCCipfj/IKJRkU2N+PDTEU4doWadRZF5/QtBTCVApzv/qEjPxsCaKUTY/G jiXQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=9oDYpJSn9q3h1pRQHmisoWBomvKprp42AWXMyEID+Qw=; b=pj3/wQzZhUayd8/uTc/eCt7JnokR90Shwz7c5H50afZ1k/Dsud72v+H/GrngacBsQ5 nCLwJa+qZIFERdfpMd1rssA7p0qpIfqNuvnCwwJ93qn1P5B2GIooyt26CDQQVzE3S+Qm IZvW4Q990P0vBApjIrbxEuixOUi/F3MFc5mWzEBH++V+pslQZ+xs7EGn9zl68sHqkR2P mX+ZowZ5pIZgDxY/Xh/lPsQS1W1llsTbQrP0uYikUupgc65WmXsl7EmAi+zUCr8VV8At q5YspgB/iNODIt8DwLKwg3X77TZ466Ak+L4j1lH5AUjSoE/WuIgahblE5oLCLUCVIKo5 FcWg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w31-v6si3418607pla.133.2018.09.05.17.57.31; Wed, 05 Sep 2018 17:57:55 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727623AbeIFF2H (ORCPT + 99 others); Thu, 6 Sep 2018 01:28:07 -0400 Received: from mga05.intel.com ([192.55.52.43]:11119 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725978AbeIFF2G (ORCPT ); Thu, 6 Sep 2018 01:28:06 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 17:55:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="68722543" Received: from allen-box.sh.intel.com (HELO [10.239.161.122]) ([10.239.161.122]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2018 17:55:05 -0700 Cc: baolu.lu@linux.intel.com, 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 To: Alex Williamson References: <20180830040922.30426-1-baolu.lu@linux.intel.com> <20180830040922.30426-3-baolu.lu@linux.intel.com> <20180905133540.5d7a7ea3@t450s.home> From: Lu Baolu Message-ID: Date: Thu, 6 Sep 2018 08:54:02 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180905133540.5d7a7ea3@t450s.home> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 09/06/2018 03:35 AM, Alex Williamson wrote: > 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, Fair enough. I will remove it in the next version. Best regards, Lu Baolu