Thread (112 messages) flat view 112 messages, 12 authors, 9d ago

Re: [PATCH v16 21/45] KVM: arm64: CCA: Handle realm enter/exit

From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
Date: 2026-08-04 13:36:23
Also in: kvm, kvmarm, linux-coco, lkml

Steven Price [off-list ref] writes:
+
+	switch (rec->run->exit.exit_reason) {
+	case RMI_EXIT_SYNC:
+		/*
+		 * HPFAR_EL2_NS is hijacked to indicate a valid HPFAR value,
+		 * see __get_fault_info()
+		 */
+		vcpu->arch.fault.hpfar_el2 = rec->run->exit.hpfar | HPFAR_EL2_NS;
+		rec_exit_sync(vcpu);
+		return ARM_EXCEPTION_TRAP;
+	case RMI_EXIT_IRQ:
+	case RMI_EXIT_FIQ:
+		return ARM_EXCEPTION_IRQ;
+	case RMI_EXIT_SERROR:
+		return ARM_EXCEPTION_EL1_SERROR;
+	case RMI_EXIT_PSCI:
+		rec_exit_hvc(vcpu);
+		kvm_make_request(KVM_REQ_RMI, vcpu);
I'm also wondering whether we can move the kvm_make_request() call until
after the PSCI/HOST_CALL handling is complete. I tried a quick hack, but
it did not look particularly clean, since we would end up adding
RMM-specific checks in handle_hvc():

ret = kvm_smccc_call_handler(vcpu);

if (vcpu_is_rec(vcpu) &&
    (vcpu->arch.rec.run->exit.exit_reason == RMI_EXIT_PSCI ||
     vcpu->arch.rec.run->exit.exit_reason == RMI_EXIT_HOST_CALL))
	kvm_make_request(KVM_REQ_RMI, vcpu);

That said, having rec_exit_hvc(vcpu) and kvm_make_request() back-to-back
is also somewhat confusing. Perhaps we could at least add a comment
explaining why the request must always be made here.

+		return ARM_EXCEPTION_TRAP;
+	case RMI_EXIT_RIPAS_CHANGE:
+		rec_exit_hvc(vcpu);
+		return ARM_EXCEPTION_TRAP;
+	}
+
+	return rec_exit_fatal(vcpu, "Unsupported Realm exit reason",
+			      rec->run->exit.exit_reason);
+}
-aneesh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help