summaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/include
diff options
context:
space:
mode:
authorMichał Żygowski <michal.zygowski@3mdeb.com>2022-10-15 16:35:31 +0200
committerPaul Fagerburg <pfagerburg@chromium.org>2023-03-17 13:53:53 +0000
commite6225874eba0e6c894b3408bcfc98292f0fe60d1 (patch)
tree2052aa4e1db6047d76a6b4e47f908086ec0b50a1 /src/soc/intel/common/block/include
parent9a035ede17a23127ec4fc451ab84283e79636e75 (diff)
intelblocks/vtd: Add VT-d block with DMA protection API
Add new common block with VT-d/IOMMU support. The patch adds an option to enable DMA protection with PMR. However the payload and OS must support VT-d in order to properly handle I/O devices. TEST=Enable DMA protection on MSI PRO Z690-A DDR4 and observe the I/O devices like USB and NVMe fail to enumerate in UEFI Payload (basically proving that DMA protection works). Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com> Change-Id: Id7edf982457c1139624e5cd383788eda41d6a948 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68449 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Michał Kopeć <michal.kopec@3mdeb.com>
Diffstat (limited to 'src/soc/intel/common/block/include')
-rw-r--r--src/soc/intel/common/block/include/intelblocks/vtd.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/include/intelblocks/vtd.h b/src/soc/intel/common/block/include/intelblocks/vtd.h
new file mode 100644
index 0000000000..222101a244
--- /dev/null
+++ b/src/soc/intel/common/block/include/intelblocks/vtd.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef SOC_INTEL_COMMON_BLOCK_VTD_H
+#define SOC_INTEL_COMMON_BLOCK_VTD_H
+
+#include <stdint.h>
+
+/*
+ * Enable DMA protection by setting PMR registers in VT-d for whole DRAM memory.
+ */
+void vtd_enable_dma_protection(void);
+/*
+ * Get DMA buffer base and size.
+ */
+void *vtd_get_dma_buffer(size_t *size);
+
+#endif /* SOC_INTEL_COMMON_BLOCK_VTD_H */