Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp170995pxf; Wed, 17 Mar 2021 02:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE0a7FCJy3f7h0wTaKvuo7O3I9P934KoM2S5cmezY8QXKjMBcsEevonlkO+6IlFI1iJ1AZ X-Received: by 2002:a17:906:bfcc:: with SMTP id us12mr35071696ejb.266.1615972368816; Wed, 17 Mar 2021 02:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615972368; cv=none; d=google.com; s=arc-20160816; b=ofjysuTMjbRp7lZRupAxvdBEBMiEnJ9pCJo0IPA9v5AKacAbqi9hGKjnS8khJqH/4d 7G/ZKzKvGvQLRdFR9CFW9qmZP9JqtHbsDu1YUTxiBy4+n6Mikn5QDw6JTFWnKNtkrKyK AfwfnQSJGcBPVgJQ7pK/rXvxYpt6xKZZdPnMC2GURB+3c608ltjG2JjBxu0yFkz0LFTH qyx0r62+JDy2gdfe97BC54kcjR2V7aClSEWYLodWXYcgR/8CGA4C+XjFyY+Moz7a0154 66urOQ8c5UJjExVkFvtJ3b1Hfixo+qQ6H6ehwgfXTWmoRb5SJacimGatpsR2v00Qnydk +kQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mCKu/JZnD5qGuunrEGSFEc2gqGrPk3SCOKdqkMbSTvw=; b=ag9dENWNwz7AAu/8j88xE/IVgouCn9y8VmSl7uBDiV5aVF9C0QuqKXuJFr8jaXXxIx hbSQuuJuvuqZnPfSQvHc5/lHLR4O3X/nS/OzRZ4Y5V1WsP7GTu0R8yPQzubiGkrd62T4 43C+1LrjvykTz+OKq3sOTv+EVkwhKXNi8qQSmQR1WLpNJRC5GK6w16aSdQHn8LlAjb33 fCFnoX7Ur52iqjn7XANz1g6VP+UB3iZO7GCLzBn76JvwGnzWluC5vX07n8IQOjKp6p8T rpps86fWpOMLgB8nvQVIgHRefpVdJ67oWPNS16UiIwlfeji3aQguTcyC0vlZStrjgecn ce7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga15si16008232ejc.24.2021.03.17.02.12.26; Wed, 17 Mar 2021 02:12:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229673AbhCQJLT (ORCPT + 99 others); Wed, 17 Mar 2021 05:11:19 -0400 Received: from 8bytes.org ([81.169.241.247]:59408 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhCQJKs (ORCPT ); Wed, 17 Mar 2021 05:10:48 -0400 Received: from cap.home.8bytes.org (p549adcf6.dip0.t-ipconnect.de [84.154.220.246]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by theia.8bytes.org (Postfix) with ESMTPSA id 27EBE3A4; Wed, 17 Mar 2021 10:10:42 +0100 (CET) From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, Huang Rui , Suravee Suthikulpanit , Alex Deucher , Xiaojian Du , David Woodhouse , Joerg Roedel , stable@vger.kernel.org Subject: [PATCH 1/3] iommu/amd: Move Stoney Ridge check to detect_ivrs() Date: Wed, 17 Mar 2021 10:10:35 +0100 Message-Id: <20210317091037.31374-2-joro@8bytes.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210317091037.31374-1-joro@8bytes.org> References: <20210317091037.31374-1-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel The AMD IOMMU will not be enabled on AMD Stoney Ridge systems. Bail out even earlier and refuse to even detect the IOMMU there. References: https://bugzilla.kernel.org/show_bug.cgi?id=212133 References: https://bugzilla.suse.com/show_bug.cgi?id=1183132 Cc: stable@vger.kernel.org # v5.11 Signed-off-by: Joerg Roedel --- drivers/iommu/amd/init.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 9126efcbaf2c..3280e6f5b720 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2714,7 +2714,6 @@ static int __init early_amd_iommu_init(void) struct acpi_table_header *ivrs_base; int i, remap_cache_sz, ret; acpi_status status; - u32 pci_id; if (!amd_iommu_detected) return -ENODEV; @@ -2804,16 +2803,6 @@ static int __init early_amd_iommu_init(void) if (ret) goto out; - /* Disable IOMMU if there's Stoney Ridge graphics */ - for (i = 0; i < 32; i++) { - pci_id = read_pci_config(0, i, 0, 0); - if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { - pr_info("Disable IOMMU on Stoney Ridge\n"); - amd_iommu_disabled = true; - break; - } - } - /* Disable any previously enabled IOMMUs */ if (!is_kdump_kernel() || amd_iommu_disabled) disable_iommus(); @@ -2880,6 +2869,7 @@ static bool detect_ivrs(void) { struct acpi_table_header *ivrs_base; acpi_status status; + int i; status = acpi_get_table("IVRS", 0, &ivrs_base); if (status == AE_NOT_FOUND) @@ -2892,6 +2882,17 @@ static bool detect_ivrs(void) acpi_put_table(ivrs_base); + /* Don't use IOMMU if there is Stoney Ridge graphics */ + for (i = 0; i < 32; i++) { + u32 pci_id; + + pci_id = read_pci_config(0, i, 0, 0); + if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) { + pr_info("Disable IOMMU on Stoney Ridge\n"); + return false; + } + } + /* Make sure ACS will be enabled during PCI probe */ pci_request_acs(); -- 2.30.2