mb/emulation/qemu-q35: Mark TSEG region as reserved

Mark TSEG as reserved, which is done on other platforms as well.

For some reason CorebootPayloadPkg crashes when using the region where
TSEG typically resides, which is basically RAM.
UefiPayloadPkg doesn't show this issue.

Change-Id: I3ae3659349d2a88bc3575fe9675433c054e28832
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50267
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/mainboard/emulation/qemu-q35/mainboard.c b/src/mainboard/emulation/qemu-q35/mainboard.c
index 540db04..e53404d 100644
--- a/src/mainboard/emulation/qemu-q35/mainboard.c
+++ b/src/mainboard/emulation/qemu-q35/mainboard.c
@@ -4,6 +4,7 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <pc80/keyboard.h>
+#include <cpu/x86/smm.h>
 
 #include "q35.h"
 
@@ -39,6 +40,9 @@
 
 static void qemu_nb_read_resources(struct device *dev)
 {
+	size_t tseg_size;
+	uintptr_t tseg_base;
+
 	pci_dev_read_resources(dev);
 
 	mmconf_resource(dev, 2);
@@ -48,6 +52,9 @@
 		reserved_ram_resource(dev, 0, CONFIG_ARCH_X86_64_PGTBL_LOC / KiB,
 			(6 * 0x1000) / KiB);
 	}
+
+	smm_region(&tseg_base, &tseg_size);
+	reserved_ram_resource(dev, ESMRAMC, tseg_base / 1024, tseg_size / 1024);
 }