[PATCH v2 06/22] iommufd/selftest: Support user_data in mock_viommu_alloc

2025-04-25 Thread Nicolin Chen
Add a simple user_data for an input-to-output loopback test. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 13 + drivers/iommu/iommufd/selftest.c | 19 +++ 2 files changed, 32 insertions(+) diff --git a/drivers/iommu/iommufd/iommufd_test.

Re: [PATCH net-next v12 1/9] netmem: add niov->type attribute to distinguish different net_iov types

2025-04-25 Thread Christophe JAILLET
Hi, below a few nitpicks in case of a v13. Le 25/04/2025 à 22:47, Mina Almasry a écrit : Later patches in the series adds TX net_iovs where there is no pp associated, so we can't rely on niov->pp->mp_ops to tell what is the type of the net_iov. Add a type enum to the net_iov which tells us th

[PATCH v2 16/22] iommu/arm-smmu-v3-iommufd: Add vsmmu_alloc impl op

2025-04-25 Thread Nicolin Chen
An impl driver might support its own vIOMMU object, as tegra241-cmdqv will add IOMMU_VIOMMU_TYPE_TEGRA241_CMDQV. Add a vsmmu_alloc op to give impl a try, upon failure fallback to standard vsmmu allocation for IOMMU_VIOMMU_TYPE_ARM_SMMUV3. Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-sm

[PATCH v2 12/22] iommufd/selftest: Add coverage for IOMMUFD_CMD_VCMDQ_ALLOC

2025-04-25 Thread Nicolin Chen
Some simple tests for IOMMUFD_CMD_VCMDQ_ALLOC infrastructure covering the new iommufd_vcmdq_depend/undepend() helpers. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 3 + tools/testing/selftests/iommu/iommufd_utils.h | 30 + drivers/iommu/iommufd/selftes

[PATCH v2 05/22] iommufd: Add iommufd_struct_destroy to revert iommufd_viommu_alloc

2025-04-25 Thread Nicolin Chen
An IOMMU driver that allocated a vIOMMU may want to revert the allocation, if it encounters an internal error after the allocation. So, there needs a destroy helper for drivers to use. Move iommufd_object_abort() to the driver.c file and the public header, to introduce common iommufd_struct_destro

[PATCH v2 00/22] iommufd: Add vIOMMU infrastructure (Part-4 vCMDQ)

2025-04-25 Thread Nicolin Chen
The vIOMMU object is designed to represent a slice of an IOMMU HW for its virtualization features shared with or passed to user space (a VM mostly) in a way of HW acceleration. This extended the HWPT-based design for more advanced virtualization feature. A vCMDQ introduced by this series as a part

[PATCH v2 01/22] iommufd/viommu: Add driver-allocated vDEVICE support

2025-04-25 Thread Nicolin Chen
To allow IOMMU drivers to allocate own vDEVICE structures, move the struct iommufd_vdevice to the public header and provide a pair of viommu ops. The iommufd_vdevice_alloc_ioctl will prioritize the callback function from the viommu ops, i.e. a driver-allocated vDEVICE. Reviewed-by: Jason Gunthorp

[PATCH v2 07/22] iommufd/selftest: Add covearge for viommu data

2025-04-25 Thread Nicolin Chen
Extend the existing test_cmd/err_viommu_alloc helpers to accept optional user data. And add a TEST_F for a loopback test. Signed-off-by: Nicolin Chen --- tools/testing/selftests/iommu/iommufd_utils.h | 21 +- tools/testing/selftests/iommu/iommufd.c | 29 +++ ...

[PATCH v2 21/22] iommu/tegra241-cmdqv: Add user-space use support

2025-04-25 Thread Nicolin Chen
The CMDQV HW supports a user-space use for virtualization cases. It allows the VM to issue guest-level TLBI or ATC_INV commands directly to the queue and executes them without a VMEXIT, as HW will replace the VMID field in a TLBI command and the SID field in an ATC_INV command with the preset VMID

[PATCH v2 19/22] iommu/tegra241-cmdqv: Simplify deinit flow in tegra241_cmdqv_remove_vintf()

2025-04-25 Thread Nicolin Chen
The current flow of tegra241_cmdqv_remove_vintf() is: 1. For each LVCMDQ, tegra241_vintf_remove_lvcmdq(): a. Disable the LVCMDQ HW b. Release the LVCMDQ SW resource 2. For current VINTF, tegra241_vintf_hw_deinit(): c. Disable all LVCMDQ HWs d. Disable VINTF HW Obviously, the step

[PATCH v2 22/22] iommu/tegra241-cmdqv: Add IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV support

2025-04-25 Thread Nicolin Chen
Add a new vEVENTQ type for VINTFs that are assigned to the user space. Simply report the two 64-bit LVCMDQ_ERR_MAPs register values. Signed-off-by: Nicolin Chen --- include/uapi/linux/iommufd.h | 15 + .../iommu/arm/arm-smmu-v3/tegra241-cmdqv.c| 22 ++

[PATCH v2 17/22] iommu/arm-smmu-v3-iommufd: Support implementation-defined hw_info

2025-04-25 Thread Nicolin Chen
Repurpose the @__reserved field in the struct iommu_hw_info_arm_smmuv3, to an HW implementation-defined field @impl. This will be used by Tegra241 CMDQV implementation on top of a standard ARM SMMUv3 IOMMU. The @impl will be only valid if @flags is set with an implementation-defined flag. Thus in

[PATCH v2 20/22] iommu/tegra241-cmdqv: Do not statically map LVCMDQs

2025-04-25 Thread Nicolin Chen
To simplify the mappings from global VCMDQs to VINTFs' LVCMDQs, the design chose to do static allocations and mappings in the global reset function. However, with the user-owned VINTF support, it exposes a security concern: if user space VM only wants one LVCMDQ for a VINTF, statically mapping two

[PATCH v2 14/22] iommufd/selftest: Add coverage for the new mmap interface

2025-04-25 Thread Nicolin Chen
Extend the loopback test to a new mmap page. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h| 4 +++ drivers/iommu/iommufd/selftest.c| 37 ++--- tools/testing/selftests/iommu/iommufd.c | 5 3 files changed, 42 insertions(+), 4 deletions

[PATCH v2 15/22] Documentation: userspace-api: iommufd: Update vCMDQ

2025-04-25 Thread Nicolin Chen
With the introduction of the new object and its infrastructure, update the doc to reflect that. Signed-off-by: Nicolin Chen --- Documentation/userspace-api/iommufd.rst | 14 ++ 1 file changed, 14 insertions(+) diff --git a/Documentation/userspace-api/iommufd.rst b/Documentation/use

[PATCH v2 13/22] iommufd: Add mmap interface

2025-04-25 Thread Nicolin Chen
For vIOMMU passing through HW resources to user space (VMs), add an mmap infrastructure to map a region of hardware MMIO pages. Maintain an mt_mmap per ictx for validations. To allow IOMMU drivers to add and delete mmappable regions to/from the mt_mmap, add a pair of new helpers: iommufd_ctx_alloc

[PATCH v2 10/22] iommufd/viommmu: Add IOMMUFD_CMD_VCMDQ_ALLOC ioctl

2025-04-25 Thread Nicolin Chen
Introduce a new IOMMUFD_CMD_VCMDQ_ALLOC ioctl for user space to allocate a vCMDQ for a vIOMMU object. Simply increase the refcount of the vIOMMU. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_private.h | 2 + include/uapi/linux/iommufd.h| 41 +++ drivers/iomm

[PATCH v2 11/22] iommufd: Add for-driver helpers iommufd_vcmdq_depend/undepend()

2025-04-25 Thread Nicolin Chen
NVIDIA Virtual Command Queue is one of the iommufd users exposing vIOMMU features to user space VMs. Its hardware has a strict rule when mapping and unmapping multiple global CMDQVs to/from a VM-owned VINTF, requiring mappings in ascending order and unmappings in descending order. The tegra241-cmd

[PATCH v2 08/22] iommufd: Abstract iopt_pin_pages and iopt_unpin_pages helpers

2025-04-25 Thread Nicolin Chen
The new vCMDQ object will be added for HW to access the guest memory for a HW-accelerated virtualization feature. It needs to ensure the guest memory pages are pinned when HW accesses them and they are contiguous in physical address space. This is very like the existing iommufd_access_pin_pages()

[PATCH v2 04/22] iommu: Add iommu_copy_struct_to_user helper

2025-04-25 Thread Nicolin Chen
Similar to the iommu_copy_struct_from_user helper receiving data from the user space, add an iommu_copy_struct_to_user helper to report output data back to the user space data pointer. Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- include/linux/iommu.h | 40 ++

[PATCH v2 03/22] iommufd/viommu: Allow driver-specific user data for a vIOMMU object

2025-04-25 Thread Nicolin Chen
The new type of vIOMMU for tegra241-cmdqv driver needs a driver-specific user data. So, add data_len/uptr to the iommu_viommu_alloc uAPI and pass it in via the viommu_alloc iommu op. Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- include/uapi/linux/iommufd.h | 6 ++ drivers/

[PATCH v2 02/22] iommu: Pass in a driver-level user data structure to viommu_alloc op

2025-04-25 Thread Nicolin Chen
The new type of vIOMMU for tegra241-cmdqv needs to pass in a driver-level data structure from user space via iommufd, so add a user_data to the op. Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 ++- include/linux/iommu.h

[PATCH] kernel-doc: Add initial binfmt docs

2025-04-25 Thread Kees Cook
Adds a framework to hold the initial exec.c and binfmt_elf.c kernel-docs. Updates scripts/kernel-doc to allow leading whitespace so that embedded "DOC:" tags can be found that aren't at the start of a line so that in-function documentation can be found, like that recently marked up in binfmt_elf.c[

[PATCH net-next v12 8/9] net: check for driver support in netmem TX

2025-04-25 Thread Mina Almasry
We should not enable netmem TX for drivers that don't declare support. Check for driver netmem TX support during devmem TX binding and fail if the driver does not have the functionality. Check for driver support in validate_xmit_skb as well. Signed-off-by: Mina Almasry Acked-by: Stanislav Fomic

[PATCH net-next v12 1/9] netmem: add niov->type attribute to distinguish different net_iov types

2025-04-25 Thread Mina Almasry
Later patches in the series adds TX net_iovs where there is no pp associated, so we can't rely on niov->pp->mp_ops to tell what is the type of the net_iov. Add a type enum to the net_iov which tells us the net_iov type. Signed-off-by: Mina Almasry --- v8: - Since io_uring zcrx is now in net-ne

[PATCH net-next v12 2/9] net: add get_netmem/put_netmem support

2025-04-25 Thread Mina Almasry
Currently net_iovs support only pp ref counts, and do not support a page ref equivalent. This is fine for the RX path as net_iovs are used exclusively with the pp and only pp refcounting is needed there. The TX path however does not use pp ref counts, thus, support for get_page/put_page equivalent

[PATCH net-next v12 9/9] selftests: ncdevmem: Implement devmem TCP TX

2025-04-25 Thread Mina Almasry
Add support for devmem TX in ncdevmem. This is a combination of the ncdevmem from the devmem TCP series RFCv1 which included the TX path, and work by Stan to include the netlink API and refactored on top of his generic memory_provider support. Signed-off-by: Mina Almasry Signed-off-by: Stanislav

[PATCH net-next v12 7/9] gve: add netmem TX support to GVE DQO-RDA mode

2025-04-25 Thread Mina Almasry
Use netmem_dma_*() helpers in gve_tx_dqo.c DQO-RDA paths to enable netmem TX support in that mode. Declare support for netmem TX in GVE DQO-RDA mode. Signed-off-by: Mina Almasry Acked-by: Harshitha Ramamurthy --- v11: - Fix whitespace (Harshitha) v10: - Move setting dev->netmem_tx to right a

[PATCH net-next v12 6/9] net: enable driver support for netmem TX

2025-04-25 Thread Mina Almasry
Drivers need to make sure not to pass netmem dma-addrs to the dma-mapping API in order to support netmem TX. Add helpers and netmem_dma_*() helpers that enables special handling of netmem dma-addrs that drivers can use. Document in netmem.rst what drivers need to do to support netmem TX. Signed-

[PATCH net-next v12 5/9] net: add devmem TCP TX documentation

2025-04-25 Thread Mina Almasry
Add documentation outlining the usage and details of the devmem TCP TX API. Signed-off-by: Mina Almasry Acked-by: Stanislav Fomichev --- v5: - Address comments from Stan and Bagas v4: - Mention SO_BINDTODEVICE is recommended (me/Pavel). v2: - Update documentation for iov_base is the dmabuf o

[PATCH net-next v12 4/9] net: devmem: Implement TX path

2025-04-25 Thread Mina Almasry
Augment dmabuf binding to be able to handle TX. Additional to all the RX binding, we also create tx_vec needed for the TX path. Provide API for sendmsg to be able to send dmabufs bound to this device: - Provide a new dmabuf_tx_cmsg which includes the dmabuf to send from. - MSG_ZEROCOPY with SCM_D

[PATCH net-next v12 3/9] net: devmem: TCP tx netlink api

2025-04-25 Thread Mina Almasry
From: Stanislav Fomichev Add bind-tx netlink call to attach dmabuf for TX; queue is not required, only ifindex and dmabuf fd for attachment. Signed-off-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- v3: - Fix ynl-regen.sh error (Simon). --- Documentation/netlink/specs/netdev.yaml |

[PATCH net-next v12 0/9] Device memory TCP TX

2025-04-25 Thread Mina Almasry
v12: https://lore.kernel.org/netdev/20250423031117.907681-1-almasrym...@google.com/ No changes in v12, just restored the selftests patch I accidentally dropped in v11 v11: https://lore.kernel.org/netdev/20250423031117.907681-1-almasrym...@google.com/ Addressed a couple of nits and co

[PATCH] Documentation:openrisc: Add build instructions with initramfs

2025-04-25 Thread Ann Yun
Mention how to include initramfs when building the kernel Signed-off-by: Ann Yun --- Documentation/arch/openrisc/openrisc_port.rst | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/arch/openrisc/openrisc_port.rst b/Documentation/arch/openrisc/openrisc_port.rst index a8f307a3

Re: [PATCH v12 12/28] riscv: Implements arch agnostic shadow stack prctls

2025-04-25 Thread Deepak Gupta
On Fri, Apr 25, 2025 at 01:42:44PM +0200, Radim Krčmář wrote: 2025-04-24T11:16:19-07:00, Deepak Gupta : On Thu, Apr 24, 2025 at 03:36:54PM +0200, Radim Krčmář wrote: 2025-04-23T21:44:09-07:00, Deepak Gupta : On Thu, Apr 10, 2025 at 11:45:58AM +0200, Radim Krčmář wrote: 2025-03-14T14:39:31-07:

Re: [PATCH v12 12/28] riscv: Implements arch agnostic shadow stack prctls

2025-04-25 Thread Radim Krčmář
2025-04-24T11:16:19-07:00, Deepak Gupta : > On Thu, Apr 24, 2025 at 03:36:54PM +0200, Radim Krčmář wrote: >>2025-04-23T21:44:09-07:00, Deepak Gupta : >>> On Thu, Apr 10, 2025 at 11:45:58AM +0200, Radim Krčmář wrote: 2025-03-14T14:39:31-07:00, Deepak Gupta : > diff --git a/arch/riscv/include

Re: [PATCH v12 05/28] riscv: usercfi state for task and save/restore of CSR_SSP on trap entry/exit

2025-04-25 Thread Radim Krčmář
2025-04-24T11:03:59-07:00, Deepak Gupta : > On Thu, Apr 24, 2025 at 02:16:32PM +0200, Radim Krčmář wrote: >>2025-04-23T17:23:56-07:00, Deepak Gupta : >>> On Thu, Apr 10, 2025 at 01:04:39PM +0200, Radim Krčmář wrote: 2025-03-14T14:39:24-07:00, Deepak Gupta : > diff --git a/arch/riscv/kernel/

Re: [PATCH v12 05/28] riscv: usercfi state for task and save/restore of CSR_SSP on trap entry/exit

2025-04-25 Thread Radim Krčmář
2025-04-24T10:56:34-07:00, Deepak Gupta : > On Thu, Apr 24, 2025 at 01:52:43PM +0200, Radim Krčmář wrote: >>2025-04-23T17:00:29-07:00, Deepak Gupta : >>> On Thu, Apr 10, 2025 at 01:04:39PM +0200, Radim Krčmář wrote: 2025-03-14T14:39:24-07:00, Deepak Gupta : > diff --git a/arch/riscv/include

Re: [PATCH v6 02/14] riscv: sbi: remove useless parenthesis

2025-04-25 Thread Andrew Jones
On Thu, Apr 24, 2025 at 07:31:49PM +0200, Clément Léger wrote: > A few parenthesis in check for SBI version/extension were useless, > remove them. > > Signed-off-by: Clément Léger > --- > arch/riscv/kernel/sbi.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch