debug prints
diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c index 644d7aa..f35d578 100644 --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
@@ -19,10 +19,14 @@ #include <nvhe/mem_protect.h> #include <nvhe/mm.h> +#include "../debug-pl011.h" + #define KVM_HOST_S2_FLAGS (KVM_PGTABLE_S2_NOFWB | KVM_PGTABLE_S2_IDMAP) struct host_mmu host_mmu; +static u64 total_host_share_guest_count; + static struct hyp_pool host_s2_pool; static DEFINE_PER_CPU(struct pkvm_hyp_vm *, __current_vm); @@ -1775,6 +1779,12 @@ int __pkvm_host_share_guest(u64 pfn, u64 gfn, struct pkvm_hyp_vcpu *vcpu, if (!page->host_share_guest_count) WARN_ON(__host_set_page_state_range(host_addr, PAGE_SIZE, PKVM_PAGE_SHARED_OWNED)); page->host_share_guest_count++; + total_host_share_guest_count++; + hyp_puts(">>> Share"); + hyp_putx64(host_addr); + hyp_putx32(page->host_share_guest_count); + hyp_putx64(total_host_share_guest_count); + hyp_puts("<<<"); WARN_ON(kvm_pgtable_stage2_map(&vm->pgt, guest_addr, PAGE_SIZE, host_addr, pkvm_mkstate(prot, PKVM_PAGE_SHARED_BORROWED), @@ -1848,8 +1858,14 @@ int __pkvm_host_unshare_guest(u64 pfn, u64 gfn, struct pkvm_hyp_vm *hyp_vm) goto unlock; page->host_share_guest_count--; + total_host_share_guest_count--; if (!page->host_share_guest_count) WARN_ON(__host_set_page_state_range(host_addr, PAGE_SIZE, PKVM_PAGE_OWNED)); + hyp_puts(">>> Unshare"); + hyp_putx64(host_addr); + hyp_putx32(page->host_share_guest_count); + hyp_putx64(total_host_share_guest_count); + hyp_puts("<<<"); unlock: guest_unlock_component(hyp_vm); @@ -1998,6 +2014,12 @@ static int ___pkvm_host_do_reclaim_page(struct pkvm_hyp_vm *vm, u64 phys, u64 ip WARN_ON(kvm_vm_is_protected(&vm->kvm)); WARN_ON(__host_check_page_state_range(phys, PAGE_SIZE, PKVM_PAGE_SHARED_OWNED, true)); page->host_share_guest_count--; + total_host_share_guest_count--; + hyp_puts(">>> Reclaim"); + hyp_putx64(phys); + hyp_putx32(page->host_share_guest_count); + hyp_putx64(total_host_share_guest_count); + hyp_puts("<<<"); if (page->host_share_guest_count) return 0; break;