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: <DFUGA22OTLEJ.AV6MKVZUFLIL@garyguo.net>
Date: Wed, 21 Jan 2026 17:40:51 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Danilo Krummrich" <dakr@...nel.org>, "Gary Guo" <gary@...yguo.net>
Cc: "Zhi Wang" <zhiw@...dia.com>, <rust-for-linux@...r.kernel.org>,
 <linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <aliceryhl@...gle.com>, <bhelgaas@...gle.com>, <kwilczynski@...nel.org>,
 <ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
 <bjorn3_gh@...tonmail.com>, <lossin@...nel.org>, <a.hindborg@...nel.org>,
 <tmgross@...ch.edu>, <markus.probst@...teo.de>, <helgaas@...nel.org>,
 <cjia@...dia.com>, <smitra@...dia.com>, <ankita@...dia.com>,
 <aniketa@...dia.com>, <kwankhede@...dia.com>, <targupta@...dia.com>,
 <acourbot@...dia.com>, <joelagnelf@...dia.com>, <jhubbard@...dia.com>,
 <zhiwang@...nel.org>, <daniel.almeida@...labora.com>
Subject: Re: [PATCH v11 4/5] rust: pci: add config space read/write support

On Wed Jan 21, 2026 at 5:12 PM GMT, Danilo Krummrich wrote:
> On Wed Jan 21, 2026 at 4:36 PM CET, Gary Guo wrote:
>>> +/// The PCI configuration space of a device.
>>> +///
>>> +/// Provides typed read and write accessors for configuration registers
>>> +/// using the standard `pci_read_config_*` and `pci_write_config_*` helpers.
>>> +///
>>> +/// The generic const parameter `SIZE` can be used to indicate the
>>> +/// maximum size of the configuration space (e.g. `ConfigSpaceSize::Normal`
>>> +/// or `ConfigSpaceSize::Extended`).
>>> +pub struct ConfigSpace<'a, const SIZE: usize = { ConfigSpaceSize::Extended as usize }> {
>>
>> This is quite long to write. Given that it'll either be normal or extended, can
>> we just have two marker types instead? So you have
>>
>>     ConfigSpace<Normal> and ConfigSpace<Extended>
>
> I think in practice users don't have the need to write it anyways. You'd access
> the config space with either
>
> 	let config = pdev.config_space()?;
>
> or
>
> 	let config = pdev.config_space_extended()?;
>

I suspect when they need to write it, they'll just write `ConfigSpace<256>`
which'll be accepted by the compiler.

Also I don't see why we wouldn't want this to use types to begin with, even if
in practice users don't need to write out the type names.

Best,
Gary

> i.e. there is no need to store an instance of the struct anywhere.
>
> Should it turn out that we do need it for some reason in the future we can do
> this as follow-up, I think.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ