Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2962626ybv; Mon, 24 Feb 2020 15:21:35 -0800 (PST) X-Google-Smtp-Source: APXvYqw1CixdR6UM6C17TTR/4sMROpCKBwqGvMRRaGvf0CBivlaeHlBRvHKvVNmnfjpPqWAJVmTv X-Received: by 2002:a05:6830:154a:: with SMTP id l10mr42692589otp.44.1582586495256; Mon, 24 Feb 2020 15:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582586495; cv=none; d=google.com; s=arc-20160816; b=mi3kO2mcFmcOBy5huNZ3SndIX0E9BRXh/SqD4vzCTlRAKoRu1MnPbmXjmUDu5pDLZ+ 4SiSapuL3MHg+dOF0MlZzEc66ouaa+r2HO2+5LmVZDjwaTZGJEGKnuFueK+mMtorViN+ 50iPwLviU+G6H6XKBr9gtR8RdEQ+i5G1fXtEx9Ysbt3NxbVmWNVI8EtgWtbFAVSxU2aI YF9L5ifN/DWaoQrqdPK3cEqmAc2p1LUBGT6bD6cu+FcVQj3y86yVHCJ22+4g8xROLu6y RhZd8q0JyBFN622GgZSGCy0HQgTJMjNx5qDut2vMqreG5aFN7j7A2fp3o7hDfaZqQkeP xfTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=3kAOOeAJwi+tJPa97h3Cgs7XZIP9LF+bzWw+yLrA8Vw=; b=mjOAv5NIye2ltJJiZsxtOc9awdLVFiTg0+6o8sFMmiOHY46D7YxoKipK1L0EmdXQ5F q7GDviCNnDG8AdGMKIz8Ry0edSAZPwXkB+eSg2u+l37jK6PrT6hvWcHGm4vXxjpX73UA Xuln17Ze+AuyY0G+h6w2lVmhEdov8nZCpQTwUdfvvbgYmhEHqqDxfVafx5iSQN77XxLB EMejZQ6hWqZBImSP9MYQjlqicI1cHCysoRTkqxYZ6ZwoOAtqv5fjbDh6nY3k89Fq6QW+ QozSY2780guG0jVDisdcD6Xg/Xvpxsj890zzYAvmMuKF8han8+wLorXrFrrjDIjoWBog MFww== 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 y71si5421710oia.82.2020.02.24.15.21.23; Mon, 24 Feb 2020 15:21:35 -0800 (PST) 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 S1728377AbgBXXVN (ORCPT + 99 others); Mon, 24 Feb 2020 18:21:13 -0500 Received: from mga11.intel.com ([192.55.52.93]:48177 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728298AbgBXXVM (ORCPT ); Mon, 24 Feb 2020 18:21:12 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2020 15:21:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,481,1574150400"; d="scan'208";a="255749668" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga002.jf.intel.com with ESMTP; 24 Feb 2020 15:21:12 -0800 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , "Lu Baolu" , Joerg Roedel , David Woodhouse Cc: "Yi Liu" , "Tian, Kevin" , Raj Ashok , Jean-Philippe Brucker , Eric Auger , Dave Jiang , Jacob Pan Subject: [PATCH 1/2] iommu/vt-d: Report SVA feature with generic flag Date: Mon, 24 Feb 2020 15:26:36 -0800 Message-Id: <1582586797-61697-3-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582586797-61697-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1582586797-61697-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Query Shared Virtual Address/Memory capability is a generic feature. SVA feature check is the required first step before calling iommu_sva_bind_device(). VT-d checks SVA feature enabling at per IOMMU level during this step, SVA bind device will check and enable PCI ATS, PRS, and PASID capabilities at device level. This patch reports Intel SVM as SVA feature such that generic code (e.g. Uacce [1]) can use it. [1] https://lkml.org/lkml/2020/1/15/604 Signed-off-by: Jacob Pan --- drivers/iommu/intel-iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 92c2f2e4197b..5eca6e10d2a4 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -6346,9 +6346,14 @@ intel_iommu_dev_has_feat(struct device *dev, enum iommu_dev_features feat) static int intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat) { + struct intel_iommu *intel_iommu = dev_to_intel_iommu(dev); + if (feat == IOMMU_DEV_FEAT_AUX) return intel_iommu_enable_auxd(dev); + if (feat == IOMMU_DEV_FEAT_SVA) + return intel_iommu->flags & VTD_FLAG_SVM_CAPABLE; + return -ENODEV; } -- 2.7.4