Re: [PATCH v6 0/6] KASan for arm

2019-07-11 Thread Florian Fainelli
On 7/2/19 2:06 PM, Linus Walleij wrote: > Hi Florian, > > On Tue, Jun 18, 2019 at 12:11 AM Florian Fainelli > wrote: > >> Abbott submitted a v5 about a year ago here: >> >> and the series was not picked up since then, so I rebased it against >> v5.2-rc4 and re-tested it on a Brahma-B53 (ARMv8 r

Re: [PATCH v6 1/6] ARM: Add TTBR operator for kasan_init

2019-07-11 Thread Florian Fainelli
On 7/2/19 2:03 PM, Linus Walleij wrote: > Hi Florian! > > thanks for your patch! > > On Tue, Jun 18, 2019 at 12:11 AM Florian Fainelli > wrote: > >> From: Abbott Liu >> >> The purpose of this patch is to provide set_ttbr0/get_ttbr0 to >> kasan_init function. The definitions of cp15 registers

Re: [PATCH v6 2/6] ARM: Disable instrumentation for some code

2019-07-11 Thread Florian Fainelli
On 7/2/19 2:56 PM, Linus Walleij wrote: > On Tue, Jun 18, 2019 at 12:11 AM Florian Fainelli > wrote: > >> @@ -236,7 +236,8 @@ static int unwind_pop_register(struct unwind_ctrl_block >> *ctrl, >> if (*vsp >= (unsigned long *)ctrl->sp_high) >> return -URC_F

[PATCH v9 11/11] vfio: Document nested stage control

2019-07-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 --- v8 -> v9: - new names for SET_MSI_BINDING and SET_PASID_TABLE - new l

[PATCH v9 07/11] vfio: Use capability chains to handle device specific irq

2019-07-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 v9 09/11] vfio/pci: Add framework for custom interrupt indices

2019-07-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 --- drivers/vfio/pci/vfio_pci.c | 100 +++-

[PATCH v9 10/11] vfio/pci: Register and allow DMA FAULT IRQ signaling

2019-07-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 --- drivers/vfio/pci/vfio_pci.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/driv

[PATCH v9 08/11] vfio: Add new IRQ for DMA fault reporting

2019-07-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 b53714ae02c5..58607809e81a 100644 --- a/include/ua

[PATCH v9 06/11] vfio/pci: Allow to mmap the fault queue

2019-07-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 in vfio_pci_fault_mmap

[PATCH v9 05/11] vfio/pci: Register an iommu fault handler

2019-07-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 as shown up. Signed-off-by: Eric Auger --- v8 -> v9: - handler now takes an

[PATCH v9 04/11] vfio/pci: Add VFIO_REGION_TYPE_NESTED region type

2019-07-11 Thread Eric Auger
Add a new specific DMA_FAULT region aiming to exposed nested mode translation faults. The region has a ring buffer that contains the actual fault records plus a header allowing to handle it (tail/head indices, max capacity, entry size). At the moment the region is dimensionned for 512 fault record

[PATCH v9 03/11] vfio: VFIO_IOMMU_SET_MSI_BINDING

2019-07-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 --- v8 -> v9: - merge VFIO_IOMMU_BIND_MSI/VFIO

[PATCH v9 01/11] vfio: VFIO_IOMMU_SET_PASID_TABLE

2019-07-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 --- v8 -> v9: - Mer

[PATCH v9 00/11] SMMUv3 Nested Stage Setup (VFIO part)

2019-07-11 Thread Eric Auger
This series brings the VFIO part of HW nested paging support in the SMMUv3. The series depends on: [PATCH v9 00/14] SMMUv3 Nested Stage Setup (IOMMU part) (https://www.spinics.net/lists/kernel/msg3187714.html) 3 new IOCTLs are introduced that allow the userspace to 1) pass the guest stage 1 confi

[PATCH v9 02/11] vfio: VFIO_IOMMU_CACHE_INVALIDATE

2019-07-11 Thread Eric Auger
From: "Liu, Yi L" When the guest "owns" the stage 1 translation structures, the host IOMMU driver has no knowledge of caching structure updates unless the guest invalidation requests are trapped and passed down to the host. This patch adds the VFIO_IOMMU_CACHE_INVALIDATE ioctl with aims at prop

Re: [GIT PULL] KVM/arm updates for Linux 5.3

2019-07-11 Thread Paolo Bonzini
On 09/07/19 14:24, Marc Zyngier wrote: > git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git > tags/kvm-arm-for-5.3 Pulled, thanks! Paolo ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/

Re: [PATCH 48/59] KVM: arm64: nv: Load timer before the GIC

2019-07-11 Thread Alexandru Elisei
On 6/21/19 10:38 AM, Marc Zyngier wrote: > In order for vgic_v3_load_nested to be able to observe which > which timer interrupts have the HW bit set for the current s/which which/which > context, the timers must have been loaded in the new mode > and the right timer mapped to their corresponding

Re: [PATCH v8 26/29] vfio-pci: Register an iommu fault handler

2019-07-11 Thread Auger Eric
Hi Jean, Jacob, On 6/18/19 4:04 PM, Jean-Philippe Brucker wrote: > On 12/06/2019 19:53, Jacob Pan wrote: You are right, the worst case of the spurious PS is to terminate the group prematurely. Need to know the scope of the HW damage in case of mdev where group IDs can be shared amon

Re: [PATCH v3 7/9] arm/arm64: kvm: pmu: Make overflow handler NMI safe

2019-07-11 Thread Zenghui Yu
Hi Julien, On 2019/7/8 22:32, Julien Thierry wrote: When using an NMI for the PMU interrupt, taking any lock migh cause a s/migh/might/ deadlock. The current PMU overflow handler in KVM takes takes locks when

Re: [PATCH 55/59] arm64: KVM: nv: Add handling of EL2-specific timer registers

2019-07-11 Thread Alexandru Elisei
On 6/21/19 10:38 AM, Marc Zyngier wrote: > Add the required handling for EL2 and EL02 registers, as > well as EL1 registers used in the E2H context. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/sys_regs.c | 72 +++ > 1 file changed, 72 insertions(+)

[PATCH v9 14/14] iommu/smmuv3: Report non recoverable faults

2019-07-11 Thread Eric Auger
When a stage 1 related fault event is read from the event queue, let's propagate it to potential external fault listeners, ie. users who registered a fault handler. Signed-off-by: Eric Auger --- v8 -> v9: - adapt to the removal of IOMMU_FAULT_UNRECOV_PERM_VALID: only look at IOMMU_FAULT_UNRECO

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

2019-07-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-smmu-v3.c | 23 +-- 1 f

[PATCH v9 13/14] iommu/smmuv3: Implement bind/unbind_guest_msi

2019-07-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-smmu-v3.c | 43 + 1 file changed, 43 insertions(+) d

[PATCH v9 11/14] iommu/smmuv3: Nested mode single MSI doorbell per domain enforcement

2019-07-11 Thread Eric Auger
In nested mode we enforce the rule that all devices belonging to the same iommu_domain share the same msi_domain. Indeed if there were several physical MSI doorbells being used within a single iommu_domain, it becomes really difficult to resolve the nested stage mapping translating into the correc

[PATCH v9 10/14] dma-iommu: Implement NESTED_MSI cookie

2019-07-11 Thread Eric Auger
Up to now, when the type was UNMANAGED, we used to allocate IOVA pages within a reserved IOVA MSI range. If both the host and the guest are exposed with SMMUs, each would allocate an IOVA. The guest allocates an IOVA (gIOVA) to map onto the guest MSI doorbell (gDB). The Host allocates another IOVA

[PATCH v9 09/14] iommu/smmuv3: Implement cache_invalidate

2019-07-11 Thread Eric Auger
Implement domain-selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v7 -> v8: - ASID based invalidation using iommu_inv_pasid_info - check ARCHID/PASID flags in addr based invalidation - use __arm_smmu_tlb_inv_context and __arm_smmu_tlb_inv_range_nosync v6 -> v7 - c

[PATCH v9 07/14] iommu/smmuv3: Implement attach/detach_pasid_table

2019-07-11 Thread Eric Auger
On attach_pasid_table() we program STE S1 related info set by the guest into the actual physical STEs. At minimum we need to program the context descriptor GPA and compute whether the stage1 is translated/bypassed or aborted. Signed-off-by: Eric Auger --- v7 -> v8: - remove smmu->features check,

[PATCH v9 08/14] iommu/smmuv3: Introduce __arm_smmu_tlb_inv_asid/s1_range_nosync

2019-07-11 Thread Eric Auger
Introduce helpers to invalidate a given asid/vmid or invalidate address ranges associated to a given asid/vmid. S1 helpers will be used to invalidate stage 1 caches upon userspace request, in nested mode. Signed-off-by: Eric Auger --- --- drivers/iommu/arm-smmu-v3.c | 98 ++

[PATCH v9 06/14] iommu/smmuv3: Get prepared for nested stage support

2019-07-11 Thread Eric Auger
When nested stage translation is setup, both s1_cfg and s2_cfg are allocated. We introduce a new smmu domain abort field that will be set upon guest stage1 configuration passing. arm_smmu_write_strtab_ent() is modified to write both stage fields in the STE and deal with the abort field. In neste

[PATCH v9 05/14] iommu/smmuv3: Dynamically allocate s1_cfg and s2_cfg

2019-07-11 Thread Eric Auger
In preparation for the introduction of nested configuration let's turn s1_cfg and s2_cfg fields into pointers which are dynamically allocated depending on the smmu_domain stage. In nested mode, s1_cfg will only be allocated when setting up S1 translation. Signed-off-by: Eric Auger --- drivers/i

[PATCH v9 02/14] iommu: Introduce cache_invalidate API

2019-07-11 Thread Eric Auger
From: Yi L Liu In any virtualization use case, when the first translation stage is "owned" by the guest OS, the host IOMMU driver has no knowledge of caching structure updates unless the guest invalidation activities are trapped by the virtualizer and passed down to the host. Since the invalidat

[PATCH v9 03/14] iommu: Introduce bind/unbind_guest_msi

2019-07-11 Thread Eric Auger
On ARM, MSI are translated by the SMMU. An IOVA is allocated for each MSI doorbell. If both the host and the guest are exposed with SMMUs, we end up with 2 different IOVAs allocated by each. guest allocates an IOVA (gIOVA) to map onto the guest MSI doorbell (gDB). The Host allocates another IOVA (h

[PATCH v9 00/14] SMMUv3 Nested Stage Setup (IOMMU part)

2019-07-11 Thread Eric Auger
This series brings the IOMMU part of HW nested paging support in the SMMUv3. The VFIO part is submitted separately. The IOMMU API is extended to support 3 new API functionalities: 1) pass the guest stage 1 configuration 2) pass stage 1 MSI bindings 3) invalidate stage 1 related caches 3) is also

[PATCH v9 04/14] iommu/arm-smmu-v3: Maintain a SID->device structure

2019-07-11 Thread Eric Auger
From: Jean-Philippe Brucker When handling faults from the event or PRI queue, we need to find the struct device associated to a SID. Add a rb_tree to keep track of SIDs. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm-smmu-v3.c | 134 ++-- 1 file chan

[PATCH v9 01/14] iommu: Introduce attach/detach_pasid_table API

2019-07-11 Thread Eric Auger
From: Jacob Pan In virtualization use case, when a guest is assigned a PCI host device, protected by a virtual IOMMU on the guest, the physical IOMMU must be programmed to be consistent with the guest mappings. If the physical IOMMU supports two translation stages it makes sense to program guest

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Alexander Graf
On 11.07.19 11:42, Andre Przywara wrote: On Thu, 11 Jul 2019 09:52:42 +0200 Paolo Bonzini wrote: Hi, On 11/07/19 07:49, Alexander Graf wrote: I agree that it would belong more in qtest, but tests in not exactly the right place is better than no tests. The problem with qtest is that it t

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Marc Zyngier
On 11/07/2019 10:42, Andre Przywara wrote: > On Thu, 11 Jul 2019 09:52:42 +0200 > Paolo Bonzini wrote: > > Hi, > >> On 11/07/19 07:49, Alexander Graf wrote: I agree that it would belong more in qtest, but tests in not exactly the right place is better than no tests. >>> >>> The probl

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Andre Przywara
On Thu, 11 Jul 2019 09:52:42 +0200 Paolo Bonzini wrote: Hi, > On 11/07/19 07:49, Alexander Graf wrote: > >> I agree that it would belong more in qtest, but tests in not exactly the > >> right place is better than no tests. > > > > The problem with qtest is that it tests QEMU device models fro

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Peter Maydell
On Thu, 11 Jul 2019 at 10:11, Alexander Graf wrote: > On 11.07.19 10:51, Peter Maydell wrote: > > Have you tested this against a real hardware pl031? > Do you have any pointers to devices I might own that have one? Heh, fair point. I'd expect to find one in most of the devboards Arm has shipped

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Peter Maydell
On Wed, 10 Jul 2019 at 14:35, Alexander Graf wrote: > > This patch adds a unit test for the PL031 RTC that is used in the virt > machine. > It just pokes basic functionality. I've mostly written it to familiarize > myself > with the device, but I suppose having the test around does not hurt, as

Re: [PATCH kvm-unit-tests] arm: Add PL031 test

2019-07-11 Thread Paolo Bonzini
On 11/07/19 07:49, Alexander Graf wrote: >> I agree that it would belong more in qtest, but tests in not exactly the >> right place is better than no tests. > > The problem with qtest is that it tests QEMU device models from a QEMU > internal view. Not really: fundamentally it tests QEMU device m