-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathqemu-sbsa-patch.patch
More file actions
82 lines (75 loc) · 2.71 KB
/
qemu-sbsa-patch.patch
File metadata and controls
82 lines (75 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index aa09d7a091..0bb74197d2 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -28,6 +28,8 @@
#include "system/numa.h"
#include "system/runstate.h"
#include "system/system.h"
+#include "system/tpm.h"
+#include "system/tpm_backend.h"
#include "exec/hwaddr.h"
#include "kvm_arm.h"
#include "hw/arm/boot.h"
@@ -94,6 +96,8 @@ enum {
SBSA_SECURE_MEM,
SBSA_AHCI,
SBSA_XHCI,
+ SBSA_TPM,
+ SBSA_SECURE_UART_TEST,
};
struct SBSAMachineState {
@@ -132,6 +136,8 @@ static const MemMapEntry sbsa_ref_memmap[] = {
/* Space here reserved for more SMMUs */
[SBSA_AHCI] = { 0x60100000, 0x00010000 },
[SBSA_XHCI] = { 0x60110000, 0x00010000 },
+ [SBSA_TPM] = { 0x60120000, 0x00010000 },
+ [SBSA_SECURE_UART_TEST] = { 0x60130000, 0x00001000 },
/* Space here reserved for other devices */
[SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },
/* 32-bit address PCIE MMIO space */
@@ -154,6 +160,7 @@ static const int sbsa_ref_irqmap[] = {
[SBSA_XHCI] = 11,
[SBSA_SMMU] = 12, /* ... to 15 */
[SBSA_GWDT_WS0] = 16,
+ [SBSA_SECURE_UART_TEST] = 17,
};
static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
@@ -631,6 +638,24 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
}
}
+static void create_tpm(SBSAMachineState *sbsa, PCIBus *bus)
+{
+ Error *errp = NULL;
+ DeviceState *dev;
+
+ TPMBackend *be = qemu_find_tpm_be("tpm0");
+ if (be == NULL) {
+ error_report("Couldn't find tmp0 backend");
+ return;
+ }
+
+ dev = qdev_new(TYPE_TPM_TIS_SYSBUS);
+ object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp);
+ object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, sbsa_ref_memmap[SBSA_TPM].base);
+}
+
static void create_pcie(SBSAMachineState *sms)
{
hwaddr base_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].base;
@@ -688,6 +713,8 @@ static void create_pcie(SBSAMachineState *sms)
pci_create_simple(pci->bus, -1, "bochs-display");
create_smmu(sms, pci->bus);
+
+ create_tpm(sms, pci->bus);
}
static void *sbsa_ref_dtb(const struct arm_boot_info *binfo, int *fdt_size)
@@ -810,6 +837,8 @@ static void sbsa_ref_init(MachineState *machine)
create_uart(sms, SBSA_SECURE_UART, secure_sysmem, serial_hd(1));
/* Second secure UART for RAS and MM from EL0 */
create_uart(sms, SBSA_SECURE_UART_MM, secure_sysmem, serial_hd(2));
+ /* Test secure UART */
+ create_uart(sms, SBSA_SECURE_UART_TEST, secure_sysmem, serial_hd(3));
create_rtc(sms);