Re: [PATCH v7 0/9] ACPI/IORT: Support for IORT RMR node

2021-08-30 Thread Jon Nettleton
On Thu, Aug 5, 2021 at 4:09 PM Ard Biesheuvel wrote: > > On Thu, 5 Aug 2021 at 15:35, Shameerali Kolothum Thodi > wrote: > > > > > > > > > -Original Message- > > > From: Ard Biesheuvel [mailto:a...@kernel.org] > > > Sent: 05 August 2021 14:23 > > > To: Shameerali Kolothum Thodi > > >

[RFC][PATCH v2 12/13] iommu/arm-smmu-v3: Add support for NVIDIA CMDQ-Virtualization hw

2021-08-30 Thread Nicolin Chen via iommu
From: Nate Watterson NVIDIA's Grace SoC has a CMDQ-Virtualization (CMDQV) hardware, which adds multiple VCMDQ interfaces (VINTFs) to supplement the architected SMMU_CMDQ in an effort to reduce contention. To make use of these supplemental CMDQs in arm-smmu-v3 driver, this patch borrows the

[RFC][PATCH v2 10/13] iommu/arm-smmu-v3: Pass cmdq pointer in arm_smmu_cmdq_issue_cmdlist()

2021-08-30 Thread Nicolin Chen via iommu
The driver currently calls arm_smmu_get_cmdq() helper internally in different places, though they are all actually called from the same source -- arm_smmu_cmdq_issue_cmdlist() function. This patch changes this to pass the cmdq pointer to these functions instead of calling arm_smmu_get_cmdq()

[RFC][PATCH v2 06/13] vfio/type1: Set/get VMID to/from iommu driver

2021-08-30 Thread Nicolin Chen via iommu
This patch adds a pair of callbacks of iommu_set_nesting_vmid() and iommu_get_nesting_vmid() to exchange VMID with the IOMMU core (then an IOMMU driver). As a VMID is generated in an IOMMU driver, which is called from the vfio_iommu_attach_group() function call, add iommu_get_nesting_vmid right

[RFC][PATCH v2 11/13] iommu/arm-smmu-v3: Add implementation infrastructure

2021-08-30 Thread Nicolin Chen via iommu
From: Nate Watterson Follow arm-smmu driver's infrastructure for handling implementation specific details outside the flow of architectural code. Signed-off-by: Nate Watterson Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/Makefile | 2 +-

[RFC][PATCH v2 08/13] iommu/arm-smmu-v3: Add VMID alloc/free helpers

2021-08-30 Thread Nicolin Chen via iommu
NVIDIA implementation needs to link its Virtual Interface to a VMID, before a device gets attached to the corresponding iommu domain. One way to ensure that is to allocate a VMID from impl side and to pass it down to virtual machine hypervisor so that later it can set it back to passthrough

[RFC][PATCH v2 13/13] iommu/nvidia-smmu-v3: Add mdev interface support

2021-08-30 Thread Nicolin Chen via iommu
From: Nate Watterson This patch adds initial mdev interface support for NVIDIA SMMU CMDQV driver. The NVIDIA SMMU CMDQV module has multiple virtual interfaces (VINTFs), designed to be exposed to virtual machines running on the user space, while each VINTF can allocate dedicated VCMDQs for TLB

[RFC][PATCH v2 03/13] vfio: Document VMID control for IOMMU Virtualization

2021-08-30 Thread Nicolin Chen via iommu
The VFIO API was enhanced to support VMID control with two new iotcls to set and get VMID between the kernel and the virtual machine hypervisor. So updating the document. Signed-off-by: Nicolin Chen --- Documentation/driver-api/vfio.rst | 34 +++ 1 file changed, 34

[RFC][PATCH v2 09/13] iommu/arm-smmu-v3: Pass dev pointer to arm_smmu_detach_dev

2021-08-30 Thread Nicolin Chen via iommu
We are adding NVIDIA implementation that will need a ->detach_dev() callback along with the dev pointer to grab client information. Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[RFC][PATCH v2 04/13] vfio: add set_vmid and get_vmid for vfio_iommu_type1

2021-08-30 Thread Nicolin Chen via iommu
A VMID is generated in an IOMMU driver, being called from this ->attach_group() callback. So call ->get_vmid() right after it creates a new VMID, and call ->set_vmid() before it, to let it reuse the same VMID. Signed-off-by: Nicolin Chen --- drivers/vfio/vfio.c | 12

[RFC][PATCH v2 07/13] iommu/arm-smmu-v3: Add shared VMID support for NESTING

2021-08-30 Thread Nicolin Chen via iommu
A VMID can be shared among iommu domains being attached to the same Virtual Machine in order to improve utilization of TLB cache. This patch implements ->set_nesting_vmid() and ->get_nesting_vmid() to set/get s2_cfg->vmid for nesting cases, and then changes to reuse the VMID. Signed-off-by:

[RFC][PATCH v2 01/13] iommu: Add set_nesting_vmid/get_nesting_vmid functions

2021-08-30 Thread Nicolin Chen via iommu
VMID stands for Virtual Machine Identifier, being used to tag TLB entries to indicate which VM they belong to. This is used by some IOMMU like SMMUv3 for virtualization case, in nesting mode. So this patch adds a pair of new iommu_ops callback functions with a pair of exported set/get functions

[RFC][PATCH v2 00/13] iommu/arm-smmu-v3: Add NVIDIA implementation

2021-08-30 Thread Nicolin Chen via iommu
The SMMUv3 devices implemented in the Grace SoC support NVIDIA's custom CMDQ-Virtualization (CMDQV) hardware. Like the new ECMDQ feature first introduced in the ARM SMMUv3.3 specification, CMDQV adds multiple VCMDQ interfaces to supplement the single architected SMMU_CMDQ in an effort to reduce

[RFC][PATCH v2 05/13] vfio/type1: Implement set_vmid and get_vmid

2021-08-30 Thread Nicolin Chen via iommu
Now we have a pair of ->set_vmid() and ->get_vmid() function pointers. This patch implements them, to exchange VMID value between vfio container and vfio_iommu_type1. Signed-off-by: Nicolin Chen --- drivers/vfio/vfio_iommu_type1.c | 25 + 1 file changed, 25 insertions(+)

[RFC][PATCH v2 02/13] vfio: add VFIO_IOMMU_GET_VMID and VFIO_IOMMU_SET_VMID

2021-08-30 Thread Nicolin Chen via iommu
This patch adds a pair of new ioctl commands to communicate with user space (virtual machine hypervisor) to get and set VMID that indicates a Virtual Machine Identifier, being used by some IOMMU to tag TLB entries -- similar to CPU MMU, using this VMID number allows IOMMU to invalidate at the same

Re: [PATCH v4 14/14] tpm: Allow locality 2 to be set when initializing the TPM for Secure Launch

2021-08-30 Thread Daniel P. Smith
On 8/27/21 9:30 AM, Jason Gunthorpe wrote: > On Fri, Aug 27, 2021 at 09:28:37AM -0400, Ross Philipson wrote: >> The Secure Launch MLE environment uses PCRs that are only accessible from >> the DRTM locality 2. By default the TPM drivers always initialize the >> locality to 0. When a Secure Launch

Re: [PATCH v7 0/7] Fixes for dma-iommu swiotlb bounce buffers

2021-08-30 Thread Rajat Jain via iommu
I'm wondering why I don't see v7 on these patches on patchwork (these patches on https://lore.kernel.org/patchwork/project/lkml/list/?series==27643) ? On Sun, Aug 29, 2021 at 10:00 PM David Stevens wrote: > > This patch set includes various fixes for dma-iommu's swiotlb bounce > buffers for

[PATCH v12 13/13] Documentation: Add documentation for VDUSE

2021-08-30 Thread Xie Yongji
VDUSE (vDPA Device in Userspace) is a framework to support implementing software-emulated vDPA devices in userspace. This document is intended to clarify the VDUSE design and usage. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- Documentation/userspace-api/index.rst | 1 +

[PATCH v12 12/13] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-08-30 Thread Xie Yongji
This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device interface (/dev/vduse/$NAME) is exported to userspace for device emulation. In order to make the device emulation

[PATCH v12 11/13] vduse: Implement an MMU-based software IOTLB

2021-08-30 Thread Xie Yongji
This implements an MMU-based software IOTLB to support mapping kernel dma buffer into userspace dynamically. The basic idea behind it is treating MMU (VA->PA) as IOMMU (IOVA->PA). The software IOTLB will set up MMU mapping instead of IOMMU mapping for the DMA transfer so that the userspace process

[PATCH v12 10/13] vdpa: Support transferring virtual addressing during DMA mapping

2021-08-30 Thread Xie Yongji
This patch introduces an attribute for vDPA device to indicate whether virtual address can be used. If vDPA device driver set it, vhost-vdpa bus driver will not pin user page and transfer userspace virtual address instead of physical address during DMA mapping. And corresponding vma->vm_file and

[PATCH v12 09/13] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-08-30 Thread Xie Yongji
The upcoming patch is going to support VA mapping/unmapping. So let's factor out the logic of PA mapping/unmapping firstly to make the code more readable. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/vdpa.c | 55

[PATCH v12 08/13] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()

2021-08-30 Thread Xie Yongji
Add an opaque pointer for DMA mapping. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 6 +++--- drivers/vhost/vdpa.c | 2 +- include/linux/vdpa.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)

[PATCH v12 07/13] vhost-iotlb: Add an opaque pointer for vhost IOTLB

2021-08-30 Thread Xie Yongji
Add an opaque pointer for vhost IOTLB. And introduce vhost_iotlb_add_range_ctx() to accept it. Suggested-by: Jason Wang Signed-off-by: Xie Yongji Acked-by: Jason Wang --- drivers/vhost/iotlb.c | 20 include/linux/vhost_iotlb.h | 3 +++ 2 files changed, 19

[PATCH v12 06/13] vhost-vdpa: Handle the failure of vdpa_reset()

2021-08-30 Thread Xie Yongji
The vdpa_reset() may fail now. This adds check to its return value and fail the vhost_vdpa_open(). Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- drivers/vhost/vdpa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git

[PATCH v12 05/13] vdpa: Add reset callback in vdpa_config_ops

2021-08-30 Thread Xie Yongji
This adds a new callback to support device specific reset behavior. The vdpa bus driver will call the reset function instead of setting status to zero during resetting. Signed-off-by: Xie Yongji --- drivers/vdpa/ifcvf/ifcvf_main.c | 35 +++---

[PATCH v12 04/13] vdpa: Fix some coding style issues

2021-08-30 Thread Xie Yongji
Fix some code indent issues and following checkpatch warning: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' 371: FILE: include/linux/vdpa.h:371: +static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset, Signed-off-by: Xie Yongji Acked-by: Jason Wang Reviewed-by:

[PATCH v12 03/13] file: Export receive_fd() to modules

2021-08-30 Thread Xie Yongji
Export receive_fd() so that some modules can use it to pass file descriptor between processes without missing any security stuffs. Signed-off-by: Xie Yongji Acked-by: Jason Wang --- fs/file.c| 6 ++ include/linux/file.h | 7 +++ 2 files changed, 9 insertions(+), 4

[PATCH v12 02/13] eventfd: Export eventfd_wake_count to modules

2021-08-30 Thread Xie Yongji
Export eventfd_wake_count so that some modules can use the eventfd_signal_count() to check whether the eventfd_signal() call should be deferred to a safe context. Signed-off-by: Xie Yongji --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index

[PATCH v12 01/13] iova: Export alloc_iova_fast() and free_iova_fast()

2021-08-30 Thread Xie Yongji
Export alloc_iova_fast() and free_iova_fast() so that some modules can make use of the per-CPU cache to get rid of rbtree spinlock in alloc_iova() and free_iova() during IOVA allocation. Signed-off-by: Xie Yongji Acked-by: Jason Wang Acked-by: Will Deacon --- drivers/iommu/iova.c | 2 ++ 1

[PATCH v12 00/13] Introduce VDUSE - vDPA Device in Userspace

2021-08-30 Thread Xie Yongji
This series introduces a framework that makes it possible to implement software-emulated vDPA devices in userspace. And to make the device emulation more secure, the emulated vDPA device's control path is handled in the kernel and only the data path is implemented in the userspace. Since the

Re: [PATCH V4 00/13] x86/Hyper-V: Add Hyper-V Isolation VM support

2021-08-30 Thread Christoph Hellwig
Sorry for the delayed answer, but I look at the vmap_pfn usage in the previous version and tried to come up with a better version. This mostly untested branch: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/hyperv-vmap get us there for swiotlb and the channel infrastructure

Re: [PATCH -next v4 2/2] iommu/arm-smmu-v3: Add suspend and resume support

2021-08-30 Thread Bixuan Cui
On 2021/8/30 15:38, Bixuan Cui wrote: > Changes in v4: > * Restore the arm_smmu_suspend() function code to the v2 version(Directly > return 0 in it). Hello, I looked up the code of smmu.c and the manual of smmu v3. For the suspend is implemented by the external clock-gating, it is not clear

[PATCH -next v4 1/2] platform-msi: Save the msg context to desc in platform_msi_write_msg()

2021-08-30 Thread Bixuan Cui
Save the msg context to desc when when the msi interrupt is requested. The drivers can use it in special scenarios(such as resume). Signed-off-by: Bixuan Cui --- drivers/base/platform-msi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/platform-msi.c

[PATCH -next v4 2/2] iommu/arm-smmu-v3: Add suspend and resume support

2021-08-30 Thread Bixuan Cui
Add suspend and resume support for arm-smmu-v3 by low-power mode. When the smmu is suspended, it is powered off and the registers are cleared. So saves the msi_msg context during msi interrupt initialization of smmu. When resume happens it calls arm_smmu_device_reset() to restore the registers.