Skip to content

Commit de94dd5

Browse files
committed
RISC-V: KVM: Reflect CoVE TAP address to TSM
Retrieve the TVM attestation payload (TAP) address passed by the VMM and reflect it to TEE security monitor (TSM) during the creation of the TEE virtual machine (TVM) via the promote call. Signed-off-by: Wojciech Ozga <woz@zurich.ibm.com>
1 parent c0179f7 commit de94dd5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

arch/riscv/include/asm/kvm_cove.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ struct kvm_cove_tvm_context {
9292
/* TODO: This is not really a VMID as TSM returns the page owner ID instead of VMID */
9393
unsigned long tvm_guest_id;
9494

95+
/* Address of TVM Attestation Payload (TAP) */
96+
unsigned long cove_tap_addr;
97+
9598
/* Pages where TVM page table is stored */
9699
struct kvm_riscv_cove_page pgtable;
97100

arch/riscv/kvm/cove.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ void noinstr kvm_riscv_cove_vcpu_switchto(struct kvm_vcpu *vcpu, struct kvm_cpu_
605605
if (is_cove_vm_multi_step_initializing(vcpu->kvm)) {
606606
rc = sbi_covh_tsm_finalize_tvm(tvmc->tvm_guest_id, cntx->sepc, cntx->a1);
607607
} else if (is_cove_vm_single_step_initializing(vcpu->kvm)) {
608-
rc = sbi_covh_tsm_promote_to_tvm(cntx->a1, 0, cntx->sepc, &tvmc->tvm_guest_id);
608+
rc = sbi_covh_tsm_promote_to_tvm(cntx->a1, tvmc->cove_tap_addr, cntx->sepc,
609+
&tvmc->tvm_guest_id);
609610
} else {
610611
rc = -EOPNOTSUPP;
611612
}
@@ -746,6 +747,10 @@ int kvm_riscv_cove_vm_measure_pages(struct kvm *kvm, struct kvm_riscv_cove_measu
746747
return -EINVAL;
747748
}
748749

750+
if (mr->type == KVM_RISCV_COVE_REGION_COVE_TAP) {
751+
tvmc->cove_tap_addr = mr->gpa;
752+
}
753+
749754
if (!is_cove_vm_multi_step_initializing(kvm))
750755
return 0;
751756

arch/riscv/kvm/vm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
237237

238238
switch (ioctl) {
239239
case KVM_RISCV_COVE_MEASURE_REGION:
240-
if (!is_cove_vm_multi_step_initializing(kvm))
241-
return -EINVAL;
242240
if (copy_from_user(&mr, argp, sizeof(mr)))
243241
return -EFAULT;
244242

0 commit comments

Comments
 (0)