drivers/block/ramshared: add hardware-accelerated VRAM block driver
A message that is not in the archive (sent off-list or not yet received): 20260904041500.ramshared-v2-cover
RFC PATCH v2 1/2 drivers/block/ramshared: add hardware-accelerated VRAM block driver
Add the RamShared driver core in drivers/block/ramshared/ supporting direct PCIe DMA aperture mapping, blk-mq request dispatch, and synchronous .rw_page swap fast-path.
---
v1 -> v2 changes:
- queue.c: use check_shl_overflow() to prevent 64-bit integer overflow when shifting sector to byte offsets.
- queue.c: enforce PCIe BAR0 boundary validation before memory-mapped I/O.
- main.c: ensure pci_clear_master() is called during linear error unwinding in probe failure paths and device teardown.
- main.c: clamp queue_depth module parameter within [1..4096].
- ramshared.h: wrap function declarations to conform to 80-column kernel coding style.
drivers/block/ramshared/Kconfig | 15 + drivers/block/ramshared/Makefile | 18 + drivers/block/ramshared/compat.h | 105 +++++ drivers/block/ramshared/dma.c | 56 +++ drivers/block/ramshared/main.c | 181 ++++++++ drivers/block/ramshared/queue.c | 264 ++++++++++ drivers/block/ramshared/ramshared.h | 63 +++ 7 files changed, 702 insertions(+)
drivers/block/ramshared/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# RamShared block driver configuration +# + +config BLK_DEV_RAMSHARED + tristate "RamShared Hardware-Accelerated VRAM Block Device" + depends on BLOCK && PCI && MMU + select BLK_MQ_PCI + help + This driver provides a high-performance block device backed by + discrete GPU video memory (VRAM) via direct PCIe DMA transfers. + + To compile this driver as a module, choose M here: the module + will be called ramshared.
drivers/block/ramshared/Makefile new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for the RamShared in-tree kernel driver. +# + +obj-$(CONFIG_BLK_DEV_RAMSHARED) += ramshared.o + +ramshared-y := main.o dma.o queue.o + +# Standalone build support +KDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +default: + $(MAKE) -C $(KDIR) M=$(PWD) CONFIG_BLK_DEV_RAMSHARED=m modules + +clean: + $(MAKE) -C $(KDIR) M=$(PWD) clean
drivers/block/ramshared/compat.h new file +105 -0
105 lines not on this page · raw message
drivers/block/ramshared/dma.c new file +56 -0
56 lines not on this page · raw message
drivers/block/ramshared/main.c new file +181 -0
181 lines not on this page · raw message
drivers/block/ramshared/queue.c new file +264 -0
264 lines not on this page · raw message
drivers/block/ramshared/ramshared.h new file +63 -0
63 lines not on this page · raw message
RFC PATCH v2 2/2 drivers/block: integrate ramshared driver into build system
In reply to a message not in the archiveConnect drivers/block/ramshared to drivers/block/Kconfig and drivers/block/Makefile under the CONFIG_BLK_DEV_RAMSHARED symbol.
--- drivers/block/Kconfig | 2 ++ drivers/block/Makefile | 1 + 2 files changed, 3 insertions(+)
drivers/block/Kconfig +2 -0
@@ -375,3 +375,5 @@ config BLK_DEV_ZONED_LOOP If unsure, say N. +source "drivers/block/ramshared/Kconfig" + endif # BLK_DEV
drivers/block/Makefile +1 -0
@@ -41,3 +41,4 @@ obj- += zloop.o +obj- += ramshared/ swim_mod-y := swim.o swim_asm.o