Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1185956yba; Thu, 9 May 2019 12:10:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoEvNnGkEklwl4P72tQopOqzlYx/vi3ykLUHWQIVdtgbtZMIbvfCYabLjj4CSkD7rR3cDw X-Received: by 2002:a17:902:8ec6:: with SMTP id x6mr7268213plo.123.1557429034202; Thu, 09 May 2019 12:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557429034; cv=none; d=google.com; s=arc-20160816; b=MuWtvLLf6ToZrK7DB5ImHpKpfASKGF0mkjU9bBet1YfaGrir1ei9gfouJlKEfw98Hd hwOiKXMUpxlgfnvILlD01pmNJgqaKefLaqlSPBLuI8Fy1r1cjKRbkutEQ7CzBooGAnAO pgdMQS870cW2FY1p1NpS2DvLM6GHN8s009NOEKSxl0UY6cbMJEaaYbAaXeSxChAAt1s8 UJWx0U+nKJ/VUiHF1f30pLtAo7dtmn9kJDnLA7koeMwughgaYXVQ+zFsxE/GU+NzuQar SdBSgZSP3it7KHnmsnBfeZhFpDqohqShxngN2uRGB2Yh17ujiuweLztMcZeH9plWcAna R8hw== 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=Fs3Rw2f9QJ8nGbwSSRB3ibflmtei6SQYgt0Odh9hmYM=; b=a8AkN2+FBqke4IlNAc1iLhYXsh/TXXrJBvUK42+RRwGWeCgcfLltEiU6Gh/T76sOZ9 xGaSR+BBh0p3kZo+sBtfxz9uBpaHCz7y0i8MiMhgOQnFy3zi/pmikQWvYceuQnOkAtIC tVxQR6/5BlpVGDmZ3OFh+mzYRu0tSb3CUh40v80qu1NDW9vv1nsZFIQfA7tr1SZOYbLp 7iLdoRYXmzBWGv48Bi1giSUFRXkNMOzeD2k9qmYiRPhCRoFJDGqUc8LuC/kxItoqb1R4 NMFB0MOSA1yX/krkakoq/zrSOZU8umL+SpPip7sxGwKq6hCpoPJABjcpmvzsmRBwjPph Bq+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lTXtCp5S; 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 78si3863040pfr.138.2019.05.09.12.10.17; Thu, 09 May 2019 12:10:34 -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=lTXtCp5S; 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 S1726721AbfEITJb (ORCPT + 99 others); Thu, 9 May 2019 15:09:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726928AbfEISoN (ORCPT ); Thu, 9 May 2019 14:44:13 -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 26A622183F; Thu, 9 May 2019 18:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557427452; bh=kK9Pt881y0iJMVCE/1Tw2pAk1AeqHYFGjcCEGqps8o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lTXtCp5SlbkkxmrZ3J9gAzHo44wG84edbrv64ev9M3rgX8qXtFvn612yIixFtHLjD TgGXZu8FHxbxa35ShU6b+MZmHiVEhyA0V4h2/uwwQF/HW94fEVJow3lRio1VbEHcM6 Y248HiswEl87+tGsITgs17kpRSi79iu7soIDsXz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joerg Roedel , Sasha Levin Subject: [PATCH 4.9 16/28] iommu/amd: Set exclusion range correctly Date: Thu, 9 May 2019 20:42:08 +0200 Message-Id: <20190509181253.539116825@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181247.647767531@linuxfoundation.org> References: <20190509181247.647767531@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 157e93421fb81..13bbe5795e4e4 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -318,7 +318,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