Re: [PATCH RFC v2 1/9] KVM: arm64: nv: selftests: Add support to run guest code in vEL2.

2025-05-29 Thread Eric Auger
Hi Itaru, On 5/29/25 1:39 AM, Itaru Kitayama wrote: > Hi Ganapatrao > On Mon, May 12, 2025 at 03:52:43AM -0700, Ganapatrao Kulkarni wrote: >> This patch adds required changes to vcpu init to run a guest code >> in vEL2 context and also adds NV specific helper functions. >> >> Signed-off-by: Ganapa

Re: [RFC PATCH v2 3/9] KVM: arm64: nv: selftests: Enable hypervisor timer tests to run in vEL2

2025-05-28 Thread Eric Auger
Hi Ganapatrao, On 5/12/25 12:52 PM, Ganapatrao Kulkarni wrote: > Adding required changes to enable and test HVTIMER and HPTIMER > in vEL2. In default case, PTIMER and VTIMER are validated and with > NV enabled (with argument "-g 1"), HPTIMER and HVTIMER are validated > by injecting respective time

Re: [RFC PATCH v2 1/9] KVM: arm64: nv: selftests: Add support to run guest code in vEL2.

2025-05-28 Thread Eric Auger
Hi, On 5/12/25 12:52 PM, Ganapatrao Kulkarni wrote: > This patch adds required changes to vcpu init to run a guest code > in vEL2 context and also adds NV specific helper functions. > > Signed-off-by: Ganapatrao Kulkarni > --- > tools/testing/selftests/kvm/Makefile.kvm | 2 + > .../kvm/in

Re: [RFC PATCH v2 0/9] KVM: Enable Nested Virt selftests

2025-05-28 Thread Eric Auger
Hi Ganapatrao, On 5/12/25 12:52 PM, Ganapatrao Kulkarni wrote: > This patch series makes the selftest work with NV enabled. The guest code > is run in vEL2 instead of EL1. We add a command line option to enable > testing of NV. The NV tests are disabled by default. For commodity, I would add in t

Re: [PATCH] virtio: break and reset virtio devices on device_shutdown()

2025-02-25 Thread Eric Auger
Hi Michael, On 2/24/25 8:31 PM, Michael S. Tsirkin wrote: > On Mon, Feb 24, 2025 at 08:49:09AM +0100, Eric Auger wrote: >> Hi Michael, >> >> On 2/21/25 12:42 AM, Michael S. Tsirkin wrote: >>> Hongyu reported a hang on kexec in a VM. QEMU reported invalid memor

Re: [PATCH] virtio: break and reset virtio devices on device_shutdown()

2025-02-23 Thread Eric Auger
all virtio devices on virtio > bus shutdown, then resetting them. > > Reported-by: Eric Auger > Reported-by: Hongyu Ning > Signed-off-by: Michael S. Tsirkin Tested-by: Eric Auger Thanks! Eric > --- > drivers/virtio/virtio.c | 31 +++ &g

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-17 Thread Eric Auger
Hi Michael, On 2/17/25 10:25 AM, Eric Auger wrote: > Hi Michael, Hongyu, > > On 2/14/25 1:16 PM, Michael S. Tsirkin wrote: >> On Fri, Feb 14, 2025 at 08:56:56AM +0100, Eric Auger wrote: >>> Hi, >>> >>> On 2/14/25 8:21 AM, Ning, Hongyu wrote: >>

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-17 Thread Eric Auger
Hi Michael, Hongyu, On 2/14/25 1:16 PM, Michael S. Tsirkin wrote: > On Fri, Feb 14, 2025 at 08:56:56AM +0100, Eric Auger wrote: >> Hi, >> >> On 2/14/25 8:21 AM, Ning, Hongyu wrote: >>> >>> >>> On 2025/2/6 16:59, Eric Auger wrote: >>>>

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-13 Thread Eric Auger
Hi, On 2/14/25 8:21 AM, Ning, Hongyu wrote: > > > On 2025/2/6 16:59, Eric Auger wrote: >> Hi, >> >> On 2/4/25 12:46 PM, Eric Auger wrote: >>> Hi, >>> >>> On 2/3/25 3:48 PM, Michael S. Tsirkin wrote: >>>> On Fri, Jan 31, 20

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-06 Thread Eric Auger
On 2/6/25 11:04 AM, Kirill A. Shutemov wrote: > On Thu, Feb 06, 2025 at 09:59:58AM +0100, Eric Auger wrote: >> Hi, >> >> On 2/4/25 12:46 PM, Eric Auger wrote: >>> Hi, >>> >>> On 2/3/25 3:48 PM, Michael S. Tsirkin wrote: >>>> On Fri,

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-06 Thread Eric Auger
Hi, On 2/4/25 12:46 PM, Eric Auger wrote: > Hi, > > On 2/3/25 3:48 PM, Michael S. Tsirkin wrote: >> On Fri, Jan 31, 2025 at 10:53:15AM +0100, Eric Auger wrote: >>> Hi Kirill, Michael >>> >>> On 8/8/24 9:51 AM, Kirill A. Shutemov wrote: >>>>

Re: [PATCH RFCv2 00/13] iommu: Add MSI mapping support with nested SMMU

2025-02-04 Thread Eric Auger
Hi Jason, On 1/29/25 9:13 PM, Jason Gunthorpe wrote: > On Wed, Jan 29, 2025 at 06:46:20PM +0100, Eric Auger wrote: >>>>> This missing peice is cleaning up the ITS mapping to allow for >>>>> multiple ITS pages. I've imagined that kvm would someone give iomm

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-02-04 Thread Eric Auger
Hi, On 2/3/25 3:48 PM, Michael S. Tsirkin wrote: > On Fri, Jan 31, 2025 at 10:53:15AM +0100, Eric Auger wrote: >> Hi Kirill, Michael >> >> On 8/8/24 9:51 AM, Kirill A. Shutemov wrote: >>> Hongyu reported a hang on kexec in a VM. QEMU reported invalid memor

Re: [PATCH] virtio: Remove virtio devices on device_shutdown()

2025-01-31 Thread Eric Auger
ls, see qemu thread ([PATCH] hw/virtio/vhost: Disable IOTLB callbacks when IOMMU gets disabled, https://lore.kernel.org/all/20250120173339.865681-1-eric.au...@redhat.com/) Reviewed-by: Eric Auger Tested-by: Eric Auger Thanks Eric > --- > drivers/virtio/virtio.c | 10 ++ >

Re: [PATCH RFCv2 09/13] iommufd: Add IOMMU_OPTION_SW_MSI_START/SIZE ioctls

2025-01-29 Thread Eric Auger
On 1/29/25 6:39 PM, Jason Gunthorpe wrote: > On Wed, Jan 29, 2025 at 06:23:33PM +0100, Eric Auger wrote: >>>> IIUC the MSI window will then be different when using legacy VFIO >>>> assignment and iommufd backend. >>> ? They use the same, iommufd can have use

Re: [PATCH RFCv2 00/13] iommu: Add MSI mapping support with nested SMMU

2025-01-29 Thread Eric Auger
On 1/29/25 4:04 PM, Jason Gunthorpe wrote: > On Wed, Jan 29, 2025 at 03:54:48PM +0100, Eric Auger wrote: >>>> or you are just mentioning it here because >>>> it is still possible to make use of that. I think from previous >>>> discussions the >>

Re: [PATCH RFCv2 09/13] iommufd: Add IOMMU_OPTION_SW_MSI_START/SIZE ioctls

2025-01-29 Thread Eric Auger
On 1/29/25 3:58 PM, Jason Gunthorpe wrote: > On Wed, Jan 29, 2025 at 02:44:12PM +0100, Eric Auger wrote: >> Hi, >> >> >> On 1/11/25 4:32 AM, Nicolin Chen wrote: >>> For systems that require MSI pages to be mapped into the IOMMU translation >>> t

Re: [PATCH RFCv2 00/13] iommu: Add MSI mapping support with nested SMMU

2025-01-29 Thread Eric Auger
Hi Jason, On 1/23/25 2:24 PM, Jason Gunthorpe wrote: > On Thu, Jan 23, 2025 at 09:06:49AM +, Shameerali Kolothum Thodi wrote: > >> One confusion I have about the above text is, do we still plan to support the >> approach -1( Using RMR in Qemu) > Yes, it remains an option. The VMM would use t

Re: [PATCH RFCv2 09/13] iommufd: Add IOMMU_OPTION_SW_MSI_START/SIZE ioctls

2025-01-29 Thread Eric Auger
Hi, On 1/11/25 4:32 AM, Nicolin Chen wrote: > For systems that require MSI pages to be mapped into the IOMMU translation > the IOMMU driver provides an IOMMU_RESV_SW_MSI range, which is the default > recommended IOVA window to place these mappings. However, there is nothing > special about this a

Re: [PATCH RFCv2 06/13] iommufd: Make attach_handle generic

2025-01-29 Thread Eric Auger
Hi, On 1/11/25 4:32 AM, Nicolin Chen wrote: > "attach_handle" was added exclusively for the iommufd_fault_iopf_handler() > used by IOPF/PRI use cases, along with the "fault_data". Now, the iommufd > version of sw_msi function will resue the attach_handle and fault_data for reuse > a non-fault cas

Re: [PATCH RFCv2 05/13] iommu: Turn fault_data to iommufd private pointer

2025-01-29 Thread Eric Auger
On 1/11/25 4:32 AM, Nicolin Chen wrote: > A "fault_data" was added exclusively for the iommufd_fault_iopf_handler() > used by IOPF/PRI use cases, along with the attach_handle. Now, the iommufd > version of sw_msi function will resue the attach_handle and fault_data for reuse > a non-fault case.

Re: [PATCH RFCv2 03/13] iommu: Make iommu_dma_prepare_msi() into a generic operation

2025-01-29 Thread Eric Auger
Hi Jason, On 1/23/25 7:16 PM, Jason Gunthorpe wrote: > On Thu, Jan 23, 2025 at 06:10:47PM +0100, Eric Auger wrote: >> Hi, >> >> >> On 1/11/25 4:32 AM, Nicolin Chen wrote: >>> From: Jason Gunthorpe >>> >>> SW_MSI supports IOMMU to translate

Re: [PATCH RFCv2 01/13] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie

2025-01-29 Thread Eric Auger
Hi, On 1/23/25 7:48 PM, Jason Gunthorpe wrote: > On Thu, Jan 23, 2025 at 06:10:48PM +0100, Eric Auger wrote: > >>> However iommufd now permits the domain to change while the driver is >>> probed and VFIO userspace can create races with IRQ changes calling >>>

Re: [PATCH RFCv2 02/13] genirq/msi: Rename iommu_dma_compose_msi_msg() to msi_msg_set_msi_addr()

2025-01-29 Thread Eric Auger
Hi Jason, On 1/23/25 7:50 PM, Jason Gunthorpe wrote: > On Thu, Jan 23, 2025 at 06:10:54PM +0100, Eric Auger wrote: > >>> -/** >>> - * iommu_dma_compose_msi_msg() - Apply translation to an MSI message >>> - * @desc: MSI descriptor prepared by iommu_dma_prepar

Re: [PATCH RFCv2 01/13] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie

2025-01-23 Thread Eric Auger
Hi Nicolin, On 1/11/25 4:32 AM, Nicolin Chen wrote: > From: Jason Gunthorpe > > All the iommu cases simply want to override the MSI page's address with those which translate MSIs > the IOVA that was mapped through the iommu. This doesn't need a cookie > pointer, we just need to store the IOVA a

Re: [PATCH RFCv2 02/13] genirq/msi: Rename iommu_dma_compose_msi_msg() to msi_msg_set_msi_addr()

2025-01-23 Thread Eric Auger
On 1/11/25 4:32 AM, Nicolin Chen wrote: > From: Jason Gunthorpe > > The new function is used to take in a u64 MSI address and store it in the > msi_msg. If the iommu has provided an alternative address then that is > replaced instead. > > All callers have a tidy u64 already so this also consol

Re: [PATCH RFCv2 03/13] iommu: Make iommu_dma_prepare_msi() into a generic operation

2025-01-23 Thread Eric Auger
Hi, On 1/11/25 4:32 AM, Nicolin Chen wrote: > From: Jason Gunthorpe > > SW_MSI supports IOMMU to translate an MSI message before the MSI message > is delivered to the interrupt controller. On such systems the iommu_domain > must have a translation for the MSI message for interrupts to work. > >

[PATCH] KVM: arm/arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST read

2021-04-12 Thread Eric Auger
returns NULL if the list is empty. Fixes: dbd9733ab674 ("KVM: arm/arm64: Replace the single rdist region by a list") Cc: # v4.18+ Signed-off-by: Eric Auger Reported-by: Gavin Shan --- arch/arm64/kvm/vgic/vgic-kvm-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) di

[PATCH v13 11/13] vfio: Document nested stage control

2021-04-11 Thread Eric Auger
The VFIO API was enhanced to support nested stage control: a bunch of new iotcls, one DMA FAULT region and an associated specific IRQ. Let's document the process to follow to set up nested mode. Signed-off-by: Eric Auger --- v11 -> v12: s/VFIO_REGION_INFO_CAP_PRODUC

[PATCH v13 13/13] vfio/pci: Inject page response upon response region fill

2021-04-11 Thread Eric Auger
When the userspace increments the head of the page response buffer ring, let's push the response into the iommu layer. This is done through a workqueue that pops the responses from the ring buffer and increment the tail. Signed-off-by: Eric Auger --- drivers/vfio/pci/vfio_pci.c

[PATCH v13 12/13] vfio/pci: Register a DMA fault response region

2021-04-11 Thread Eric Auger
In preparation for vSVA, let's register a DMA fault response region, where the userspace will push the page responses and increment the head of the buffer. The kernel will pop those responses and inject them on iommu side. Signed-off-by: Eric Auger --- v11 -> v12: - use DMA_FAULT_RESP

[PATCH v13 10/13] vfio/pci: Register and allow DMA FAULT IRQ signaling

2021-04-11 Thread Eric Auger
Register the VFIO_IRQ_TYPE_NESTED/VFIO_IRQ_SUBTYPE_DMA_FAULT IRQ that allows to signal a nested mode DMA fault. Signed-off-by: Eric Auger --- v10 -> v11: - the irq now is registered in vfio_pci_dma_fault_init() in case the domain is nested --- drivers/vfio/pci/vfio_pci.c |

[PATCH v13 08/13] vfio/pci: Add framework for custom interrupt indices

2021-04-11 Thread Eric Auger
Implement IRQ capability chain infrastructure. All interrupt indexes beyond VFIO_PCI_NUM_IRQS are handled as extended interrupts. They are registered with a specific type/subtype and supported flags. Signed-off-by: Eric Auger --- v11 -> v12: - check !vdev->num_ext_i

[PATCH v13 09/13] vfio: Add new IRQ for DMA fault reporting

2021-04-11 Thread Eric Auger
Add a new IRQ type/subtype to get notification on nested stage DMA faults. Signed-off-by: Eric Auger --- include/uapi/linux/vfio.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 0728b6f3f348..ad7c275b4074 100644 --- a/include

[PATCH v13 05/13] vfio/pci: Register an iommu fault handler

2021-04-11 Thread Eric Auger
Register an IOMMU fault handler which records faults in the DMA FAULT region ring buffer. In a subsequent patch, we will add the signaling of a specific eventfd to allow the userspace to be notified whenever a new fault has shown up. Signed-off-by: Eric Auger --- v11 -> v12: - take

[PATCH v13 07/13] vfio: Use capability chains to handle device specific irq

2021-04-11 Thread Eric Auger
From: Tina Zhang Caps the number of irqs with fixed indexes and uses capability chains to chain device specific irqs. Signed-off-by: Tina Zhang Signed-off-by: Eric Auger [Eric: Put cap_offset at the end of the vfio_irq_info struct, remove GFX IRQ at the moment and remove any reference to this

[PATCH v13 06/13] vfio/pci: Allow to mmap the fault queue

2021-04-11 Thread Eric Auger
The DMA FAULT region contains the fault ring buffer. There is benefit to let the userspace mmap this area. Expose this mmappable area through a sparse mmap entry and implement the mmap operation. Signed-off-by: Eric Auger --- v8 -> v9: - remove unused index local variable

[PATCH v13 04/13] vfio/pci: Add VFIO_REGION_TYPE_NESTED region type

2021-04-11 Thread Eric Auger
, entry size). At the moment the region is dimensionned for 512 fault records. Signed-off-by: Eric Auger --- v11 -> v12: - set fault_pages to NULL after free - check new_tail >= header->nb_entries (Zenghui) - update value of VFIO_REGION_TYPE_NESTED - handle the case where the domain is NU

[PATCH v13 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING

2021-04-11 Thread Eric Auger
This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim to (un)register the guest MSI binding to the host. This latter then can use those stage 1 bindings to build a nested stage binding targeting the physical MSIs. Signed-off-by: Eric Auger --- v11 -> v12: - Share VFIO_BASE + 20 w

[PATCH v13 02/13] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2021-04-11 Thread Eric Auger
E ioctl with aims at propagating guest stage1 IOMMU cache invalidations to the host. Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger --- v12 -> v13: - resolve minor conflict due to 898b9eaeb3fe ("vfio/type1: block on invalid vaddr") v11 -> v12: - share VFIO_BASE + 19 with VFI

[PATCH v13 01/13] vfio: VFIO_IOMMU_SET_PASID_TABLE

2021-04-11 Thread Eric Auger
From: "Liu, Yi L" This patch adds an VFIO_IOMMU_SET_PASID_TABLE ioctl which aims to pass the virtual iommu guest configuration to the host. This latter takes the form of the so-called PASID table. Signed-off-by: Jacob Pan Signed-off-by: Liu, Yi L Signed-off-by: Eric Auger ---

[PATCH v13 00/13] SMMUv3 Nested Stage Setup (VFIO part)

2021-04-11 Thread Eric Auger
e response region - Took into account Zenghui's comments - In this version I have kept the ioctl separate. Since Yi's series [2] is currently stalled, I've just rebased here. [2] [PATCH v7 00/16] vfio: expose virtual Shared Virtual Addressing to VMs v9 -> v10 - rebase on top of

[PATCH v15 12/12] iommu/smmuv3: report additional recoverable faults

2021-04-11 Thread Eric Auger
Up to now we have only reported translation faults. Now that the guest can induce some configuration faults, let's report them too. Add propagation for BAD_SUBSTREAMID, CD_FETCH, BAD_CD, WALK_EABT. We also fix the transcoding for some existing translation faults. Signed-off-by: Eric

[PATCH v15 11/12] iommu/smmuv3: Implement bind/unbind_guest_msi

2021-04-11 Thread Eric Auger
The bind/unbind_guest_msi() callbacks check the domain is NESTED and redirect to the dma-iommu implementation. Signed-off-by: Eric Auger --- v6 -> v7: - remove device handle argument --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 43 + 1 file changed, 43 inserti

[PATCH v15 10/12] iommu/smmuv3: Enforce incompatibility between nested mode and HW MSI regions

2021-04-11 Thread Eric Auger
Nested mode currently is not compatible with HW MSI reserved regions. Indeed MSI transactions targeting this MSI doorbells bypass the SMMU. Let's check nested mode is not attempted in such configuration. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH v15 09/12] iommu/smmuv3: Nested mode single MSI doorbell per domain enforcement

2021-04-11 Thread Eric Auger
correct physical doorbell. So let's forbid this situation. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 41 + 1 file changed, 41 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu

[PATCH v15 08/12] dma-iommu: Implement NESTED_MSI cookie

2021-04-11 Thread Eric Auger
ectly mapped through both stages. Nested mode is not compatible with HW MSI regions as in that case gDB and hDB should have a 1-1 mapping. This check will be done when attaching each device to the IOMMU domain. Signed-off-by: Eric Auger --- v14 -> v15: Took into account Zenghui's comments

[PATCH v15 07/12] iommu/smmuv3: Implement cache_invalidate

2021-04-11 Thread Eric Auger
Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v4 -> v15: - remove the redundant arm_smmu_cmdq_issue_sync(smmu) in IOMMU_INV_GRANU_ADDR case (Zenghui) - if RIL is not supported by the host, make sure the granule_size that

[PATCH v15 06/12] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-04-11 Thread Eric Auger
With nested stage support, soon we will need to invalidate S1 contexts and ranges tagged with an unmanaged asid, this latter being managed by the guest. So let's introduce 2 helpers that allow to invalidate with externally managed ASIDs Signed-off-by: Eric Auger --- v14 -> v15: - Alw

[PATCH v15 05/12] iommu/smmuv3: Implement attach/detach_pasid_table

2021-04-11 Thread Eric Auger
. Signed-off-by: Eric Auger --- v14 -> v15: - add a comment before arm_smmu_get_cd_ptr to warn the developper this function must not be used in case of nested (Keqian) v13 -> v14: - on PASID table detach, reset the abort flag (Keqian) v7 -> v8: - remove smmu->features check, now do

[PATCH v15 04/12] iommu/smmuv3: Get prepared for nested stage support

2021-04-11 Thread Eric Auger
write both stage fields in the STE and deal with the abort field. In nested mode, only stage 2 is "finalized" as the host does not own/configure the stage 1 context descriptor; guest does. Signed-off-by: Eric Auger --- v13 -> v14: - removed BUG_ON(ste_live && !nested)

[PATCH v15 03/12] iommu/smmuv3: Allow s1 and s2 configs to coexist

2021-04-11 Thread Eric Auger
both stages are used and the S1 config is "set" when the guest passes its pasid table. No functional change intended. Signed-off-by: Eric Auger --- v13 -> v14: - slight reword of the commit message v12 -> v13: - does not dynamically allocate s1-cfg and s2_cfg anymore. Add t

[PATCH v15 02/12] iommu: Introduce bind/unbind_guest_msi

2021-04-11 Thread Eric Auger
similarly a single virtual doorbell mapping gets registered (1 single virtual doorbell is used on guest as well). Signed-off-by: Eric Auger --- v13 -> v14: - s/iova/giova in iommu_unbind_guest_msi proto (Kequian) v7 -> v8: - dummy iommu_unbind_guest_msi turned into a void function v6 -

[PATCH v15 01/12] iommu: Introduce attach/detach_pasid_table API

2021-04-11 Thread Eric Auger
. A generic iommu_pasid_table_config struct is introduced in a new iommu.h uapi header. This is going to be used by the VFIO user API. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Liu, Yi L Signed-off-by: Ashok Raj Signed-off-by: Jacob Pan Signed-off-by: Eric Auger --- v13 ->

[PATCH v15 00/12] SMMUv3 Nested Stage Setup (IOMMU part)

2021-04-11 Thread Eric Auger
a SID->device structure" according to the last version v11 -> v12: - rebase on top of v5.10-rc4 Eric Auger (12): iommu: Introduce attach/detach_pasid_table API iommu: Introduce bind/unbind_guest_msi iommu/smmuv3: Allow s1 and s2 configs to coexist iommu/smmuv3: Get prepar

[PATCH] KVM: selftests: vgic_init kvm selftests fixup

2021-04-07 Thread Eric Auger
is checked by the caller - vm_gic struct is used whenever possible, as well as vm_gic_destroy - _kvm_create_device takes an addition fd parameter Signed-off-by: Eric Auger Suggested-by: Andrew Jones --- Applies on top of [PATCH v6 0/9] KVM/ARM: Some vgic fixes and init sequence KVM selftests,

[PATCH v6 8/9] KVM: arm64: vgic-v3: Expose GICR_TYPER.Last for userspace

2021-04-05 Thread Eric Auger
istributor contributor pages. With this new implementation we do not need to have a uaccess read accessor anymore. Signed-off-by: Eric Auger --- v4 -> v5: - change the implementation according to Marc's understanding of the spec --- arch/arm64/kvm/vgic/v

[PATCH v6 9/9] KVM: selftests: aarch64/vgic-v3 init sequence tests

2021-04-05 Thread Eric Auger
. The goal was to test the case recently fixed by commit 23bde34771f1 ("KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace"). The API under test can be found at Documentation/virt/kvm/devices/arm-vgic-v3.rst Signed-off-by: Eric Auger --- v4 -> v5: - simplify the l

[PATCH v6 7/9] kvm: arm64: vgic-v3: Introduce vgic_v3_free_redist_region()

2021-04-05 Thread Eric Auger
To improve the readability, we introduce the new vgic_v3_free_redist_region helper and also rename vgic_v3_insert_redist_region into vgic_v3_alloc_redist_region Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic-init.c| 6 ++ arch/arm64/kvm/vgic/vgic-mmio-v3.c | 17

[PATCH v6 5/9] docs: kvm: devices/arm-vgic-v3: enhance KVM_DEV_ARM_VGIC_CTRL_INIT doc

2021-04-05 Thread Eric Auger
kvm_arch_vcpu_precreate() returns -EBUSY if the vgic is already initialized. So let's document that KVM_DEV_ARM_VGIC_CTRL_INIT must be called after all vcpu creations. Signed-off-by: Eric Auger --- v1 -> v2: - Must be called after all vcpu creations -> Must be called after all

[PATCH v6 6/9] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write]

2021-04-05 Thread Eric Auger
,write}. Signed-off-by: Eric Auger --- v1 -> v2: - reworded the commit message as suggested by Alexandru --- arch/arm64/kvm/vgic/vgic-mmio.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c in

[PATCH v6 3/9] KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base()

2021-04-05 Thread Eric Auger
vgic_register_redist_iodev(). In such a case, remove the newly added redistributor region and free it. Signed-off-by: Eric Auger --- v1 -> v2: - fix the commit message and split declaration/assignment of rdreg --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 8 +++- 1 file changed, 7 insertions(+), 1 delet

[PATCH v6 4/9] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy()

2021-04-05 Thread Eric Auger
On vgic_dist_destroy(), the addresses are not reset. However for kvm selftest purpose this would allow to continue the test execution even after a failure when running KVM_RUN. So let's reset the base addresses. Signed-off-by: Eric Auger --- v1 -> v2: - use dist-> in the else and

[PATCH v6 2/9] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read

2021-04-05 Thread Eric Auger
rm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") Cc: sta...@vger.kernel.org#v4.17+ Signed-off-by: Eric Auger Reviewed-by: Alexandru Elisei --- v1 -> v2: - in the commit message, remove the statement that the index always is 0 - add Alexandru's R-b --- arch/arm64/kvm/vgic/vgic-kvm-devi

[PATCH v6 1/9] KVM: arm64: vgic-v3: Fix some error codes when setting RDIST base

2021-04-05 Thread Eric Auger
by looking at the count field. Signed-off-by: Eric Auger --- v3 -> v4: - rewrite the test checking that we do not mix rdist region types v1 -> v2: - simplify the check sequence --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-)

[PATCH v6 0/9] KVM/ARM: Some vgic fixes and init sequence KVM selftests

2021-04-05 Thread Eric Auger
ce after the map_resources v1 -> v2: - Took into account all comments from Marc and Alexandru's except the has_run_once still after the map_resources (this would oblige me to revisit in depth the selftests) Eric Auger (9): KVM: arm64: vgic-v3: Fix some error co

[PATCH v5 4/8] docs: kvm: devices/arm-vgic-v3: enhance KVM_DEV_ARM_VGIC_CTRL_INIT doc

2021-04-04 Thread Eric Auger
kvm_arch_vcpu_precreate() returns -EBUSY if the vgic is already initialized. So let's document that KVM_DEV_ARM_VGIC_CTRL_INIT must be called after all vcpu creations. Signed-off-by: Eric Auger --- v1 -> v2: - Must be called after all vcpu creations -> Must be called after all

[PATCH v5 7/8] KVM: arm64: vgic-v3: Expose GICR_TYPER.Last for userspace

2021-04-04 Thread Eric Auger
istributor contributor pages. With this new implementation we do not need to have a uaccess read accessor anymore. Signed-off-by: Eric Auger --- v4 -> v5: - redist region list now is sorted by @base - change the implementation according to Marc's understanding of the spec --- arch/a

[PATCH v5 8/8] KVM: selftests: aarch64/vgic-v3 init sequence tests

2021-04-04 Thread Eric Auger
. The goal was to test the case recently fixed by commit 23bde34771f1 ("KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace"). The API under test can be found at Documentation/virt/kvm/devices/arm-vgic-v3.rst Signed-off-by: Eric Auger --- v4 -> v5: - simplify the l

[PATCH v5 6/8] kvm: arm64: vgic-v3: Introduce vgic_v3_free_redist_region()

2021-04-04 Thread Eric Auger
To improve the readability, we introduce the new vgic_v3_free_redist_region helper and also rename vgic_v3_insert_redist_region into vgic_v3_alloc_redist_region Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic-init.c| 6 ++ arch/arm64/kvm/vgic/vgic-mmio-v3.c | 17

[PATCH v5 5/8] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write]

2021-04-04 Thread Eric Auger
,write}. Signed-off-by: Eric Auger --- v1 -> v2: - reworded the commit message as suggested by Alexandru --- arch/arm64/kvm/vgic/vgic-mmio.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c in

[PATCH v5 3/8] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy()

2021-04-04 Thread Eric Auger
On vgic_dist_destroy(), the addresses are not reset. However for kvm selftest purpose this would allow to continue the test execution even after a failure when running KVM_RUN. So let's reset the base addresses. Signed-off-by: Eric Auger --- v1 -> v2: - use dist-> in the else and

[PATCH v5 1/8] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read

2021-04-04 Thread Eric Auger
rm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") Cc: sta...@vger.kernel.org#v4.17+ Signed-off-by: Eric Auger Reviewed-by: Alexandru Elisei --- v1 -> v2: - in the commit message, remove the statement that the index always is 0 - add Alexandru's R-b --- arch/arm64/kvm/vgic/vgic-kvm-devi

[PATCH v5 2/8] KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base()

2021-04-04 Thread Eric Auger
vgic_register_redist_iodev(). In such a case, remove the newly added redistributor region and free it. Signed-off-by: Eric Auger --- v1 -> v2: - fix the commit message and split declaration/assignment of rdreg --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 8 +++- 1 file changed, 7 insertions(+), 1 delet

[PATCH v5 0/8] KVM/ARM: Some vgic fixes and init sequence KVM selftests

2021-04-04 Thread Eric Auger
registered in ascending order - removed [PATCH 5/9] KVM: arm: move has_run_once after the map_resources v1 -> v2: - Took into account all comments from Marc and Alexandru's except the has_run_once still after the map_resources (this would oblige me to revisit in depth the selftests

[PATCH v4 5/8] docs: kvm: devices/arm-vgic-v3: enhance KVM_DEV_ARM_VGIC_CTRL_INIT doc

2021-04-01 Thread Eric Auger
kvm_arch_vcpu_precreate() returns -EBUSY if the vgic is already initialized. So let's document that KVM_DEV_ARM_VGIC_CTRL_INIT must be called after all vcpu creations. Signed-off-by: Eric Auger --- v1 -> v2: - Must be called after all vcpu creations -> Must be called after all

[PATCH v4 6/8] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write]

2021-04-01 Thread Eric Auger
,write}. Signed-off-by: Eric Auger --- v1 -> v2: - reworded the commit message as suggested by Alexandru --- arch/arm64/kvm/vgic/vgic-mmio.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c in

[PATCH v4 7/8] KVM: arm64: vgic-v3: Expose GICR_TYPER.Last for userspace

2021-04-01 Thread Eric Auger
o not need to have a uaccess read accessor anymore. Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic-init.c| 7 +-- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 97 -- arch/arm64/kvm/vgic/vgic.h | 1 + include/kvm/arm_vgic.h | 3 + 4 files changed,

[PATCH v4 8/8] KVM: selftests: aarch64/vgic-v3 init sequence tests

2021-04-01 Thread Eric Auger
. The goal was to test the case recently fixed by commit 23bde34771f1 ("KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace"). The API under test can be found at Documentation/virt/kvm/devices/arm-vgic-v3.rst Signed-off-by: Eric Auger --- v3 -> v4: - update .git

[PATCH v4 4/8] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy()

2021-04-01 Thread Eric Auger
On vgic_dist_destroy(), the addresses are not reset. However for kvm selftest purpose this would allow to continue the test execution even after a failure when running KVM_RUN. So let's reset the base addresses. Signed-off-by: Eric Auger --- v1 -> v2: - use dist-> in the else and

[PATCH v4 2/8] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read

2021-04-01 Thread Eric Auger
rm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") Cc: sta...@vger.kernel.org#v4.17+ Signed-off-by: Eric Auger Reviewed-by: Alexandru Elisei --- v1 -> v2: - in the commit message, remove the statement that the index always is 0 - add Alexandru's R-b --- arch/arm64/kvm/vgic/vgic-kvm-devi

[PATCH v4 3/8] KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base()

2021-04-01 Thread Eric Auger
vgic_register_redist_iodev(). In such a case, remove the newly added redistributor region and free it. Signed-off-by: Eric Auger --- v1 -> v2: - fix the commit message and split declaration/assignment of rdreg --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 8 +++- 1 file changed, 7 insertions(+), 1 delet

[PATCH v4 1/8] KVM: arm64: vgic-v3: Fix some error codes when setting RDIST base

2021-04-01 Thread Eric Auger
by looking at the count field. Signed-off-by: Eric Auger --- v1 -> v2: - simplify the check sequence --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio

[PATCH v4 0/8] KVM/ARM: Some vgic fixes and init sequence KVM selftests

2021-04-01 Thread Eric Auger
comments from Marc and Alexandru's except the has_run_once still after the map_resources (this would oblige me to revisit in depth the selftests) Eric Auger (8): KVM: arm64: vgic-v3: Fix some error codes when setting RDIST base KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION re

[PATCH v3 8/8] KVM: selftests: aarch64/vgic-v3 init sequence tests

2021-03-12 Thread Eric Auger
. The goal was to test the case recently fixed by commit 23bde34771f1 ("KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace"). The API under test can be found at Documentation/virt/kvm/devices/arm-vgic-v3.rst Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic

[PATCH v3 7/8] KVM: arm64: vgic-v3: Expose GICR_TYPER.Last for userspace

2021-03-12 Thread Eric Auger
o not need to have a uaccess read accessor anymore. Signed-off-by: Eric Auger --- arch/arm64/kvm/vgic/vgic-init.c| 7 +-- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 97 -- arch/arm64/kvm/vgic/vgic.h | 1 + include/kvm/arm_vgic.h | 3 + 4 files changed,

[PATCH v3 6/8] KVM: arm64: Simplify argument passing to vgic_uaccess_[read|write]

2021-03-12 Thread Eric Auger
,write}. Signed-off-by: Eric Auger --- v1 -> v2: - reworded the commit message as suggested by Alexandru --- arch/arm64/kvm/vgic/vgic-mmio.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c in

[PATCH v3 5/8] docs: kvm: devices/arm-vgic-v3: enhance KVM_DEV_ARM_VGIC_CTRL_INIT doc

2021-03-12 Thread Eric Auger
kvm_arch_vcpu_precreate() returns -EBUSY if the vgic is already initialized. So let's document that KVM_DEV_ARM_VGIC_CTRL_INIT must be called after all vcpu creations. Signed-off-by: Eric Auger --- v1 -> v2: - Must be called after all vcpu creations -> Must be called after all

[PATCH v3 4/8] KVM: arm/arm64: vgic: Reset base address on kvm_vgic_dist_destroy()

2021-03-12 Thread Eric Auger
On vgic_dist_destroy(), the addresses are not reset. However for kvm selftest purpose this would allow to continue the test execution even after a failure when running KVM_RUN. So let's reset the base addresses. Signed-off-by: Eric Auger --- v1 -> v2: - use dist-> in the else and

[PATCH v3 0/8] KVM/ARM: Some vgic fixes and init sequence KVM selftests

2021-03-12 Thread Eric Auger
sit in depth the selftests) Eric Auger (8): KVM: arm64: vgic-v3: Fix some error codes when setting RDIST base KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base() KVM: arm/arm64: vgic: Reset base address on kvm_v

[PATCH v3 2/8] KVM: arm64: Fix KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION read

2021-03-12 Thread Eric Auger
rm64: Implement KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION") Cc: sta...@vger.kernel.org#v4.17+ Signed-off-by: Eric Auger Reviewed-by: Alexandru Elisei --- v1 -> v2: - in the commit message, remove the statement that the index always is 0 - add Alexandru's R-b --- arch/arm64/kvm/vgic/vgic-kvm-devi

[PATCH v3 1/8] KVM: arm64: vgic-v3: Fix some error codes when setting RDIST base

2021-03-12 Thread Eric Auger
by looking at the count field. Signed-off-by: Eric Auger --- v1 -> v2: - simplify the check sequence --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio

[PATCH v3 3/8] KVM: arm64: vgic-v3: Fix error handling in vgic_v3_set_redist_base()

2021-03-12 Thread Eric Auger
vgic_register_redist_iodev(). In such a case, remove the newly added redistributor region and free it. Signed-off-by: Eric Auger --- v1 -> v2: - fix the commit message and split declaration/assignment of rdreg --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 8 +++- 1 file changed, 7 insertions(+), 1 delet

[PATCH v12 10/13] vfio/pci: Register and allow DMA FAULT IRQ signaling

2021-02-23 Thread Eric Auger
Register the VFIO_IRQ_TYPE_NESTED/VFIO_IRQ_SUBTYPE_DMA_FAULT IRQ that allows to signal a nested mode DMA fault. Signed-off-by: Eric Auger --- v10 -> v11: - the irq now is registered in vfio_pci_dma_fault_init() in case the domain is nested --- drivers/vfio/pci/vfio_pci.c |

[PATCH v12 07/13] vfio: Use capability chains to handle device specific irq

2021-02-23 Thread Eric Auger
From: Tina Zhang Caps the number of irqs with fixed indexes and uses capability chains to chain device specific irqs. Signed-off-by: Tina Zhang Signed-off-by: Eric Auger [Eric: Put cap_offset at the end of the vfio_irq_info struct, remove GFX IRQ at the moment and remove any reference to this

[PATCH v12 06/13] vfio/pci: Allow to mmap the fault queue

2021-02-23 Thread Eric Auger
The DMA FAULT region contains the fault ring buffer. There is benefit to let the userspace mmap this area. Expose this mmappable area through a sparse mmap entry and implement the mmap operation. Signed-off-by: Eric Auger --- v8 -> v9: - remove unused index local variable

[PATCH v12 12/13] vfio/pci: Register a DMA fault response region

2021-02-23 Thread Eric Auger
In preparation for vSVA, let's register a DMA fault response region, where the userspace will push the page responses and increment the head of the buffer. The kernel will pop those responses and inject them on iommu side. Signed-off-by: Eric Auger --- v11 -> v12: - use DMA_FAULT_RESP

[PATCH v12 13/13] vfio/pci: Inject page response upon response region fill

2021-02-23 Thread Eric Auger
When the userspace increments the head of the page response buffer ring, let's push the response into the iommu layer. This is done through a workqueue that pops the responses from the ring buffer and increment the tail. Signed-off-by: Eric Auger --- drivers/vfio/pci/vfio_pci.c

[PATCH v12 08/13] vfio/pci: Add framework for custom interrupt indices

2021-02-23 Thread Eric Auger
Implement IRQ capability chain infrastructure. All interrupt indexes beyond VFIO_PCI_NUM_IRQS are handled as extended interrupts. They are registered with a specific type/subtype and supported flags. Signed-off-by: Eric Auger --- v11 -> v12: - check !vdev->num_ext_i

[PATCH v12 11/13] vfio: Document nested stage control

2021-02-23 Thread Eric Auger
The VFIO API was enhanced to support nested stage control: a bunch of new iotcls, one DMA FAULT region and an associated specific IRQ. Let's document the process to follow to set up nested mode. Signed-off-by: Eric Auger --- v11 -> v12: s/VFIO_REGION_INFO_CAP_PRODUC

  1   2   3   4   5   6   7   8   9   10   >