project: Add generic-arm64-virt-test-debug

Add config to run as a vm in non-secure mode.

Bug: 298710242
Change-Id: I128b3643fc60782faf8312761de97cbd04c7742f
diff --git a/project/generic-arm-inc.mk b/project/generic-arm-inc.mk
index f478a6a..fc6e34b 100644
--- a/project/generic-arm-inc.mk
+++ b/project/generic-arm-inc.mk
@@ -54,10 +54,11 @@
 # select timer
 ifeq (true,$(call TOBOOL,$(KERNEL_32BIT)))
 # 32 bit Secure EL1 with a 64 bit EL3 gets the non-secure physical timer
-GLOBAL_DEFINES += TIMER_ARM_GENERIC_SELECTED=CNTP
+TIMER_ARM_GENERIC_SELECTED ?= CNTP
 else
-GLOBAL_DEFINES += TIMER_ARM_GENERIC_SELECTED=CNTPS
+TIMER_ARM_GENERIC_SELECTED ?= CNTPS
 endif
+GLOBAL_DEFINES += TIMER_ARM_GENERIC_SELECTED=$(TIMER_ARM_GENERIC_SELECTED)
 
 #
 # GLOBAL definitions
@@ -134,13 +135,20 @@
 # Modules to be compiled into lk.bin
 #
 MODULES += \
-	trusty/kernel/lib/sm \
 	trusty/kernel/lib/trusty \
-	trusty/kernel/lib/memlog \
 	trusty/kernel/lib/metrics \
 	trusty/kernel/services/apploader \
 	trusty/kernel/services/smc \
 
+# Add lib/sm by default but allow building without it
+LIB_SM_ENABLED ?= true
+ifeq (true,$(call TOBOOL,$(LIB_SM_ENABLED)))
+    MODULES += \
+		trusty/kernel/lib/memlog \
+		trusty/kernel/lib/sm \
+
+endif
+
 #
 # Set user space arch
 #
diff --git a/project/generic-arm-virt-inc.mk b/project/generic-arm-virt-inc.mk
new file mode 100644
index 0000000..a11912f
--- /dev/null
+++ b/project/generic-arm-virt-inc.mk
@@ -0,0 +1,32 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# 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
+#
+#      http://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.
+#
+
+ARM64_BOOT_PROTOCOL := X0_DTB
+
+# Derive RPMB key using HKDF
+WITH_HKDF_RPMB_KEY ?= true
+
+# Always allow provisioning for emulator builds
+STATIC_SYSTEM_STATE_FLAG_PROVISIONING_ALLOWED := 1
+
+LIB_SM_ENABLED := false
+WITH_TRUSTY_VIRTIO_IPC_DEV := false
+
+# Disable for quicker boot since the uart output is much slower than the smc to el3
+GENERIC_ARM64_DEBUG := UART
+
+GIC_VERSION := 3
+GLOBAL_DEFINES += ARM_GIC_SELECTED_IRQ_GROUP=GRP1NS
+TIMER_ARM_GENERIC_SELECTED ?= CNTV
diff --git a/project/generic-arm32-virt-test-debug.mk b/project/generic-arm32-virt-test-debug.mk
new file mode 100644
index 0000000..82840a4
--- /dev/null
+++ b/project/generic-arm32-virt-test-debug.mk
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# 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
+#
+#      http://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 project/generic-arm-virt-inc.mk
+include project/generic-arm32-test-debug-inc.mk
diff --git a/project/generic-arm64-virt-test-debug.mk b/project/generic-arm64-virt-test-debug.mk
new file mode 100644
index 0000000..968e90b
--- /dev/null
+++ b/project/generic-arm64-virt-test-debug.mk
@@ -0,0 +1,17 @@
+# Copyright (C) 2023 The Android Open Source Project
+#
+# 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
+#
+#      http://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 project/generic-arm-virt-inc.mk
+include project/generic-arm64-test-debug-inc.mk