From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 A865A368260 for ; Thu, 29 Jan 2026 21:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769721973; cv=none; b=PYDBh/AnzaUnBkZY9kfpjKfWLHOXta37X4rHSzPLg7lOofixwy0Ze98CAHOGI17hzBK3hxZnXeyuQBUvRWWTmTEtGcvPAunbtSTO+y+XriBOAAErh4m0VJ7EFGDJqXE2C1RtlfqR/1LV3QbqRgF48gqCl07/Db2QDxeZTsm0o/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769721973; c=relaxed/simple; bh=rzLzfQ5aFdVRSJeSbIlzRD0ZQoe/xL5btWLwt6zemMY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=LkVa3zkGZNBcHf0Zz9vXrVNRY+886yoJ8B94cINQJnzkybLip4mBlwIWvB7hoU/YZDsGmnhunmtJz9ydjPU2kuFtNeorOQo5gdBbW15aO8gpssS3WJTCXAn+kgFMtxYTyPSZ4GVS0S5H6rWaDO77d06Jb3BDmDC43FdsAf4Hh1w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vsHoIDiV; arc=none smtp.client-ip=209.85.216.74 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--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vsHoIDiV" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-34c5d203988so2580362a91.3 for ; Thu, 29 Jan 2026 13:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769721969; x=1770326769; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xZYm6U95PKyVs4z00Hg/ZV7BBbgjTCKK+U9M7txSstE=; b=vsHoIDiV6OWKfXOkJEefD3nmxTq9d2bBOte3nbIHo+29FIKL60dkUKiWNqXiDl9nDv awlgm3pxEarSdD7EE4VW3Gmf4p8/DaaSugzyDq+2X7+s14Zgrw6pEfDtS+iTNjyCDp9p dWqPR02UGc/eaSUxhVq6J257dprQyiO5GeZujJcVnnILUHOYgsMMWGFuJj2fFZ/8PiQA xUfoNirro9duFMPPjTKZZK/EF5kbF+GRW8c5f6aruQtRtEPiWR1/kTpt64owru6EqXmY CsMJ0G18oEja26QXnLXNJcapsZN0Rz7Ll7zFk2rp8JtBIRap8A+iGWQCjuMEygvPYuIr 4V6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769721969; x=1770326769; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xZYm6U95PKyVs4z00Hg/ZV7BBbgjTCKK+U9M7txSstE=; b=opfaQajY5lrghV9fT74c6D2QcHgTDfGzWZgnaKoUFpCaFY6qC+eIkiNBvaLWQlIFC/ SOpXR4022dGrEXQEqcpZHiI1Q4j/u7HFzeleky1W7pZ465RBv5lvkczwUkp2ACY0It5i i169klUAXVSQ5syTye3vzSxWXoS4Ea8cQ1y8HY6ANOF/cpuvt58CZNRopPPUyivIfMLZ valmQZd4/KDea/1p1XgVQyjd6Del5gbdXL5lYC0r34WvRfcasbkgs6XZ8n1ta6D/LglI rS7Obf5Da8HDNMnypIGdrcgwr1OD5PaI1bW+IJpfSBAolGdAZmVtkxEQ44ldVpyNN51u M5Uw== X-Forwarded-Encrypted: i=1; AJvYcCX1L84fhqS0OmZFH1ekdEYD6aNY+RIZqY95l4MXUXTWKTAEabc3Zz7zcVgHcEbR9rwsapS268jPaOw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzaj+DMbyyWSRLH2tNKy4PKjXO+eLqhJZeuAX91dtqTWk3V32LS wTJulpcII/ZF04JAlpzZxhmI+dxjmW8xSGoQS39uF1G9T68plC6J04394Cmg3IukaptP30QTorG oIAn5QzUfmZGWnw== X-Received: from pjpy19.prod.google.com ([2002:a17:90a:a413:b0:34c:9f0b:fd7]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3ccd:b0:352:bd7c:ddbd with SMTP id 98e67ed59e1d1-3543b38af32mr803010a91.23.1769721969001; Thu, 29 Jan 2026 13:26:09 -0800 (PST) Date: Thu, 29 Jan 2026 21:25:06 +0000 In-Reply-To: <20260129212510.967611-1-dmatlack@google.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129212510.967611-1-dmatlack@google.com> X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260129212510.967611-20-dmatlack@google.com> Subject: [PATCH v2 19/22] vfio: selftests: Expose iommu_modes to tests From: David Matlack To: Alex Williamson Cc: Adithya Jayachandran , Alexander Graf , Alex Mastro , Alistair Popple , Andrew Morton , Ankit Agrawal , Bjorn Helgaas , Chris Li , David Matlack , David Rientjes , Jacob Pan , Jason Gunthorpe , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Kevin Tian , kexec@lists.infradead.org, kvm@vger.kernel.org, Leon Romanovsky , Leon Romanovsky , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Lukas Wunner , "=?UTF-8?q?Micha=C5=82=20Winiarski?=" , Mike Rapoport , Parav Pandit , Pasha Tatashin , Pranjal Shrivastava , Pratyush Yadav , Raghavendra Rao Ananta , Rodrigo Vivi , Saeed Mahameed , Samiullah Khawaja , Shuah Khan , "=?UTF-8?q?Thomas=20Hellstr=C3=B6m?=" , Tomita Moeko , Vipin Sharma , Vivek Kasireddy , William Tu , Yi Liu , Zhu Yanjun Content-Type: text/plain; charset="UTF-8" Expose the list of iommu_modes to enable tests that want to iterate through all possible iommu modes. Signed-off-by: David Matlack --- tools/testing/selftests/vfio/lib/include/libvfio/iommu.h | 2 ++ tools/testing/selftests/vfio/lib/iommu.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h index 5c9b9dc6d993..a03ff2281f11 100644 --- a/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h +++ b/tools/testing/selftests/vfio/lib/include/libvfio/iommu.h @@ -15,6 +15,8 @@ struct iommu_mode { unsigned long iommu_type; }; +extern const struct iommu_mode iommu_modes[]; +extern const int nr_iommu_modes; extern const char *default_iommu_mode; struct dma_region { diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c index 58b7fb7430d4..add35dbc83f8 100644 --- a/tools/testing/selftests/vfio/lib/iommu.c +++ b/tools/testing/selftests/vfio/lib/iommu.c @@ -23,7 +23,7 @@ const char *default_iommu_mode = "iommufd"; /* Reminder: Keep in sync with FIXTURE_VARIANT_ADD_ALL_IOMMU_MODES(). */ -static const struct iommu_mode iommu_modes[] = { +const struct iommu_mode iommu_modes[] = { { .name = "vfio_type1_iommu", .container_path = "/dev/vfio/vfio", @@ -49,6 +49,8 @@ static const struct iommu_mode iommu_modes[] = { }, }; +const int nr_iommu_modes = ARRAY_SIZE(iommu_modes); + static const struct iommu_mode *lookup_iommu_mode(const char *iommu_mode) { int i; -- 2.53.0.rc1.225.gd81095ad13-goog