intel/txt: Add txt_get_chipset_dpr function

Due to platform-specific constraints, it is not possible to enable DPR
by programming the MCH's DPR register in ramstage. Instead, assume it
has been programmed earlier and check that its value is valid. If it is,
then simply configure DPR in TXT public base with the same parameters.
Note that some bits only exist on MCH DPR, and thus need to be cleared.

Implement this function on most client platforms. For Skylake and newer,
place it in common System Agent code. Also implement it for Haswell, for
which the rest of Intel TXT support will be added in subsequent commits.

Do not error out if DPR is larger than expected. On some platforms, such
as Haswell, MRC decides the size of DPR, and cannot be changed easily.
Reimplementing MRC is easier than working around its limitations anyway.

Change-Id: I391383fb03bd6636063964ff249c75028e0644cf
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46490
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Angel Pons
2020-10-15 23:25:58 +02:00
committed by Philipp Deppenwiese
parent 578a4d2b6a
commit ffbb4b2b11
4 changed files with 60 additions and 10 deletions

View File

@@ -9,6 +9,7 @@
#include <cpu/x86/smm.h>
#include <device/pci_ops.h>
#include <cbmem.h>
#include <security/intel/txt/txt_platform.h>
#include <security/intel/txt/txt_register.h>
#include "haswell.h"
@@ -23,6 +24,11 @@ static size_t northbridge_get_tseg_size(void)
return CONFIG_SMM_TSEG_SIZE;
}
union dpr_register txt_get_chipset_dpr(void)
{
return (union dpr_register) { .raw = pci_read_config32(HOST_BRIDGE, DPR) };
}
/*
* Return the topmost memory address below 4 GiB available for general
* use, from software's view of memory. Do not confuse this with TOLUD,
@@ -39,9 +45,7 @@ static uintptr_t top_of_low_usable_memory(void)
*/
uintptr_t tolum = northbridge_get_tseg_base();
const union dpr_register dpr = {
.raw = pci_read_config32(HOST_BRIDGE, DPR),
};
const union dpr_register dpr = txt_get_chipset_dpr();
/* Subtract DMA Protected Range size if enabled */
if (dpr.epm)