Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2708267ybl; Mon, 19 Aug 2019 06:24:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKYVqp0rYcb8xKj2rGxgYXWbjybrlFpX0u0J/pGL3iJ80TawSVOXonT4cACYrtU66oUnr3 X-Received: by 2002:aa7:83ce:: with SMTP id j14mr23733434pfn.55.1566221077778; Mon, 19 Aug 2019 06:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566221077; cv=none; d=google.com; s=arc-20160816; b=VwQJLg+jQMLDD7Y9iZ4otU+a/MVPLcf4PDxMh6wjBnlqPkUmhdeR4Qyo+y91E54N5U zmhiW7z/dQlGgCvkWnEAyyQV1Ef0qxIFA8WnVF1xdWmaDefk3LnDLhzXn5cFOs/KB23D MdLUB8zQuT/Fe2z6nnpda+SFDrLr/EvAQu0PJx3b6sZwgs8SZE6QNtzM6AQnDq5+Y9dR DXV04J1hDcPOwL4XTaBRlziHeXaQYRJbRBnAGdFY5tHWFCYp/sQBmy19UKwpz3n/oX4S hIHjPC6JNkf7fROzJiDsg60criVNgZjS4cXJ7GIhhM59c8TWA2k1oCw+/sEc60+m16gE 2EmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=KS1hPauhDG2siKW6XSRMPvOkeWYxWvrCtPfkfUAxzps=; b=yNiUkeEu+f30HOvddwkQpBqDPgL5umtS/IiCRnsQSxkWnT9XDa1YFGXnjcE/dWJfPH 5sFrbUgPwOg678sTVtC4agSTiqVkqk2XmxpojAn+zLh2w2pMUiQF6QCc5yT5QwrdAun8 yhtppKL+dr0WRVhoTxZUIuLFYBB5XdavHlAHSVA9Txs0fpp6UVziascvCWgB4BJVZ8KT fIylaEb8xqPdk/RHzgWZfRDFY9f5WLDXW079uc09x3wimMdyRYQKdR9l1EDEcAYOCApu pMQg14GSQVX2XIJWnZGjQTx1kAGpWkGYLzDagnhrfUpiQMiktUv+j6YuxLWCC3Y40Xi4 d9fA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si9629191pgv.541.2019.08.19.06.24.23; Mon, 19 Aug 2019 06:24:37 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727820AbfHSNXV (ORCPT + 99 others); Mon, 19 Aug 2019 09:23:21 -0400 Received: from 8bytes.org ([81.169.241.247]:50418 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727716AbfHSNXC (ORCPT ); Mon, 19 Aug 2019 09:23:02 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 745E2712; Mon, 19 Aug 2019 15:23:00 +0200 (CEST) From: Joerg Roedel To: Joerg Roedel Cc: corbet@lwn.net, tony.luck@intel.com, fenghua.yu@intel.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Thomas.Lendacky@amd.com, Suravee.Suthikulpanit@amd.com, Joerg Roedel Subject: [PATCH 10/11] iommu: Disable passthrough mode when SME is active Date: Mon, 19 Aug 2019 15:22:55 +0200 Message-Id: <20190819132256.14436-11-joro@8bytes.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819132256.14436-1-joro@8bytes.org> References: <20190819132256.14436-1-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joerg Roedel Using Passthrough mode when SME is active causes certain devices to use the SWIOTLB bounce buffer. The bounce buffer code has an upper limit of 256kb for the size of DMA allocations, which is too small for certain devices and causes them to fail. With this patch we enable IOMMU by default when SME is active in the system, making the default configuration work for more systems than it does now. Users that don't want IOMMUs to be enabled still can disable them with kernel parameters. Signed-off-by: Joerg Roedel --- drivers/iommu/iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 01759d4ac70b..ec18c9630e93 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -119,6 +119,11 @@ static int __init iommu_subsys_init(void) iommu_set_default_passthrough(false); else iommu_set_default_translated(false); + + if (iommu_default_passthrough() && sme_active()) { + pr_info("SME detected - Disabling default IOMMU Passthrough\n"); + iommu_set_default_translated(false); + } } pr_info("Default domain type: %s %s\n", -- 2.16.4