From patchwork Tue Feb 13 09:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 200346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp443999dyb; Tue, 13 Feb 2024 02:25:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5WJeJysF6anJxdPojVyTpYGTT7ynj6pIeyK0tuUSmTLJFa1HlMgW8f7eZTnwtukDGxY/SlQhCzhl1R7RuqpIDnuFS2Q== X-Google-Smtp-Source: AGHT+IEYQXTCKbE9eeb3uUHTdqJJBqJ0JkOiapo3nTOv7Yhp8cIL0+vS6nDPfS2AWKpWlxihjspK X-Received: by 2002:a17:903:428f:b0:1d9:803a:8b14 with SMTP id ju15-20020a170903428f00b001d9803a8b14mr9978693plb.59.1707819906107; Tue, 13 Feb 2024 02:25:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707819906; cv=pass; d=google.com; s=arc-20160816; b=qc2K4cSh35Ctr5RURhzB8T5RIijuGqEFL+3IjumFJ+8EtBLv+rLlQfUPVzhApY6d8/ u7oiJv0w5tP2pA3ebJ+8LLSG58Q2DN/1Nv2NsosAUJtsltAY5YYI/HOBCBFmVs6dXVLv SmZLeEVNcB+KuPO8utGllzyxLuRm/NVcVUb3pfLmPTRIa/KnL0fAvUcF+qq3fvsq3nlf RauTjS7Yzs0pnRykT2okrtlceKLr/fXN8sZJ1t+LEuXGiIpf2/sflPf2UA0XGFPsUpsm AgVqCeJuVbWp2Kxg6HI/LK3rCQ+5sEfUSzbEOETO2Q+t+U2LU/BzxzAeCz1XlHY8quhC AuhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=rPbTW6UH18y3LLQE1rpdamvhaW8hbKb0iIIf6FdLfuU=; fh=CULLMX/dTxz/sQ3fRpdtE7hB7eWyxgSWx0dPgdJ8fxY=; b=aTp2wbzXwkBl4M6klO8gA0MrQps7z7YGkApwsS3+IGpuEpK1HBl0TwGS/L6M3LhOU5 VfjrdCs5CSfOKcAm/P9d1rHatPRKpZMbJHsAzmGSgy/fD7ZzLxg3v7O/bTa0yvoF3FYo XT/BPxc4oM7KNNGJtPVNhYyphnqcd980XZfBIx4kjvsNAFgygYIl4I8CS+RQWNzVGqIA cY6OmocvnW5YcBuaxwBM5eLZq4XT2tABi5Z+ULSiC3Tmzj89HbrHfcIbbQ7l6l/h0hUv 3aTUaVQqExNC0u9AQLNuvTT1yxEkRqgkPDINY1nzgRmTHLIHCodmjpRWsy/QyIjuv/Yl dTcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=szljOOS0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63290-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVZlW9nO1KmYAEbQSir8xumrf0tV3rJF56JsJQCee7IImO2FcFfPton/50oVf98RjYJPAidXRisMox2fSyUbaS42pViyA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lk7-20020a17090308c700b001db2aedfceesi740027plb.225.2024.02.13.02.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:25:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=szljOOS0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63290-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 40D89B2945E for ; Tue, 13 Feb 2024 10:00:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B7B22BB1D; Tue, 13 Feb 2024 09:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="szljOOS0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A86D42BB01; Tue, 13 Feb 2024 09:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818319; cv=none; b=as3HTdFl/C5+Kku1WksYsb6t7M66PgzNB1zrluky5rdP7EkwhsaHgYLfuGj7CCDAEDQmgkqPR58A88NqbqKITRKA1d8vflfFNQ0Ex46nTU/LiCAFNqyArjAFQtnsNhGBg+o26w1gaeoL48wjGIXODRV/GKk0+Ertq4ucjV5I0hI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818319; c=relaxed/simple; bh=zRzb7KQv3xRBZo9WYphp8IEg9VdrU4vqON6031OOSn0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=THw1qx+0ACLbCG2ZKKzV1S50hfBDyiRsmV3RBH3/DHV+mmHn/82SngqEmcPyyKZxUdbJp4DrAguYv5Me+r0Zx6QpVFtfumAMi0ZCVw3QE2evhaUIxntIPfQhDFkXcrBROF6JiMWAApktMbT7jWoTJZnpbXtz/R+FyoVmiOFu1qc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=szljOOS0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF023C433C7; Tue, 13 Feb 2024 09:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707818319; bh=zRzb7KQv3xRBZo9WYphp8IEg9VdrU4vqON6031OOSn0=; h=From:To:Cc:Subject:Date:From; b=szljOOS0X5reBC/rEedA3Pp3GuGD4SQq7ebT+rhQK6CV0qKApjF0nrIt7hVDh42mv t3NOycP/SJhpr9wfFtjQcbzaMYE51opx1y56z0RLNyt0Z4U7HN0ndRt/FN5x+y2ORN UzHqEE8V0ejjXSLZ7C4JkeGM/4m+1AzEZnTvFAMTZGOe3luBtOeFPBrhyFO4LtnA9a RxrBis7RD+0EFrCTQsVevCGgs2PyqM53/46X+j1X9wlqeq66uhtVEh/MrszBBR+bzW HEuRulOJ3NDV22pnID7xB9KDaeQpVIbTY3KWvIoo82UA94AIKDBR7WjXJ+9AONr8Yf /8wBUR0r4oOQA== From: Arnd Bergmann To: David Woodhouse , Lu Baolu Cc: Arnd Bergmann , Joerg Roedel , Will Deacon , Robin Murphy , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Kevin Tian , Yi Liu , Jason Gunthorpe , Jacob Pan , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] iommu/vt-d: fix constant-out-of-range warning Date: Tue, 13 Feb 2024 10:58:20 +0100 Message-Id: <20240213095832.455245-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790778965967956502 X-GMAIL-MSGID: 1790778965967956502 From: Arnd Bergmann On 32-bit builds, the vt-d driver causes a warning with clang: drivers/iommu/intel/nested.c:112:13: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned long' is always false [-Werror,-Wtautological-constant-out-of-range-compare] 112 | if (npages == U64_MAX) | ~~~~~~ ^ ~~~~~~~ This can be easily avoided by making the variable a 64-bit type, which matches both the caller and the use anyway. Fixes: f6f3721244a8 ("iommu/vt-d: Add iotlb flush for nested domain") Signed-off-by: Arnd Bergmann --- drivers/iommu/intel/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/nested.c b/drivers/iommu/intel/nested.c index f26c7f1c46cc..77a09c982979 100644 --- a/drivers/iommu/intel/nested.c +++ b/drivers/iommu/intel/nested.c @@ -95,7 +95,7 @@ static void nested_flush_dev_iotlb(struct dmar_domain *domain, u64 addr, } static void intel_nested_flush_cache(struct dmar_domain *domain, u64 addr, - unsigned long npages, bool ih) + u64 npages, bool ih) { struct iommu_domain_info *info; unsigned int mask;