From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2035530C638 for ; Mon, 3 Nov 2025 12:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173244; cv=none; b=q1tLajr9eyArPSKc9+dZ2jDJVNSTnTEAARhgIP/+rMcvRF0CyFsxPOFpH5KZdykBzZZviiVtqN847BE4SGGwqv23bqzs1UlC1oYsHyLLGUbaatR9jSGU8HTHEQjruDxvDeMjT+BKp38v4ofG79O6joDGI5ahwmJ3weP9ljr/ffQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173244; c=relaxed/simple; bh=w36KW/wPb3cVagvybLftrF4CjYrWqxSZqwj4SEHtr88=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=kwZZRUIVV5V1N6ZIhzp0nA5ENFRKL+4hj6E+fTV1H+cuGmErLVlsZ+md8cosl8GHj9vMEvpx6tr/KoGIk6UQKddDMAIIVRJi0qGxfjCeSaK6jrGvkBO0DqSEofG559yskYjlHFY7S0e6+A8KUCz1MQBsdeIEXgTXijkJ29v4crE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1yIt+xuO; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1yIt+xuO" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-477212937eeso31012745e9.2 for ; Mon, 03 Nov 2025 04:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762173241; x=1762778041; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=MSAYutkZ7+a569qs6E4HPdsGwXOmRZ2wAq/f2x6mExQ=; b=1yIt+xuOYwX5i7ODDEsQ5NbdkV5bYpYInTeM+iGri5xNow1udp+RYn2hFjNS07sg8S M9Mxl48IvlYQD8UbDzMFMef84CajUNmyxGW597yAomAmZjK8lo3w/+EKRufRXf88ITgG MdVa6m/pvXjIe8DpQYSHSdv4Vjf9nGQDnZIgxVcomYjBvBCmHrdi9uyIlCBfr/UNmRoj W/zDbgkMgHdI/6cVnLx2iXxePNuOOhIthKCVBAIq02ow0IcrCFs1jwcOguu6/NX3HtkB C16tB9C30AnFKkUoM68d8gaTsrXQfj/uZBPAmpJlYSblCZuKJALqCQ8AND3xcWpqiUvN sEBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762173241; x=1762778041; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MSAYutkZ7+a569qs6E4HPdsGwXOmRZ2wAq/f2x6mExQ=; b=i3IxFjidOczd7dnH+RVnIAOxk9reGB8h9iNoKRs69mnJR8S+MWv6APmqKx/jdPbaQ4 XQIrnas5U1dwLnX9DoAOkK+NvFMIFXsife2x6P+jMW4Oo5rsyhXZ25r8/x9/P11UbmHo ZE8mpDks1p6EJHYQSXLxQ+V6y4sY0h0z23ZrSXGTdQq8XRqspG4BdqNP9RYBLC3R01RC ZCSgwE5OaTG80OLYSYmwqY/Yz7XtYCt/KQadMikVd6/OkcnDyWDbWZ19rWHggyWm9TxJ HhZSwhhf5Rtnj/JduXzugmsg5qCchV+k7id976dKstqK8cTizs2qDSOOXWPhyc83MsfY o98g== X-Forwarded-Encrypted: i=1; AJvYcCWSanfs4hOjkbzkm6yt05gQD9gz4Lp6g2vxJdT33xxTOhgZGAH+erScFlaoH3PnDA/pTIdkYIjFyOsYE/0=@vger.kernel.org X-Gm-Message-State: AOJu0Yzf/KFUdK7UKyAasY6kudLqSoM1NfiH3VAqbE2DJVpW/7uHvN0w YZigoeihbvGJ8F1l+TkptbiYYTtYgu4/PaaLTLxMBXCmMDm5B6WUuwzrfUIJ6ezlYwQBJUvj74q S7ULDWc3JjtDAig== X-Google-Smtp-Source: AGHT+IE3BVSRA1xaeeR33gXX0nVF0a1SF+382+YyhshPRNKnmANoXw9zOSGPxjdhjzWLcN6ym2yRotwlAcsWrA== X-Received: from wmbgz3.prod.google.com ([2002:a05:600c:8883:b0:477:df7:b01a]) (user=smostafa job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4e08:b0:471:3b6:f2d with SMTP id 5b1f17b1804b1-477308aeaeamr104092065e9.38.1762173241601; Mon, 03 Nov 2025 04:34:01 -0800 (PST) Date: Mon, 3 Nov 2025 12:33:48 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.51.1.930.gacf6e81ea2-goog Message-ID: <20251103123355.1769093-1-smostafa@google.com> Subject: [PATCH v6 0/4] Move io-pgtable-arm selftest to KUnit From: Mostafa Saleh To: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: robin.murphy@arm.com, will@kernel.org, joro@8bytes.org, jgg@ziepe.ca, praan@google.com, Mostafa Saleh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is a small series to clean up the io-pgtable-arm library. The first patch is a small clean up to reduce the depedencies of the test before moving it. The second patch was originally part of the SMMUv3 KVM driver support[1], which needed to factor out the kernel code from the io-pgtable-arm library, and based on Jason=E2=80=99s suggestion this can be taken out as a cleanup, and a step further to convert it to kunit. The second patch just moves the code to a new file with no other changes, so it can be easier to review with =E2=80=9C--color-moved=E2=80=9D The third patch converts the sefltest to be modular, that is useful as kunit can be a module and it can run anytime after boot. The fourth patch registers the test using kunit, and converges some of the APIs, some notes about that: Granularity of tests: --------------------- To make the series easier to review, the series changes the test to run in kunit without making intrusive changes to the test itself. It=E2=80=99s possible to refactor the tests to have smaller granularity (al= though I think that would make it less efficient as we might create the same io-pg= table config multiple times) and integrate them in kunit as multiple tests, that change would be more intrusive, if you think that is the right approach, I can add a couple of more patches re-writing the tests. Other changes: -------------- - Also, to make the test changes minimal, and the fail messages similar, =E2=80=9CKUNIT_FAIL()=E2=80=9D is used to fail all tests instead of using= KUNIT specific assertions. - Instead of using faux device, we rely on kunit_device_register() - The WARN is removed when a test fails, as that doesn=E2=80=99t seem to be= a pattern used with kunit. You can find the instructions on how to run kunit in the last patch commit = message. A failure at the test with the new implementation look as [ 55.631877] # arm_lpae_do_selftests: pgsize_bitmap 0x20010000, IAS 4= 4 OAS 48 [ 55.632135] # arm_lpae_do_selftests: EXPECTATION FAILED at drivers/i= ommu/io-pgtable-arm-selftests.c:144 [ 55.632135] test failed for fmt idx 0 Changes in v6: -------------- - Remove arm_lpae_dump_ops() - Simplify __FAIL() v5: https://lore.kernel.org/linux-iommu/20250929155001.3287719-1-smostafa@g= oogle.com/ Changes in v5: -------------- - Rebase on iommu/next tree - Collected Jason and Praan Rbs - Move back #include to the main file. v4: https://lore.kernel.org/linux-iommu/20250922090003.686704-1-smostafa@go= ogle.com/ Main changes in v4: ------------------- - Remove one missed __init. - Change the kconfig dependencies back as it broke ARM https://lore.kernel.org/all/202509201819.f369wBHc-lkp@intel.com/ v3: https://lore.kernel.org/all/20250919133316.2741279-1-smostafa@google.co= m/ Main changes in v3: ------------------- - Move back unused code - Simplify printing based on Jason comments + some renames - Collect Jasons Rb v2: https://lore.kernel.org/all/20250917191143.3847487-1-smostafa@google.co= m/ Main changes in v2: ------------------- - Make the test modular v1: https://lore.kernel.org/linux-iommu/20250917140216.2199055-1-smostafa@g= oogle.com/ [1] https://lore.kernel.org/all/20250819215156.2494305-5-smostafa@google.co= m/ Mostafa Saleh (4): iommu/io-pgtable-arm: Remove arm_lpae_dump_ops() iommu/io-pgtable-arm: Move selftests to a separate file iommu/io-pgtable-arm-selftests: Modularize the test iommu/io-pgtable-arm-selftests: Use KUnit drivers/iommu/Kconfig | 11 +- drivers/iommu/Makefile | 1 + drivers/iommu/io-pgtable-arm-selftests.c | 214 +++++++++++++++++++++++ drivers/iommu/io-pgtable-arm.c | 203 --------------------- 4 files changed, 221 insertions(+), 208 deletions(-) create mode 100644 drivers/iommu/io-pgtable-arm-selftests.c base-commit: 6146a0f1dfae5d37442a9ddcba012add260bceb0 --=20 2.51.1.930.gacf6e81ea2-goog