From patchwork Fri Jun 7 17:34:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Lane X-Patchwork-Id: 1112893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Mmbv0CYxz9sNq; Mon, 10 Jun 2019 18:32:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1haFjY-0003OD-OB; Mon, 10 Jun 2019 08:32:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hZIlK-0006Cl-Kv for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 17:34:46 +0000 Received: from mail-yw1-f72.google.com ([209.85.161.72]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hZIlK-0003fL-7F for kernel-team@lists.ubuntu.com; Fri, 07 Jun 2019 17:34:46 +0000 Received: by mail-yw1-f72.google.com with SMTP id t128so2687140ywd.15 for ; Fri, 07 Jun 2019 10:34:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=YRybYZlXSUs0/wvZWRSVs1PAQZAZZfWHK97AMXdp4fo=; b=MwWSAA1DVFUMz/TpryLVQ3Lg9cq9Y7Q9RUz/X0yoGqj0oz31x3YJ3nwEIdZorQYhWi Dqs2U6a214djuLm8KDtCnEyJ+GKuFN+sHTbk8dysd1gb1DpENtvLbn7mWAOPYvfkizWJ Iq9Y+UHYoVe/ealWsPCdMd7jS/JROsN51wX4lM7lkSnPQ8surm4SJ7F9B4GU4jot0c+M +cWNJcVHz92ZCpDj9UzPRO1yk8Dl11SNCwUUTumiYN2Z3f5YYQx0gHuB5R+C0zbaVTO5 nVr0BqM6st5N52cuS6g6BB7EppJr3lk8vvdcK/PrT0MXKI5OXVlEwqZyXvIyutRq/OOV 12tQ== X-Gm-Message-State: APjAAAVspPmkPW13WccRx9OdWZ6xJp/ROftRQJOHJyqoDUz7iJYtlbHM 5vCoC10M2EJ4JnSutN4PGSWIH5NUdFaVKP5kdzThURUXb1ikaldReqKUiRWiTNpFJEIObMx5LJo Uiq/eJ1OWHALlTpU/wCdGCOZ1vqe3qu6qsNbTSUPwXw== X-Received: by 2002:a81:a493:: with SMTP id b141mr26875993ywh.463.1559928884686; Fri, 07 Jun 2019 10:34:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9ahKj9ZFDe0KoNxFFNdmhU88zIo7pWHxos4lZ0qfAkL+nKdIt6iSH83OS9CBE5gJEq6oXJQ== X-Received: by 2002:a81:a493:: with SMTP id b141mr26875964ywh.463.1559928884353; Fri, 07 Jun 2019 10:34:44 -0700 (PDT) Received: from galactica.lanes ([174.24.193.243]) by smtp.gmail.com with ESMTPSA id f3sm602429ywb.53.2019.06.07.10.34.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 10:34:43 -0700 (PDT) From: Jeff Lane To: kernel-team@lists.ubuntu.com Subject: [SRU][COSMIC][PATCH 2/2] iommu/amd: Set exclusion range correctly Date: Fri, 7 Jun 2019 13:34:32 -0400 Message-Id: <20190607173433.32695-5-jeffrey.lane@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607173433.32695-1-jeffrey.lane@canonical.com> References: <20190607173433.32695-1-jeffrey.lane@canonical.com> X-Mailman-Approved-At: Mon, 10 Jun 2019 08:32:51 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Joerg Roedel BugLink: https://bugs.launchpad.net/bugs/1823037 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 (cherry picked from commit 3c677d206210f53a4be972211066c0f1cd47fe12 5.2-rc1) Signed-off-by: Jeffrey Lane --- 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 75c6d5b654e6..9b29a425cfb6 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -356,7 +356,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)