Revert "ANDROID: KVM: arm64: Change variable names to avoid confusing size and count"

This reverts commit 7ab22b914d.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I2fc71418a9145b7a548d15f790509e591b3e5811
This commit is contained in:
Will Deacon
2022-07-07 15:49:10 +01:00
parent 717816658d
commit 3fa7323143

View File

@@ -568,9 +568,8 @@ int __pkvm_init_shadow(struct kvm *kvm,
struct kvm_shadow_vm *vm = kern_hyp_va(shadow_va);
phys_addr_t shadow_pa = hyp_virt_to_phys(vm);
u64 pfn = hyp_phys_to_pfn(shadow_pa);
u64 nr_shadow_pages = shadow_size >> PAGE_SHIFT;
u64 nr_pgd_pages;
size_t pgd_size;
u64 nr_pages = shadow_size >> PAGE_SHIFT;
u64 pgd_size;
int nr_vcpus = 0;
int ret = 0;
@@ -593,16 +592,15 @@ int __pkvm_init_shadow(struct kvm *kvm,
if (ret)
goto err;
ret = __pkvm_host_donate_hyp(pfn, nr_shadow_pages);
ret = __pkvm_host_donate_hyp(pfn, nr_pages);
if (ret)
goto err;
/* Ensure we're working with a clean slate. */
memset(vm, 0, shadow_size);
vm->arch.vtcr = host_kvm.arch.vtcr;
pgd_size = kvm_pgtable_stage2_pgd_size(host_kvm.arch.vtcr);
nr_pgd_pages = pgd_size >> PAGE_SHIFT;
ret = __pkvm_host_donate_hyp(hyp_virt_to_pfn(pgd), nr_pgd_pages);
pgd_size = kvm_pgtable_stage2_pgd_size(vm->arch.vtcr) >> PAGE_SHIFT;
ret = __pkvm_host_donate_hyp(hyp_virt_to_pfn(pgd), pgd_size);
if (ret)
goto err_remove_mappings;
@@ -625,7 +623,7 @@ err_remove_shadow_table:
remove_shadow_table(vm->shadow_handle);
err_remove_pgd:
WARN_ON(__pkvm_hyp_donate_host(hyp_virt_to_pfn(pgd), nr_pgd_pages));
WARN_ON(__pkvm_hyp_donate_host(hyp_virt_to_pfn(pgd), pgd_size));
err_remove_mappings:
unpin_host_vcpus(vm);