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: <34d7a6af-5974-482e-9f70-3f92a823bd96@nvidia.com>
Date: Mon, 3 Feb 2025 12:59:57 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Joel Fernandes <joel@...lfernandes.org>, Danilo Krummrich
	<dakr@...nel.org>
CC: <airlied@...il.com>, <simona@...ll.ch>, <corbet@....net>,
	<maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
	<tzimmermann@...e.de>, <ajanulgu@...hat.com>, <lyude@...hat.com>,
	<pstanner@...hat.com>, <zhiw@...dia.com>, <cjia@...dia.com>,
	<bskeggs@...dia.com>, <acurrid@...dia.com>, <ojeda@...nel.org>,
	<alex.gaynor@...il.com>, <boqun.feng@...il.com>, <gary@...yguo.net>,
	<bjorn3_gh@...tonmail.com>, <benno.lossin@...ton.me>,
	<a.hindborg@...nel.org>, <aliceryhl@...gle.com>, <tmgross@...ch.edu>,
	<dri-devel@...ts.freedesktop.org>, <linux-doc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <nouveau@...ts.freedesktop.org>,
	<rust-for-linux@...r.kernel.org>, <joelagnelf@...dia.com>
Subject: Re: [PATCH 1/2] gpu: nova-core: add initial driver stub

On 2/3/25 12:24 PM, Joel Fernandes wrote:
> Hi Danilo,
> On Fri, Jan 31, 2025 at 11:04:24PM +0100, Danilo Krummrich wrote:
...
>> +const BAR0_SIZE: usize = 8;
>> +pub(crate) type Bar0 = pci::Bar<BAR0_SIZE>;
>> +
>> +kernel::pci_device_table!(
>> +    PCI_TABLE,
>> +    MODULE_PCI_TABLE,
>> +    <NovaCore as pci::Driver>::IdInfo,
>> +    [(
>> +        pci::DeviceId::from_id(bindings::PCI_VENDOR_ID_NVIDIA, bindings::PCI_ANY_ID as _),
> 
> Does this mean it will match even non-GSP Nvidia devices?
> 

Yes, it does. However, the Gpu construction a little further down
will fail on pre-GSP GPUs, thus failing the probe(), so all is well.

More below:

>> +        ()
>> +    )]
>> +);
>> +
>> +impl pci::Driver for NovaCore {
>> +    type IdInfo = ();
>> +    const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE;
>> +
>> +    fn probe(pdev: &mut pci::Device, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> {
>> +        dev_dbg!(pdev.as_ref(), "Probe Nova Core GPU driver.\n");
>> +
>> +        pdev.enable_device_mem()?;
>> +        pdev.set_master();
>> +
>> +        let bar = pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core"))?;
>> +
>> +        let this = KBox::pin_init(
>> +            try_pin_init!(Self {
>> +                gpu <- Gpu::new(pdev, bar)?,

Here. Try to construct a Gpu, which tries to construct a GpuSpec, which
fails out if Chipset is not listed, or if CardType (which should be
renamed to Architecture) is not listed.

And only Turing+ GPUs are listed. Turing is the first GPU that has a
GSP unit.

By the way, I have loaded this on a system with a Kepler GPU (pre-Turing),
and an Ampere GPU, and traced through actually loading NovaCore, and it
behaves as described above.

thanks,
-- 
John Hubbard


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ