[PATCH v5 08/13] iommufd/selftest: Add mock_viommu_cache_invalidate

2024-10-25 Thread Nicolin Chen
Similar to the coverage of cache_invalidate_user for iotlb invalidation, add a device cache and a viommu_cache_invalidate function to test it out. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 25 + drivers/iommu/iommufd/selftest.c | 76 ++

[PATCH v5 09/13] iommufd/selftest: Add refcount to mock_iommu_device

2024-10-25 Thread Nicolin Chen
For an iommu_dev that can unplug (so far only this selftest does so), the viommu->iommu_dev pointer has no guarantee of its life cycle after it is copied from the idev->dev->iommu->iommu_dev. Track the user count of the iommu_dev. Postpone the exit routine using a completion, if refcount is unbala

[PATCH v5 02/13] iommufd/selftest: Add IOMMU_VDEVICE_ALLOC test coverage

2024-10-25 Thread Nicolin Chen
Add a vdevice_alloc op to the viommu mock_viommu_ops for the coverage of IOMMU_VIOMMU_TYPE_SELFTEST allocations. Then, add a vdevice_alloc TEST_F to cover the IOMMU_VDEVICE_ALLOC ioctl. Signed-off-by: Nicolin Chen --- tools/testing/selftests/iommu/iommufd_utils.h | 27 +++ tools/

[PATCH v5 05/13] iommufd: Add alloc_domain_nested op to iommufd_viommu_ops

2024-10-25 Thread Nicolin Chen
Allow IOMMU driver to use a vIOMMU object that holds a nesting parent hwpt/domain to allocate a nested domain. Suggested-by: Jason Gunthorpe Reviewed-by: Kevin Tian Signed-off-by: Nicolin Chen --- include/linux/iommufd.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linu

[PATCH v5 01/13] iommufd/viommu: Add IOMMUFD_OBJ_VDEVICE and IOMMU_VDEVICE_ALLOC ioctl

2024-10-25 Thread Nicolin Chen
Introduce a new IOMMUFD_OBJ_VDEVICE to represent a physical device, i.e. iommufd_device (idev) object, against an iommufd_viommu (vIOMMU) object in the VM. This vDEVICE object (and its structure) holds all the information and attributes in a VM, regarding the device related to the vIOMMU. As an in

[PATCH v5 07/13] iommufd/viommu: Add iommufd_viommu_find_dev helper

2024-10-25 Thread Nicolin Chen
This avoids a bigger trouble of exposing struct iommufd_device and struct iommufd_vdevice in the public header. Signed-off-by: Nicolin Chen --- include/linux/iommufd.h| 8 drivers/iommu/iommufd/driver.c | 13 + 2 files changed, 21 insertions(+) diff --git a/include

[PATCH v5 04/13] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl

2024-10-25 Thread Nicolin Chen
Add a new ioctl for user space to do a vIOMMU allocation. It must be based on a nesting parent HWPT, so take its refcount. IOMMU driver wanting to support vIOMMUs must define its IOMMU_VIOMMU_TYPE_ in the uAPI header and implement a viommu_alloc op in its iommu_ops. Reviewed-by: Jason Gunthorpe

[PATCH v12 0/7] Introduction of a remoteproc tee to load signed firmware

2024-10-25 Thread Arnaud Pouliquen
Main updates from version V11[1]: - rename structures, functions, and variables from "tee_rproc_xxx" to "rproc_tee_xxx", - update rproc_tee_register to return an error instead of "struct rproc_tee *" pointer [1] https://lore.kernel.org/lkml/ZxZ4cBilIlpf3IPw@p14s/T/ Tested-on: 42f7652d3eb

[PATCH v5 07/13] iommufd/selftest: Add container_of helpers

2024-10-25 Thread Nicolin Chen
Use these inline helpers to shorten those container_of lines. Note that one of them goes back and forth between iommu_domain and mock_iommu_domain, which isn't necessary. So drop its container_of. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/selftest.c | 75 ++--

[PATCH v12 3/7] remoteproc: core: Refactor resource table cleanup into rproc_release_fw

2024-10-25 Thread Arnaud Pouliquen
This patch centralizing the cleanup of the resource table into a new helper function rproc_release_fw(). More than just factorizing the code into a common function, it is the first step to integrate the release of the firmware image loaded by the OP-TEE remoteproc framework. Suggested-by: Mathieu

[PATCH v5 12/13] iommu/arm-smmu-v3: Add arm_vsmmu_cache_invalidate

2024-10-25 Thread Nicolin Chen
Implement the vIOMMU's cache_invalidate op for user space to invalidate the IOTLB entries, Device ATS and CD entries that are still cached by hardware. Add struct iommu_viommu_arm_smmuv3_invalidate defining invalidation entries that are simply in the native format of a 128-bit TLBI command. Scan t

[PATCH v5 13/13] iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED

2024-10-25 Thread Nicolin Chen
From: Jason Gunthorpe Now, ATC invalidation can be done with the vIOMMU invalidation op. A guest owned IOMMU_DOMAIN_NESTED can do an ATS too. Allow it to pass in the EATS field via the vSTE words. Signed-off-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/arm

[PATCH v5 11/13] Documentation: userspace-api: iommufd: Update vDEVICE

2024-10-25 Thread Nicolin Chen
With the introduction of the new object and its infrastructure, update the doc and the vIOMMU graph to reflect that. Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- Documentation/userspace-api/iommufd.rst | 41 +++-- 1 file changed, 32 insertions(+), 9 deletions

[PATCH v5 10/13] iommufd/selftest: Add vIOMMU coverage for IOMMU_HWPT_INVALIDATE ioctl

2024-10-25 Thread Nicolin Chen
Add a viommu_cache test function to cover vIOMMU invalidations using the updated IOMMU_HWPT_INVALIDATE ioctl, which now allows passing in a vIOMMU via its hwpt_id field. Signed-off-by: Nicolin Chen --- tools/testing/selftests/iommu/iommufd_utils.h | 32 tools/testing/selftests/iommu/iommuf

[PATCH v5 09/13] iommufd/selftest: Add IOMMU_TEST_OP_DEV_CHECK_CACHE test command

2024-10-25 Thread Nicolin Chen
Similar to IOMMU_TEST_OP_MD_CHECK_IOTLB verifying a mock_domain's iotlb, IOMMU_TEST_OP_DEV_CHECK_CACHE will be used to verify a mock_dev's cache. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 5 tools/testing/selftests/iommu/iommufd_utils.h | 24 ++

[PATCH v5 06/13] iommu: Add iommu_copy_struct_from_full_user_array helper

2024-10-25 Thread Nicolin Chen
From: Jason Gunthorpe The iommu_copy_struct_from_user_array helper can be used to copy a single entry from a user array which might not be efficient if the array is big. Add a new iommu_copy_struct_from_full_user_array to copy the entire user array at once. Update the existing iommu_copy_struct_

[PATCH v5 05/13] iommufd: Allow hwpt_id to carry viommu_id for IOMMU_HWPT_INVALIDATE

2024-10-25 Thread Nicolin Chen
With a vIOMMU object, use space can flush any IOMMU related cache that can be directed via a vIOMMU object. It is similar to the IOMMU_HWPT_INVALIDATE uAPI, but can cover a wider range than IOTLB, e.g. device/desciprtor cache. Allow hwpt_id of the iommu_hwpt_invalidate structure to carry a viommu_

[PATCH v5 03/13] iommu/viommu: Add cache_invalidate to iommufd_viommu_ops

2024-10-25 Thread Nicolin Chen
This per-vIOMMU cache_invalidate op is like the cache_invalidate_user op in struct iommu_domain_ops, but wider, supporting device cache (e.g. PCI ATC invaldiations). Reviewed-by: Jason Gunthorpe Signed-off-by: Nicolin Chen --- include/linux/iommufd.h | 10 ++ 1 file changed, 10 insertio

[PATCH v5 04/13] iommufd/hw_pagetable: Enforce invalidation op on vIOMMU-based hwpt_nested

2024-10-25 Thread Nicolin Chen
A vIOMMU-based hwpt_nested requires a cache invalidation op too, either using the one in iommu_domain_ops or the one in viommu_ops. Enforce that upon the allocated hwpt_nested. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/hw_pagetable.c | 4 +++- 1 file changed, 3 insertions(+), 1 delet

[PATCH v5 00/13] iommufd: Add vIOMMU infrastructure (Part-2: vDEVICE)

2024-10-25 Thread Nicolin Chen
Following the previous vIOMMU series, this adds another vDEVICE structure, representing the association from an iommufd_device to an iommufd_viommu. This gives the whole architecture a new "v" layer: ___ | i

[PATCH v5 03/13] iommufd: Add iommufd_verify_unfinalized_object

2024-10-25 Thread Nicolin Chen
To support driver-allocated vIOMMU objects, it's suggested to call the allocator helper in IOMMU dirvers. However, there is no guarantee that drivers will all use it and allocate objects properly. Add a helper for iommufd core to verify if an unfinalized object is at least reserved in the ictx. R

[PATCH v5 13/13] iommu/arm-smmu-v3: Add IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support

2024-10-25 Thread Nicolin Chen
Add a new driver-type for ARM SMMUv3 to enum iommu_viommu_type. Implement an arm_vsmmu_alloc() with its viommu op arm_vsmmu_domain_alloc_nested(), to replace arm_smmu_domain_alloc_nesting(). As an initial step, copy the VMID from s2_parent. A later cleanup series is required to move the VMID alloca

[PATCH v5 11/13] iommufd/selftest: Add IOMMU_VIOMMU_ALLOC test coverage

2024-10-25 Thread Nicolin Chen
Add a new iommufd_viommu FIXTURE and setup it up with a vIOMMU object. Any new vIOMMU feature will be added as a TEST_F under that. Signed-off-by: Nicolin Chen --- tools/testing/selftests/iommu/iommufd_utils.h | 28 ++ tools/testing/selftests/iommu/iommufd.c | 87 +++

[PATCH v5 12/13] Documentation: userspace-api: iommufd: Update vIOMMU

2024-10-25 Thread Nicolin Chen
With the introduction of the new object and its infrastructure, update the doc to reflect that and add a new graph. Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Signed-off-by: Nicolin Chen --- Documentation/userspace-api/iommufd.rst | 69 - 1 file changed, 68 in

[PATCH v5 10/13] iommufd/selftest: Add IOMMU_VIOMMU_TYPE_SELFTEST

2024-10-25 Thread Nicolin Chen
Implement the viommu alloc/free functions to increase/reduce refcount of its dependent mock iommu device. User space can verify this loop via the IOMMU_VIOMMU_TYPE_SELFTEST. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 2 + drivers/iommu/iommufd/selftest.c | 64 +++

[PATCH v5 06/13] iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC

2024-10-25 Thread Nicolin Chen
Now a vIOMMU holds a shareable nesting parent HWPT. So, it can act like that nesting parent HWPT to allocate a nested HWPT. Support that in the IOMMU_HWPT_ALLOC ioctl handler, and update its kdoc. Also, add an iommufd_hwpt_nested_alloc_for_viommu helper to allocate a nested HWPT for a vIOMMU obje

[PATCH v5 08/13] iommufd/selftest: Prepare for mock_viommu_alloc_domain_nested()

2024-10-25 Thread Nicolin Chen
A nested domain now can be allocated for a parent domain for a vIOMMU object. Rework the existing allocators to prepare for the latter case. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/selftest.c | 89 ++-- 1 file changed, 50 insertions(+), 39 deletions(-)

[PATCH v5 02/13] iommufd: Introduce IOMMUFD_OBJ_VIOMMU and its related struct

2024-10-25 Thread Nicolin Chen
Add a new IOMMUFD_OBJ_VIOMMU with an iommufd_viommu structure to represent a slice of physical IOMMU device passed to or shared with a user space VM. This slice, now a vIOMMU object, is a group of virtualization resources of a physical IOMMU's, such as: - Security namespace for guest owned ID, e.g

[PATCH v5 01/13] iommufd: Move struct iommufd_object to public iommufd header

2024-10-25 Thread Nicolin Chen
Prepare for an embedded structure design for driver-level iommufd_viommu objects: // include/linux/iommufd.h struct iommufd_viommu { struct iommufd_object obj; }; // Some IOMMU driver struct iommu_driver_viommu { struct iommufd_viommu core;

[PATCH v5 00/13] iommufd: Add vIOMMU infrastructure (Part-1)

2024-10-25 Thread Nicolin Chen
This series introduces a new vIOMMU infrastructure and related ioctls. IOMMUFD has been using the HWPT infrastructure for all cases, including a nested IO page table support. Yet, there're limitations for an HWPT-based structure to support some advanced HW-accelerated features, such as CMDQV on NV

[PATCH 2/2] kunit: enable hardware acceleration when available

2024-10-25 Thread Tamir Duberstein
Use KVM or HVF if supported by the QEMU binary and available on the system. This produces a nice improvement on my Apple M3 Pro running macOS 14.7: Before: ./tools/testing/kunit/kunit.py exec --arch arm64 [HH:MM:SS] Elapsed time: 10.145s After: ./tools/testing/kunit/kunit.py exec --arch arm64 [H

[PATCH RFC v2 3/5] pinctrl: mediatek: common: Expose more configurations to GPIO set_config

2024-10-25 Thread Nícolas F . R . A . Prado
Currently the set_config callback in the gpio_chip registered by the pinctrl-mtk-common driver only supports configuring a single parameter on specific pins (the input debounce of the EINT controller, on pins that support it), even though many other configurations are already implemented and availa

Re: [PATCH next] rcu: Unlock correctly in rcu_dump_cpu_stacks()

2024-10-25 Thread Paul E. McKenney
On Fri, Oct 25, 2024 at 10:06:43AM +0300, Dan Carpenter wrote: > The unlock needs to be outside the } close curly braces for this if > statement. Otherwise it leads to a deadlock. > > Fixes: 744e87210b1a ("rcu: Finer-grained grace-period-end checks in > rcu_dump_cpu_stacks()") > Signed-off-by: D

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 02:51:29PM -0700, John Hubbard wrote: > On 10/25/24 2:09 PM, Lorenzo Stoakes wrote: > > On Fri, Oct 25, 2024 at 01:31:49PM -0700, John Hubbard wrote: > > > On 10/25/24 12:49 PM, Lorenzo Stoakes wrote: > > > > On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: > >

[PATCH RFC v2 2/5] pinctrl: mediatek: moore: Expose more configurations to GPIO set_config

2024-10-25 Thread Nícolas F . R . A . Prado
Currently the set_config callback in the gpio_chip registered by the pinctrl_moore driver only supports configuring a single parameter on specific pins (the input debounce of the EINT controller, on pins that support it), even though many other configurations are already implemented and available t

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread John Hubbard
On 10/25/24 2:09 PM, Lorenzo Stoakes wrote: On Fri, Oct 25, 2024 at 01:31:49PM -0700, John Hubbard wrote: On 10/25/24 12:49 PM, Lorenzo Stoakes wrote: On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: On 10/25/24 11:38 AM, Pedro Falcato wrote: On Fri, Oct 25, 2024 at 6:41 PM John

[PATCH v12 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware

2024-10-25 Thread Arnaud Pouliquen
The new TEE remoteproc driver is used to manage remote firmware in a secure, trusted context. The 'st,stm32mp1-m4-tee' compatibility is introduced to delegate the loading of the firmware to the trusted execution context. In such cases, the firmware should be signed and adhere to the image format de

[PATCH v12 6/7] remoteproc: stm32: Create sub-functions to request shutdown and release

2024-10-25 Thread Arnaud Pouliquen
To prepare for the support of TEE remoteproc, create sub-functions that can be used in both cases, with and without remoteproc TEE support. Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/stm32_rproc.c | 82 +++- 1 file changed, 49 insertions(+), 33 deletions(-

[PATCH v12 2/7] remoteproc: Add TEE support

2024-10-25 Thread Arnaud Pouliquen
Add a remoteproc TEE (Trusted Execution Environment) driver that will be probed by the TEE bus. If the associated Trusted application is supported on secure part this driver offers a client interface to load a firmware by the secure part. This firmware could be authenticated by the secure trusted a

[PATCH 1/2] kunit: add fallback for os.sched_getaffinity

2024-10-25 Thread Tamir Duberstein
Python 3.13 added os.process_cpu_count as a cross-platform alternative for the Linux-only os.sched_getaffinity. Use it when it's available and provide a fallback when it's not. This allows kunit to run on macOS. Signed-off-by: Tamir Duberstein --- tools/testing/kunit/kunit.py | 11 ++-

[PATCH 0/2] kunit: enable hardware virtualization

2024-10-25 Thread Tamir Duberstein
(-) --- base-commit: ae90f6a6170d7a7a1aa4fddf664fbd093e3023bc change-id: 20241025-kunit-qemu-accel-macos-2840e4c2def5 Best regards, -- Tamir Duberstein

[PATCH v12 4/7] remoteproc: Introduce release_fw optional operation

2024-10-25 Thread Arnaud Pouliquen
This patch updates the rproc_ops struct to include an optional release_fw function. The release_fw ops is responsible for releasing the remote processor firmware image. The ops is called in the following cases: - An error occurs in rproc_start() between the loading of the segments and the

[PATCH v12 5/7] dt-bindings: remoteproc: Add compatibility for TEE support

2024-10-25 Thread Arnaud Pouliquen
The "st,stm32mp1-m4-tee" compatible is utilized in a system configuration where the Cortex-M4 firmware is loaded by the Trusted Execution Environment (TEE). For instance, this compatible is used in both the Linux and OP-TEE device trees: - In OP-TEE, a node is defined in the device tree with the

[PATCH v12 1/7] remoteproc: core: Introduce rproc_pa_to_va helper

2024-10-25 Thread Arnaud Pouliquen
When a resource table is loaded by an external entity such as U-boot or OP-TEE, we do not necessarily get the device address(da) but the physical address(pa). This helper performs similar translation than the rproc_da_to_va() but based on a physical address. Signed-off-by: Arnaud Pouliquen --- d

Re: [RFC PATCH] remoteproc: core: Add support for predefined notifyids

2024-10-25 Thread Arnaud POULIQUEN
hello On 10/23/24 17:32, Mathieu Poirier wrote: > Hello Daniel, > > On Fri, Oct 18, 2024 at 02:09:29PM +0300, Daniel Baluta wrote: >> Currently we generate notifyids in the linux kernel and override >> those found in rsc_table. >> >> This doesn't play well with users expecting to use the exact id

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread John Hubbard
On 10/25/24 12:49 PM, Lorenzo Stoakes wrote: On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: On 10/25/24 11:38 AM, Pedro Falcato wrote: On Fri, Oct 25, 2024 at 6:41 PM John Hubbard wrote: ... That seems to only apply to the kernel internally, uapi headers are Yes. included

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 11:44:34AM -0700, John Hubbard wrote: > On 10/25/24 11:38 AM, Pedro Falcato wrote: > > On Fri, Oct 25, 2024 at 6:41 PM John Hubbard wrote: > > > > > > On 10/25/24 5:50 AM, Pedro Falcato wrote: > > > > On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes > > > > wrote: > > > ..

[PATCH RFC v2 5/5] selftest: gpio: Add a new set-get config test

2024-10-25 Thread Nícolas F . R . A . Prado
Add a new kselftest that sets a configuration to a GPIO line and then gets it back to verify that it was correctly carried out by the driver. Setting a configuration is done through the GPIO uAPI, but retrieving it is done through the debugfs interface since that is the only place where it can be

[PATCH RFC v2 4/5] selftest: gpio: Add wait flag to gpio-mockup-cdev

2024-10-25 Thread Nícolas F . R . A . Prado
Add a -w flag to the gpio-mockup-cdev utility that causes the program to wait until a signal is received before exiting, even when its behavior is to retrieve the GPIO value of the line. This allows using this utility to keep a GPIO line configured even when in input mode, which will be relied on i

[PATCH RFC v2 0/5] Verify bias functionality for pinctrl_paris driver through new gpio test

2024-10-25 Thread Nícolas F . R . A . Prado
This series was motivated by the regression fixed by 166bf8af9122 ("pinctrl: mediatek: common-v2: Fix broken bias-disable for PULL_PU_PD_RSEL_TYPE"). A bug was introduced in the pinctrl_paris driver which prevented certain pins from having their bias configured. Running this test on the mt8195-tom

[PATCH RFC v2 1/5] pinctrl: mediatek: paris: Expose more configurations to GPIO set_config

2024-10-25 Thread Nícolas F . R . A . Prado
Currently the set_config callback in the gpio_chip registered by the pinctrl_paris driver only supports configuring a single parameter on specific pins (the input debounce of the EINT controller, on pins that support it), even though many other configurations are already implemented and available t

Re: [PATCH for-next 3/7] selftests/mm: Add a few missing gitignore files

2024-10-25 Thread John Hubbard
On 10/24/24 6:40 PM, Li Zhijian wrote: Compiled binary files should be added to .gitignore 'git status' complains: Untracked files: (use "git add ..." to include in what will be committed) mm/hugetlb_dio mm/pkey_sighandler_tests_32 mm/pkey_sighandler_tests_64

Re: [PATCH 6/6] remoteproc: qcom: Enable map/unmap and SHM bridge support

2024-10-25 Thread Konrad Dybcio
On 4.10.2024 11:23 PM, Mukesh Ojha wrote: > For Qualcomm SoCs runnning with Qualcomm EL2 hypervisor(QHEE), IOMMU > translation for remote processors is managed by QHEE and if the same SoC > run under KVM, remoteproc carveout and devmem region should be IOMMU > mapped from Linux PAS driver before re

Re: [PATCH 5/6] remoteproc: qcom: Add support of SHM bridge to enable memory protection

2024-10-25 Thread Konrad Dybcio
On 4.10.2024 11:23 PM, Mukesh Ojha wrote: > Qualcomm SoCs running with the Qualcomm EL2 hypervisor(QHEE) have been > utilizing the Peripheral Authentication Service (PAS) from its TrustZone > (TZ) firmware to securely authenticate and reset via sequence of SMC > calls like qcom_scm_pas_init_image()

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread John Hubbard
On 10/25/24 11:38 AM, Pedro Falcato wrote: On Fri, Oct 25, 2024 at 6:41 PM John Hubbard wrote: On 10/25/24 5:50 AM, Pedro Falcato wrote: On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes wrote: ... +static inline int pidfd_is_self_sentinel(pid_t pid) +{ + return pid == PIDFD_SELF_THRE

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Pedro Falcato
On Fri, Oct 25, 2024 at 6:41 PM John Hubbard wrote: > > On 10/25/24 5:50 AM, Pedro Falcato wrote: > > On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes > > wrote: > ... > >> +static inline int pidfd_is_self_sentinel(pid_t pid) > >> +{ > >> + return pid == PIDFD_SELF_THREAD || pid == PIDFD_SE

Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet

2024-10-25 Thread Breno Leitao
On Fri, Oct 25, 2024 at 07:01:59PM +0200, Petr Machata wrote: > > Breno Leitao writes: > > > Use a less populated IP range to run the tests, as suggested by Petr in > > Link: https://lore.kernel.org/netdev/87ikvukv3s@nvidia.com/. > > > > Suggested-by: Petr Machata > > Signed-off-by: Breno L

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread John Hubbard
On 10/25/24 5:50 AM, Pedro Falcato wrote: On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes wrote: ... +static inline int pidfd_is_self_sentinel(pid_t pid) +{ + return pid == PIDFD_SELF_THREAD || pid == PIDFD_SELF_THREAD_GROUP; +} Do we want this in the uapi header? Even if this is usef

Re: [PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet

2024-10-25 Thread Petr Machata
Breno Leitao writes: > Use a less populated IP range to run the tests, as suggested by Petr in > Link: https://lore.kernel.org/netdev/87ikvukv3s@nvidia.com/. > > Suggested-by: Petr Machata > Signed-off-by: Breno Leitao > --- > tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++--

Re: [PATCH v4 01/14] iommufd/viommu: Introduce IOMMUFD_OBJ_VDEVICE and its related struct

2024-10-25 Thread Nicolin Chen
On Fri, Oct 25, 2024 at 10:20:54AM -0300, Jason Gunthorpe wrote: > On Fri, Oct 25, 2024 at 06:53:01PM +1100, Alexey Kardashevskiy wrote: > > > +#define iommufd_vdevice_alloc(ictx, drv_struct, member) > > > \ > > > + ({

[PATCH net-next 1/2] net: netconsole: selftests: Change the IP subnet

2024-10-25 Thread Breno Leitao
Use a less populated IP range to run the tests, as suggested by Petr in Link: https://lore.kernel.org/netdev/87ikvukv3s@nvidia.com/. Suggested-by: Petr Machata Signed-off-by: Breno Leitao --- tools/testing/selftests/drivers/net/netcons_basic.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 d

Re: [PATCH v4 04/11] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl

2024-10-25 Thread Nicolin Chen
On Fri, Oct 25, 2024 at 08:59:11AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Tuesday, October 22, 2024 8:19 AM > > > > Add a new ioctl for user space to do a vIOMMU allocation. It must be based > > on a nesting parent HWPT, so take its refcount. > > > > If an IOMMU driver supports

Re: [PATCH v4 00/11] iommufd: Add vIOMMU infrastructure (Part-1)

2024-10-25 Thread Nicolin Chen
On Fri, Oct 25, 2024 at 08:34:05AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Tuesday, October 22, 2024 8:19 AM > > > > This series introduces a new vIOMMU infrastructure and related ioctls. > > > > IOMMUFD has been using the HWPT infrastructure for all cases, including a > > neste

Re: [PATCH v4 04/11] iommufd/viommu: Add IOMMU_VIOMMU_ALLOC ioctl

2024-10-25 Thread Nicolin Chen
On Fri, Oct 25, 2024 at 09:05:58AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Tuesday, October 22, 2024 8:19 AM > > + > > + viommu->type = cmd->type; > > + viommu->ictx = ucmd->ictx; > > + viommu->hwpt = hwpt_paging; > > + /* Assume physical IOMMUs are unpluggable (

Re: [PATCH v4 06/11] iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC

2024-10-25 Thread Nicolin Chen
On Fri, Oct 25, 2024 at 09:04:15AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Tuesday, October 22, 2024 8:19 AM > > > > +static struct iommufd_hwpt_nested * > > +iommufd_hwpt_nested_alloc_for_viommu(struct iommufd_viommu > > *viommu, > > + const str

[PATCH net-next 2/2] net: netconsole: selftests: Add userdata validation

2024-10-25 Thread Breno Leitao
Extend netcons_basic selftest to verify the userdata functionality by: 1. Creating a test key in the userdata configfs directory 2. Writing a known value to the key 3. Validating the key-value pair appears in the captured network output This ensures the userdata feature is properly tested durin

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
On Fri, Oct 25, 2024 at 01:50:12PM +0100, Pedro Falcato wrote: > On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes > wrote: > > > > It is useful to be able to utilise the pidfd mechanism to reference the > > current thread or process (from a userland point of view - thread group > > leader from the

Re: [PATCH v4 01/14] iommufd/viommu: Introduce IOMMUFD_OBJ_VDEVICE and its related struct

2024-10-25 Thread Jason Gunthorpe
On Fri, Oct 25, 2024 at 06:53:01PM +1100, Alexey Kardashevskiy wrote: > > +#define iommufd_vdevice_alloc(ictx, drv_struct, member) > > \ > > + ({ \ > > + static_assert(

Re: [PATCH v4 00/11] iommufd: Add vIOMMU infrastructure (Part-1)

2024-10-25 Thread Jason Gunthorpe
On Fri, Oct 25, 2024 at 08:34:05AM +, Tian, Kevin wrote: > > The vIOMMU object should be seen as a slice of a physical IOMMU instance > > that is passed to or shared with a VM. That can be some HW/SW resources: > > - Security namespace for guest owned ID, e.g. guest-controlled cache tags > >

[PATCH v3] vsock/test: fix failures due to wrong SO_RCVLOWAT parameter

2024-10-25 Thread Konstantin Shkolnyy
This happens on 64-bit big-endian machines. SO_RCVLOWAT requires an int parameter. However, instead of int, the test uses unsigned long in one place and size_t in another. Both are 8 bytes long on 64-bit machines. The kernel, having received the 8 bytes, doesn't test for the exact size of the param

Re: [PATCH v4 11/11] iommu/arm-smmu-v3: Add IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support

2024-10-25 Thread Jason Gunthorpe
On Fri, Oct 25, 2024 at 09:18:05AM +, Tian, Kevin wrote: > > From: Nicolin Chen > > Sent: Tuesday, October 22, 2024 8:20 AM > > > > Add a new driver-type for ARM SMMUv3 to enum iommu_viommu_type. > > Implement > > an arm_vsmmu_alloc() with its viommu op > > arm_vsmmu_domain_alloc_nested(), >

Re: [PATCH v3] remoteproc: Add a new remoteproc state RPROC_DEFUNCT

2024-10-25 Thread Mukesh Ojha
On Fri, Oct 25, 2024 at 09:08:03AM -0600, Mathieu Poirier wrote: > On Fri, Oct 25, 2024 at 01:40:45PM +0530, Mukesh Ojha wrote: > > On Mon, Oct 21, 2024 at 09:12:47AM -0600, Mathieu Poirier wrote: > > > Hi Mukesh, > > > > > > On Wed, Oct 16, 2024 at 10:25:46AM +0530, Mukesh Ojha wrote: > > > > Mul

Re: [PATCH v4 02/11] iommufd: Introduce IOMMUFD_OBJ_VIOMMU and its related struct

2024-10-25 Thread Jason Gunthorpe
On Fri, Oct 25, 2024 at 08:47:40AM +, Tian, Kevin wrote: > > From: Jason Gunthorpe > > Sent: Tuesday, October 22, 2024 9:16 PM > > > > On Tue, Oct 22, 2024 at 04:59:07PM +0800, Baolu Lu wrote: > > > > > Is it feasible to make vIOMMU object more generic, rather than strictly > > > tying it to

Re: [PATCH v7 1/3] modules: Support extended MODVERSIONS info

2024-10-25 Thread Matthew Maurer
> Sorry I realise it's version 7, but although the above looks correct it's > kind of dense. > > I think the below would also work and is (I think) easier to follow, and > is more obviously similar to the existing code. I'm sure your version is > faster, but I don't think it's that performance crit

Re: [PATCH v3] remoteproc: Add a new remoteproc state RPROC_DEFUNCT

2024-10-25 Thread Mathieu Poirier
On Fri, Oct 25, 2024 at 01:40:45PM +0530, Mukesh Ojha wrote: > On Mon, Oct 21, 2024 at 09:12:47AM -0600, Mathieu Poirier wrote: > > Hi Mukesh, > > > > On Wed, Oct 16, 2024 at 10:25:46AM +0530, Mukesh Ojha wrote: > > > Multiple call to glink_subdev_stop() for the same remoteproc can happen > > > if

Re: [PATCH V4 00/15] selftests/resctrl: Support diverse platforms with MBM and MBA tests

2024-10-25 Thread Reinette Chatre
On 10/25/24 6:54 AM, Ilpo Järvinen wrote: > On Thu, 24 Oct 2024, Reinette Chatre wrote: > >> Hi Shuah, >> >> On 10/24/24 3:36 PM, Shuah Khan wrote: >>> >>> Is this patch series ready to be applied? >>> >> >> I believe it is close ... I would like to give Ilpo some time to peek >> at patches 2 a

Re: [PATCH V4 00/15] selftests/resctrl: Support diverse platforms with MBM and MBA tests

2024-10-25 Thread Ilpo Järvinen
On Thu, 24 Oct 2024, Reinette Chatre wrote: > Hi Shuah, > > On 10/24/24 3:36 PM, Shuah Khan wrote: > > > > Is this patch series ready to be applied? > > > > I believe it is close ... I would like to give Ilpo some time to peek > at patches 2 and 10 to confirm if I got their fixes right this ti

Re: [PATCH V4 02/15] selftests/resctrl: Print accurate buffer size as part of MBM results

2024-10-25 Thread Ilpo Järvinen
On Thu, 24 Oct 2024, Reinette Chatre wrote: > By default the MBM test uses the "fill_buf" benchmark to keep reading > from a buffer with size DEFAULT_SPAN while measuring memory bandwidth. > User space can provide an alternate benchmark or amend the size of > the buffer "fill_buf" should use. > >

Re: [PATCH V4 10/15] selftests/resctrl: Make benchmark parameter passing robust

2024-10-25 Thread Ilpo Järvinen
On Thu, 24 Oct 2024, Reinette Chatre wrote: > The benchmark used during the CMT, MBM, and MBA tests can be provided by > the user via (-b) parameter, if not provided the default "fill_buf" > benchmark is used. The user is additionally able to override > any of the "fill_buf" default parameters whe

Re: [PATCH v4 00/14] iommufd: Add vIOMMU infrastructure (Part-2: vDEVICE)

2024-10-25 Thread Jason Gunthorpe
On Thu, Oct 24, 2024 at 11:14:21PM -0700, Nicolin Chen wrote: > On Fri, Oct 25, 2024 at 04:58:33PM +1100, Alexey Kardashevskiy wrote: > > > > > > Is there any real example of a .vdevice_alloc hook, besides the > > > > > > selftests? It is not in iommufd_viommu_p2-v4-with-rmr, hence the > > > > > >

[PATCH net-next v10 08/23] ovpn: implement basic TX path (UDP)

2024-10-25 Thread Antonio Quartulli
Packets sent over the ovpn interface are processed and transmitted to the connected peer, if any. Implementation is UDP only. TCP will be added by a later patch. Note: no crypto/encapsulation exists yet. packets are just captured and sent. Signed-off-by: Antonio Quartulli --- drivers/net/ovpn/

Re: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Pedro Falcato
On Fri, Oct 25, 2024 at 10:41 AM Lorenzo Stoakes wrote: > > It is useful to be able to utilise the pidfd mechanism to reference the > current thread or process (from a userland point of view - thread group > leader from the kernel's point of view). > > Therefore introduce PIDFD_SELF_THREAD to refe

Re: [PATCH v7 1/3] modules: Support extended MODVERSIONS info

2024-10-25 Thread Michael Ellerman
Matthew Maurer writes: > Adds a new format for MODVERSIONS which stores each field in a separate > ELF section. This initially adds support for variable length names, but > could later be used to add additional fields to MODVERSIONS in a > backwards compatible way if needed. Any new fields will be

Re: [PATCH for-next 1/7] selftests/alsa: Add a few missing gitignore files

2024-10-25 Thread Mark Brown
On Fri, Oct 25, 2024 at 09:40:04AM +0800, Li Zhijian wrote: > index 12dc3fcd3456..1407fd24a97b 100644 > --- a/tools/testing/selftests/alsa/.gitignore > +++ b/tools/testing/selftests/alsa/.gitignore > @@ -1,3 +1,5 @@ > mixer-test > pcm-test > test-pcmtest-driver > +global-timer > +utimer-test >

[PATCH v5 3/5] tools: testing: separate out wait_for_pid() into helper header

2024-10-25 Thread Lorenzo Stoakes
It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/cgroup

Re: [PATCH net 2/3] mptcp: remove unneeded lock when listing scheds

2024-10-25 Thread Simon Horman
On Wed, Oct 23, 2024 at 04:13:36PM +0200, Matthieu Baerts wrote: > Hi Simon, > > Thank you for the reviews! > > On 23/10/2024 14:21, Simon Horman wrote: > > On Mon, Oct 21, 2024 at 12:25:27PM +0200, Matthieu Baerts (NGI0) wrote: > >> mptcp_get_available_schedulers() needs to iterate over the sche

[PATCH v5 0/5] introduce PIDFD_SELF* sentinels

2024-10-25 Thread Lorenzo Stoakes
If you wish to utilise a pidfd interface to refer to the current process or thread it is rather cumbersome, requiring something like: int pidfd = pidfd_open(getpid(), 0 or PIDFD_THREAD); ... close(pidfd); Or the equivalent call opening /proc/self. It is more convenient t

[PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process

2024-10-25 Thread Lorenzo Stoakes
It is useful to be able to utilise the pidfd mechanism to reference the current thread or process (from a userland point of view - thread group leader from the kernel's point of view). Therefore introduce PIDFD_SELF_THREAD to refer to the current thread, and PIDFD_SELF_THREAD_GROUP to refer to the

[PATCH v5 5/5] selftests: pidfd: add tests for PIDFD_SELF_*

2024-10-25 Thread Lorenzo Stoakes
Add tests to assert that PIDFD_SELF_* correctly refers to the current thread and process. This is only practically meaningful to pidfd_send_signal() and pidfd_getfd(), but also explicitly test that we disallow this feature for setns() where it would make no sense. We cannot reasonably wait on our

[PATCH v5 4/5] selftests: pidfd: add pidfd.h UAPI wrapper

2024-10-25 Thread Lorenzo Stoakes
Conflicts can arise between system fcntl.h and linux/fcntl.h, imported by the linux/pidfd.h UAPI header. Work around this by adding a wrapper for linux/pidfd.h to tools/include/ which sets the linux/fcntl.h header guard ahead of importing the pidfd.h header file. Adjust the pidfd selftests Makefi

[PATCH v5 1/5] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup

2024-10-25 Thread Lorenzo Stoakes
The means by which a pid is determined from a pidfd is duplicated, with some callers holding a reference to the (pid)fd, and others explicitly pinning the pid. Introduce __pidfd_get_pid() which narrows this to one approach of pinning the pid, with an optional output parameters for file->f_flags to

[PATCH v2] vsock/test: fix failures due to wrong SO_RCVLOWAT parameter

2024-10-25 Thread Konstantin Shkolnyy
This happens on 64-bit big-endian machines. SO_RCVLOWAT requires an int parameter. However, instead of int, the test uses unsigned long in one place and size_t in another. Both are 8 bytes long on 64-bit machines. The kernel, having received the 8 bytes, doesn't test for the exact size of the param

Re: [PATCH] sched_ext: Fix function pointer type mismatches in BPF selftests

2024-10-25 Thread Tejun Heo
On Thu, Oct 24, 2024 at 10:46:09AM +0530, Vishal Chourasia wrote: > Fix incompatible function pointer type warnings in sched_ext BPF selftests by > explicitly casting the function pointers when initializing struct_ops. > This addresses multiple -Wincompatible-function-pointer-types warnings from >

Re: [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat

2024-10-25 Thread Uladzislau Rezki
On Thu, Oct 24, 2024 at 01:28:24PM -0700, Paul E. McKenney wrote: > On Thu, Oct 24, 2024 at 06:45:58PM +0200, Uladzislau Rezki (Sony) wrote: > > There are two places where WARN_ON_ONCE() is called two times > > in the error paths. One which is encapsulated into if() condition > > and another one, w

Re: [PATCH V2 0/4] A few fixes for RISC-V

2024-10-25 Thread Palmer Dabbelt
On Tue, 08 Oct 2024 02:41:37 PDT (-0700), zhangchun...@iscas.ac.cn wrote: These patches are all simple fixes with no strong dependency though, I hope that making them a patchset will be more convenient for merge. It doesn't: there's two RISC-V fixes and two MM cleanups, which makes stuff likel

RE: [PATCH v4 11/11] iommu/arm-smmu-v3: Add IOMMU_VIOMMU_TYPE_ARM_SMMUV3 support

2024-10-25 Thread Tian, Kevin
> From: Nicolin Chen > Sent: Tuesday, October 22, 2024 8:20 AM > > Add a new driver-type for ARM SMMUv3 to enum iommu_viommu_type. > Implement > an arm_vsmmu_alloc() with its viommu op > arm_vsmmu_domain_alloc_nested(), > to replace arm_smmu_domain_alloc_nesting(). As an initial step, copy the >

[PATCH net-next v10 23/23] testing/selftests: add test tool and scripts for ovpn module

2024-10-25 Thread Antonio Quartulli
The ovpn-cli tool can be compiled and used as selftest for the ovpn kernel module. It implements the netlink API and can thus be integrated in any script for more automated testing. Along with the tool, 4 scripts are added that perform basic functionality tests by means of network namespaces. Cc

[PATCH net-next v10 22/23] ovpn: add basic ethtool support

2024-10-25 Thread Antonio Quartulli
Implement support for basic ethtool functionality. Note that ovpn is a virtual device driver, therefore various ethtool APIs are just not meaningful and thus not implemented. Signed-off-by: Antonio Quartulli Reviewed-by: Andrew Lunn --- drivers/net/ovpn/main.c | 15 +++ 1 file chan

[PATCH net-next v10 21/23] ovpn: notify userspace when a peer is deleted

2024-10-25 Thread Antonio Quartulli
Whenever a peer is deleted, send a notification to userspace so that it can react accordingly. This is most important when a peer is deleted due to ping timeout, because it all happens in kernelspace and thus userspace has no direct way to learn about it. Signed-off-by: Antonio Quartulli --- dr

[PATCH net-next v10 20/23] ovpn: kill key and notify userspace in case of IV exhaustion

2024-10-25 Thread Antonio Quartulli
IV wrap-around is cryptographically dangerous for a number of ciphers, therefore kill the key and inform userspace (via netlink) should the IV space go exhausted. Userspace has two ways of deciding when the key has to be renewed before exhausting the IV space: 1) time based approach: after X se

  1   2   >