Avoid including vm.h header in tests.

Bug: 115484857
Change-Id: I3145826c057d28ddab2c830361a5881e4455f016
diff --git a/build/toolchain/embedded.gni b/build/toolchain/embedded.gni
index e608c61..d6a6102 100644
--- a/build/toolchain/embedded.gni
+++ b/build/toolchain/embedded.gni
@@ -368,6 +368,6 @@
 
     # Nonsense values because they are required but shouldn't be used.
     heap_pages = 0
-    max_vms = 1
+    max_vms = 0
   }
 }
diff --git a/build/toolchain/platform.gni b/build/toolchain/platform.gni
index 8e9feea..4e30a1b 100644
--- a/build/toolchain/platform.gni
+++ b/build/toolchain/platform.gni
@@ -28,5 +28,5 @@
   plat_max_cpus = 1
 
   # The maximum number of VMs required for the platform.
-  plat_max_vms = 1
+  plat_max_vms = 0
 }
diff --git a/inc/hf/dlog.h b/inc/hf/dlog.h
index 01dddd9..f36c428 100644
--- a/inc/hf/dlog.h
+++ b/inc/hf/dlog.h
@@ -17,8 +17,9 @@
 #pragma once
 
 #include <stdarg.h>
+#include <stddef.h>
 
-#include "vm.h"
+#include "hf/spci.h"
 
 #if DEBUG
 void dlog_enable_lock(void);
@@ -30,4 +31,4 @@
 #define vdlog(fmt, args)
 #endif
 
-void dlog_flush_vm_buffer(struct vm_locked vm);
+void dlog_flush_vm_buffer(spci_vm_id_t id, char buffer[], size_t length);
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();