Skip to content

Commit 49b63b5

Browse files
authored
Added changes to allow QEMU to expose UART (#3)
1 parent 07405af commit 49b63b5

2 files changed

Lines changed: 30 additions & 11 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apt-get update && \
2929
libtpms-dev && \
3030
rm -rf /var/lib/apt/lists/*
3131

32-
COPY qemu-tpm-patch.patch /tmp/qemu-tpm-patch.patch
32+
COPY qemu-sbsa-patch.patch /tmp/qemu-sbsa-patch.patch
3333

3434
ARG QEMU_URL="https://gitlab.com/qemu-project/qemu.git"
3535
ARG QEMU_BRANCH="v10.0.0"
@@ -38,7 +38,7 @@ ARG TARGETARCH
3838
RUN --mount=type=cache,id=ccache-${TARGETARCH},target=/root/.cache/ccache \
3939
git clone "${QEMU_URL}" --branch "${QEMU_BRANCH}" --depth 1 qemu && \
4040
cd qemu && \
41-
git apply /tmp/qemu-tpm-patch.patch && \
41+
git apply /tmp/qemu-sbsa-patch.patch && \
4242
PATH="/usr/lib/ccache:${PATH}" ./configure --target-list=aarch64-softmmu --enable-plugins --enable-tpm && \
4343
PATH="/usr/lib/ccache:${PATH}" ninja -C build qemu-system-aarch64 && \
4444
ninja -C build install && \
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
2-
index aa09d7a..c579197 100644
2+
index aa09d7a091..0bb74197d2 100644
33
--- a/hw/arm/sbsa-ref.c
44
+++ b/hw/arm/sbsa-ref.c
55
@@ -28,6 +28,8 @@
@@ -11,26 +11,36 @@ index aa09d7a..c579197 100644
1111
#include "exec/hwaddr.h"
1212
#include "kvm_arm.h"
1313
#include "hw/arm/boot.h"
14-
@@ -94,6 +96,7 @@ enum {
14+
@@ -94,6 +96,8 @@ enum {
1515
SBSA_SECURE_MEM,
1616
SBSA_AHCI,
1717
SBSA_XHCI,
1818
+ SBSA_TPM,
19+
+ SBSA_SECURE_UART_TEST,
1920
};
20-
21+
2122
struct SBSAMachineState {
22-
@@ -132,6 +135,7 @@ static const MemMapEntry sbsa_ref_memmap[] = {
23+
@@ -132,6 +136,8 @@ static const MemMapEntry sbsa_ref_memmap[] = {
2324
/* Space here reserved for more SMMUs */
2425
[SBSA_AHCI] = { 0x60100000, 0x00010000 },
2526
[SBSA_XHCI] = { 0x60110000, 0x00010000 },
2627
+ [SBSA_TPM] = { 0x60120000, 0x00010000 },
28+
+ [SBSA_SECURE_UART_TEST] = { 0x60130000, 0x00001000 },
2729
/* Space here reserved for other devices */
2830
[SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },
2931
/* 32-bit address PCIE MMIO space */
30-
@@ -631,6 +635,24 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
32+
@@ -154,6 +160,7 @@ static const int sbsa_ref_irqmap[] = {
33+
[SBSA_XHCI] = 11,
34+
[SBSA_SMMU] = 12, /* ... to 15 */
35+
[SBSA_GWDT_WS0] = 16,
36+
+ [SBSA_SECURE_UART_TEST] = 17,
37+
};
38+
39+
static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
40+
@@ -631,6 +638,24 @@ static void create_smmu(const SBSAMachineState *sms, PCIBus *bus)
3141
}
3242
}
33-
43+
3444
+static void create_tpm(SBSAMachineState *sbsa, PCIBus *bus)
3545
+{
3646
+ Error *errp = NULL;
@@ -52,12 +62,21 @@ index aa09d7a..c579197 100644
5262
static void create_pcie(SBSAMachineState *sms)
5363
{
5464
hwaddr base_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].base;
55-
@@ -688,6 +710,8 @@ static void create_pcie(SBSAMachineState *sms)
65+
@@ -688,6 +713,8 @@ static void create_pcie(SBSAMachineState *sms)
5666
pci_create_simple(pci->bus, -1, "bochs-display");
57-
67+
5868
create_smmu(sms, pci->bus);
5969
+
6070
+ create_tpm(sms, pci->bus);
6171
}
62-
72+
6373
static void *sbsa_ref_dtb(const struct arm_boot_info *binfo, int *fdt_size)
74+
@@ -810,6 +837,8 @@ static void sbsa_ref_init(MachineState *machine)
75+
create_uart(sms, SBSA_SECURE_UART, secure_sysmem, serial_hd(1));
76+
/* Second secure UART for RAS and MM from EL0 */
77+
create_uart(sms, SBSA_SECURE_UART_MM, secure_sysmem, serial_hd(2));
78+
+ /* Test secure UART */
79+
+ create_uart(sms, SBSA_SECURE_UART_TEST, secure_sysmem, serial_hd(3));
80+
81+
create_rtc(sms);
82+

0 commit comments

Comments
 (0)