[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/22] hw/arm/virt: Add support for Arm RME
From: |
Jean-Philippe Brucker |
Subject: |
[PATCH v2 05/22] hw/arm/virt: Add support for Arm RME |
Date: |
Fri, 19 Apr 2024 16:56:53 +0100 |
When confidential-guest-support is enabled for the virt machine, call
the RME init function, and add the RME flag to the VM type.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
v1->v2:
* Don't explicitly disable steal_time, it's now done through KVM capabilities
* Split patch
---
hw/arm/virt.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a9a913aead..07ad31876e 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -224,6 +224,11 @@ static const int a15irqmap[] = {
[VIRT_PLATFORM_BUS] = 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */
};
+static bool virt_machine_is_confidential(VirtMachineState *vms)
+{
+ return MACHINE(vms)->cgs;
+}
+
static void create_randomness(MachineState *ms, const char *node)
{
struct {
@@ -2111,10 +2116,11 @@ static void machvirt_init(MachineState *machine)
* if the guest has EL2 then we will use SMC as the conduit,
* and otherwise we will use HVC (for backwards compatibility and
* because if we're using KVM then we must use HVC).
+ * Realm guests must also use SMC.
*/
if (vms->secure && firmware_loaded) {
vms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
- } else if (vms->virt) {
+ } else if (vms->virt || virt_machine_is_confidential(vms)) {
vms->psci_conduit = QEMU_PSCI_CONDUIT_SMC;
} else {
vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC;
@@ -2917,6 +2923,7 @@ static HotplugHandler
*virt_machine_get_hotplug_handler(MachineState *machine,
static int virt_kvm_type(MachineState *ms, const char *type_str)
{
VirtMachineState *vms = VIRT_MACHINE(ms);
+ int rme_vm_type = kvm_arm_rme_vm_type(ms);
int max_vm_pa_size, requested_pa_size;
bool fixed_ipa;
@@ -2946,7 +2953,11 @@ static int virt_kvm_type(MachineState *ms, const char
*type_str)
* the implicit legacy 40b IPA setting, in which case the kvm_type
* must be 0.
*/
- return fixed_ipa ? 0 : requested_pa_size;
+ if (fixed_ipa) {
+ return 0;
+ }
+
+ return requested_pa_size | rme_vm_type;
}
static void virt_machine_class_init(ObjectClass *oc, void *data)
--
2.44.0
- [PATCH v2 14/22] target/arm/kvm-rme: Add Realm Personalization Value parameter, (continued)
- [PATCH v2 14/22] target/arm/kvm-rme: Add Realm Personalization Value parameter, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 19/22] target/arm/cpu: Inform about reading confidential CPU registers, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 21/22] hw/arm/virt: Move virt_flash_create() to machvirt_init(), Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 22/22] hw/arm/virt: Use RAM instead of flash for confidential guest firmware, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 17/22] target/arm/cpu: Set number of PMU counters in KVM, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 01/22] kvm: Merge kvm_check_extension() and kvm_vm_check_extension(), Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 05/22] hw/arm/virt: Add support for Arm RME,
Jean-Philippe Brucker <=
- [PATCH v2 15/22] target/arm/kvm-rme: Add measurement algorithm property, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 08/22] target/arm/kvm: Split kvm_arch_get/put_registers, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 07/22] hw/arm/virt: Reserve one bit of guest-physical address for RME, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 03/22] target/arm/kvm: Return immediately on error in kvm_arch_init(), Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 09/22] target/arm/kvm-rme: Initialize vCPU, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 10/22] target/arm/kvm: Create scratch VM as Realm if necessary, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 11/22] hw/core/loader: Add ROM loader notifier, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 13/22] hw/arm/boot: Register Linux BSS section for confidential guests, Jean-Philippe Brucker, 2024/04/19
- [PATCH v2 12/22] target/arm/kvm-rme: Populate Realm memory, Jean-Philippe Brucker, 2024/04/19