Avoid including vm.h header in tests.

Bug: 115484857
Change-Id: I3145826c057d28ddab2c830361a5881e4455f016
diff --git a/src/api.c b/src/api.c
index c8778cb..b3cab1a 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1664,7 +1664,9 @@
 
 	if (c == '\n' || c == '\0' ||
 	    vm->log_buffer_length == sizeof(vm->log_buffer)) {
-		dlog_flush_vm_buffer(vm_locked);
+		dlog_flush_vm_buffer(vm->id, vm->log_buffer,
+				     vm->log_buffer_length);
+		vm->log_buffer_length = 0;
 	} else {
 		vm->log_buffer[vm->log_buffer_length++] = c;
 	}
diff --git a/src/dlog.c b/src/dlog.c
index 453a597..1b0a793 100644
--- a/src/dlog.c
+++ b/src/dlog.c
@@ -20,9 +20,9 @@
 #include <stddef.h>
 
 #include "hf/plat/console.h"
+#include "hf/spci.h"
 #include "hf/spinlock.h"
 #include "hf/std.h"
-#include "hf/vm.h"
 
 /* Keep macro alignment */
 /* clang-format off */
@@ -215,19 +215,18 @@
  * Send the contents of the given VM's log buffer to the log, preceded by the VM
  * ID and followed by a newline.
  */
-void dlog_flush_vm_buffer(struct vm_locked vm)
+void dlog_flush_vm_buffer(spci_vm_id_t id, char buffer[], size_t length)
 {
 	lock();
 
 	print_raw_string("VM ");
-	print_num(vm.vm->id, 10, 0, 0);
+	print_num(id, 10, 0, 0);
 	print_raw_string(": ");
 
-	for (size_t i = 0; i < vm.vm->log_buffer_length; ++i) {
-		plat_console_putchar(vm.vm->log_buffer[i]);
-		vm.vm->log_buffer[i] = '\0';
+	for (size_t i = 0; i < length; ++i) {
+		plat_console_putchar(buffer[i]);
+		buffer[i] = '\0';
 	}
-	vm.vm->log_buffer_length = 0;
 	plat_console_putchar('\n');
 
 	unlock();