From nobody Tue Feb 10 03:44:51 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3866B33372D for ; Thu, 5 Feb 2026 21:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770325238; cv=none; b=IzLmvdHkGI30Ng2qcFrI8qOdzr+5t/dKx54v2VJC2KO7l3V8SmMXIyHbVtz85jlL+YrkTdV70SVkQi40yQhaVmWwbuo8h7FkubvgUbyd7DTsjBWxUG1J/osphQ0NdKtEzQhxba64ZLqsmerokNTUjPzuRY9OosE+c6LNy0JTZOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770325238; c=relaxed/simple; bh=0n3HUB5a0dbq5Vp3zcn3fKughLCja0FW1cbYz+y6V0c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s76I0HDm4IeOxgHA/g3J6HYoWCl+h4aRqxsWPr7GNH/DKCJLAcEF2K0MPaYZ5v+J/8QMYupOqEvH5D4i4WIR7iOH1ocCa7DvUReO+M4huSaUj7uV0V3A1QEGpmk0NZag5ex+999SCj4PlGIN8Zi+RBo1qQDQhmPdKJbKiCT5l0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=S5Bnq9Zw; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=DJRyOtFk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="S5Bnq9Zw"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="DJRyOtFk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770325237; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2gGPFCPOPX/fBbf5qQfZiwEzewT+3Ulk7LVkRWF8dEo=; b=S5Bnq9ZwrCaHAWjhsveZG8+FeBF8WPKG05djIc2YY5sjWU6PJ0DHkEWWaVjkacvJCpynza colUDhZgNV1Sk5epkD4tZQYrlGbgMatF1pFQHGAiwfNxm3ZFpsGLxkHFkuj/Bnsg5vyW12 s01Crg7fOXDOmkXzS14aVhhxR3PUFtM= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-151-62MG920-OhyA25GLwDCv_w-1; Thu, 05 Feb 2026 16:00:36 -0500 X-MC-Unique: 62MG920-OhyA25GLwDCv_w-1 X-Mimecast-MFC-AGG-ID: 62MG920-OhyA25GLwDCv_w_1770325236 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8c71655aa11so469339385a.3 for ; Thu, 05 Feb 2026 13:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1770325236; x=1770930036; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2gGPFCPOPX/fBbf5qQfZiwEzewT+3Ulk7LVkRWF8dEo=; b=DJRyOtFkMsI56US+c6NOdfhByUFio75q00vlHZbra4em7TLWYHg9rKAmMm/epAyWPs hSFC4G2LSEtPVxaHk9ZQ4KYKrCJIPyHSTxLvpRhPnsCSlwHI7y4sa7TyjNPBZzbgVR8C 09B4gK0amQJqQ1YJgAPeyN7dchCz13rbztccDwQs3D/IW1PBauK2zHGpkNo48saBL0AN CAoA0uXDdII9Sr6m6UW3FtuaHeICm5Nkm+32CFSXF4ZAlHeDf9ULVCE5eXlXYg4GdIPm OD4Pr3b5c7Qt4j0+0EnfKZs/vUY7C51qDB79wc3my5PkBCU28vzICduaq9X7WofM1jv6 xIXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770325236; x=1770930036; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2gGPFCPOPX/fBbf5qQfZiwEzewT+3Ulk7LVkRWF8dEo=; b=cv8QKNvSjd68RVZ6+Q+4k9wfen+vbPJXk1IwbKREZM1DFaDTc9mo18shSnDtce7ReE kERB5aaujUdky9rK9XXslmxIj+NBgx9lf/GBroklbcQgjpnIN7iWbvXfiqSEJ2HLLNc6 m4XYMXedBv961wgFd8VgcmAt94QL+s1rjLjG9Awf5RYKfVfpE+vVssdpuaLbF555LRTm VqfEXGryDLPLVlVzTpaeYmqBxRl+uo+BEiLoMlmcG49ZoOluZ92CkN4yaT1Og6H3Kh/S EoUDi/sEq7t4soqTWMNlIQe731LGlhQxwY6OhUWBRibDnQvpG7OkXJW7aJafHCELlL9w WJkg== X-Forwarded-Encrypted: i=1; AJvYcCXX6xzzPSsTCkcRXzXdDPV2C1nRoDEDONB6IC2v55a7IbguctJCpgsAczuRjHs0Oqm5GVccUEajSFSc0V8=@vger.kernel.org X-Gm-Message-State: AOJu0YxpQSA6kZdkMf9k3RSseWqb7YdGaxL4kmpiHlyJAntNak2ISDV3 K+AwaPJ7VUJ3vcwWCK3n9k08CuKAKY7rVDSd6nBxWsLFCZhTdM2x2cBysUPhc7A69nFn6w4J+03 RkThb0OzANUDScFWQaw1MxSFcbeAiGyDWXdxQw7SQB6Em2hKtn+at926QHfvnSGJQbQ== X-Gm-Gg: AZuq6aIi6LSX6JDhbffR55BcNC5pG3vGhcefMk00VMd09ZxAOSY6FNNVJYmB4AHmkFb HH9/hG2DWSd9deWUIVezqS06fAtnTgZxsYZ+PqDmsVSLGr8Yg95z3OzRUUL6pnof4PgpSBdMZNq omdSBQIWX1627xjsPkd2yFB4etHuawJTgKV926oLgTB2A8N1tvD4/VNRl9xP6YI9KVCc2q2YtZL 82GzviAK9jvKtVB/cj2KpGwOR09iTxy/wM2K5NMOTpSG8xmzkr9T9SCMUOR0MYu+gobwK0Hcyq8 hU9XMQWv1Ugy8a5NPLjQ97NEWok1GnINNqI9tazKdWBJO6tNwCDqvg1QOBHkr+fWjPqnXVI1cZj eq3IzFsNAj3mvlBI= X-Received: by 2002:a05:620a:1a04:b0:8ca:4438:b8f4 with SMTP id af79cd13be357-8caf13fedb3mr61787985a.67.1770325235573; Thu, 05 Feb 2026 13:00:35 -0800 (PST) X-Received: by 2002:a05:620a:1a04:b0:8ca:4438:b8f4 with SMTP id af79cd13be357-8caf13fedb3mr61780085a.67.1770325234922; Thu, 05 Feb 2026 13:00:34 -0800 (PST) Received: from [172.16.1.8] ([2607:f2c0:b010:9000:4c85:f148:4c91:943a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8caf9fdf692sm17571285a.44.2026.02.05.13.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Feb 2026 13:00:34 -0800 (PST) From: Peter Colberg Date: Thu, 05 Feb 2026 15:59:54 -0500 Subject: [PATCH v2 07/10] rust: pci: add is_physfn(), to check for PFs 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260205-rust-pci-sriov-v2-7-ef9400c7767b@redhat.com> References: <20260205-rust-pci-sriov-v2-0-ef9400c7767b@redhat.com> In-Reply-To: <20260205-rust-pci-sriov-v2-0-ef9400c7767b@redhat.com> To: Danilo Krummrich , Bjorn Helgaas , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Abdiel Janulgue , Daniel Almeida , Robin Murphy , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , David Airlie , Simona Vetter , Jonathan Corbet , Xu Yilun , Tom Rix , Moritz Fischer , "Rafael J. Wysocki" Cc: linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot , Alistair Popple , Joel Fernandes , John Hubbard , Zhi Wang , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-fpga@vger.kernel.org, driver-core@lists.linux.dev, Peter Colberg , Jason Gunthorpe X-Mailer: b4 0.14.2 Add a method to check if a PCI device is a Physical Function (PF). Reviewed-by: Joel Fernandes Signed-off-by: Peter Colberg --- Changes in v2: - Replace VF -> PF in doc comment of is_physfn(). - Add #[inline] to is_physfn(). --- rust/kernel/pci.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs index db05641186c3a42922e2b6a463de9c1b099a4673..df39ad3f0d5fd898b034609efb0= 3368f83c2a2e9 100644 --- a/rust/kernel/pci.rs +++ b/rust/kernel/pci.rs @@ -484,6 +484,13 @@ pub fn resource_start(&self, bar: u32) -> Result { Ok(unsafe { bindings::pci_resource_start(self.as_raw(), bar.try_in= to()?) }) } =20 + /// Returns `true` if this device is a Physical Function (PF). + #[inline] + pub fn is_physfn(&self) -> bool { + // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`. + unsafe { (*self.as_raw()).is_physfn() !=3D 0 } + } + /// Returns `true` if this device is a Virtual Function (VF). #[inline] pub fn is_virtfn(&self) -> bool { --=20 2.52.0