RE: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com; eric.au...@linaro.org; linux-arm-ker...@lists.infradead.org; marc.zyng...@arm.com; christoffer.d...@linaro.org; andre.przyw...@arm.com; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org Cc: linux-ker...@vger.kernel.org; patc...@linaro.org; p.fe...@samsung.com; pbonz...@redhat.com Subject: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/kvm/Kconfig | 1 + virt/kvm/arm/vgic.c | 5 + 2 files changed, 6 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 151e710..0f58baf 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD + select HAVE_KVM_MSI select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING depends on ARM_VIRT_EXT ARM_LPAE ARM_ARCH_TIMER diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0b4c48c..b3c10dc 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2314,6 +2314,11 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, return kvm-arch.vgic.vm_ops.inject_msi(kvm, msi); else return -ENODEV; + case KVM_IRQ_ROUTING_MSI: + if (kvm-arch.vgic.vm_ops.inject_msi) + return -EINVAL; + else + return kvm_vgic_inject_irq(kvm, 0, e-msi.data, level); Given API change i suggest (using KVM_MSI_VALID_DEVID flag), we could get rid of all these if()'s here. Just forward all parameters to vGIC implementation code and let it do its checks. default: return -EINVAL; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Hi Pavel, On 07/02/2015 09:53 AM, Pavel Fedin wrote: Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com; eric.au...@linaro.org; linux-arm-ker...@lists.infradead.org; marc.zyng...@arm.com; christoffer.d...@linaro.org; andre.przyw...@arm.com; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org Cc: linux-ker...@vger.kernel.org; patc...@linaro.org; p.fe...@samsung.com; pbonz...@redhat.com Subject: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/kvm/Kconfig | 1 + virt/kvm/arm/vgic.c | 5 + 2 files changed, 6 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 151e710..0f58baf 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD +select HAVE_KVM_MSI select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING depends on ARM_VIRT_EXT ARM_LPAE ARM_ARCH_TIMER diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0b4c48c..b3c10dc 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2314,6 +2314,11 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, return kvm-arch.vgic.vm_ops.inject_msi(kvm, msi); else return -ENODEV; +case KVM_IRQ_ROUTING_MSI: +if (kvm-arch.vgic.vm_ops.inject_msi) +return -EINVAL; +else +return kvm_vgic_inject_irq(kvm, 0, e-msi.data, level); Given API change i suggest (using KVM_MSI_VALID_DEVID flag), we could get rid of all these if()'s here. Just forward all parameters to vGIC implementation code and let it do its checks. I don't understand this comment. Here this is the kernel struct that is used (struct kvm_kernel_irq_routing_entry) and not the user one (kvm_irq_routing_entry). The kernel struct does not have the flag field. Another reason I think to keep using the type for homogeneity. To be noted that in the kernel struct, the devid is passed in kvm_extended_msi, as you suggested for the user-space struct. Thanks Eric default: return -EINVAL; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Hello! Given API change i suggest (using KVM_MSI_VALID_DEVID flag), we could get rid of all these if()'s here. Just forward all parameters to vGIC implementation code and let it do its checks. I don't understand this comment. Here this is the kernel struct that is used (struct kvm_kernel_irq_routing_entry) and not the user one (kvm_irq_routing_entry). The kernel struct does not have the flag field. Easy. ARM code can always use struct kvm_extended_msi, and flags can go to this structure. Another reason I think to keep using the type for homogeneity. Homogeneity is perfect IMHO. If that would be simpler for you, i could post a patch for this which i made on top of your series. Sorry, i don't have time to respin the whole thing, busy with qemu GICv3 fight :) Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Hi Andre, On 07/02/2015 07:10 PM, Andre Przywara wrote: Hi Eric, On 29/06/15 16:37, Eric Auger wrote: If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/kvm/Kconfig | 1 + virt/kvm/arm/vgic.c | 5 + 2 files changed, 6 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 151e710..0f58baf 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD +select HAVE_KVM_MSI select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING depends on ARM_VIRT_EXT ARM_LPAE ARM_ARCH_TIMER diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0b4c48c..b3c10dc 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2314,6 +2314,11 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, return kvm-arch.vgic.vm_ops.inject_msi(kvm, msi); else return -ENODEV; +case KVM_IRQ_ROUTING_MSI: +if (kvm-arch.vgic.vm_ops.inject_msi) +return -EINVAL; +else +return kvm_vgic_inject_irq(kvm, 0, e-msi.data, level); If you add: static int vgic_v2m_inject_msi(struct kvm *kvm, struct kvm_msi *msi) { return kvm_vgic_inject_irq(kvm, 0, msi-data, 1); } to vgic-v2-emul.c and wire it up accordingly, you can simplify the above kvm_set_msi, getting rid of all those extra case handling. This also helps merging KVM_IRQ_ROUTING_MSI and the extended case. I have hacked this up and it seems to work for me. OK thanks I will respin either today or on monday. Best Regards Eric Cheers, Andre. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping
Hi Eric, On 29/06/15 16:37, Eric Auger wrote: If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/kvm/Kconfig | 1 + virt/kvm/arm/vgic.c | 5 + 2 files changed, 6 insertions(+) diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig index 151e710..0f58baf 100644 --- a/arch/arm/kvm/Kconfig +++ b/arch/arm/kvm/Kconfig @@ -31,6 +31,7 @@ config KVM select KVM_VFIO select HAVE_KVM_EVENTFD select HAVE_KVM_IRQFD + select HAVE_KVM_MSI select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQ_ROUTING depends on ARM_VIRT_EXT ARM_LPAE ARM_ARCH_TIMER diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0b4c48c..b3c10dc 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -2314,6 +2314,11 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, return kvm-arch.vgic.vm_ops.inject_msi(kvm, msi); else return -ENODEV; + case KVM_IRQ_ROUTING_MSI: + if (kvm-arch.vgic.vm_ops.inject_msi) + return -EINVAL; + else + return kvm_vgic_inject_irq(kvm, 0, e-msi.data, level); If you add: static int vgic_v2m_inject_msi(struct kvm *kvm, struct kvm_msi *msi) { return kvm_vgic_inject_irq(kvm, 0, msi-data, 1); } to vgic-v2-emul.c and wire it up accordingly, you can simplify the above kvm_set_msi, getting rid of all those extra case handling. This also helps merging KVM_IRQ_ROUTING_MSI and the extended case. I have hacked this up and it seems to work for me. Cheers, Andre. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html