[PATCH v2 1/6] rust: helpers: io: use macro to generate io accessor functions

2025-05-14 Thread Andrew Ballance
From: Fiona Behrens Generate the `rust_helper_read{b,w,l,q}`, `rust_helper_write{b,w,l,q}` and the relaxed version using a C macro. This removes a lot of redundant code and is in preparation for pio functions which uses a similar C macro. Signed-off-by: Fiona Behrens Signed-off-by: Andrew

[PATCH v2 0/6] rust: add support for port io

2025-05-14 Thread Andrew Ballance
rust name - specialize `io_backend` for the x86 case - do not modify lib/iomap.c - rebased on v6.15-rc6 Link to v1: https://lore.kernel.org/rust-for-linux/20250509031524.2604087-1-andrewjballa...@gmail.com/ Andrew Ballance (3): rust: io: add new Io type rust: io: add from_raw_cookie functi

[PATCH v2 5/6] rust: io: add from_raw_cookie functions

2025-05-14 Thread Andrew Ballance
hint about their type. Suggested-by: Danilo Krummrich Signed-off-by: Andrew Ballance --- rust/kernel/io.rs | 73 +++ 1 file changed, 73 insertions(+) diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs index 9445451f4b02..81b26602d3bc 100644 --- a

[PATCH v2 2/6] rust: io: make Io use IoAccess trait

2025-05-14 Thread Andrew Ballance
-off-by: Fiona Behrens Co-developed-by: Andrew Ballance Signed-off-by: Andrew Ballance --- drivers/gpu/nova-core/regs.rs | 1 + rust/kernel/devres.rs | 4 +- rust/kernel/io.rs | 438 +++- rust/kernel/pci.rs | 2 +- samples

[PATCH v2 6/6] rust: pci: make Bar generic over Io

2025-05-14 Thread Andrew Ballance
renames `Bar` to `RawBar` and makes it generic over `IoAccess`. a user can give a compile time suggestion when mapping a bar so that the type of io can be known. updates nova-core and rust_driver_pci to use new bar api. Suggested-by: Danilo Krummrich Signed-off-by: Andrew Ballance --- drivers

[PATCH v2 4/6] rust: io: implement Debug for IoRaw and add some doctests

2025-05-14 Thread Andrew Ballance
From: Fiona Behrens Implement `Debug` for `kernel::io::IoRaw` which also outputs the const generic SIZE as a field. Add some doctests to `IoRaw::new` and `MMIo::from_raw(_ref)`. Signed-off-by: Fiona Behrens Signed-off-by: Andrew Ballance --- rust/kernel/io.rs | 63

[PATCH v2 3/6] rust: io: add new Io type

2025-05-14 Thread Andrew Ballance
adds a new Io type that uses the C ioread/iowrite family of functions and implements the IoAccess trait for it and renames the old `Io` to `MMIo`. Signed-off-by: Andrew Ballance --- rust/helpers/io.c | 7 rust/kernel/io.rs | 97 --- 2 files

Re: [PATCH 00/11] rust: add support for Port io

2025-05-13 Thread Andrew Ballance
t; path would be > sufficient to cover the common outliers (ata, uart, vga, ipmi, ne2000) > that need the iomap indirection and also the legacy devices that only > need port I/O (floppy, x86 platform devices, ...). Yeah, we probably don`t need the `PortIo` type and can rely on `Io` fo

[PATCH 07/11] rust: io: add from_raw_cookie functions

2025-05-08 Thread Andrew Ballance
can give a hint about their type. Suggested-by: Danilo Krummrich Signed-off-by: Andrew Ballance --- rust/kernel/io.rs | 104 ++ 1 file changed, 104 insertions(+) diff --git a/rust/kernel/io.rs b/rust/kernel/io.rs index 3d8b6e731ce7..30892f2909a6

[PATCH 09/11] samples: rust: rust_driver_pci: update to use new bar and io api

2025-05-08 Thread Andrew Ballance
update rust_driver_pci.rs to use the new bar and io api. Signed-off-by: Andrew Ballance --- samples/rust/rust_driver_pci.rs | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs index 2bb260aebc9e

[PATCH 02/11] rust: io: Replace Io with MMIo using IoAccess trait

2025-05-08 Thread Andrew Ballance
From: Fiona Behrens Replace the Io struct with a new MMIo struct that uses the different traits (`IoAccess`, `IoAccess64`, `IoAccessRelaxed` and `IoAccess64Relaxed). This allows to later implement PortIo and a generic Io framework. Signed-off-by: Fiona Behrens Co-developed-by: Andrew Ballance

[PATCH 01/11] rust: helpers: io: use macro to generate io accessor functions

2025-05-08 Thread Andrew Ballance
From: Fiona Behrens Generate the `rust_helper_read{b,w,l,q}`, `rust_helper_write{b,w,l,q}` and the relaxed version using a C macro. This removes a lot of redundant code and is in preparation for pio functions which uses a similar C macro. Signed-off-by: Fiona Behrens Signed-off-by: Andrew

[PATCH 11/11] rust: devres: fix doctest

2025-05-08 Thread Andrew Ballance
fix a doc test to use the new Io api. Signed-off-by: Andrew Ballance --- rust/kernel/devres.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs index ddb1ce4a78d9..88d145821ca8 100644 --- a/rust/kernel/devres.rs +++ b/rust

[PATCH 10/11] gpu: nova-core: update to use the new bar and io api

2025-05-08 Thread Andrew Ballance
updates nova-core to use the new Io and Bar api. Signed-off-by: Andrew Ballance --- drivers/gpu/nova-core/driver.rs | 4 ++-- drivers/gpu/nova-core/regs.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs

[PATCH 08/11] rust: pci: make Bar generic over Io

2025-05-08 Thread Andrew Ballance
renames `Bar` to `RawBar` and makes it generic over `IoAccess`. a user can give a compile time suggestion when mapping a bar so that the type of io can be known. Suggested-by: Danilo Krummrich Signed-off-by: Andrew Ballance --- rust/kernel/pci.rs | 88

[PATCH 06/11] io: move PIO_OFFSET to linux/io.h

2025-05-08 Thread Andrew Ballance
From: Fiona Behrens Move the non arch specific PIO size to linux/io.h. This allows rust to access `PIO_OFFSET`, `PIO_MASK` and `PIO_RESERVED`. This is required to implement `IO_COND` in rust. Signed-off-by: Fiona Behrens Signed-off-by: Andrew Ballance --- include/linux/io.h | 13

[PATCH 05/11] rust: io: add new Io type

2025-05-08 Thread Andrew Ballance
adds a new Io type that uses the C ioread/iowrite family of functions and implements the IoAccess trait for it. Signed-off-by: Andrew Ballance --- rust/helpers/io.c | 8 + rust/kernel/io.rs | 86 +++ 2 files changed, 94 insertions(+) diff --git

[PATCH 04/11] rust: io: add PortIo

2025-05-08 Thread Andrew Ballance
From: Fiona Behrens Add `rust::io::PortIo` implementing the `IoAccess` trait. Signed-off-by: Fiona Behrens Signed-off-by: Andrew Ballance --- rust/helpers/io.c | 20 +++ rust/kernel/io.rs | 88 +++ 2 files changed, 108 insertions(+) diff

[PATCH 03/11] rust: io: implement Debug for IoRaw and add some doctests

2025-05-08 Thread Andrew Ballance
From: Fiona Behrens Implement `Debug` for `kernel::io::IoRaw` which also outputs the const generic SIZE as a field. Add some doctests to `IoRaw::new` and `MMIo::from_raw(_ref)`. Signed-off-by: Fiona Behrens Signed-off-by: Andrew Ballance --- rust/kernel/io.rs | 62

[PATCH 00/11] rust: add support for Port io

2025-05-08 Thread Andrew Ballance
/#narrow/channel/288089-General/topic/.60IoRaw.60.20and.20.60usize.60/near/514788730 [1] Andrew Ballance (6): rust: io: add new Io type rust: io: add from_raw_cookie functions rust: pci: make Bar generic over Io samples: rust: rust_driver_pci: update to use new bar and io api gpu: nova

[PATCH v2 3/3] gpu: nova-core: remove completed Vec extentions from task list

2025-03-16 Thread Andrew Ballance
The requested Vec methods have been implemented thus, removes the completed item from the nova task list Signed-off-by: Andrew Ballance --- Documentation/gpu/nova/core/todo.rst | 10 -- 1 file changed, 10 deletions(-) diff --git a/Documentation/gpu/nova/core/todo.rst b/Documentation

[PATCH v2 2/3] rust: alloc: add Vec::resize method

2025-03-16 Thread Andrew Ballance
implement the equivalent of the rust std's Vec::resize on the kernel's Vec type. Signed-off-by: Andrew Ballance --- rust/kernel/alloc/kvec.rs | 26 ++ 1 file changed, 26 insertions(+) diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs index 18

[PATCH v2 1/3] rust: alloc: add Vec::truncate method

2025-03-16 Thread Andrew Ballance
implement the equivalent to the std's Vec::truncate on the kernel's Vec type. Signed-off-by: Andrew Ballance --- rust/kernel/alloc/kvec.rs | 36 1 file changed, 36 insertions(+) diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kve

[PATCH v2 0/3] rust: alloc: add Vec::resize and Vec::truncate

2025-03-16 Thread Andrew Ballance
: https://lore.kernel.org/rust-for-linux/20250315024235.5282-1-andrewjballa...@gmail.com/ Andrew Ballance (3): rust: alloc: add Vec::truncate method rust: alloc: add Vec::resize method gpu: nova-core: remove completed Vec extentions from task list Documentation/gpu/nova/core/todo.rst | 10

[PATCH 0/3] rust: alloc: add Vec::resize and Vec::truncate

2025-03-15 Thread Andrew Ballance
This patch series implements the Vec::truncate and Vec::resize methods that were needed by the nova driver and removes the corresponding item from their task list Andrew Ballance (3): rust: alloc: add Vec::truncate method rust: alloc: add Vec::resize method gpu: nova-core: remove completed

[PATCH 1/3] rust: alloc: add Vec::truncate method

2025-03-15 Thread Andrew Ballance
implements the equivalent to the std's Vec::truncate on the kernel's Vec type. Signed-off-by: Andrew Ballance --- rust/kernel/alloc/kvec.rs | 36 1 file changed, 36 insertions(+) diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kve

[PATCH 2/3] rust: alloc: add Vec::resize method

2025-03-15 Thread Andrew Ballance
implemnts the equivalent of the rust std's Vec::resize on the kernel's Vec type. Signed-off-by: Andrew Ballance --- rust/kernel/alloc/kvec.rs | 25 + 1 file changed, 25 insertions(+) diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs index 75

[PATCH 3/3] gpu: nova-core: remove completed Vec extentions from task list

2025-03-15 Thread Andrew Ballance
The requested Vec methods have been implemented thus, removes the completed item from the nova task list Signed-off-by: Andrew Ballance --- Documentation/gpu/nova/core/todo.rst | 10 -- 1 file changed, 10 deletions(-) diff --git a/Documentation/gpu/nova/core/todo.rst b/Documentation

Re: [PATCH 1/3] rust: alloc: add Vec::truncate method

2025-03-15 Thread Andrew Ballance
On Sat, Mar 15, 2025 at 10:09:26AM +, Benno Lossin wrote: > On Sat Mar 15, 2025 at 3:42 AM CET, Andrew Ballance wrote: > > implements the equivalent to the std's Vec::truncate > > on the kernel's Vec type. > > > > Signed-off-by: Andrew Ballance > &