linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Make HCX writable from userspace
@ 2025-03-25 12:11 Jinqian Yang
  2025-03-25 16:20 ` Oliver Upton
  0 siblings, 1 reply; 3+ messages in thread
From: Jinqian Yang @ 2025-03-25 12:11 UTC (permalink / raw)
  To: maz, oliver.upton, yuzenghui
  Cc: linux-arm-kernel, kvmarm, linux-kernel, wangzhou1,
	shameerali.kolothum.thodi, liuyonglong, jiangkunkun, yangjinqian1

Allow userspace to modify guest visible value for HCX in
ID_AA64MMFR1_EL1.

Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com>
---
 arch/arm64/kvm/sys_regs.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 82430c1e1dd0..b105f156bdf6 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -2666,7 +2666,6 @@ static const struct sys_reg_desc sys_reg_descs[] = {
 					ID_AA64MMFR0_EL1_TGRAN16_2 |
 					ID_AA64MMFR0_EL1_ASIDBITS)),
 	ID_WRITABLE(ID_AA64MMFR1_EL1, ~(ID_AA64MMFR1_EL1_RES0 |
-					ID_AA64MMFR1_EL1_HCX |
 					ID_AA64MMFR1_EL1_TWED |
 					ID_AA64MMFR1_EL1_XNX |
 					ID_AA64MMFR1_EL1_VH |
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: Make HCX writable from userspace
  2025-03-25 12:11 [PATCH] KVM: arm64: Make HCX writable from userspace Jinqian Yang
@ 2025-03-25 16:20 ` Oliver Upton
  2025-05-27 13:05   ` Jinqian Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Upton @ 2025-03-25 16:20 UTC (permalink / raw)
  To: Jinqian Yang
  Cc: maz, yuzenghui, linux-arm-kernel, kvmarm, linux-kernel, wangzhou1,
	shameerali.kolothum.thodi, liuyonglong, jiangkunkun

Hi Jinqian,

On Tue, Mar 25, 2025 at 08:11:26PM +0800, Jinqian Yang wrote:
> Allow userspace to modify guest visible value for HCX in
> ID_AA64MMFR1_EL1.
> 
> Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com>

This is fine, but I would rather we handle all the features like FEAT_HCX
instead of a trickle of one-off patches.

So, could you please:

 - Identify all of the features that describe an *EL2* feature which
   we've exposed to non-nested VMs
 
 - Implement patch(es) to make those fields writable (i.e. allow them to
   be downgraded)

 - Add corresponding test cases to the set_id_regs selftest

Thanks,
Oliver

> ---
>  arch/arm64/kvm/sys_regs.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 82430c1e1dd0..b105f156bdf6 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -2666,7 +2666,6 @@ static const struct sys_reg_desc sys_reg_descs[] = {
>  					ID_AA64MMFR0_EL1_TGRAN16_2 |
>  					ID_AA64MMFR0_EL1_ASIDBITS)),
>  	ID_WRITABLE(ID_AA64MMFR1_EL1, ~(ID_AA64MMFR1_EL1_RES0 |
> -					ID_AA64MMFR1_EL1_HCX |
>  					ID_AA64MMFR1_EL1_TWED |
>  					ID_AA64MMFR1_EL1_XNX |
>  					ID_AA64MMFR1_EL1_VH |
> -- 
> 2.33.0
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: Make HCX writable from userspace
  2025-03-25 16:20 ` Oliver Upton
@ 2025-05-27 13:05   ` Jinqian Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Jinqian Yang @ 2025-05-27 13:05 UTC (permalink / raw)
  To: Oliver Upton
  Cc: maz, yuzenghui, linux-arm-kernel, kvmarm, linux-kernel, wangzhou1,
	shameerali.kolothum.thodi, liuyonglong, jiangkunkun


> Hi Jinqian,
>
> On Tue, Mar 25, 2025 at 08:11:26PM +0800, Jinqian Yang wrote:
>> Allow userspace to modify guest visible value for HCX in
>> ID_AA64MMFR1_EL1.
>>
>> Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com>
>
> This is fine, but I would rather we handle all the features like FEAT_HCX
> instead of a trickle of one-off patches.
>
> So, could you please:
>
> - Identify all of the features that describe an *EL2* feature which
>   we've exposed to non-nested VMs
>
> - Implement patch(es) to make those fields writable (i.e. allow them to
>   be downgraded)
>
> - Add corresponding test cases to the set_id_regs selftest
>
> Thanks,
> Oliver
>
Hi Oliver,

Thanks for the detailed explantation!

During our testing of cross-generation live migration, we encountered
an issue that requires applying the patch. The problem arises when two
chips have inconsistent FEAT_HCX. To ensure consistent virtual machine
behavior before and after migration, we need to make FEAT_HCX writable,
thereby aligning the feature flags across source and destination hosts.


Above is the context of this patch. I will revise this patch following your
suggestions, but I need to confirm: does the term *EL2* feature specifically
refer to capabilities related to ​​HCRX_EL2​​ and ​​HCR_EL2​​?

Jinqian


>> ---
>>  arch/arm64/kvm/sys_regs.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
>> index 82430c1e1dd0..b105f156bdf6 100644
>> --- a/arch/arm64/kvm/sys_regs.c
>> +++ b/arch/arm64/kvm/sys_regs.c
>> @@ -2666,7 +2666,6 @@ static const struct sys_reg_desc 
>> sys_reg_descs[] = {
>>                      ID_AA64MMFR0_EL1_TGRAN16_2 |
>>                      ID_AA64MMFR0_EL1_ASIDBITS)),
>>      ID_WRITABLE(ID_AA64MMFR1_EL1, ~(ID_AA64MMFR1_EL1_RES0 |
>> -                    ID_AA64MMFR1_EL1_HCX |
>>                      ID_AA64MMFR1_EL1_TWED |
>>                      ID_AA64MMFR1_EL1_XNX |
>>                      ID_AA64MMFR1_EL1_VH |
>> -- 
>> 2.33.0
>>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-27 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 12:11 [PATCH] KVM: arm64: Make HCX writable from userspace Jinqian Yang
2025-03-25 16:20 ` Oliver Upton
2025-05-27 13:05   ` Jinqian Yang

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).