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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D918C433EF for ; Tue, 15 Mar 2022 16:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347601AbiCOQtq (ORCPT ); Tue, 15 Mar 2022 12:49:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242803AbiCOQtl (ORCPT ); Tue, 15 Mar 2022 12:49:41 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3C5443EA; Tue, 15 Mar 2022 09:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NQX8+5nySoNC5mbdZyl6P/Zb6lIGsr4OoSrqjyhxvFw=; b=WN66xSNv72R+8NnaTfLzcrmyQO dAwotE14FKTGCz/uOjsYeQmg2LKaBIoVUXeWVAM2noGxnlHiSuHfR0AB+gAfHd8nvl5en038lksxF LXDGlF+pcQOtLVtep0t4W1tJdCRVyJNjxqB2ZPg3QUaoTdV8BP/8J/BT3EPRVq72S54CpJHCS3Zel 0/fYGYJstPcOzvmVcJ6zVZLne91GPKNaxPSDDkJsbAnyPY3mOKuvGwFm/0fIHBYXK0AIevXhzU8Tq W2Icp+694MKqfFnuq6/yIXQdG1pd+bAX50OTj/1Zls1rWu4NoKzA+lPw4kQE1+Npdcv89+oMiPxrg GpWZr+/A==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUALJ-009vSs-AR; Tue, 15 Mar 2022 16:48:17 +0000 Date: Tue, 15 Mar 2022 09:48:17 -0700 From: Christoph Hellwig To: Mario Limonciello Cc: Joerg Roedel , Suravee Suthikulpanit , Mika Westerberg , Will Deacon , Andreas Noever , Michael Jamet , Yehezkel Bernat , "open list:AMD IOMMU (AMD-VI)" , open list , "open list:THUNDERBOLT DRIVER" Subject: Re: [PATCH 2/2] thunderbolt: Use pre-boot DMA protection on AMD systems Message-ID: References: <20220315162455.5190-1-mario.limonciello@amd.com> <20220315162455.5190-2-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220315162455.5190-2-mario.limonciello@amd.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 15, 2022 at 11:24:55AM -0500, Mario Limonciello wrote: > - * handled natively using IOMMU. It is enabled when IOMMU is > - * enabled and ACPI DMAR table has DMAR_PLATFORM_OPT_IN set. > + * handled natively using IOMMU. It is enabled when the IOMMU is > + * enabled and either: > + * ACPI DMAR table has DMAR_PLATFORM_OPT_IN set > + * or > + * ACPI IVRS table has DMA_REMAP bitset > */ > return sprintf(buf, "%d\n", > - iommu_present(&pci_bus_type) && dmar_platform_optin()); > + iommu_present(&pci_bus_type) && > + (dmar_platform_optin() || amd_ivrs_remap_support())); Yikes. No, the thunderbot code does not have any business poking into either dmar_platform_optin or amd_ivrs_remap_support. This needs a proper abstration from the IOMMU code.