* [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI
@ 2023-11-19 10:49 Kunkun Jiang
2023-11-20 9:15 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: Kunkun Jiang @ 2023-11-19 10:49 UTC (permalink / raw)
To: Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose,
Zenghui Yu, Catalin Marinas, Will Deacon, Jean-Philippe Brucker,
eric.auger
Cc: linux-arm-kernel, kvmarm, wanghaibin.wang, Kunkun Jiang
Before performing a map, let's check whether the vLPI has been
mapped. This corresponds to checking whether a vLPI is valid
before unmap it.
Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of VLPIs in VFIO irq bypass")
Signed-off-by: Kunkun Jiang <jiangkunkun@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..fb60bbb94460 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 = 0;
+ goto out;
+ }
+
/*
* Emit the mapping request. If it fails, the ITS probably
* isn't v4 compatible, so let's silently bail out. Holding
--
2.33.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI
2023-11-19 10:49 [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI Kunkun Jiang
@ 2023-11-20 9:15 ` Marc Zyngier
2023-11-20 13:19 ` Kunkun Jiang
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2023-11-20 9:15 UTC (permalink / raw)
To: Kunkun Jiang
Cc: Oliver Upton, James Morse, Suzuki K Poulose, Zenghui Yu,
Catalin Marinas, Will Deacon, Jean-Philippe Brucker, eric.auger,
linux-arm-kernel, kvmarm, wanghaibin.wang
On 2023-11-19 10:49, Kunkun Jiang wrote:
> Before performing a map, let's check whether the vLPI has been
> mapped. This corresponds to checking whether a vLPI is valid
> before unmap it.
I don't understand this last sentence. Mapping and unmapping
are two different actions, and we shouldn't conflate them.
>
> Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of
> VLPIs in VFIO irq bypass")
> Signed-off-by: Kunkun Jiang <jiangkunkun@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..fb60bbb94460 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 = 0;
ret is obviously already 0.
> + goto out;
> + }
> +
> /*
> * Emit the mapping request. If it fails, the ITS probably
> * isn't v4 compatible, so let's silently bail out. Holding
Furthermore, this really deserves a comment. Something like:
/* Silently exit if the vLPI is already mapped */
With these changes:
Acked-by: Marc Zyngier <maz@kernel.org>
Oliver, can you please apply these changes and queue it as a fix
for 6.7?
Thanks,
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI
2023-11-20 9:15 ` Marc Zyngier
@ 2023-11-20 13:19 ` Kunkun Jiang
0 siblings, 0 replies; 3+ messages in thread
From: Kunkun Jiang @ 2023-11-20 13:19 UTC (permalink / raw)
To: Marc Zyngier, Oliver Upton
Cc: James Morse, Suzuki K Poulose, Zenghui Yu, Catalin Marinas,
Will Deacon, Jean-Philippe Brucker, eric.auger, linux-arm-kernel,
kvmarm, wanghaibin.wang
Hi Marc,Oliver,
On 2023/11/20 17:15, Marc Zyngier wrote:
> On 2023-11-19 10:49, Kunkun Jiang wrote:
>> Before performing a map, let's check whether the vLPI has been
>> mapped. This corresponds to checking whether a vLPI is valid
>> before unmap it.
>
> I don't understand this last sentence. Mapping and unmapping
> are two different actions, and we shouldn't conflate them.
>
>>
>> Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of
>> VLPIs in VFIO irq bypass")
>> Signed-off-by: Kunkun Jiang <jiangkunkun@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..fb60bbb94460 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 = 0;
>
> ret is obviously already 0.
>
>> + goto out;
>> + }
>> +
>> /*
>> * Emit the mapping request. If it fails, the ITS probably
>> * isn't v4 compatible, so let's silently bail out. Holding
>
> Furthermore, this really deserves a comment. Something like:
>
> /* Silently exit if the vLPI is already mapped */
>
> With these changes:
>
> Acked-by: Marc Zyngier <maz@kernel.org>
>
> Oliver, can you please apply these changes and queue it as a fix
> for 6.7?
>
Thank you for your careful review. I just sent the v3 and applied
these changes.
https://lore.kernel.org/kvmarm/20231120131210.2039-1-jiangkunkun@huawei.com/
Thanks,
Kunkun Jiang
> Thanks,
>
> M.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-20 13:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-19 10:49 [PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI Kunkun Jiang
2023-11-20 9:15 ` Marc Zyngier
2023-11-20 13:19 ` Kunkun Jiang
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).