From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 614484302E7 for ; Mon, 6 Jul 2026 21:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783374549; cv=none; b=f7fuW/gnl4Ib/MdzGCvydSZq9XZX25CJzxzBX97nRGAOFQMQF1bPiIimEJ73cek8zocXQP52bo4sHj9BnB4lLsO5byULQhiGKYs6Oq7u7YZqdd2zONW7m8MD6VVnACLrXN2NdNm/Vmfc3nz0CKpN0EUvbR5DHRsSOBWclZ7DrSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783374549; c=relaxed/simple; bh=e675eE0ZMFoT1AEyjyOTLomvpLfl+YMD+jiR6g7h4TI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OCsQLjUpr1XTKXqwQPhD8JVhzHziOZnzw33gtDlSurk/6kdzYHC/o+JuHiUW+4OVJPFt8u6PZM+FjCZ9DJr2RP+A2tGGFFPCA1rRijB2ewRIQISwRl2SveBpmXIjBZJa7UmcrnumOvvkB3p1Zu85KgtUe+QDD+SJI+RtJyeVGUU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Qzoi2T4k; arc=none smtp.client-ip=209.85.216.43 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Qzoi2T4k" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-381891a9525so3241133a91.3 for ; Mon, 06 Jul 2026 14:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783374548; x=1783979348; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=j/fz4zBeCM+AKNVXg8StRUyGYLTlPNg6xC0itoPf18c=; b=Qzoi2T4k3Xt2ynqtGbHWJVq+JYc0ZL4SKpwcAPQBG5A+FHwgG3IMqBcDphrm5lBH2x EGHePMkrD+T3ai7TRwfbbt8OJEzqXLTWMXA22SRulPoFpqaWh8A5Y3As5cFCzW572UG3 wBDY3E28rldwyQeY2nQzxF1ODDP0pDsB6lsoVDsbri/lFrAR0yWPopfTS4ZQFinZV8zu S3K2pHjcgL471gbeXWQpGpDa/RNdoX/c9T0D+2G6BKvJwVEu8PyVPt2MYlPxu0s8j08N 18PGVulgJFawSDiDklP8vowR5X7YBvtkbYJN8ctbqOWU9yKV8e7kIT5A03HcIJtgkpf9 2pYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783374548; x=1783979348; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j/fz4zBeCM+AKNVXg8StRUyGYLTlPNg6xC0itoPf18c=; b=GSIhHvPxRHUoNhFg+0xZBQXm2Q0JAG3fj+d/yNQUqByTe7KiXi5aoUZZtdNZLcuUv1 izYeAUCJCQwkbQZJ0+2xlxIKbowDKM05RY0tj0tTZejJdo5oYCZJvzk+YNBNHIKFddsX XPPrVD79iHVXZavTIfXZ2Bz5/JEaWidJe7FPCeYU/cPfupzcprzTma3vM6M04gEgoAJu 9mZ+xrJWTZsRNFncNw2KljJhtqZkJk7WwvEw0jyUdIaKhOqKlchucCZ0D/5azHDsquP3 3AIzlkwmUhnQy+T/eHeBjRsqMqKBk4MQhnHbeJvsR+bF7SucK2uQAqXnEGootpv6i8lw 2uPw== X-Forwarded-Encrypted: i=1; AHgh+RrgLnSJW0BH+ApVY4YT3em2iiiz+dGLGFBVA/QOwWBdOS4Titq+5FsPJYX0ssC0ZDCSaASDXhnb2zN/HMI=@vger.kernel.org X-Gm-Message-State: AOJu0YwZ/jP87yugHzMmbT4SmIvuimGTZKPJ3hsUKZcn525X1xUkXs4T ypgZH2DP216i8o9VKFmbM86TelGXTFziXyoGcdMug6YLBVthzrdmytTEJ29W2BQlCg== X-Gm-Gg: AfdE7ck4uocEkl3t/O3H/3e3k0dehBpchv0Q91DVeToyqAAxUms/LxD8ozMBRnW+mSw ZHPnI1nLU9p+NxS61IAIl595DeehVLPgFMjG8aqzSUgWdP4K4MKapwGMeEC4O+gDsWHz25gaWpw 56myYcrfB+6k3n+NIsK8V3hUfuUjjaIBvD7vx3zENjGm3abnH1LOkSJvR2QgCjwoogc6Q1qmsuL ZHk4iCDngYTPdzyzQMkhm5il5+yjxoQ0qwrFmi/FD6Sfb/z0CZIFERg5+VtjteRem/+s9MeNnJm EJMYuN032kn1K8k/n5Uvdx6DNkYusBrKJmtDNFgtP6mUhkmDT1Lw7wLVLLYPBG66eQBqbm9Gi3B Feqlo0W9Z0Tlx+chU7Myw7aCVuexUWSKdnOE6YMlBWELUbvrOk5wyJba2+RzxEad/R1Tmkd6hSx ZRB2hVORfx+FHSGMiLY4nbnLjKQDeDkfKFcxGcLhM7MKo7th8M9+o= X-Received: by 2002:a17:90a:d003:b0:37f:e326:6557 with SMTP id 98e67ed59e1d1-387555738ccmr2308385a91.4.1783374547192; Mon, 06 Jul 2026 14:49:07 -0700 (PDT) Received: from google.com (56.149.168.34.bc.googleusercontent.com. [34.168.149.56]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-387ceb724b0sm44659a91.0.2026.07.06.14.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 14:49:06 -0700 (PDT) Date: Mon, 6 Jul 2026 21:49:03 +0000 From: David Matlack To: Narayana Murty N Cc: alex@shazbot.org, shuah@kernel.org, amastro@fb.com, rananta@google.com, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, vaibhav@linux.ibm.com, sbhat@linux.ibm.com, harshpb@linux.ibm.com Subject: Re: [RFC PATCH 1/6] selftests/vfio: allow selecting IOMMU backend from environment Message-ID: References: <20260703032806.40946-1-nnmlinux@linux.ibm.com> <20260703032806.40946-2-nnmlinux@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260703032806.40946-2-nnmlinux@linux.ibm.com> On 2026-07-02 11:28 PM, Narayana Murty N wrote: > Add support for selecting the IOMMU mode through the environment > variable VFIO_SELFTESTS_IOMMU_MODE. This allows tests to be run > with different IOMMU backends without modifying test code. > > The environment variable is validated against the list of supported > modes. On PowerPC, this includes the sPAPR TCE v2 mode which will > be added in a subsequent patch. > > If the environment variable is not set, tests use their default > mode, preserving existing behavior. > > Signed-off-by: Narayana Murty N > diff --git a/tools/testing/selftests/vfio/vfio_pci_device_test.c b/tools/testing/selftests/vfio/vfio_pci_device_test.c > index 93c11fd5e081..45b8bf60527a 100644 > --- a/tools/testing/selftests/vfio/vfio_pci_device_test.c > +++ b/tools/testing/selftests/vfio/vfio_pci_device_test.c > @@ -29,7 +29,7 @@ FIXTURE(vfio_pci_device_test) { > > FIXTURE_SETUP(vfio_pci_device_test) > { > - self->iommu = iommu_init(default_iommu_mode); > + self->iommu = iommu_init(vfio_selftests_get_iommu_mode()); > self->device = vfio_pci_device_init(device_bdf, self->iommu); > } > > @@ -121,7 +121,7 @@ FIXTURE_VARIANT_ADD(vfio_pci_irq_test, msix) { > > FIXTURE_SETUP(vfio_pci_irq_test) > { > - self->iommu = iommu_init(default_iommu_mode); > + self->iommu = iommu_init(vfio_selftests_get_iommu_mode()); > self->device = vfio_pci_device_init(device_bdf, self->iommu); > } Rather than forcing the user to pass in the mode via environment variable, can vfio_selftests_get_iommu_mode() pick a reasonable default based on what the host supports? i.e. Is it possible for vfio_selftests_get_iommu_mode() to now when to pick MODE_VFIO_SPAPR_TCE_V2_IOMMU as the default mode? The new KVM device-posted interrupt test that uses the VFIO selftests library also wants this to pick between MODE_IOMMUFD and MODE_VFIO_TYPE1_IOMMU. https://lore.kernel.org/kvm/aiIG2L_KdPwuxYA1@google.com/ And this would also fix VFIO selftests that get run on kernels where IOMMUFD is not enabled.