lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251031145039.711ccaa1.zhiw@nvidia.com>
Date: Fri, 31 Oct 2025 14:50:39 +0200
From: Zhi Wang <zhiw@...dia.com>
To: Danilo Krummrich <dakr@...nel.org>
CC: <rust-for-linux@...r.kernel.org>, <bhelgaas@...gle.com>,
	<kwilczynski@...nel.org>, <ojeda@...nel.org>, <alex.gaynor@...il.com>,
	<boqun.feng@...il.com>, <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>,
	<lossin@...nel.org>, <a.hindborg@...nel.org>, <aliceryhl@...gle.com>,
	<tmgross@...ch.edu>, <linux-pci@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <cjia@...dia.com>, <smitra@...dia.com>,
	<ankita@...dia.com>, <aniketa@...dia.com>, <kwankhede@...dia.com>,
	<targupta@...dia.com>, <zhiwang@...nel.org>, <acourbot@...dia.com>,
	<joelagnelf@...dia.com>, <jhubbard@...dia.com>, <markus.probst@...teo.de>
Subject: Re: [PATCH v3 4/5] rust: pci: add config space read/write support

On Fri, 31 Oct 2025 13:48:41 +0100
"Danilo Krummrich" <dakr@...nel.org> wrote:

> On Thu Oct 30, 2025 at 4:48 PM CET, Zhi Wang wrote:
> > +impl<'a, const SIZE: usize> Io<SIZE> for ConfigSpace<'a, SIZE> {
> > +    /// Returns the base address of this mapping.
> > +    #[inline]
> > +    fn addr(&self) -> usize {
> > +        0
> > +    }
> > +
> > +    /// Returns the maximum size of this mapping.
> > +    #[inline]
> > +    fn maxsize(&self) -> usize {
> > +        self.pdev.cfg_size().map_or(0, |v| v as usize)
> > +    }
> > +
> > +    define_read!(fallible, try_read8, call_config_read,
> > pci_read_config_byte -> u8);
> > +    define_read!(fallible, try_read16, call_config_read,
> > pci_read_config_word -> u16);
> > +    define_read!(fallible, try_read32, call_config_read,
> > pci_read_config_dword -> u32); +
> > +    define_write!(fallible, try_write8, call_config_write,
> > pci_write_config_byte <- u8);
> > +    define_write!(fallible, try_write16, call_config_write,
> > pci_write_config_word <- u16);
> > +    define_write!(fallible, try_write32, call_config_write,
> > pci_write_config_dword <- u32); +}
> 
> Please also implement the infallible ones.
> 

Thanks. Will do this in the next spin.

> > +
> >  /// A PCI BAR to perform I/O-Operations on.
> >  ///
> >  /// # Invariants
> > @@ -615,6 +670,11 @@ pub fn set_master(&self) {
> >          // SAFETY: `self.as_raw` is guaranteed to be a pointer to
> > a valid `struct pci_dev`. unsafe {
> > bindings::pci_set_master(self.as_raw()) }; }
> > +
> > +    /// Return an initialized config space object.
> > +    pub fn config_space<'a>(&'a self) -> Result<ConfigSpace<'a>> {
> > +        Ok(ConfigSpace { pdev: self })
> > +    }
> 
> Please see [1].
> 
> [1] https://lore.kernel.org/lkml/DDWINZJUGVQ8.POKS7A6ZSRFK@kernel.org/


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ