arch-arm: Add ArmRelease factory function to be used in KVM mode

From gem5 v22.0, EL2 and EL3 are automatically implemented
in the default release object [1]. This means any FS simulation
will start at EL3, which is the highest implemented EL.

Unfortunately this doesn't work in KVM mode, which is assuming
a VM does not start at EL3:

As soon as updateKvmState is called [2] gem5 tries to set
the VM PSTATE to EL3 and KVM fails the ioctl PSTATE write

[1]: https://gem5-review.googlesource.com/c/public/gem5/+/51011
[2]: https://github.com/gem5/gem5/blob/v22.0.0.2/\
    src/arch/arm/kvm/armv8_cpu.cc#L237

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: Icf951bcfb47e0c2ff9abe64b1b9006934303ad48
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64072
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py
index 3994aee..936c032 100644
--- a/src/arch/arm/ArmSystem.py
+++ b/src/arch/arm/ArmSystem.py
@@ -41,6 +41,8 @@
 from m5.objects.System import System
 from m5.objects.ArmSemihosting import ArmSemihosting
 
+from typing import Any
+
 
 class SveVectorLength(UInt8):
     min = 1
@@ -108,6 +110,17 @@
         else:
             return True
 
+    @classmethod
+    def for_kvm(cls) -> Any:
+        """
+        Generates an ArmRelease for KVM. It simply extracts EL2/EL3 support
+        from the current cls object
+        """
+        release = cls()
+        release.remove(ArmExtension("SECURITY"))
+        release.remove(ArmExtension("VIRTUALIZATION"))
+        return release
+
 
 class Armv8(ArmRelease):
     extensions = ["LPAE", "VIRTUALIZATION", "SECURITY"]