linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability
@ 2017-07-08 13:48 Shanker Donthineni
  2017-07-09 21:26 ` Auger Eric
  2017-07-11 16:35 ` Marc Zyngier
  0 siblings, 2 replies; 3+ messages in thread
From: Shanker Donthineni @ 2017-07-08 13:48 UTC (permalink / raw)
  To: Marc Zyngier, Christoffer Dall
  Cc: linux-kernel, linux-arm-kernel, kvmarm, kvm, Eric Auger,
	Vikram Sethi, Andre Przywara, Shanker Donthineni

Commit 0e4e82f154e3 ("KVM: arm64: vgic-its: Enable ITS emulation as
a virtual MSI controller") tried to advertise KVM_CAP_MSI_DEVID, but
the code logic was not updating the dist->msis_require_devid field
correctly. If hypervisor tool creates the ITS device after VGIC
initialization then we don't advertise KVM_CAP_MSI_DEVID capability.

Update the field msis_require_devid to true inside vgic_its_create()
to fix the issue.

Fixes: 0e4e82f154e3 ("vgic-its: Enable ITS emulation as a virtual MSI controller")
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
 virt/kvm/arm/vgic/vgic-init.c | 3 ---
 virt/kvm/arm/vgic/vgic-its.c  | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
index 3a0b899..5801261 100644
--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -285,9 +285,6 @@ int vgic_init(struct kvm *kvm)
 	if (ret)
 		goto out;
 
-	if (vgic_has_its(kvm))
-		dist->msis_require_devid = true;
-
 	kvm_for_each_vcpu(i, vcpu, kvm)
 		kvm_vgic_vcpu_enable(vcpu);
 
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 2dff288..aa6b68d 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -1598,6 +1598,7 @@ static int vgic_its_create(struct kvm_device *dev, u32 type)
 	INIT_LIST_HEAD(&its->device_list);
 	INIT_LIST_HEAD(&its->collection_list);
 
+	dev->kvm->arch.vgic.msis_require_devid = true;
 	dev->kvm->arch.vgic.has_its = true;
 	its->enabled = false;
 	its->dev = dev;
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

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

* Re: [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability
  2017-07-08 13:48 [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability Shanker Donthineni
@ 2017-07-09 21:26 ` Auger Eric
  2017-07-11 16:35 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Auger Eric @ 2017-07-09 21:26 UTC (permalink / raw)
  To: Shanker Donthineni, Marc Zyngier, Christoffer Dall
  Cc: kvm, Vikram Sethi, Andre Przywara, linux-kernel, kvmarm,
	linux-arm-kernel

Hi,

On 08/07/2017 15:48, Shanker Donthineni wrote:
> Commit 0e4e82f154e3 ("KVM: arm64: vgic-its: Enable ITS emulation as
> a virtual MSI controller") tried to advertise KVM_CAP_MSI_DEVID, but
> the code logic was not updating the dist->msis_require_devid field
> correctly. If hypervisor tool creates the ITS device after VGIC
> initialization then we don't advertise KVM_CAP_MSI_DEVID capability.
> 
> Update the field msis_require_devid to true inside vgic_its_create()
> to fix the issue.
> 
> Fixes: 0e4e82f154e3 ("vgic-its: Enable ITS emulation as a virtual MSI controller")
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

In QEMU the capability is not checked as "kvm_msi_use_devid" is directly
set in the ITS device :-(

Thanks

Eric

> ---
>  virt/kvm/arm/vgic/vgic-init.c | 3 ---
>  virt/kvm/arm/vgic/vgic-its.c  | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
> index 3a0b899..5801261 100644
> --- a/virt/kvm/arm/vgic/vgic-init.c
> +++ b/virt/kvm/arm/vgic/vgic-init.c
> @@ -285,9 +285,6 @@ int vgic_init(struct kvm *kvm)
>  	if (ret)
>  		goto out;
>  
> -	if (vgic_has_its(kvm))
> -		dist->msis_require_devid = true;
> -
>  	kvm_for_each_vcpu(i, vcpu, kvm)
>  		kvm_vgic_vcpu_enable(vcpu);
>  
> diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
> index 2dff288..aa6b68d 100644
> --- a/virt/kvm/arm/vgic/vgic-its.c
> +++ b/virt/kvm/arm/vgic/vgic-its.c
> @@ -1598,6 +1598,7 @@ static int vgic_its_create(struct kvm_device *dev, u32 type)
>  	INIT_LIST_HEAD(&its->device_list);
>  	INIT_LIST_HEAD(&its->collection_list);
>  
> +	dev->kvm->arch.vgic.msis_require_devid = true;
>  	dev->kvm->arch.vgic.has_its = true;
>  	its->enabled = false;
>  	its->dev = dev;
> 

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

* Re: [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability
  2017-07-08 13:48 [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability Shanker Donthineni
  2017-07-09 21:26 ` Auger Eric
@ 2017-07-11 16:35 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2017-07-11 16:35 UTC (permalink / raw)
  To: Shanker Donthineni, Christoffer Dall
  Cc: linux-kernel, linux-arm-kernel, kvmarm, kvm, Eric Auger,
	Vikram Sethi, Andre Przywara

On 08/07/17 14:48, Shanker Donthineni wrote:
> Commit 0e4e82f154e3 ("KVM: arm64: vgic-its: Enable ITS emulation as
> a virtual MSI controller") tried to advertise KVM_CAP_MSI_DEVID, but
> the code logic was not updating the dist->msis_require_devid field
> correctly. If hypervisor tool creates the ITS device after VGIC
> initialization then we don't advertise KVM_CAP_MSI_DEVID capability.
> 
> Update the field msis_require_devid to true inside vgic_its_create()
> to fix the issue.
> 
> Fixes: 0e4e82f154e3 ("vgic-its: Enable ITS emulation as a virtual MSI controller")
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
>  virt/kvm/arm/vgic/vgic-init.c | 3 ---
>  virt/kvm/arm/vgic/vgic-its.c  | 1 +
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
> index 3a0b899..5801261 100644
> --- a/virt/kvm/arm/vgic/vgic-init.c
> +++ b/virt/kvm/arm/vgic/vgic-init.c
> @@ -285,9 +285,6 @@ int vgic_init(struct kvm *kvm)
>  	if (ret)
>  		goto out;
>  
> -	if (vgic_has_its(kvm))
> -		dist->msis_require_devid = true;
> -
>  	kvm_for_each_vcpu(i, vcpu, kvm)
>  		kvm_vgic_vcpu_enable(vcpu);
>  
> diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
> index 2dff288..aa6b68d 100644
> --- a/virt/kvm/arm/vgic/vgic-its.c
> +++ b/virt/kvm/arm/vgic/vgic-its.c
> @@ -1598,6 +1598,7 @@ static int vgic_its_create(struct kvm_device *dev, u32 type)
>  	INIT_LIST_HEAD(&its->device_list);
>  	INIT_LIST_HEAD(&its->collection_list);
>  
> +	dev->kvm->arch.vgic.msis_require_devid = true;
>  	dev->kvm->arch.vgic.has_its = true;
>  	its->enabled = false;
>  	its->dev = dev;
> 

Seems sensible to me. Unless someone screams, I'll queue it for post -rc1.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

end of thread, other threads:[~2017-07-11 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-08 13:48 [PATCH] KVM: arm/arm64: Fix bug in advertising KVM_CAP_MSI_DEVID capability Shanker Donthineni
2017-07-09 21:26 ` Auger Eric
2017-07-11 16:35 ` Marc Zyngier

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