From c7fee24887aef62919b9d55f3b83cb130b407a61 Mon Sep 17 00:00:00 2001 From: Michał Żygowski Date: Sat, 15 Oct 2022 16:39:46 +0200 Subject: soc/intel/alderlake: Hook the VT-d DMA protection option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: Iecaa3d04f1447b7e73507ca57a0d23d42e24d663 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68450 Reviewed-by: Michał Kopeć Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/romstage/fsp_params.c | 2 ++ src/soc/intel/alderlake/romstage/romstage.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src/soc/intel') diff --git a/src/soc/intel/alderlake/romstage/fsp_params.c b/src/soc/intel/alderlake/romstage/fsp_params.c index f18e1f48b0..50343fb7a7 100644 --- a/src/soc/intel/alderlake/romstage/fsp_params.c +++ b/src/soc/intel/alderlake/romstage/fsp_params.c @@ -300,6 +300,8 @@ static void fill_fspm_vtd_params(FSP_M_CONFIG *m_cfg, m_cfg->VtdIgdEnable = m_cfg->InternalGfx; m_cfg->VtdIpuEnable = m_cfg->SaIpuEnable; + m_cfg->PreBootDmaMask = CONFIG(ENABLE_EARLY_DMA_PROTECTION); + if (m_cfg->VtdIgdEnable && m_cfg->VtdBaseAddress[VTD_GFX] == 0) { m_cfg->VtdIgdEnable = 0; printk(BIOS_ERR, "Requested IGD VT-d, but GFXVT_BASE_ADDRESS is 0\n"); diff --git a/src/soc/intel/alderlake/romstage/romstage.c b/src/soc/intel/alderlake/romstage/romstage.c index 2c0bdea11a..a3273e610a 100644 --- a/src/soc/intel/alderlake/romstage/romstage.c +++ b/src/soc/intel/alderlake/romstage/romstage.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -227,4 +228,7 @@ void mainboard_romstage_entry(void) * RUN_FSP_GOP is selected */ early_graphics_stop(); + + if (CONFIG(ENABLE_EARLY_DMA_PROTECTION)) + vtd_enable_dma_protection(); } -- cgit v1.2.3