From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C66F6C43219 for ; Sat, 27 Apr 2019 01:43:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90027216C4 for ; Sat, 27 Apr 2019 01:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556329435; bh=1Ei3fWbLIEllEVAsSYQspR0fjQOz0OjJs7ISywT3qXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=l8xTa7gAjhz0wBBVCwrQq8jbChm5huAXqeZBbCiXfiVl68qiH8TIk3pf7xvDzoON2 AodU/m31YrSCd8UBFW9hB3bSQ3nUeAiHlkgAaG4XdISRPtl7oxu1JJpCJ4+xMldnhq g6IslurOb8Pzsum34TnLIMwVFEE+ffmvGH95qNVM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728895AbfD0Bny (ORCPT ); Fri, 26 Apr 2019 21:43:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:48172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728874AbfD0Bnw (ORCPT ); Fri, 26 Apr 2019 21:43:52 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 46164215EA; Sat, 27 Apr 2019 01:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556329431; bh=1Ei3fWbLIEllEVAsSYQspR0fjQOz0OjJs7ISywT3qXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPx2l0Uj/TaTmdFFEhb9+NSQuERMCYMLOXii8vA6NrYpZMuJTNqzCKRuNxFfdNVGS h0V+tJVg0aXpunB/iH8YQqAqQcN4ptfwI4EC1ZWx1AJzmfAHzYDkAJvylnvoVPGg0Q j94FtxeWx/6wRJYva5PAgu+dCLjb69Ib+vYwIJh0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Joerg Roedel , Sasha Levin , iommu@lists.linux-foundation.org Subject: [PATCH AUTOSEL 4.9 15/16] iommu/amd: Set exclusion range correctly Date: Fri, 26 Apr 2019 21:43:23 -0400 Message-Id: <20190427014325.8704-15-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190427014325.8704-1-sashal@kernel.org> References: <20190427014325.8704-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel [ 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 157e93421fb8..13bbe5795e4e 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.19.1