Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3859798pxb; Tue, 17 Nov 2020 05:35:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJycZR4NwtXEaqrLbbqd3ffSVtVWpEUxB7oNiU2vtQl3usyIZn4M1bPrQ0eNWdLrMcJC26Cv X-Received: by 2002:a17:906:2708:: with SMTP id z8mr19793985ejc.428.1605620149597; Tue, 17 Nov 2020 05:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620149; cv=none; d=google.com; s=arc-20160816; b=vYwXMz/vxUWNcBoJHm26HW7asZ/Hrpb9eSIC3NS+3NPQKJJwlukaXsh80pMzPbv9MX 5GVLJEoQtYADgKp1K622Jaasm5YGRkU4N4zg29/S7GymYVVkkJMtjl/IcIZjGjON9fbp mTVzJMdvMC//6bBzESgWXdNgF08p9NcOEFfkpl3DXNbFysJhxJ/NBTMxNXMlcqzU2aSS ZXrmWFDpa5YjgzBs7f20P63c3yUWw7WkOj/A5ZRjBrCUOmxhPasQdACauFWQk92LF+yn WlasdPJ32IpzfGGAy0gwY4kF71xYhHQf2kw9EavmuerX9QMA167kDGtmFbxcE7NTMqmw 6ifQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oaPf79BpnTY/0ytH3f6KUH/nm8MlVkKYPmmgg2ahvqc=; b=oZ/OO0NYg3/6uTsxlDD5Kp2gr8vCYJmm9XyC4CPXpQ48JePv6KpjykFQ6wIHpccdC5 NQoY/y7fY91s4DjUoLSLftRgTCLJAWAxw7+CAkKRdaGkwFCoos9xgmnScoD9K0n/JU9S qCfEAbs8BEYa7Rwvno0wcVd70GnYrlmKCLEm7xKrQ0dzmJpmehhod4ioff37AqlayZRZ xvykzwe7PJVKDPgRoP85F3ooPilPiW69LeTTRuZ51S+jeILNwdkRNgUmnzDjSleQZ0h8 3AhkhhvaFCiIrI/YdxlCbvghNXGXY66EY7VL05fVxftNDMtNBIOYr7i4zi8zJaVbTIoH XtKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pnXhcnJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv12si13084308ejb.613.2020.11.17.05.35.26; Tue, 17 Nov 2020 05:35:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pnXhcnJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731711AbgKQNcz (ORCPT + 99 others); Tue, 17 Nov 2020 08:32:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:41054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732050AbgKQNbe (ORCPT ); Tue, 17 Nov 2020 08:31:34 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F3252078E; Tue, 17 Nov 2020 13:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619894; bh=0kalvLJ1E8/bfqGdTkFmYlRCb6jsNrUuzy5oOrOawig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pnXhcnJ+99gFCOzfvmWez/IaKb6djomy/tGP9NSCOeIqYKSCWzKOhiasupT5GIPfJ 6bYpa7BaHH17OaIKQ2uiNbZd+a5REA9Sn8XtmXTUFX3W5zEHUGIS/IKQhKvwUfs23M jRLsFi/u84NZ/h57khm5aj194Cv1YNgNrmKuyUyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Yi L , Yi Sun , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 5.9 040/255] iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid() Date: Tue, 17 Nov 2020 14:03:00 +0100 Message-Id: <20201117122140.898809357@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liu Yi L [ Upstream commit eea4e29ab8bef254b228d6e1e3de188087b2c7d0 ] Should get correct sid and set it into sdev. Because we execute 'sdev->sid != req->rid' in the loop of prq_event_thread(). Fixes: eb8d93ea3c1d ("iommu/vt-d: Report page request faults for guest SVA") Signed-off-by: Liu Yi L Signed-off-by: Yi Sun Acked-by: Lu Baolu Link: https://lore.kernel.org/r/1604025444-6954-2-git-send-email-yi.y.sun@linux.intel.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/intel/svm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index 95c3164a2302f..a71fbbddaa66e 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -278,6 +278,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL); struct intel_svm_dev *sdev = NULL; struct dmar_domain *dmar_domain; + struct device_domain_info *info; struct intel_svm *svm = NULL; int ret = 0; @@ -302,6 +303,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, if (data->hpasid <= 0 || data->hpasid >= PASID_MAX) return -EINVAL; + info = get_domain_info(dev); + if (!info) + return -EINVAL; + dmar_domain = to_dmar_domain(domain); mutex_lock(&pasid_mutex); @@ -349,6 +354,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, goto out; } sdev->dev = dev; + sdev->sid = PCI_DEVID(info->bus, info->devfn); /* Only count users if device has aux domains */ if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)) -- 2.27.0