linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Kunwu Chan <kunwu.chan@linux.dev>
To: Fuad Tabba <tabba@google.com>, kvmarm <kvmarm@lists.linux.dev>,
	arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v1 1/8] KVM: arm64: Rename pkvm.enabled to pkvm.is_protected
Date: Fri, 8 Aug 2025 19:32:54 +0800	[thread overview]
Message-ID: <3c52f485-cde4-44ef-8ffd-a61a671359db@linux.dev> (raw)
In-Reply-To: <20250729120014.2799359-2-tabba@google.com>

On 2025/7/29 20:00, Fuad Tabba wrote:
> The 'pkvm.enabled' field in struct kvm_protected_vm is confusingly named.
> Its purpose is to indicate whether a VM is a pKVM protected VM, not
> whether the VM itself is enabled or running.
> 
> For a non-protected VM, the VM can be fully active, yet this field would
> be false. This ambiguity can lead to incorrect assumptions about the VM's
> operational state and makes the code harder to reason about.
> 
> Rename the field to 'is_protected' to make it unambiguous that the flag
> tracks the protected status of the VM.
> 
> No functional change intended.
> 
lgtm

> Signed-off-by: Fuad Tabba <tabba@google.com>
> ---
>   arch/arm64/include/asm/kvm_host.h | 4 ++--
>   arch/arm64/kvm/hyp/nvhe/pkvm.c    | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 3e41a880b062..55dc7cd83e40 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -252,7 +252,7 @@ struct kvm_protected_vm {
>   	pkvm_handle_t handle;
>   	struct kvm_hyp_memcache teardown_mc;
>   	struct kvm_hyp_memcache stage2_teardown_mc;
> -	bool enabled;
> +	bool is_protected;
>   };
>   
>   struct kvm_mpidr_data {
> @@ -1522,7 +1522,7 @@ struct kvm *kvm_arch_alloc_vm(void);
>   
>   #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
>   
> -#define kvm_vm_is_protected(kvm)	(is_protected_kvm_enabled() && (kvm)->arch.pkvm.enabled)
> +#define kvm_vm_is_protected(kvm)	(is_protected_kvm_enabled() && (kvm)->arch.pkvm.is_protected)
>   
>   #define vcpu_is_protected(vcpu)		kvm_vm_is_protected((vcpu)->kvm)
>   
> diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> index 338505cb0171..6198c1d27b5b 100644
> --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
> +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> @@ -406,7 +406,7 @@ static void init_pkvm_hyp_vm(struct kvm *host_kvm, struct pkvm_hyp_vm *hyp_vm,
>   	hyp_vm->host_kvm = host_kvm;
>   	hyp_vm->kvm.created_vcpus = nr_vcpus;
>   	hyp_vm->kvm.arch.mmu.vtcr = host_mmu.arch.mmu.vtcr;
> -	hyp_vm->kvm.arch.pkvm.enabled = READ_ONCE(host_kvm->arch.pkvm.enabled);
> +	hyp_vm->kvm.arch.pkvm.is_protected = READ_ONCE(host_kvm->arch.pkvm.is_protected);
>   	hyp_vm->kvm.arch.flags = 0;
>   	pkvm_init_features_from_host(hyp_vm, host_kvm);
>   }

Reviewed-by: Kunwu Chan <chentao@kylinos.cn>

-- 
Thanks,
        Kunwu Chan.



  parent reply	other threads:[~2025-08-08 12:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 12:00 [PATCH v1 0/8] KVM: arm64: Reserve pKVM VM handle during initial VM setup Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 1/8] KVM: arm64: Rename pkvm.enabled to pkvm.is_protected Fuad Tabba
2025-08-03  6:10   ` Wei-Lin Chang
2025-08-04  7:00     ` Fuad Tabba
2025-08-04 12:20       ` Wei-Lin Chang
2025-08-08 11:32   ` Kunwu Chan [this message]
2025-07-29 12:00 ` [PATCH v1 2/8] KVM: arm64: Rename 'host_kvm' to 'kvm' in pKVM host code Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 3/8] KVM: arm64: Clarify comments to distinguish pKVM mode from protected VMs Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 4/8] KVM: arm64: Decouple hyp VM creation state from its handle Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 5/8] KVM: arm64: Separate allocation and insertion of pKVM VM table entries Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 6/8] KVM: arm64: Consolidate pKVM hypervisor VM initialization logic Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 7/8] KVM: arm64: Introduce separate hypercalls for pKVM VM reservation and initialization Fuad Tabba
2025-07-29 12:00 ` [PATCH v1 8/8] KVM: arm64: Reserve pKVM handle during pkvm_init_host_vm() Fuad Tabba

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=3c52f485-cde4-44ef-8ffd-a61a671359db@linux.dev \
    --to=kunwu.chan@linux.dev \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=tabba@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).