All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Raghavendra Rao Ananta <rananta@google.com>,
	Marc Zyngier <maz@kernel.org>, Andrew Jones <drjones@redhat.com>,
	James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	Peter Shier <pshier@google.com>,
	linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 3/9] KVM: arm64: Add standard hypervisor firmware register
Date: Tue, 26 Apr 2022 14:37:27 +0800	[thread overview]
Message-ID: <9ac02210-437e-befd-cea5-2bfc57c00ec2@redhat.com> (raw)
In-Reply-To: <20220423000328.2103733-4-rananta@google.com>

On 4/23/22 8:03 AM, Raghavendra Rao Ananta wrote:
> Introduce the firmware register to hold the standard hypervisor
> service calls (owner value 5) as a bitmap. The bitmap represents
> the features that'll be enabled for the guest, as configured by
> the user-space. Currently, this includes support only for
> Paravirtualized time, represented by bit-0.
> 
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> ---
>   arch/arm64/include/asm/kvm_host.h |  2 ++
>   arch/arm64/include/uapi/asm/kvm.h |  3 +++
>   arch/arm64/kvm/hypercalls.c       | 21 ++++++++++++++++++---
>   include/kvm/arm_hypercalls.h      |  2 ++
>   4 files changed, 25 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index df07f4c10197..27d4b2a7970e 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -105,9 +105,11 @@ struct kvm_arch_memory_slot {
>    * struct kvm_smccc_features: Descriptor the hypercall services exposed to the guests
>    *
>    * @std_bmap: Bitmap of standard secure service calls
> + * @std_hyp_bmap: Bitmap of standard hypervisor service calls
>    */
>   struct kvm_smccc_features {
>   	unsigned long std_bmap;
> +	unsigned long std_hyp_bmap;
>   };
>   
>   struct kvm_arch {
> diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
> index 0b79d2dc6ffd..9eecc7ee8c14 100644
> --- a/arch/arm64/include/uapi/asm/kvm.h
> +++ b/arch/arm64/include/uapi/asm/kvm.h
> @@ -341,6 +341,9 @@ struct kvm_arm_copy_mte_tags {
>   #define KVM_REG_ARM_STD_BMAP			KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
>   #define KVM_REG_ARM_STD_BIT_TRNG_V1_0		0
>   
> +#define KVM_REG_ARM_STD_HYP_BMAP		KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
> +#define KVM_REG_ARM_STD_HYP_BIT_PV_TIME		0
> +
>   /* Device Control API: ARM VGIC */
>   #define KVM_DEV_ARM_VGIC_GRP_ADDR	0
>   #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS	1
> diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
> index df55a04d2fe8..f097bebdad39 100644
> --- a/arch/arm64/kvm/hypercalls.c
> +++ b/arch/arm64/kvm/hypercalls.c
> @@ -72,8 +72,6 @@ static bool kvm_hvc_call_default_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	 */
>   	case ARM_SMCCC_VERSION_FUNC_ID:
>   	case ARM_SMCCC_ARCH_FEATURES_FUNC_ID:
> -	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -	case ARM_SMCCC_HV_PV_TIME_ST:
>   	case ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID:
> @@ -95,6 +93,10 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	case ARM_SMCCC_TRNG_RND64:
>   		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_bmap,
>   						KVM_REG_ARM_STD_BIT_TRNG_V1_0);
> +	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> +	case ARM_SMCCC_HV_PV_TIME_ST:
> +		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME);
>   	default:
>   		return kvm_hvc_call_default_allowed(vcpu, func_id);
>   	}
> @@ -102,6 +104,7 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   {
> +	struct kvm_smccc_features *smccc_feat = &vcpu->kvm->arch.smccc_feat;
>   	u32 func_id = smccc_get_function(vcpu);
>   	u64 val[4] = {SMCCC_RET_NOT_SUPPORTED};
>   	u32 feature;
> @@ -165,7 +168,9 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   			}
>   			break;
>   		case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -			val[0] = SMCCC_RET_SUCCESS;
> +			if (kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME))
> +				val[0] = SMCCC_RET_SUCCESS;
>   			break;
>   		}
>   		break;
> @@ -211,6 +216,7 @@ static const u64 kvm_arm_fw_reg_ids[] = {
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2,
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3,
>   	KVM_REG_ARM_STD_BMAP,
> +	KVM_REG_ARM_STD_HYP_BMAP,
>   };
>   
>   void kvm_arm_init_hypercalls(struct kvm *kvm)
> @@ -218,6 +224,7 @@ void kvm_arm_init_hypercalls(struct kvm *kvm)
>   	struct kvm_smccc_features *smccc_feat = &kvm->arch.smccc_feat;
>   
>   	smccc_feat->std_bmap = KVM_ARM_SMCCC_STD_FEATURES;
> +	smccc_feat->std_hyp_bmap = KVM_ARM_SMCCC_STD_HYP_FEATURES;
>   }
>   
>   int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu)
> @@ -307,6 +314,9 @@ int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   	case KVM_REG_ARM_STD_BMAP:
>   		val = READ_ONCE(smccc_feat->std_bmap);
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		val = READ_ONCE(smccc_feat->std_hyp_bmap);
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -329,6 +339,10 @@ static int kvm_arm_set_fw_reg_bmap(struct kvm_vcpu *vcpu, u64 reg_id, u64 val)
>   		fw_reg_bmap = &smccc_feat->std_bmap;
>   		fw_reg_features = KVM_ARM_SMCCC_STD_FEATURES;
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		fw_reg_bmap = &smccc_feat->std_hyp_bmap;
> +		fw_reg_features = KVM_ARM_SMCCC_STD_HYP_FEATURES;
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -430,6 +444,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   
>   		return 0;
>   	case KVM_REG_ARM_STD_BMAP:
> +	case KVM_REG_ARM_STD_HYP_BMAP:
>   		return kvm_arm_set_fw_reg_bmap(vcpu, reg->id, val);
>   	default:
>   		return -ENOENT;
> diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
> index 499b45b607b6..aadd6ae3ab72 100644
> --- a/include/kvm/arm_hypercalls.h
> +++ b/include/kvm/arm_hypercalls.h
> @@ -8,8 +8,10 @@
>   
>   /* Last valid bits of the bitmapped firmware registers */
>   #define KVM_REG_ARM_STD_BMAP_BIT_MAX		0
> +#define KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX	0
>   
>   #define KVM_ARM_SMCCC_STD_FEATURES		GENMASK(KVM_REG_ARM_STD_BMAP_BIT_MAX, 0)
> +#define KVM_ARM_SMCCC_STD_HYP_FEATURES		GENMASK(KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX, 0)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
>   
> 


WARNING: multiple messages have this Message-ID (diff)
From: Gavin Shan <gshan@redhat.com>
To: Raghavendra Rao Ananta <rananta@google.com>,
	Marc Zyngier <maz@kernel.org>, Andrew Jones <drjones@redhat.com>,
	James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	Peter Shier <pshier@google.com>,
	linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 3/9] KVM: arm64: Add standard hypervisor firmware register
Date: Tue, 26 Apr 2022 14:37:27 +0800	[thread overview]
Message-ID: <9ac02210-437e-befd-cea5-2bfc57c00ec2@redhat.com> (raw)
In-Reply-To: <20220423000328.2103733-4-rananta@google.com>

On 4/23/22 8:03 AM, Raghavendra Rao Ananta wrote:
> Introduce the firmware register to hold the standard hypervisor
> service calls (owner value 5) as a bitmap. The bitmap represents
> the features that'll be enabled for the guest, as configured by
> the user-space. Currently, this includes support only for
> Paravirtualized time, represented by bit-0.
> 
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> ---
>   arch/arm64/include/asm/kvm_host.h |  2 ++
>   arch/arm64/include/uapi/asm/kvm.h |  3 +++
>   arch/arm64/kvm/hypercalls.c       | 21 ++++++++++++++++++---
>   include/kvm/arm_hypercalls.h      |  2 ++
>   4 files changed, 25 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index df07f4c10197..27d4b2a7970e 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -105,9 +105,11 @@ struct kvm_arch_memory_slot {
>    * struct kvm_smccc_features: Descriptor the hypercall services exposed to the guests
>    *
>    * @std_bmap: Bitmap of standard secure service calls
> + * @std_hyp_bmap: Bitmap of standard hypervisor service calls
>    */
>   struct kvm_smccc_features {
>   	unsigned long std_bmap;
> +	unsigned long std_hyp_bmap;
>   };
>   
>   struct kvm_arch {
> diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
> index 0b79d2dc6ffd..9eecc7ee8c14 100644
> --- a/arch/arm64/include/uapi/asm/kvm.h
> +++ b/arch/arm64/include/uapi/asm/kvm.h
> @@ -341,6 +341,9 @@ struct kvm_arm_copy_mte_tags {
>   #define KVM_REG_ARM_STD_BMAP			KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
>   #define KVM_REG_ARM_STD_BIT_TRNG_V1_0		0
>   
> +#define KVM_REG_ARM_STD_HYP_BMAP		KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
> +#define KVM_REG_ARM_STD_HYP_BIT_PV_TIME		0
> +
>   /* Device Control API: ARM VGIC */
>   #define KVM_DEV_ARM_VGIC_GRP_ADDR	0
>   #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS	1
> diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
> index df55a04d2fe8..f097bebdad39 100644
> --- a/arch/arm64/kvm/hypercalls.c
> +++ b/arch/arm64/kvm/hypercalls.c
> @@ -72,8 +72,6 @@ static bool kvm_hvc_call_default_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	 */
>   	case ARM_SMCCC_VERSION_FUNC_ID:
>   	case ARM_SMCCC_ARCH_FEATURES_FUNC_ID:
> -	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -	case ARM_SMCCC_HV_PV_TIME_ST:
>   	case ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID:
> @@ -95,6 +93,10 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	case ARM_SMCCC_TRNG_RND64:
>   		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_bmap,
>   						KVM_REG_ARM_STD_BIT_TRNG_V1_0);
> +	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> +	case ARM_SMCCC_HV_PV_TIME_ST:
> +		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME);
>   	default:
>   		return kvm_hvc_call_default_allowed(vcpu, func_id);
>   	}
> @@ -102,6 +104,7 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   {
> +	struct kvm_smccc_features *smccc_feat = &vcpu->kvm->arch.smccc_feat;
>   	u32 func_id = smccc_get_function(vcpu);
>   	u64 val[4] = {SMCCC_RET_NOT_SUPPORTED};
>   	u32 feature;
> @@ -165,7 +168,9 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   			}
>   			break;
>   		case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -			val[0] = SMCCC_RET_SUCCESS;
> +			if (kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME))
> +				val[0] = SMCCC_RET_SUCCESS;
>   			break;
>   		}
>   		break;
> @@ -211,6 +216,7 @@ static const u64 kvm_arm_fw_reg_ids[] = {
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2,
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3,
>   	KVM_REG_ARM_STD_BMAP,
> +	KVM_REG_ARM_STD_HYP_BMAP,
>   };
>   
>   void kvm_arm_init_hypercalls(struct kvm *kvm)
> @@ -218,6 +224,7 @@ void kvm_arm_init_hypercalls(struct kvm *kvm)
>   	struct kvm_smccc_features *smccc_feat = &kvm->arch.smccc_feat;
>   
>   	smccc_feat->std_bmap = KVM_ARM_SMCCC_STD_FEATURES;
> +	smccc_feat->std_hyp_bmap = KVM_ARM_SMCCC_STD_HYP_FEATURES;
>   }
>   
>   int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu)
> @@ -307,6 +314,9 @@ int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   	case KVM_REG_ARM_STD_BMAP:
>   		val = READ_ONCE(smccc_feat->std_bmap);
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		val = READ_ONCE(smccc_feat->std_hyp_bmap);
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -329,6 +339,10 @@ static int kvm_arm_set_fw_reg_bmap(struct kvm_vcpu *vcpu, u64 reg_id, u64 val)
>   		fw_reg_bmap = &smccc_feat->std_bmap;
>   		fw_reg_features = KVM_ARM_SMCCC_STD_FEATURES;
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		fw_reg_bmap = &smccc_feat->std_hyp_bmap;
> +		fw_reg_features = KVM_ARM_SMCCC_STD_HYP_FEATURES;
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -430,6 +444,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   
>   		return 0;
>   	case KVM_REG_ARM_STD_BMAP:
> +	case KVM_REG_ARM_STD_HYP_BMAP:
>   		return kvm_arm_set_fw_reg_bmap(vcpu, reg->id, val);
>   	default:
>   		return -ENOENT;
> diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
> index 499b45b607b6..aadd6ae3ab72 100644
> --- a/include/kvm/arm_hypercalls.h
> +++ b/include/kvm/arm_hypercalls.h
> @@ -8,8 +8,10 @@
>   
>   /* Last valid bits of the bitmapped firmware registers */
>   #define KVM_REG_ARM_STD_BMAP_BIT_MAX		0
> +#define KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX	0
>   
>   #define KVM_ARM_SMCCC_STD_FEATURES		GENMASK(KVM_REG_ARM_STD_BMAP_BIT_MAX, 0)
> +#define KVM_ARM_SMCCC_STD_HYP_FEATURES		GENMASK(KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX, 0)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
>   
> 

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Gavin Shan <gshan@redhat.com>
To: Raghavendra Rao Ananta <rananta@google.com>,
	Marc Zyngier <maz@kernel.org>, Andrew Jones <drjones@redhat.com>,
	James Morse <james.morse@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: kvm@vger.kernel.org, Catalin Marinas <catalin.marinas@arm.com>,
	Peter Shier <pshier@google.com>,
	linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 3/9] KVM: arm64: Add standard hypervisor firmware register
Date: Tue, 26 Apr 2022 14:37:27 +0800	[thread overview]
Message-ID: <9ac02210-437e-befd-cea5-2bfc57c00ec2@redhat.com> (raw)
In-Reply-To: <20220423000328.2103733-4-rananta@google.com>

On 4/23/22 8:03 AM, Raghavendra Rao Ananta wrote:
> Introduce the firmware register to hold the standard hypervisor
> service calls (owner value 5) as a bitmap. The bitmap represents
> the features that'll be enabled for the guest, as configured by
> the user-space. Currently, this includes support only for
> Paravirtualized time, represented by bit-0.
> 
> Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
> ---
>   arch/arm64/include/asm/kvm_host.h |  2 ++
>   arch/arm64/include/uapi/asm/kvm.h |  3 +++
>   arch/arm64/kvm/hypercalls.c       | 21 ++++++++++++++++++---
>   include/kvm/arm_hypercalls.h      |  2 ++
>   4 files changed, 25 insertions(+), 3 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index df07f4c10197..27d4b2a7970e 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -105,9 +105,11 @@ struct kvm_arch_memory_slot {
>    * struct kvm_smccc_features: Descriptor the hypercall services exposed to the guests
>    *
>    * @std_bmap: Bitmap of standard secure service calls
> + * @std_hyp_bmap: Bitmap of standard hypervisor service calls
>    */
>   struct kvm_smccc_features {
>   	unsigned long std_bmap;
> +	unsigned long std_hyp_bmap;
>   };
>   
>   struct kvm_arch {
> diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
> index 0b79d2dc6ffd..9eecc7ee8c14 100644
> --- a/arch/arm64/include/uapi/asm/kvm.h
> +++ b/arch/arm64/include/uapi/asm/kvm.h
> @@ -341,6 +341,9 @@ struct kvm_arm_copy_mte_tags {
>   #define KVM_REG_ARM_STD_BMAP			KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
>   #define KVM_REG_ARM_STD_BIT_TRNG_V1_0		0
>   
> +#define KVM_REG_ARM_STD_HYP_BMAP		KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
> +#define KVM_REG_ARM_STD_HYP_BIT_PV_TIME		0
> +
>   /* Device Control API: ARM VGIC */
>   #define KVM_DEV_ARM_VGIC_GRP_ADDR	0
>   #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS	1
> diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
> index df55a04d2fe8..f097bebdad39 100644
> --- a/arch/arm64/kvm/hypercalls.c
> +++ b/arch/arm64/kvm/hypercalls.c
> @@ -72,8 +72,6 @@ static bool kvm_hvc_call_default_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	 */
>   	case ARM_SMCCC_VERSION_FUNC_ID:
>   	case ARM_SMCCC_ARCH_FEATURES_FUNC_ID:
> -	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -	case ARM_SMCCC_HV_PV_TIME_ST:
>   	case ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
>   	case ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID:
> @@ -95,6 +93,10 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   	case ARM_SMCCC_TRNG_RND64:
>   		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_bmap,
>   						KVM_REG_ARM_STD_BIT_TRNG_V1_0);
> +	case ARM_SMCCC_HV_PV_TIME_FEATURES:
> +	case ARM_SMCCC_HV_PV_TIME_ST:
> +		return kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME);
>   	default:
>   		return kvm_hvc_call_default_allowed(vcpu, func_id);
>   	}
> @@ -102,6 +104,7 @@ static bool kvm_hvc_call_allowed(struct kvm_vcpu *vcpu, u32 func_id)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   {
> +	struct kvm_smccc_features *smccc_feat = &vcpu->kvm->arch.smccc_feat;
>   	u32 func_id = smccc_get_function(vcpu);
>   	u64 val[4] = {SMCCC_RET_NOT_SUPPORTED};
>   	u32 feature;
> @@ -165,7 +168,9 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
>   			}
>   			break;
>   		case ARM_SMCCC_HV_PV_TIME_FEATURES:
> -			val[0] = SMCCC_RET_SUCCESS;
> +			if (kvm_arm_fw_reg_feat_enabled(&smccc_feat->std_hyp_bmap,
> +					KVM_REG_ARM_STD_HYP_BIT_PV_TIME))
> +				val[0] = SMCCC_RET_SUCCESS;
>   			break;
>   		}
>   		break;
> @@ -211,6 +216,7 @@ static const u64 kvm_arm_fw_reg_ids[] = {
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2,
>   	KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3,
>   	KVM_REG_ARM_STD_BMAP,
> +	KVM_REG_ARM_STD_HYP_BMAP,
>   };
>   
>   void kvm_arm_init_hypercalls(struct kvm *kvm)
> @@ -218,6 +224,7 @@ void kvm_arm_init_hypercalls(struct kvm *kvm)
>   	struct kvm_smccc_features *smccc_feat = &kvm->arch.smccc_feat;
>   
>   	smccc_feat->std_bmap = KVM_ARM_SMCCC_STD_FEATURES;
> +	smccc_feat->std_hyp_bmap = KVM_ARM_SMCCC_STD_HYP_FEATURES;
>   }
>   
>   int kvm_arm_get_fw_num_regs(struct kvm_vcpu *vcpu)
> @@ -307,6 +314,9 @@ int kvm_arm_get_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   	case KVM_REG_ARM_STD_BMAP:
>   		val = READ_ONCE(smccc_feat->std_bmap);
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		val = READ_ONCE(smccc_feat->std_hyp_bmap);
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -329,6 +339,10 @@ static int kvm_arm_set_fw_reg_bmap(struct kvm_vcpu *vcpu, u64 reg_id, u64 val)
>   		fw_reg_bmap = &smccc_feat->std_bmap;
>   		fw_reg_features = KVM_ARM_SMCCC_STD_FEATURES;
>   		break;
> +	case KVM_REG_ARM_STD_HYP_BMAP:
> +		fw_reg_bmap = &smccc_feat->std_hyp_bmap;
> +		fw_reg_features = KVM_ARM_SMCCC_STD_HYP_FEATURES;
> +		break;
>   	default:
>   		return -ENOENT;
>   	}
> @@ -430,6 +444,7 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
>   
>   		return 0;
>   	case KVM_REG_ARM_STD_BMAP:
> +	case KVM_REG_ARM_STD_HYP_BMAP:
>   		return kvm_arm_set_fw_reg_bmap(vcpu, reg->id, val);
>   	default:
>   		return -ENOENT;
> diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
> index 499b45b607b6..aadd6ae3ab72 100644
> --- a/include/kvm/arm_hypercalls.h
> +++ b/include/kvm/arm_hypercalls.h
> @@ -8,8 +8,10 @@
>   
>   /* Last valid bits of the bitmapped firmware registers */
>   #define KVM_REG_ARM_STD_BMAP_BIT_MAX		0
> +#define KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX	0
>   
>   #define KVM_ARM_SMCCC_STD_FEATURES		GENMASK(KVM_REG_ARM_STD_BMAP_BIT_MAX, 0)
> +#define KVM_ARM_SMCCC_STD_HYP_FEATURES		GENMASK(KVM_REG_ARM_STD_HYP_BMAP_BIT_MAX, 0)
>   
>   int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
>   
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-26  6:37 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23  0:03 [PATCH v6 0/9] KVM: arm64: Add support for hypercall services selection Raghavendra Rao Ananta
2022-04-23  0:03 ` Raghavendra Rao Ananta
2022-04-23  0:03 ` Raghavendra Rao Ananta
2022-04-23  0:03 ` [PATCH v6 1/9] KVM: arm64: Factor out firmware register handling from psci.c Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03 ` [PATCH v6 2/9] KVM: arm64: Setup a framework for hypercall bitmap firmware registers Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-25  4:52   ` Reiji Watanabe
2022-04-25  4:52     ` Reiji Watanabe
2022-04-25  4:52     ` Reiji Watanabe
2022-04-25 16:46     ` Raghavendra Rao Ananta
2022-04-25 16:46       ` Raghavendra Rao Ananta
2022-04-25 16:46       ` Raghavendra Rao Ananta
2022-04-27  1:46       ` Reiji Watanabe
2022-04-27  1:46         ` Reiji Watanabe
2022-04-27  1:46         ` Reiji Watanabe
2022-04-27 17:57         ` Raghavendra Rao Ananta
2022-04-27 17:57           ` Raghavendra Rao Ananta
2022-04-27 17:57           ` Raghavendra Rao Ananta
2022-04-26  6:33   ` Gavin Shan
2022-04-26  6:33     ` Gavin Shan
2022-04-26  6:33     ` Gavin Shan
2022-04-26 16:44     ` Raghavendra Rao Ananta
2022-04-26 16:44       ` Raghavendra Rao Ananta
2022-04-26 16:44       ` Raghavendra Rao Ananta
2022-04-27  1:38       ` Gavin Shan
2022-04-27  1:38         ` Gavin Shan
2022-04-27  1:38         ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 3/9] KVM: arm64: Add standard hypervisor firmware register Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-26  6:37   ` Gavin Shan [this message]
2022-04-26  6:37     ` Gavin Shan
2022-04-26  6:37     ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 4/9] KVM: arm64: Add vendor " Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-25  6:22   ` Reiji Watanabe
2022-04-25  6:22     ` Reiji Watanabe
2022-04-25  6:22     ` Reiji Watanabe
2022-04-25 16:51     ` Raghavendra Rao Ananta
2022-04-25 16:51       ` Raghavendra Rao Ananta
2022-04-25 16:51       ` Raghavendra Rao Ananta
2022-04-25 17:12       ` Oliver Upton
2022-04-25 17:12         ` Oliver Upton
2022-04-25 17:12         ` Oliver Upton
2022-04-26  6:40   ` Gavin Shan
2022-04-26  6:40     ` Gavin Shan
2022-04-26  6:40     ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 5/9] Docs: KVM: Rename psci.rst to hypercalls.rst Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-26  6:41   ` Gavin Shan
2022-04-26  6:41     ` Gavin Shan
2022-04-26  6:41     ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 6/9] Docs: KVM: Add doc for the bitmap firmware registers Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-25  6:31   ` Reiji Watanabe
2022-04-25  6:31     ` Reiji Watanabe
2022-04-25  6:31     ` Reiji Watanabe
2022-04-25 16:52     ` Raghavendra Rao Ananta
2022-04-25 16:52       ` Raghavendra Rao Ananta
2022-04-25 16:52       ` Raghavendra Rao Ananta
2022-04-26  6:42   ` Gavin Shan
2022-04-26  6:42     ` Gavin Shan
2022-04-26  6:42     ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 7/9] tools: Import ARM SMCCC definitions Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-26  7:24   ` Gavin Shan
2022-04-26  7:24     ` Gavin Shan
2022-04-26  7:24     ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 8/9] selftests: KVM: aarch64: Introduce hypercall ABI test Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-26  7:49   ` Gavin Shan
2022-04-26  7:49     ` Gavin Shan
2022-04-26  7:49     ` Gavin Shan
2022-04-26 16:59     ` Raghavendra Rao Ananta
2022-04-26 16:59       ` Raghavendra Rao Ananta
2022-04-26 16:59       ` Raghavendra Rao Ananta
2022-04-27  2:09       ` Gavin Shan
2022-04-27  2:09         ` Gavin Shan
2022-04-27  2:09         ` Gavin Shan
2022-04-23  0:03 ` [PATCH v6 9/9] selftests: KVM: aarch64: Add the bitmap firmware registers to get-reg-list Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta
2022-04-23  0:03   ` Raghavendra Rao Ananta

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=9ac02210-437e-befd-cea5-2bfc57c00ec2@redhat.com \
    --to=gshan@redhat.com \
    --cc=alexandru.elisei@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=drjones@redhat.com \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rananta@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /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.