Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode

2025-02-08 Thread Alexei Starovoitov
On Sat, Feb 8, 2025 at 11:32 AM Josh Poimboeuf wrote: > > On Sat, Feb 08, 2025 at 07:47:12AM -0800, Alexei Starovoitov wrote: > > On Fri, Feb 7, 2025 at 10:42 PM Yafang Shao wrote: > > > > > > On Fri, Feb 7, 2025 at 2:01 AM Song Liu wrote: > > > > > > > > On Wed, Feb 5, 2025 at 6:55 PM Yafang Sh

[PATCH v5 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein --- lib/K

[PATCH v5 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
This Makefile has been dead code since it was added in commit 7fcc9b53216c ("lib/math: Add int_pow test suite"); the tests worked because of the duplicated rules in the parent directory's Makefile. Wire up tests/Makefile and remove the duplication. Fixes: 7fcc9b53216c ("lib/math: Add int_pow test

[PATCH v5 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v5: - Rebase against mm/mm-everything. - Correctly EXPORT_SYMBOL(with_primes). - Link to v4: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert-v4-0-76e36bca0...@gmail.com Apologies for the

[PATCH] selftests: mm: Fixed typo

2025-02-08 Thread Eric Salem
Fixed misspelling. Signed-off-by: Eric Salem --- tools/testing/selftests/mm/uffd-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c index 717539eddf98..f23c57d9d1bd 100644 --- a/tools/t

[PATCH v4 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein --- lib/K

[PATCH v4 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
This Makefile has been dead code since it was added in commit 7fcc9b53216c ("lib/math: Add int_pow test suite"); the tests worked because of the duplicated rules in the parent directory's Makefile. Wire up tests/Makefile and remove the duplication. Fixes: 7fcc9b53216c ("lib/math: Add int_pow test

[PATCH v4 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v4: - Use `#if IS_ENABLED` to handle `CONFIG_PRIME_NUMBERS_KUNIT_TEST=m`. (Andrew Morton) - Link to v3: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert-v3-0-8ffd5816d...@gmail.com

Re: [PATCH v3 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 7:25 PM Andrew Morton wrote: > > On Sat, 08 Feb 2025 17:52:28 -0500 Tamir Duberstein wrote: > > > This is a clear example of a unit test. > > > > I tested this using: > > > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 > > math-prime_numbers > > >

Re: [PATCH v3 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Andrew Morton
On Sat, 08 Feb 2025 17:52:28 -0500 Tamir Duberstein wrote: > This is a clear example of a unit test. > > I tested this using: > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 > math-prime_numbers > > On success: > ; [08:51:41] == math-prime_numbers (1 subt

[PATCH v3 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
This Makefile has been dead code since it was added in commit 7fcc9b53216c ("lib/math: Add int_pow test suite"); the tests worked because of the duplicated rules in the parent directory's Makefile. Wire up tests/Makefile and remove the duplication. Fixes: 7fcc9b53216c ("lib/math: Add int_pow test

[PATCH v3 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein --- lib/K

[PATCH v3 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
:50:19] Testing complete. Ran 1 tests: failed: 1 Signed-off-by: Tamir Duberstein --- Changes in v3: - Remove `selftest_max` again; snuck into v2. - Restore `#include `. - Sending v3 early because kernel test robot is sad. - Link to v2: https://lore.kernel.org/r/20250208-prime_numbers-kunit-convert

Re: [PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread kernel test robot
Hi Tamir, kernel test robot noticed the following build errors: [auto build test ERROR on 2014c95afecee3e76ca4a56956a936e23283f05b] url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/lib-math-Hook-up-tests-Makefile/20250208-220040 base

Re: [PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread kernel test robot
Hi Tamir, kernel test robot noticed the following build errors: [auto build test ERROR on 2014c95afecee3e76ca4a56956a936e23283f05b] url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/lib-math-Hook-up-tests-Makefile/20250208-220040 base

Re: [PATCH 1/2] arm64: dts: qcom: qcm6490-fairphone-fp5: Enable display

2025-02-08 Thread Marijn Suijten
On 2025-02-02 23:45:51, Luca Weiss wrote: > Configure the MDSS nodes for the phone and add the panel node. > > Signed-off-by: Luca Weiss Glad to hear (and see in real life) that you're able to use the 1:1:1 topology patches. Reviewed-by: Marijn Suijten Thanks! > --- > arch/arm64/boot/dts/qc

Re: [PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread kernel test robot
Hi Tamir, kernel test robot noticed the following build warnings: [auto build test WARNING on 2014c95afecee3e76ca4a56956a936e23283f05b] url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/lib-math-Hook-up-tests-Makefile/20250208-220040 base

[PATCH v5 0/8] iio: light: stk3310: support powering off during suspend

2025-02-08 Thread Aren Moynihan
In the Pine64 PinePhone, the stk3310 chip is powered by a regulator that is disabled at system boot and can be shut off during suspend. To ensure that the chip properly initializes, both after boot and suspend, we need to manage this regulator. Additionally if the chip is shut off in suspend, we n

[PATCH v5 1/8] dt-bindings: iio: light: stk33xx: add vdd and leda regulators

2025-02-08 Thread Aren Moynihan
stk3310 and stk3311 are typically connected to power supplies for the chip (vdd) and the infrared LED (leda). Add properties so we can power these up / down appropriately. Signed-off-by: Aren Moynihan Reviewed-by: Krzysztof Kozlowski --- Notes: Changes in v2: - add leda-supply - a

[PATCH v5 2/8] iio: light: stk3310: handle all remove logic with devm callbacks

2025-02-08 Thread Aren Moynihan
Using devm callbacks helps to make the ordering of probe / remove operations easier to reason about and removes some duplicate code between the probe error path and driver remove. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - also replace mutex_init with devm_mutex_init

[PATCH v5 7/8] iio: light: stk3310: log error if reading the chip id fails

2025-02-08 Thread Aren Moynihan
If the chip isn't powered, this call is likely to return an error. Without a log here the driver will silently fail to probe. Potential errors include ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus isn't powered). This function is only called from stk3310_probe, and this condi

[PATCH v5 8/8] arm64: dts: allwinner: pinephone: add power supplies to stk3311

2025-02-08 Thread Aren Moynihan
From: Ondrej Jirman This allows the driver to properly handle powering this device, and disable power during suspend. Signed-off-by: Ondrej Jirman Signed-off-by: Aren Moynihan --- Notes: Changes in v2: - add leda-supply arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 2 ++

[PATCH v5 6/8] iio: light: stk3310: use dev_err_probe where possible

2025-02-08 Thread Aren Moynihan
Using dev_err_probe instead of dev_err and return makes the errors easier to understand by including the error name, and saves a little code. Signed-off-by: Aren Moynihan --- Notes: Changes in v4: - Get a struct device ahead of time so it can be passed as "dev" instead of "&clien

[PATCH v5 5/8] iio: light: stk3310: refactor to always make dev a variable

2025-02-08 Thread Aren Moynihan
This reduces syntactic noise where the dev variable is used, which should help improve readability. Signed-off-by: Aren Moynihan --- Notes: Added in v5 drivers/iio/light/stk3310.c | 40 ++--- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/dr

[PATCH v5 4/8] iio: light: stk3310: simplify and inline STK3310_REGFIELD macro

2025-02-08 Thread Aren Moynihan
This macro has a conditional return statement, which obfuscates control flow. Inlining makes the control flow more clear. This also switches to using dev_err_probe for error reporting, which is a shorter way of expressing the same logic as before. Signed-off-by: Aren Moynihan --- Notes: Add

[PATCH v5 3/8] iio: light: stk3310: implement vdd and leda supplies

2025-02-08 Thread Aren Moynihan
The vdd and leda supplies must be powered on for the chip to function and can be powered off during system suspend. This is originally based on a patch by Ondrej Jirman, but has been rewritten since. Link: https://codeberg.org/megi/linux/commit/a933aff8b7a0e6e3c9cf1d832dcba07022bbfa82 Signed-off

Re: [PATCH 0/6] KUnit test moves / renames

2025-02-08 Thread Kees Cook
On Fri, Oct 11, 2024 at 07:53:43AM -0600, Shuah Khan wrote: > On 10/11/24 01:25, David Gow wrote: > > As discussed in [1], the KUnit test naming scheme has changed to avoid > > name conflicts (and tab-completion woes) with the files being tested. > > These renames and moves have caused a nasty set

Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode

2025-02-08 Thread Josh Poimboeuf
On Sat, Feb 08, 2025 at 07:47:12AM -0800, Alexei Starovoitov wrote: > On Fri, Feb 7, 2025 at 10:42 PM Yafang Shao wrote: > > > > On Fri, Feb 7, 2025 at 2:01 AM Song Liu wrote: > > > > > > On Wed, Feb 5, 2025 at 6:55 PM Yafang Shao wrote: > > > [...] > > > > > I think we should first understand w

[PATCH v2] blackhole_dev: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Convert this very simple smoke test to a KUnit test. Add a missing `htons` call that was spotted[0] by kernel test robot after initial conversion to KUnit. Link: https://lore.kernel.org/oe-kbuild-all/202502090223.qcymbjwt-...@intel.com/ [0] Signed-off-by: Tamir Duberstein --- I tested this usi

Re: [PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 12:53 PM Yury Norov wrote: > > [...] > > Take over means that you'd at least add the Co-developed-by tag. I didn't use their code - the thing being "taken over" is the work of having these debates with the maintainers. > [...] > > KUNIT is disabled in defconfig, at least o

Re: [PATCH] blackhole_dev: convert self-test to KUnit

2025-02-08 Thread kernel test robot
Hi Tamir, kernel test robot noticed the following build warnings: [auto build test WARNING on 2014c95afecee3e76ca4a56956a936e23283f05b] url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/blackhole_dev-convert-self-test-to-KUnit/20250208-074037 base

Re: [PATCH] blackhole_dev: convert self-test to KUnit

2025-02-08 Thread kernel test robot
Hi Tamir, kernel test robot noticed the following build warnings: [auto build test WARNING on 2014c95afecee3e76ca4a56956a936e23283f05b] url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/blackhole_dev-convert-self-test-to-KUnit/20250208-074037 base

Re: [PATCH 1/3] bitmap: remove _check_eq_u32_array

2025-02-08 Thread Yury Norov
On Fri, Feb 07, 2025 at 03:14:02PM -0500, Tamir Duberstein wrote: > This has been unused since commit 3aa56885e516 ("bitmap: replace > bitmap_{from,to}_u32array") in 2018. Remove it to avoid the need to port > it to KUnit in this series. > > Signed-off-by: Tamir Duberstein OK, 7 years is enough

Re: [PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-08 Thread Yury Norov
On Fri, Feb 07, 2025 at 03:14:01PM -0500, Tamir Duberstein wrote: > This is one of just 3 remaining "Test Module" kselftests (the others > being printf and scanf), the rest having been converted to KUnit. > > I tested this using: > > $ tools/testing/kunit/kunit.py run --arch arm64 --make_options

Re: [RFC PATCH 0/2] livepatch: Add support for hybrid mode

2025-02-08 Thread Alexei Starovoitov
On Fri, Feb 7, 2025 at 10:42 PM Yafang Shao wrote: > > On Fri, Feb 7, 2025 at 2:01 AM Song Liu wrote: > > > > On Wed, Feb 5, 2025 at 6:55 PM Yafang Shao wrote: > > [...] > > > > I think we should first understand why the trampoline is not > > > > freed. > > > > > > IIUC, the fexit works as follo

Re: [PATCH v14 09/15] PCI: endpoint: pci-epf-test: Add doorbell test support

2025-02-08 Thread kernel test robot
Hi Frank, kernel test robot noticed the following build errors: [auto build test ERROR on 00f3246adeeacbda0bd0b303604e46eb59c32e6e] url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/platform-msi-Add-msi_remove_device_irq_domain-in-platform_device_msi_free_irqs_all/20250208-034445

Re: [PATCH v14 07/15] PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check

2025-02-08 Thread kernel test robot
Hi Frank, kernel test robot noticed the following build errors: [auto build test ERROR on 00f3246adeeacbda0bd0b303604e46eb59c32e6e] url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/platform-msi-Add-msi_remove_device_irq_domain-in-platform_device_msi_free_irqs_all/20250208-034445

Re: [PATCH v14 06/15] PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller

2025-02-08 Thread kernel test robot
Hi Frank, kernel test robot noticed the following build errors: [auto build test ERROR on 00f3246adeeacbda0bd0b303604e46eb59c32e6e] url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/platform-msi-Add-msi_remove_device_irq_domain-in-platform_device_msi_free_irqs_all/20250208-034445

Re: [PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 8:58 AM Tamir Duberstein wrote: > > [...] > > diff --git a/lib/math/prime_numbers.c b/lib/math/prime_numbers.c > index 9a17ee9af93a..540d9b7b178f 100644 > --- a/lib/math/prime_numbers.c > +++ b/lib/math/prime_numbers.c > @@ -64,7 +58,13 @@ static const struct primes __rcu *p

[PATCH v2 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
Extract a private header and convert the prime_numbers self-test to a KUnit test. I considered parameterizing the test using `KUNIT_CASE_PARAM` but didn't see how it was possible since the test logic is entangled with the test parameter generation logic. Signed-off-by: Tamir Duberstein --- lib/K

[PATCH v2 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread Tamir Duberstein
This Makefile has been dead code since it was added in commit 7fcc9b53216c ("lib/math: Add int_pow test suite"); the tests worked because of the duplicated rules in the parent directory's Makefile. Wire up tests/Makefile and remove the duplication. Fixes: 7fcc9b53216c ("lib/math: Add int_pow test

[PATCH v2 0/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread Tamir Duberstein
This is a clear example of a unit test. I tested this using: $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 math-prime_numbers On success: ; [08:51:41] == math-prime_numbers (1 subtest) == ; [08:51:41] [PASSED] prime_numbers_test ; [08:51:41] =

Re: [PATCH 3/3] bitmap: break kunit into test cases

2025-02-08 Thread Tamir Duberstein
On Sat, Feb 8, 2025 at 4:07 AM David Gow wrote: > > On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > > > Move some tests into `bitmap_test_cases` and parameterize > > `test_bitmap_print_buf`. This gives us nicer output in the event of a > > failure. > > > > Signed-off-by: Tamir Duberstein

[PATCH v2] media: dw9719: Add of_match table

2025-02-08 Thread André Apitzsch via B4 Relay
From: André Apitzsch Add of_match table for "dongwoon,dw9719" and "dongwoon,dw9761" compatible string. This fixes automatic driver loading when using a device-tree, and if built as a module like major linux distributions do. Signed-off-by: André Apitzsch --- This patch depends on https://lore.

Re: [RESEND] [PATCH bpf-next 2/3] bpf: Overwrite the element in hash map atomically

2025-02-08 Thread Hou Tao
Hi Toke, On 2/6/2025 11:05 PM, Toke Høiland-Jørgensen wrote: > Hou Tao writes: > >> +cc Cody Haas >> >> Sorry for the resend. I sent the reply in the HTML format. >> >> On 2/4/2025 4:28 PM, Hou Tao wrote: >>> Currently, the update of existing element in hash map involves two >>> steps: >>> 1) ins

Re: [PATCH 1/3] bitmap: remove _check_eq_u32_array

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > This has been unused since commit 3aa56885e516 ("bitmap: replace > bitmap_{from,to}_u32array") in 2018. Remove it to avoid the need to port > it to KUnit in this series. > > Signed-off-by: Tamir Duberstein > --- Makes sense. Reviewed-by:

Re: [PATCH 2/3] bitmap: convert self-test to KUnit

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > Convert the bitmap() self-test to a KUnit test. > > In the interest of keeping the patch reasonably-sized this doesn't > refactor the tests into proper parameterized tests - it's all one big > test case. > > Signed-off-by: Tamir Duberstein

Re: [PATCH 3/3] bitmap: break kunit into test cases

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > Move some tests into `bitmap_test_cases` and parameterize > `test_bitmap_print_buf`. This gives us nicer output in the event of a > failure. > > Signed-off-by: Tamir Duberstein > --- I very much like this cleanup: the static global 'kunitt

Re: [PATCH 0/3] bitmap: convert self-test to KUnit

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 04:14, Tamir Duberstein wrote: > > This is one of just 3 remaining "Test Module" kselftests (the others > being printf and scanf), the rest having been converted to KUnit. Thanks a lot, Tamir: these are great! > > I tested this using: > > $ tools/testing/kunit/kunit.py run

[PATCH v1 13/13] iommufd/selftest: Add coverage for IOMMU_OPTION_SW_MSI_START/SIZE

2025-02-08 Thread Nicolin Chen
Also add fail_nth coverage too. Signed-off-by: Nicolin Chen --- tools/testing/selftests/iommu/iommufd.c | 97 +++ .../selftests/iommu/iommufd_fail_nth.c| 21 2 files changed, 118 insertions(+) diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testi

[PATCH v1 09/13] iommufd: Pass in idev to iopt_table_enforce_dev_resv_regions

2025-02-08 Thread Nicolin Chen
The iopt_table_enforce_dev_resv_regions needs to access the sw_msi_start and sw_msi_size stored in the idev, set by user space. So, pass in idev pointer instead. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_private.h | 2 +- drivers/iommu/iommufd/device.c | 5 ++--- dri

[PATCH v1 12/13] iommufd/selftest: Add a testing reserved region

2025-02-08 Thread Nicolin Chen
The new IOMMU_OPTION_SW_MSI_START/SIZE must not overlap with any existing device reserved region, so add a testing region [0x8000, 0x8fff], on top of the normal IOVA aperture for selftest program to run an overlap test. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h

[PATCH v1 11/13] iommufd/selftest: Add MOCK_FLAGS_DEVICE_NO_ATTACH

2025-02-08 Thread Nicolin Chen
Add a new MOCK_FLAGS_DEVICE_NO_ATTACH flag to allow the mock_domain cmd to bypass the attach step, as IOMMU_OPTION_SW_MSI_START/SIZE only allow users to set prior to an IOAS/HWPT attachment. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_test.h | 1 + drivers/iommu/iommufd/selfte

[PATCH v1 10/13] iommufd: Add IOMMU_OPTION_SW_MSI_START/SIZE ioctls

2025-02-08 Thread Nicolin Chen
For systems that require MSI pages to be mapped into the IOMMU translation the IOMMU driver provides an IOMMU_RESV_SW_MSI range, which is the default recommended IOVA window to place these mappings. However, there is nothing special about this address. And to support the RMR trick in VMM for nested

[PATCH v1 06/13] iommufd: Implement sw_msi support natively

2025-02-08 Thread Nicolin Chen
From: Jason Gunthorpe iommufd has a model where the iommu_domain can be changed while the VFIO device is attached. In this case the MSI should continue to work. This corner case has not worked because the dma-iommu implementation of sw_msi is tied to a single domain. Implement the sw_msi mapping

[PATCH v1 05/13] iommu: Turn fault_data to iommufd private pointer

2025-02-08 Thread Nicolin Chen
A "fault_data" was added exclusively for the iommufd_fault_iopf_handler() used by IOPF/PRI use cases, along with the attach_handle. Now, the iommufd version of sw_msi function will reuse the attach_handle and fault_data for a non-fault case. Rename "fault_data" to "iommufd_hwpt" so as not to confi

[PATCH v1 03/13] iommu: Make iommu_dma_prepare_msi() into a generic operation

2025-02-08 Thread Nicolin Chen
From: Jason Gunthorpe SW_MSI supports IOMMU to translate an MSI message before the MSI message is delivered to the interrupt controller. On such systems the iommu_domain must have a translation for the MSI message for interrupts to work. The IRQ subsystem will call into IOMMU to request that a p

[PATCH v1 08/13] iommufd/device: Move sw_msi_start from igroup to idev

2025-02-08 Thread Nicolin Chen
The sw_msi_start was set from the per-device reserved region, so storing it in the iommufd_device structure makes sense too. This will also ease a following patch adding a SET_OPTION uAPI to set per-idev sw_msi args. Signed-off-by: Nicolin Chen --- drivers/iommu/iommufd/iommufd_private.h | 2 +-

[PATCH v1 07/13] iommu: Turn iova_cookie to dma-iommu private pointer

2025-02-08 Thread Nicolin Chen
Now that iommufd does not rely on dma-iommu.c for any purpose we can combine the dma-iommu.c iova_cookie and the iommufd_hwpt under the same union. This union is effectively 'owner data' can be used by the entity that allocated the domain. Note that legacy vfio type1 flows continue to use dma-iommu

[PATCH v1 04/13] irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by the irqchips that need it

2025-02-08 Thread Nicolin Chen
From: Jason Gunthorpe Currently IRQ_MSI_IOMMU is selected if DMA_IOMMU is available to provide an implementation for iommu_dma_prepare/compose_msi_msg(). However it makes more sense for the irqchips that call prepare/compose to select it and that will trigger all the additional code and data to b

[PATCH v1 02/13] genirq/msi: Rename iommu_dma_compose_msi_msg() to msi_msg_set_addr()

2025-02-08 Thread Nicolin Chen
From: Jason Gunthorpe The new function is used to take in a u64 MSI address and store it in the msi_msg. If the iommu has provided an alternative address then that is replaced instead. All callers have a tidy u64 already so this also consolidates the repeated low/high code into a small helper.

[PATCH v1 01/13] genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iommu_cookie

2025-02-08 Thread Nicolin Chen
From: Jason Gunthorpe All the iommu cases simply want to override the MSI page's address with the IOVA that was mapped through the iommu. This doesn't need a cookie pointer, we just need to store the IOVA and its page size in the msi_desc. Instead provide msi_desc_set_iommu_msi_iova() which allo

[PATCH v1 00/13] iommu: Add MSI mapping support with nested SMMU

2025-02-08 Thread Nicolin Chen
[ Background ] On ARM GIC systems and others, the target address of the MSI is translated by the IOMMU. For GIC, the MSI address page is called "ITS" page. When the IOMMU is disabled, the MSI address is programmed to the physical location of the GIC ITS page (e.g. 0x2020). When the IOMMU is ena

Re: [PATCH 2/2] lib/prime_numbers: convert self-test to KUnit

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 06:33, Tamir Duberstein wrote: > > Extract a private header and convert the prime_numbers self-test to a > KUnit test. I considered parameterizing the test using > `KUNIT_CASE_PARAM` but didn't see how it was possible since the test > logic is entangled with the test paramete

Re: [PATCH 1/2] lib/math: Hook up tests/Makefile

2025-02-08 Thread David Gow
On Sat, 8 Feb 2025 at 06:33, Tamir Duberstein wrote: > > This Makefile has been dead code since it was added in commit > 7fcc9b53216c ("lib/math: Add int_pow test suite"); the tests worked > because of the duplicated rules in the parent directory's Makefile. Wire > up tests/Makefile and remove the