From: Mario Limonciello <mario.limonciello@amd.com> To: Joerg Roedel <joro@8bytes.org>, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Will Deacon <will@kernel.org>, Andreas Noever <andreas.noever@gmail.com>, Michael Jamet <michael.jamet@intel.com>, Yehezkel Bernat <YehezkelShB@gmail.com>, "open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux-foundation.org>, open list <linux-kernel@vger.kernel.org>, "open list:THUNDERBOLT DRIVER" <linux-usb@vger.kernel.org>, Mario Limonciello <mario.limonciello@amd.com> Subject: [PATCH 2/2] thunderbolt: Use pre-boot DMA protection on AMD systems Date: Tue, 15 Mar 2022 11:24:55 -0500 [thread overview] Message-ID: <20220315162455.5190-2-mario.limonciello@amd.com> (raw) In-Reply-To: <20220315162455.5190-1-mario.limonciello@amd.com> The information is exported from the IOMMU driver whether or not pre-boot DMA protection has been enabled on AMD systems. Use this information to properly set iomma_dma_protection. Link: https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/oem-kernel-dma-protection Link: https://www.amd.com/system/files/TechDocs/48882_IOMMU.pdf Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- drivers/thunderbolt/domain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c index 7018d959f775..e03790735c12 100644 --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c @@ -6,6 +6,7 @@ * Author: Mika Westerberg <mika.westerberg@linux.intel.com> */ +#include <linux/amd-iommu.h> #include <linux/device.h> #include <linux/dmar.h> #include <linux/idr.h> @@ -259,11 +260,15 @@ static ssize_t iommu_dma_protection_show(struct device *dev, { /* * Kernel DMA protection is a feature where Thunderbolt security is - * 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())); } static DEVICE_ATTR_RO(iommu_dma_protection); -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Mario Limonciello via iommu <iommu@lists.linux-foundation.org> To: Joerg Roedel <joro@8bytes.org>, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Michael Jamet <michael.jamet@intel.com>, "open list:THUNDERBOLT DRIVER" <linux-usb@vger.kernel.org>, open list <linux-kernel@vger.kernel.org>, Yehezkel Bernat <YehezkelShB@gmail.com>, "open list:AMD IOMMU \(AMD-VI\)" <iommu@lists.linux-foundation.org>, Mario Limonciello <mario.limonciello@amd.com>, Andreas Noever <andreas.noever@gmail.com>, Will Deacon <will@kernel.org> Subject: [PATCH 2/2] thunderbolt: Use pre-boot DMA protection on AMD systems Date: Tue, 15 Mar 2022 11:24:55 -0500 [thread overview] Message-ID: <20220315162455.5190-2-mario.limonciello@amd.com> (raw) In-Reply-To: <20220315162455.5190-1-mario.limonciello@amd.com> The information is exported from the IOMMU driver whether or not pre-boot DMA protection has been enabled on AMD systems. Use this information to properly set iomma_dma_protection. Link: https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/oem-kernel-dma-protection Link: https://www.amd.com/system/files/TechDocs/48882_IOMMU.pdf Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- drivers/thunderbolt/domain.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c index 7018d959f775..e03790735c12 100644 --- a/drivers/thunderbolt/domain.c +++ b/drivers/thunderbolt/domain.c @@ -6,6 +6,7 @@ * Author: Mika Westerberg <mika.westerberg@linux.intel.com> */ +#include <linux/amd-iommu.h> #include <linux/device.h> #include <linux/dmar.h> #include <linux/idr.h> @@ -259,11 +260,15 @@ static ssize_t iommu_dma_protection_show(struct device *dev, { /* * Kernel DMA protection is a feature where Thunderbolt security is - * 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())); } static DEVICE_ATTR_RO(iommu_dma_protection); -- 2.34.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-03-15 16:26 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-15 16:24 [PATCH 1/2] iommu/amd: Add support to indicate whether DMA remap support is enabled Mario Limonciello 2022-03-15 16:24 ` Mario Limonciello via iommu 2022-03-15 16:24 ` Mario Limonciello [this message] 2022-03-15 16:24 ` [PATCH 2/2] thunderbolt: Use pre-boot DMA protection on AMD systems Mario Limonciello via iommu 2022-03-15 16:48 ` Christoph Hellwig 2022-03-15 16:48 ` Christoph Hellwig 2022-03-15 16:54 ` Limonciello, Mario 2022-03-15 16:54 ` Limonciello, Mario via iommu 2022-03-15 18:07 ` Robin Murphy 2022-03-15 18:07 ` Robin Murphy 2022-03-15 18:36 ` Limonciello, Mario 2022-03-15 18:36 ` Limonciello, Mario via iommu 2022-03-15 21:34 ` Limonciello, Mario 2022-03-15 21:34 ` Limonciello, Mario via iommu 2022-03-15 22:04 ` Robin Murphy 2022-03-15 22:04 ` Robin Murphy 2022-03-16 9:50 ` Mika Westerberg 2022-03-16 9:50 ` Mika Westerberg 2022-03-16 1:32 ` kernel test robot 2022-03-16 1:32 ` kernel test robot 2022-03-16 0:51 ` [PATCH 1/2] iommu/amd: Add support to indicate whether DMA remap support is enabled kernel test robot 2022-03-16 0:51 ` kernel test robot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220315162455.5190-2-mario.limonciello@amd.com \ --to=mario.limonciello@amd.com \ --cc=YehezkelShB@gmail.com \ --cc=andreas.noever@gmail.com \ --cc=iommu@lists.linux-foundation.org \ --cc=joro@8bytes.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=michael.jamet@intel.com \ --cc=mika.westerberg@linux.intel.com \ --cc=suravee.suthikulpanit@amd.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.