[PATCH] KVM: arm/arm64: GICv4: Do not perform an map to a mapped vLPI

Marc Zyngier maz at kernel.org
Thu Nov 16 06:10:26 PST 2023


On Thu, 16 Nov 2023 12:52:15 +0000,
Kunkun Jiang <jiangkunkun at huawei.com> wrote:
> 
> Before performing an unmap, let's check whether the vLPI has been
> mapped. This corresponds to checking whether a vLPI is valid before
> unmap it.
>
> Signed-off-by: Kunkun Jiang <jiangkunkun at huawei.com>
> ---
>  arch/arm64/kvm/vgic/vgic-v4.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c
> index 339a55194b2c..824f4baf50ee 100644
> --- a/arch/arm64/kvm/vgic/vgic-v4.c
> +++ b/arch/arm64/kvm/vgic/vgic-v4.c
> @@ -436,6 +436,11 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, int virq,
>  	if (ret)
>  		goto out;
>  
> +	if (irq->hw) {
> +		ret = -EBUSY;
> +		goto out;
> +	}
> +

So this code affects the mapping side, not the unmapping. Even more
confusingly, the subject of the patch doesn't match the commit
message.

Furthermore, I'm not sure we want to return an error here. Userspace
has no knowledge of GICv4, and there are numerous other cases where we
don't return any error. This is certainly a userspace visible change.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list