Use debug log SMC in tests rather than writing directly to UART.
Bug: 115484857
Change-Id: I67f94e740420f8e071bdb7a42712cc93690296d9
diff --git a/build/toolchain/embedded.gni b/build/toolchain/embedded.gni
index 462bbfa..e608c61 100644
--- a/build/toolchain/embedded.gni
+++ b/build/toolchain/embedded.gni
@@ -354,11 +354,9 @@
# Toolchain for building test VMs which run under Hafnium.
aarch64_toolchain("${target_name}_vm") {
- # TODO(b/115484857): Remove access to PL011 from VMs.
forward_variables_from(invoker,
[
"origin_address",
- "console",
"gic_version",
"gicd_base_address",
"gicr_base_address",
@@ -366,6 +364,7 @@
"toolchain_args",
])
cpu = "${invoker.cpu}+fp"
+ console = "//src/arch/aarch64/hftest:console"
# Nonsense values because they are required but shouldn't be used.
heap_pages = 0
diff --git a/inc/hf/plat/console.h b/inc/hf/plat/console.h
index dbce103..8fb4969 100644
--- a/inc/hf/plat/console.h
+++ b/inc/hf/plat/console.h
@@ -18,7 +18,6 @@
#include "hf/mm.h"
#include "hf/mpool.h"
-#include "hf/vm.h"
/** Initialises the console hardware. */
void plat_console_init(void);
@@ -27,8 +26,5 @@
void plat_console_mm_init(struct mm_stage1_locked stage1_locked,
struct mpool *ppool);
-/** Initialises any per-VM memory mappings that the console driver needs. */
-void plat_console_vm_mm_init(struct vm *vm, struct mpool *ppool);
-
/** Puts a single character on the console. */
void plat_console_putchar(char c);
diff --git a/src/arch/aarch64/hftest/BUILD.gn b/src/arch/aarch64/hftest/BUILD.gn
index 6c3938a..4c5dace 100644
--- a/src/arch/aarch64/hftest/BUILD.gn
+++ b/src/arch/aarch64/hftest/BUILD.gn
@@ -69,3 +69,13 @@
"registers.c",
]
}
+
+source_set("console") {
+ sources = [
+ "console.c",
+ ]
+
+ deps = [
+ "//src/arch/aarch64/hftest:hf_call",
+ ]
+}
diff --git a/src/arch/aarch64/hftest/console.c b/src/arch/aarch64/hftest/console.c
new file mode 100644
index 0000000..4e2f4e8
--- /dev/null
+++ b/src/arch/aarch64/hftest/console.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2019 The Hafnium Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "hf/plat/console.h"
+
+#include "vmapi/hf/call.h"
+
+void plat_console_putchar(char c)
+{
+ hf_debug_log(c);
+}
diff --git a/src/arch/aarch64/pl011/pl011.c b/src/arch/aarch64/pl011/pl011.c
index bf7186c..9afc3b9 100644
--- a/src/arch/aarch64/pl011/pl011.c
+++ b/src/arch/aarch64/pl011/pl011.c
@@ -18,7 +18,6 @@
#include "hf/mm.h"
#include "hf/mpool.h"
#include "hf/plat/console.h"
-#include "hf/vm.h"
/* UART Data Register. */
#define UARTDR IO32_C(PL011_BASE + 0x0)
@@ -46,15 +45,6 @@
MM_MODE_R | MM_MODE_W | MM_MODE_D, ppool);
}
-/* TODO: Remove this. */
-void plat_console_vm_mm_init(struct vm *vm, struct mpool *ppool)
-{
- /* Grant VM access to UART. */
- mm_vm_identity_map(&vm->ptable, pa_init(PL011_BASE),
- pa_add(pa_init(PL011_BASE), PAGE_SIZE),
- MM_MODE_R | MM_MODE_W, NULL, ppool);
-}
-
void plat_console_putchar(char c)
{
/* Print a carriage-return as well. */
diff --git a/src/load.c b/src/load.c
index 8b1dce3..78b5777 100644
--- a/src/load.c
+++ b/src/load.c
@@ -331,8 +331,6 @@
continue;
}
- plat_console_vm_mm_init(vm, ppool);
-
/* Grant the VM access to the memory. */
if (!mm_vm_identity_map(&vm->ptable, secondary_mem_begin,
secondary_mem_end,
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index 3fa902e..dcb4634 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -165,11 +165,13 @@
def hftest_lines(raw):
- return [
- line[len(HFTEST_LOG_PREFIX):]
- for line in raw.splitlines()
- if line.startswith(HFTEST_LOG_PREFIX)
- ]
+ lines = []
+ for line in raw.splitlines():
+ if line.startswith("VM "):
+ line = line[len("VM 0: "):]
+ if line.startswith(HFTEST_LOG_PREFIX):
+ lines.append(line[len(HFTEST_LOG_PREFIX):])
+ return lines
def Main():