From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 C9A47346E6C for ; Thu, 9 Apr 2026 01:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775699522; cv=none; b=QJVRa4lPLD6riRqj84r5O7vc5LTpkCyhvYFz5cy8c7F95utUyi5rqy6paEn+CabcClxG8Es5MVG92Fitd+RyIaMd73J69w/G9Ov7EMcxJth2DimZEp5O/8AJo1G++H/Sxjx64j5xWvmVhOXklhwBZrKUwSBTud7/zsaW4wi+gd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775699522; c=relaxed/simple; bh=guVUo2Cwnwa+kL5K7NoDxZu9WS2iHeUqrrW/dgWavO4=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Wqmri22TnQLIwSmaO9eGnuuoRmrNbuc8QPQpCBk4/EQ9L6EX0aYJrWThbVK+R4RWPR3Iugz1r/iXHuGjxXJm4ZNRbxsXywKGzmI59UfQEC2+GaLAwCaSPEgvHd4wiE+9cika/rOKY4enaPHndV+vkgQpt+jgyfFLgnItER5jXn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jrhilke.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KBFUhTnG; arc=none smtp.client-ip=209.85.210.202 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--jrhilke.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KBFUhTnG" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-82ce0a9e558so423767b3a.1 for ; Wed, 08 Apr 2026 18:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775699521; x=1776304321; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=CoRX83w9uMC+lyD0NCTQGQP5G19CTg6wgCWZNM28fVM=; b=KBFUhTnGO22+hPMWCr/WjZH9AaXDB46XgUoIop9AgskK6QOPw2aEVR6iYiB9/G5Tx4 fmYEi6hUz/QBjyQefd4NXBqTXc7PkJxw74oHcT8UAQilQjdHvEagkCGkEwvGVnT03bzV tZxRCwsKtpETISIvBl+02hjwmd7q1b3LdWEhyMeRgtOqVPB/A/9yF0EHCium5s1wDGM0 KzNfzCt38e5fkkTfR4wheK7vuHQZOqLPj7xDNk7Np6bCmcjSyfdouWICwgRqoBHWf90p 77pnCzrfsZyOMFVFFWedIKw0ySJ5j2kk2BYt18jFhSa39/k6TEZnByqXtOWxO/jl4tad VO2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775699521; x=1776304321; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CoRX83w9uMC+lyD0NCTQGQP5G19CTg6wgCWZNM28fVM=; b=GplZBEmTPtanIaAV1iXBxoBxoyvli38BQSdtovjVKrRK4kF6mA7wFIGyv8BKUHiz1W aHX3yjeHiwGVw2RwVT7SG+yh9f467Y0DAfW5Ovrd5Car5P7Uvo3U4Mvby+z+UXa0N4xN IvGSBLZoTQz1YYR3t3yABd5FN5c/u0WCOf/15lU9kQcZObpJ0qEItNc5wXwPVZwoasOA Y+ZKXNJmsREWAIzpaMJRUOHvoZNP0ZeCVReElZxrbL01UaEgAv6sj3/ZoOe0Q485MSbE bnHP9Qd6AfeXXM/hmNMJ8Sj1NVHppNJl9u2yR1pPrvSklpv3tagG/yh1416BZTZqGsXg 4ntw== X-Forwarded-Encrypted: i=1; AJvYcCV0CTP28nu4hliiQ6CRKfJpZ2q4norWP/NgX8sdWEDD540/olTRGTs1AR3InDe4GTzhPr5Hpw1QKtGIcb8=@vger.kernel.org X-Gm-Message-State: AOJu0YwYSMvn/couuxFeqQ97QzWcOgyF9RkKPkYQBXkiJPM35oi/ol+1 v+XRR9ZL/pASrQ7Zl9/r0164fhga77p24EhFzvC+mqyt+JIyKD0I/K+wa5KQ5spN+B8iTTStxzL lSajvAq48 X-Received: from pfbcn4.prod.google.com ([2002:a05:6a00:3404:b0:829:a3ad:9925]) (user=jrhilke job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:3010:b0:82c:e76b:c68c with SMTP id d2e1a72fcca58-82d0d73f532mr22906776b3a.0.1775699520862; Wed, 08 Apr 2026 18:52:00 -0700 (PDT) Date: Thu, 9 Apr 2026 01:51:37 +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.53.0.1213.gd9a14994de-goog Message-ID: <20260409015139.2800185-1-jrhilke@google.com> Subject: [PATCH 0/2] vfio: selftests: Automate finding/setting up devices for testing From: Josh Hilke To: Alex Williamson Cc: David Matlack , Vipin Sharma , Raghavendra Rao Ananta , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Hilke Content-Type: text/plain; charset="UTF-8" This series introduces two improvements to make setting up devices for VFIO selftests more user-friendly. 1. Add functionality to the VFIO selftest setup script to find devices on a user's system that are compatible with the VFIO selftest framework (i.e. devices that have a VFIO selftest driver). Example: $ ./tools/testing/selftests/vfio/scripts/setup.sh -l Supported devices: 0000:6a:01.0 0000:6f:01.0 0000:74:01.0 0000:79:01.0 0000:e7:01.0 0000:ec:01.0 0000:f1:01.0 0000:f6:01.0 2. Modify the VFIO selftest setup script to try to find and set up a compatible device automatically. "Set up the device for testing" means unbind the device from its driver, then bind it to VFIO. The user is no longer required to find a segment:bus:device.function number to pass to the script (though this functionality is still available through a -d option). Example of automated device setup: $ ./tools/testing/selftests/vfio/scripts/setup.sh + echo "0000:6a:01.0" > /sys/bus/pci/drivers/idxd/unbind + echo "vfio-pci" > /sys/bus/pci/devices/0000:6a:01.0/driver_override + echo "0000:6a:01.0" > /sys/bus/pci/drivers/vfio-pci/bind Successfully set up 0000:6a:01.0 Example of manual device setup: $ ./tools/testing/selftests/vfio/scripts/setup.sh -d 0000:6a:01.0 + echo "0000:6a:01.0" > /sys/bus/pci/drivers/idxd/unbind + echo "vfio-pci" > /sys/bus/pci/devices/0000:6a:01.0/driver_override + echo "0000:6a:01.0" > /sys/bus/pci/drivers/vfio-pci/bind Successfully set up 0000:6a:01.0 Josh Hilke (2): vfio: selftests: Find devices that are compatible with VFIO selftests vfio: selftests: Automate finding/setting up devices for testing tools/testing/selftests/vfio/scripts/setup.sh | 63 +++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) -- 2.53.0.1213.gd9a14994de-goog