Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1169696yba; Thu, 9 May 2019 11:55:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyR3vcZdQyRqwIxJ7IcQszZbJwNa1QgL9RkEgh8wHDqfDcgcMJ0yeqG8mQzWOWrraPRaZIb X-Received: by 2002:a63:a54:: with SMTP id z20mr7707061pgk.27.1557428101469; Thu, 09 May 2019 11:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557428101; cv=none; d=google.com; s=arc-20160816; b=Dnl/YiQOKzfmCAyhUvRgzVCShJ4GoSEJnJLPcryqm9NosRp6ICD8ooT0ZGoyg9qUdR 3TuuFcNTRwd1BbwF5UXBD56CUc8j9HRbiOCy+vV957q08c0xAoYcprI8yzCzI9XEKZ2B 2hhs8WYcBJgqEUWYts4OAuEq/dpbgri9MEjPta0x250dSh7FpwdPdFT5lqYHImHai9kC ILGTPKBEu4pg29QNiKo347RRPYHrVJ0nIpiMuNrqSPlYacraxbivvqqaozPOcRm9/Jw8 SLrf26iRm6ZR80NUA3duFEu7qKNP8aURMLUxIaGTs0SI5Be6tJXd5DIo6i1Y5FuBH6/f 0aaw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xsVk7gu+f2O06g43NXfF/ni/n+3KU8R5hK8IVtM8EAI=; b=HCufB4MDHX39tSaZ+7NSBTK77pMPuXcnHNrPgjekSly3SrJx2fRVU1Jdu92l6kabr6 8Ogi7wd6SzfY2TuXXWkSNYLGzb+JhUjwxI75wUjx4PBN2ulNHE57vYFegv8u1Utb7hyx 47qhwQKlYwqobCKesjP3/MSvzE/a3Ttn9ph51o0N7f8/WFAE/bltQkW721q4Qxm8OJ2V Asbte/HYq1CufTPcZZ8Mhvnxn3Bw/7q0uASi4/E88+dnBDYtGnRt/Fd+ThTLQCuwG7cK oJy4nCtwMDcVKdRchSTRMQS7/79Fk2+DQHG5BQn2tnFF7WWDEMpLbPx/Z3oFywI/Al7D 6tzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ptyACXCS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cp7si2433628plb.14.2019.05.09.11.54.45; Thu, 09 May 2019 11:55:01 -0700 (PDT) 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=@kernel.org header.s=default header.b=ptyACXCS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728965AbfEISx5 (ORCPT + 99 others); Thu, 9 May 2019 14:53:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728717AbfEISxz (ORCPT ); Thu, 9 May 2019 14:53:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 45ABB217D6; Thu, 9 May 2019 18:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557428034; bh=akjBWzY3nl2yJ8RVgOG/XpQVOwor6NTE11/BVRi/H3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptyACXCSwR5iaq9eo3eGknR5V2FrP0DiLU0kMEmJiyr7p77Df/O6odB+/OrKuxxZB hZjeSGgkUTeQTLHOiey8mU192ZwjB7JUG2Spc+oOQsu2mhSWgxwQZ3bXHSTvraQDD5 esNH9idv6G670GiksIZjLVeHyYrjOF0dCftcJjSU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Sasha Levin Subject: [PATCH 5.0 72/95] iommu/amd: Set exclusion range correctly Date: Thu, 9 May 2019 20:42:29 +0200 Message-Id: <20190509181314.456363344@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181309.180685671@linuxfoundation.org> References: <20190509181309.180685671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 3c677d206210f53a4be972211066c0f1cd47fe12 ] The exlcusion range limit register needs to contain the base-address of the last page that is part of the range, as bits 0-11 of this register are treated as 0xfff by the hardware for comparisons. So correctly set the exclusion range in the hardware to the last page which is _in_ the range. Fixes: b2026aa2dce44 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space') Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/amd_iommu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 84fa5b22371e8..e8a2efe0afce0 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -358,7 +358,7 @@ static void iommu_write_l2(struct amd_iommu *iommu, u8 address, u32 val) static void iommu_set_exclusion_range(struct amd_iommu *iommu) { u64 start = iommu->exclusion_start & PAGE_MASK; - u64 limit = (start + iommu->exclusion_length) & PAGE_MASK; + u64 limit = (start + iommu->exclusion_length - 1) & PAGE_MASK; u64 entry; if (!iommu->exclusion_start) -- 2.20.1