From: Quentin Perret <qperret@google.com>
To: Fuad Tabba <tabba@google.com>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
maz@kernel.org, oliver.upton@linux.dev, mark.rutland@arm.com,
will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com, catalin.marinas@arm.com,
broonie@kernel.org, vdonnefort@google.com
Subject: Re: [PATCH v2 3/4] KVM: arm64: Factor out pKVM hyp vcpu creation to separate function
Date: Fri, 28 Feb 2025 19:44:47 +0000 [thread overview]
Message-ID: <Z8ISLxQRcsx2uuHw@google.com> (raw)
In-Reply-To: <20250226215520.1759218-4-tabba@google.com>
On Wednesday 26 Feb 2025 at 21:55:19 (+0000), Fuad Tabba wrote:
> static int __pkvm_create_hyp_vm(struct kvm *host_kvm)
> {
> - size_t pgd_sz, hyp_vm_sz, hyp_vcpu_sz;
> + size_t pgd_sz, hyp_vm_sz;
> struct kvm_vcpu *host_vcpu;
> - pkvm_handle_t handle;
> void *pgd, *hyp_vm;
> unsigned long idx;
> int ret;
> @@ -161,33 +178,12 @@ static int __pkvm_create_hyp_vm(struct kvm *host_kvm)
> if (ret < 0)
> goto free_vm;
>
> - handle = ret;
> + WRITE_ONCE(host_kvm->arch.pkvm.handle, ret);
What's the reason to make this a WRITE_ONCE? Does it mean we should
update the readers to be READ_ONCE()?
> - host_kvm->arch.pkvm.handle = handle;
> -
> - /* Donate memory for the vcpus at hyp and initialize it. */
> - hyp_vcpu_sz = PAGE_ALIGN(PKVM_HYP_VCPU_SIZE);
> kvm_for_each_vcpu(idx, host_vcpu, host_kvm) {
> - void *hyp_vcpu;
> -
> - /* Indexing of the vcpus to be sequential starting at 0. */
> - if (WARN_ON(host_vcpu->vcpu_idx != idx)) {
> - ret = -EINVAL;
> - goto destroy_vm;
> - }
> -
> - hyp_vcpu = alloc_pages_exact(hyp_vcpu_sz, GFP_KERNEL_ACCOUNT);
> - if (!hyp_vcpu) {
> - ret = -ENOMEM;
> - goto destroy_vm;
> - }
> -
> - ret = kvm_call_hyp_nvhe(__pkvm_init_vcpu, handle, host_vcpu,
> - hyp_vcpu);
> - if (ret) {
> - free_pages_exact(hyp_vcpu, hyp_vcpu_sz);
> + ret = __pkvm_create_hyp_vcpu(host_vcpu);
> + if (ret)
> goto destroy_vm;
> - }
> }
>
> return 0;
> --
> 2.48.1.711.g2feabab25a-goog
>
next prev parent reply other threads:[~2025-02-28 19:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 21:55 [PATCH v2 0/4] KVM: arm64: Fix initializing HCRX_EL2 and other traps in pKVM Fuad Tabba
2025-02-26 21:55 ` [PATCH v2 1/4] KVM: arm64: Factor out setting HCRX_EL2 traps into separate function Fuad Tabba
2025-02-26 21:55 ` [PATCH v2 2/4] KVM: arm64: Initialize HCRX_EL2 traps in pKVM Fuad Tabba
2025-02-26 21:55 ` [PATCH v2 3/4] KVM: arm64: Factor out pKVM hyp vcpu creation to separate function Fuad Tabba
2025-02-28 19:44 ` Quentin Perret [this message]
2025-03-03 7:57 ` Fuad Tabba
2025-03-03 19:18 ` Will Deacon
2025-03-03 19:21 ` Fuad Tabba
2025-03-03 21:49 ` Will Deacon
2025-03-04 12:33 ` Fuad Tabba
2025-03-12 15:29 ` Will Deacon
2025-03-12 15:31 ` Fuad Tabba
2025-03-14 11:14 ` Will Deacon
2025-02-26 21:55 ` [PATCH v2 4/4] KVM: arm64: Create each pKVM hyp vcpu after its corresponding host vcpu Fuad Tabba
2025-02-27 12:09 ` Marc Zyngier
2025-02-27 12:47 ` Fuad Tabba
2025-02-27 14:13 ` Marc Zyngier
2025-02-27 14:13 ` [PATCH v2 0/4] KVM: arm64: Fix initializing HCRX_EL2 and other traps in pKVM Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8ISLxQRcsx2uuHw@google.com \
--to=qperret@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.com \
--cc=vdonnefort@google.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.