Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3304032ybc; Mon, 18 Nov 2019 12:57:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxzk8nVvZByPqI4Og6+k9SLLlfmcrEfjuf/FPptVtv6d/CTEImhSwpGanK7EfkVBQX/tY56 X-Received: by 2002:a17:906:4bcb:: with SMTP id x11mr29875797ejv.100.1574110661253; Mon, 18 Nov 2019 12:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574110661; cv=none; d=google.com; s=arc-20160816; b=i2ZHYrOnl/S6kxt0OKcTVdk5G/Jj362iYdg6Wrw3Bxuw6iubStZoNOO8MXDmj2/b/+ K1NLoJFQkLRoGFyqT7GXtL78u/TVgiDa+1GLBiUV7jWOS8vY3Jf9PPFWlkBXMzG52Bj1 MWOKIhFO7oEqNoioeakx7iOq1hoW7WqRLzpql64gXvKWJmKK6OvnZyEsPTYoUg8t7W6N b1pgIRLiC/yoTJqYIGbA5smuxonjPbsVUoH2qWqzA0e9tXjYT1SL2blmD3XZNP0WeKOc u7Fpq0DNfLXFalvt9ev8fYfKAIz6H+3L81/PVaifLqzoxYv+BoJySg6My852gLf+OEuL 0Gvw== 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:cc:to:subject:dkim-signature; bh=I0VTPYLDkVIgquZihOZDiuVZWPSC4PnJRIoop9yQxqM=; b=dAig6ObqrSpHfovDcG1GtJZQ2f5tsyGVM+zJMDB3NYEtyXXxzfkiIROddqyyOcL+w3 a5POdOav4RNLcxV/1LE5NSVwqb05LfUyXdjPmbC2nl59e8DWY/iRLuvPVeGOx1m2aAD4 pE6wHQxlUtjS7fmjc5tm07luUHYls27L7hobbV5kn9iT6olJ2jn40RB1P8S1Scuq7yjt YHQ7NmTZ2h8z0J17038D/+cFd5czpwgsJoLF/5NbR9HZ4keXGHv3iy0qSd+wHM8QZ95U GUTWtpZM9mxfvGdohMlbJGkkJJH/W2O87CH14L7Erh2HZWUJ5oNM/RMQI2kkq1yxNWfp V6yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HKNy6Etl; 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=pass (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 q30si15003745edb.372.2019.11.18.12.57.17; Mon, 18 Nov 2019 12:57:41 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HKNy6Etl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727016AbfKRUzl (ORCPT + 99 others); Mon, 18 Nov 2019 15:55:41 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39385 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726475AbfKRUzk (ORCPT ); Mon, 18 Nov 2019 15:55:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574110539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I0VTPYLDkVIgquZihOZDiuVZWPSC4PnJRIoop9yQxqM=; b=HKNy6Etl9LhFMCFCLo2Zzj34OiRaai5JhowjNppDTepW2r/PdGTkxw67DM+GP/8i7W+jxP +Tsih2zo+jqT0E84FBtnhgsNxf9biwQF2Vjomp9/0v1HBebVOdo7btRDSH7Txx4spJoo8b NLt+wsZJUp70DSeLxnpZsnBb5d85sDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-198-p4DIraRiNg6RfOQTH1u2MQ-1; Mon, 18 Nov 2019 15:55:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4FBA801E5B; Mon, 18 Nov 2019 20:55:34 +0000 (UTC) Received: from [10.36.116.37] (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6BD4260E3E; Mon, 18 Nov 2019 20:55:32 +0000 (UTC) Subject: Re: [PATCH v2 03/10] iommu/vt-d: Reject SVM bind for failed capability check To: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Joerg Roedel , Lu Baolu , David Woodhouse Cc: "Tian, Kevin" , Raj Ashok , Yi Liu References: <1574106153-45867-1-git-send-email-jacob.jun.pan@linux.intel.com> <1574106153-45867-4-git-send-email-jacob.jun.pan@linux.intel.com> From: Auger Eric Message-ID: <5ecbea4b-4418-32e4-9b3d-49447e4bf420@redhat.com> Date: Mon, 18 Nov 2019 21:55:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1574106153-45867-4-git-send-email-jacob.jun.pan@linux.intel.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: p4DIraRiNg6RfOQTH1u2MQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 11/18/19 8:42 PM, Jacob Pan wrote: > Add a check during SVM bind to ensure CPU and IOMMU hardware capabilities > are met. >=20 > Signed-off-by: Jacob Pan > Acked-by: Lu Baolu > --- > drivers/iommu/intel-svm.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c > index 716c543488f6..74df10a39dfc 100644 > --- a/drivers/iommu/intel-svm.c > +++ b/drivers/iommu/intel-svm.c > @@ -238,6 +238,9 @@ int intel_svm_bind_mm(struct device *dev, int *pasid,= int flags, struct svm_dev_ > =09if (!iommu || dmar_disabled) > =09=09return -EINVAL; > =20 > +=09if (!intel_svm_capable(iommu)) > +=09=09return -ENOTSUPP; > + > =09if (dev_is_pci(dev)) { > =09=09pasid_max =3D pci_max_pasids(to_pci_dev(dev)); > =09=09if (pasid_max < 0) >=20 Reviewed-by: Eric Auger Thanks Eric