Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp725612pxb; Tue, 2 Feb 2021 16:48:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVVFSh1rvlS0Did9LQ8iIj/UyAFohm7GdWnDDPpPj89rYTKa6rT5p7MvM6dZJsF490XAYq X-Received: by 2002:a50:c88d:: with SMTP id d13mr669406edh.206.1612313334777; Tue, 02 Feb 2021 16:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313334; cv=none; d=google.com; s=arc-20160816; b=jbhxwltlMM3xzwcnwZQlVCUDfTULWsOc1yBVWNv5G2jcK2laaGki++eE0C/ELNoANN fr4eolRbsROb9wJnnRBmTauImurQCPNHZNR2w67WdDjKCU9CIJ32VDLwOl1d9QrKaHb3 4+TN4oq/4MHgTYhLm/nhrwiiNHZgIof13TAG9HvQXVKJQ9WTJlax5M1ErwfHd+5CtHEg 2fRERF8Bg/9ZBIFghyacp4qE5HC8JVO+zLodbR2G7RWNV5991AsDXzLzB7ymHCOpF0gb hfZtfYccaV+Ov2K2urAgdeTGPuMxlEayEpEL3/8Q2dbMhVh/ISx5ZJtbaG95dt1VqOFf 3thw== 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=V7GUJtPctDlvPt5vTQDT0o1GdXCU9edl4u4R1xgAsXE=; b=PH8TuApNgJV7iNGtMhnZlrpqbUioK/3sepEGv5PPWqizGOk0FbkgOGz4AyPWKWvIBg 23GX+j/fNB70UM3ZIlI6gs9z8v4/8VsVj4lKOD6RVpjGfp14uYb3Vj8qb21/weTZ76tM 101oI4lKPwBqq1BptdRHYQcd9NJcggwpsBhZtGAEjiwWt7YBt5W40zU51ShRbtDUpQ3d 9mKIivBEt5FKPvCSA5NmZnDPFSNY6P7DZ2ElZIJuzRqsu1xe8/BVu/ukSWE7i1OhPjvV esN/x679VybB7O9+zNLl0jSqW8dsGAjT72FkR2UL//xsPjh1+faODxuoou4Uhe9Q8SP3 at0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X5js5vSP; 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=pass (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 jx12si302511ejb.247.2021.02.02.16.48.30; Tue, 02 Feb 2021 16:48:54 -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=@linuxfoundation.org header.s=korg header.b=X5js5vSP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239926AbhBBThm (ORCPT + 99 others); Tue, 2 Feb 2021 14:37:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:45152 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbhBBN4K (ORCPT ); Tue, 2 Feb 2021 08:56:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 99B8964F65; Tue, 2 Feb 2021 13:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273499; bh=YxGFlF6SpAQUAlzuQPlGWdwibyY6rby2gQVkguphQJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X5js5vSP+gMV1/NSazVCFVCgLkbk3ZWQd3GWSsLihZvs/6IvV21KZ5/XG++NwRG8j NkYaVL5/oIWa+ndGrEif4+7dr7ATCUd5w/TRrRoXc1cy7BhfD0VZeUf1XOUVCV8yp1 5/2fFoHLN5af2Xym4y1xBVp7xrGe4EHktUVYmH/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lu Baolu , Liu Yi L , Joerg Roedel , Sasha Levin , Guo Kaijie Subject: [PATCH 5.10 129/142] iommu/vt-d: Correctly check addr alignment in qi_flush_dev_iotlb_pasid() Date: Tue, 2 Feb 2021 14:38:12 +0100 Message-Id: <20210202133003.020070161@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Lu Baolu [ Upstream commit 494b3688bb11a21af12e92a344a1313486693d47 ] An incorrect address mask is being used in the qi_flush_dev_iotlb_pasid() to check the address alignment. This leads to a lot of spurious kernel warnings: [ 485.837093] DMAR: Invalidate non-aligned address 7f76f47f9000, order 0 [ 485.837098] DMAR: Invalidate non-aligned address 7f76f47f9000, order 0 [ 492.494145] qi_flush_dev_iotlb_pasid: 5734 callbacks suppressed [ 492.494147] DMAR: Invalidate non-aligned address 7f7728800000, order 11 [ 492.508965] DMAR: Invalidate non-aligned address 7f7728800000, order 11 Fix it by checking the alignment in right way. Fixes: 288d08e780088 ("iommu/vt-d: Handle non-page aligned address") Reported-and-tested-by: Guo Kaijie Signed-off-by: Lu Baolu Cc: Liu Yi L Link: https://lore.kernel.org/r/20210119043500.1539596-1-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 004feaed3c72c..02e7c10a4224b 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -1496,7 +1496,7 @@ void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid, * Max Invs Pending (MIP) is set to 0 for now until we have DIT in * ECAP. */ - if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0)) + if (!IS_ALIGNED(addr, VTD_PAGE_SIZE << size_order)) pr_warn_ratelimited("Invalidate non-aligned address %llx, order %d\n", addr, size_order); -- 2.27.0