[PATCH v2 7/9] iommu/vt-d: Listen to IOASID notifications

2020-08-22 Thread Jacob Pan
On Intel Scalable I/O Virtualization (SIOV) enabled platforms, IOMMU driver is one of the users of IOASIDs. In normal flow, callers will perform IOASID allocation, bind, unbind, and free in order. However, for guest SVA, IOASID free could come before unbind as guest is untrusted. This patch

[PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-08-22 Thread Jacob Pan
When an IOASID set is used for guest SVA, each VM will acquire its ioasid_set for IOASID allocations. IOASIDs within the VM must have a host/physical IOASID backing, mapping between guest and host IOASIDs can be non-identical. IOASID set private ID (SPID) is introduced in this patch to be used as

[PATCH v2 6/9] iommu/ioasid: Introduce notification APIs

2020-08-22 Thread Jacob Pan
Relations among IOASID users largely follow a publisher-subscriber pattern. E.g. to support guest SVA on Intel Scalable I/O Virtualization (SIOV) enabled platforms, VFIO, IOMMU, device drivers, KVM are all users of IOASIDs. When a state change occurs, VFIO publishes the change event that needs to

[PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-22 Thread Jacob Pan
IOASID is used to identify address spaces that can be targeted by device DMA. It is a system-wide resource that is essential to its many users. This document is an attempt to help developers from all vendors navigate the APIs. At this time, ARM SMMU and Intel’s Scalable IO Virtualization (SIOV)

[PATCH v2 4/9] iommu/ioasid: Add reference couting functions

2020-08-22 Thread Jacob Pan
There can be multiple users of an IOASID, each user could have hardware contexts associated with the IOASID. In order to align lifecycles, reference counting is introduced in this patch. It is expected that when an IOASID is being freed, each user will drop a reference only after its context is

[PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-08-22 Thread Jacob Pan
ioasid_set was introduced as an arbitrary token that are shared by a group of IOASIDs. For example, if IOASID #1 and #2 are allocated via the same ioasid_set*, they are viewed as to belong to the same set. For guest SVA usages, system-wide IOASID resources need to be partitioned such that VMs can

[PATCH v2 9/9] iommu/vt-d: Store guest PASID during bind

2020-08-22 Thread Jacob Pan
IOASID core maintains the guest-host mapping in the form of SPID and IOASID. This patch assigns the guest PASID (if valid) as SPID while binding guest page table with a host PASID. This mapping will be used for lookup and notifications. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 2

[PATCH v2 8/9] iommu/vt-d: Send IOASID bind/unbind notifications

2020-08-22 Thread Jacob Pan
On Intel Scalable I/O Virtualization (SIOV) enabled platforms with ENQCMD in use by the guest, KVM must establish a guest-host PASID translation table prior to the issuing of ENQCMD. PASID translation table also depends on the IOMMU PASID entry, which is configured during the guest page table bind

[PATCH v2 2/9] iommu/ioasid: Rename ioasid_set_data()

2020-08-22 Thread Jacob Pan
Rename ioasid_set_data() to ioasid_attach_data() to avoid confusion with struct ioasid_set. ioasid_set is a group of IOASIDs that share a common token. Signed-off-by: Jacob Pan --- drivers/iommu/intel/svm.c | 6 +++--- drivers/iommu/ioasid.c| 6 +++--- include/linux/ioasid.h| 4 ++-- 3

[PATCH v2 0/9] IOASID extensions for guest SVA

2020-08-22 Thread Jacob Pan
IOASID was introduced in v5.5 as a generic kernel allocator service for both PCIe Process Address Space ID (PASID) and ARM SMMU's Sub Stream ID. In addition to basic ID allocation, ioasid_set was defined as a token that is shared by a group of IOASIDs. This set token can be used for permission

Re: [PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-08-22 Thread kernel test robot
' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jacob-Pan/IOASID-extensions-for-guest-SVA/20200822-123111 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: ia64-randconfig-r003-20200822 (attached

Re: [PATCH v2 5/9] iommu/ioasid: Introduce ioasid_set private ID

2020-08-22 Thread kernel test robot
' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jacob-Pan/IOASID-extensions-for-guest-SVA/20200822-123111 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: mips-randconfig-r015-20200822 (attached

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-08-22 Thread kernel test robot
'--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jacob-Pan/IOASID-extensions-for-guest-SVA/20200822-123111 base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next config: x86_64-allyesconfig (attached as .config

Re: [patch RFC 00/38] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-08-22 Thread Jürgen Groß
On 21.08.20 02:24, Thomas Gleixner wrote: First of all, sorry for the horrible long Cc list, which was unfortunately unavoidable as this touches the world and some more. This patch series aims to provide a base to support device MSI (non PCI based) in a halfways architecture independent way.

Re: [PATCH] iommu/intel: Handle 36b addressing for x86-32

2020-08-22 Thread Chris Wilson
Quoting Chris Wilson (2020-08-22 17:02:09) > Beware that the address size for x86-32 may exceed unsigned long. > > [0.368971] UBSAN: shift-out-of-bounds in > drivers/iommu/intel/iommu.c:128:14 > [0.369055] shift exponent 36 is too large for 32-bit type 'long unsigned > int' > > If we

[PATCH] iommu/intel: Handle 36b addressing for x86-32

2020-08-22 Thread Chris Wilson
Beware that the address size for x86-32 may exceed unsigned long. [0.368971] UBSAN: shift-out-of-bounds in drivers/iommu/intel/iommu.c:128:14 [0.369055] shift exponent 36 is too large for 32-bit type 'long unsigned int' If we don't handle the wide addresses, the pages are mismapped and

Re: [patch RFC 38/38] irqchip: Add IMS array driver - NOT FOR MERGING

2020-08-22 Thread Jason Gunthorpe
On Sat, Aug 22, 2020 at 03:34:45AM +0200, Thomas Gleixner wrote: > >> One question is whether the device can see partial updates to that > >> memory due to the async 'swap' of context from the device CPU. > > > > It is worse than just partial updates.. The device operation is much > > more like