From mboxrd@z Thu Jan 1 00:00:00 1970 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 9455E2EE262 for ; Tue, 9 Dec 2025 18:24:26 +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=1765304668; cv=none; b=b3+IzXbtjqXkTpgeZvSi0HTy3zBgdizVFWlDG1NWCxELNqYd8c9VZ4FPBzsrR2Feuy1GZaHul2vdapcUAczvmdDYL5YgWZSMuzXDSq4XKQjM013t3DExhOpuKUCANXQ1Kvj8kDrzko5AyFhX70nj/1U+wcW6xzQzOK6lUQH1m74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765304668; c=relaxed/simple; bh=hAn/Z5Df5IfuEg5YxLgjH2jmnTaDG3wqcDn0Zcz6LNA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FZRLUgi7NLst+68xFbhyKbdKBL5/dGkXWUMuLJ/HzioPnsPiwGr7Epuoq+Nho7qgtf2/LmzZEzYSL+VtO2UDu48oE1b5jmmFgYi1nCjJG0f/QWhrluSH4liiWASWrmHbZ9+Tqw27OgI2S5dbh393kepVZTu+ePmderryK901TKY= 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=b+znwH6x; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RhUHERv5; 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="b+znwH6x"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RhUHERv5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765304665; 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: in-reply-to:in-reply-to:references:references; bh=dnmWADxON+YmdpGHvTe/CcMuyEKp/5Q83Q83DsKz/iw=; b=b+znwH6x5wY4ZFL8D9VkPO/lH7E5ktzQQBAveo1J8LFRy30cU1wX7oXe1X4IVIVDb7efHV YTY4sxzABi5jH5SamgdFdEkuuPDvBeHKMiLvAn7+KDjaqevpcpT2kxI5rJa+Oz0uW2SgYQ Zy9Vt26uGWV+vtpAnoAhEL5VSR2PQO0= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-Jizjl_0BP8KML9HbvgRveQ-1; Tue, 09 Dec 2025 13:24:21 -0500 X-MC-Unique: Jizjl_0BP8KML9HbvgRveQ-1 X-Mimecast-MFC-AGG-ID: Jizjl_0BP8KML9HbvgRveQ_1765304660 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8823f4666abso132225796d6.0 for ; Tue, 09 Dec 2025 10:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1765304660; x=1765909460; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=dnmWADxON+YmdpGHvTe/CcMuyEKp/5Q83Q83DsKz/iw=; b=RhUHERv5aCV1g94Al3drDXugVOU2KCXVCug/Lt9w9uoMCCMkrXFGh/teicLlb+HZYM dxT2crzLXky46ZKLWYXpOM0xGRqkAkZgk96Sh9bdv2mRLibNkWbYabW8UNWYeYMqyt9V yPVK2H28MpCUm8Z3g6g+oKGeBraN7417fbCRKEhmH84Xb5EaU1UqXyU3wW0gsx3KRt/y TRz6R8T8Jitkbvsl6NOc1lOVnVhd1O5AJ/cwzLX3F+Hgm+Hv2C3TFhEX/JtvczDfJ+uz pfaTDoUx5DEI+3np7Xp1iDRwx0sl1ibTla0SuGGgwVAvw7tkoxKNd0obUT/T6gprAmxJ FWFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765304660; x=1765909460; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dnmWADxON+YmdpGHvTe/CcMuyEKp/5Q83Q83DsKz/iw=; b=gE0i9r6ZezLYe4SkmkVtYBavgO2pGFgy3keybnE2WNvUFXoZpC3jG+WeWFsxdD56a3 UD9wvkTgg4qDaQmkJ+B/NcKh6f8/PrZ/gqHpAuNTXSdrRsgj5jRqI+3AfswFWKoODgCn 1VdSZnWRa4TBMX2dvtjZnNK5eA87FKBgi787gOMTt8VnRebUEzHnnvPIb/SFgt/5Iv2L 4RPfHEuECM1ilfYcSHeCPZLQravPEFeHGRdce7lyrdAws27ZWa8xWwRjnA8M/dc0Xi+m JhdhPjvkKtyfj3B+7kG2/lDNnE3Q3178o67Be20IPpkNfZIjegHI+3qJkudbW1zJ7epL iQRg== X-Forwarded-Encrypted: i=1; AJvYcCUyI8H+kKVB47KhTsEwSa9s2d8rAT3yjNVVIk421ouxDOdAfTCQaU+kPqWpbN6I/Co5EWra9P8TXf0mmbQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+ETquGgXFVkrU4LB5JUnY6ctqR0xDzYgjmqHoG1FIZDCxFqyS To08Rz6hdp1X1RkoQkgrSsJyZGQ6hNZFSUGaDpV1LPlVEUdOLvg7NOCiivXmq71LPkYhLe0usc5 zulmk0RtEiMPhRtKgx+Ry6s07yWZK5UIQWHCW8jWUjy8JU+X2sHLhyABDiYnj9970Hw== X-Gm-Gg: AY/fxX4sn7N55vHCSZLaUSeMvTHk+hcE2UMsiELyYhN0DSaLDbrilUX4AgXKErj/B8Q pR1FBFCG3pJV0aUr/5hdxdGvwRWSaPnjKJJaP53WrC04+wFs1JvqOSKpwDA1zbaYlSfjNUBS7G9 IFCsaHGT2XPpTG/mXcvTDfEU1cO8x9UrTX5bOaLfEE4vGvlbIb6nYT9DyyYT2KvtJJajCcXPD34 MUax6ZffuMljECmaDg+k08E++QHEybrooeoHBXLHrE8485ACrd+fPtWfNBg0r1fQpD/zws3II7T 5a275hHlG/9jbiPTBrRkjxYlB5Pm6qZzkYOpylo1sj3gDIVjxee6RdvFNHxX/1lClL9HcOCCVIB ZYyOyRZfuyg== X-Received: by 2002:a05:6214:ca4:b0:880:5a6d:acdd with SMTP id 6a1803df08f44-8883db2a6b2mr191693046d6.20.1765304660211; Tue, 09 Dec 2025 10:24:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJ8wAtHimvFzUwt+2wodU61BXEoK2Jlph6a1B6dGPRD3NMrmeZ11TpnWCcFApbeYhstxlBjw== X-Received: by 2002:a05:6214:ca4:b0:880:5a6d:acdd with SMTP id 6a1803df08f44-8883db2a6b2mr191692316d6.20.1765304659571; Tue, 09 Dec 2025 10:24:19 -0800 (PST) Received: from localhost ([2607:f2c0:b021:e700:1a3d:b7ef:5d4d:bee5]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-888287d5f9csm131225306d6.46.2025.12.09.10.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 10:24:19 -0800 (PST) Date: Tue, 9 Dec 2025 13:24:18 -0500 From: Peter Colberg To: Joel Fernandes Cc: Danilo Krummrich , Bjorn Helgaas , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= 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 , linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot , Alistair Popple , John Hubbard , Zhi Wang , Jason Gunthorpe Subject: Re: [PATCH 2/8] rust: pci: add is_physfn(), to check for PFs Message-ID: Mail-Followup-To: Joel Fernandes , Danilo Krummrich , Bjorn Helgaas , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= 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 , linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot , Alistair Popple , John Hubbard , Zhi Wang , Jason Gunthorpe References: <20251119-rust-pci-sriov-v1-0-883a94599a97@redhat.com> <20251119-rust-pci-sriov-v1-2-883a94599a97@redhat.com> <20251207063529.GA213398@joelbox2> 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: <20251207063529.GA213398@joelbox2> On Sun, Dec 07, 2025 at 01:35:29AM -0500, Joel Fernandes wrote: > On Wed, Nov 19, 2025 at 05:19:06PM -0500, Peter Colberg wrote: > > Add a method to check if a PCI device is a Physical Function (PF). > > > > Signed-off-by: Peter Colberg > > --- > > rust/kernel/pci.rs | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs > > index c20b8daeb7aadbef9f6ecfc48c972436efac9a08..814990d386708fe2ac652ccaa674c10a6cf390cb 100644 > > --- a/rust/kernel/pci.rs > > +++ b/rust/kernel/pci.rs > > @@ -409,6 +409,12 @@ pub fn resource_start(&self, bar: u32) -> Result { > > Ok(unsafe { bindings::pci_resource_start(self.as_raw(), bar.try_into()?) }) > > } > > > > + /// Returns `true` if this device is a Physical Function (VF). > > nit: s/VF/PF/ > > also, add #[inline]. > > With that, > > Reviewed-by: Joel Fernandes Thanks, done. Peter > > thanks, > > - Joel > > > > > + 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() != 0 } > > + } > > + > > /// Returns `true` if this device is a Virtual Function (VF). > > pub fn is_virtfn(&self) -> bool { > > // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`. > > > > -- > > 2.51.1 > > >