Commit 2e4986cf authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

fwctl: Add basic structure for a class subsystem with a cdev

Create the class, character device and functions for a fwctl driver to
un/register to the subsystem.

A typical fwctl driver has a sysfs presence like:

$ ls -l /dev/fwctl/fwctl0
crw------- 1 root root 250, 0 Apr 25 19:16 /dev/fwctl/fwctl0

$ ls /sys/class/fwctl/fwctl0
dev  device  power  subsystem  uevent

$ ls /sys/class/fwctl/fwctl0/device/infiniband/
ibp0s10f0

$ ls /sys/class/infiniband/ibp0s10f0/device/fwctl/
fwctl0/

$ ls /sys/devices/pci0000:00/0000:00:0a.0/fwctl/fwctl0
dev  device  power  subsystem  uevent

Which allows userspace to link all the multi-subsystem driver components
together and learn the subsystem specific names for the device's
components.

Link: https://patch.msgid.link/r/1-v5-642aa0c94070+4447f-fwctl_jgg@nvidia.com


Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Reviewed-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Tested-by: default avatarDave Jiang <dave.jiang@intel.com>
Tested-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 2014c95a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -9557,6 +9557,15 @@ F: kernel/futex/*
F:	tools/perf/bench/futex*
F:	tools/testing/selftests/futex/
FWCTL SUBSYSTEM
M:	Dave Jiang <dave.jiang@intel.com>
M:	Jason Gunthorpe <jgg@nvidia.com>
M:	Saeed Mahameed <saeedm@nvidia.com>
R:	Jonathan Cameron <Jonathan.Cameron@huawei.com>
S:	Maintained
F:	drivers/fwctl/
F:	include/linux/fwctl.h
GALAXYCORE GC0308 CAMERA SENSOR DRIVER
M:	Sebastian Reichel <sre@kernel.org>
L:	linux-media@vger.kernel.org
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ source "drivers/connector/Kconfig"

source "drivers/firmware/Kconfig"

source "drivers/fwctl/Kconfig"

source "drivers/gnss/Kconfig"

source "drivers/mtd/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ obj-y += ufs/
obj-$(CONFIG_MEMSTICK)		+= memstick/
obj-$(CONFIG_INFINIBAND)	+= infiniband/
obj-y				+= firmware/
obj-$(CONFIG_FWCTL)		+= fwctl/
obj-$(CONFIG_CRYPTO)		+= crypto/
obj-$(CONFIG_SUPERH)		+= sh/
obj-y				+= clocksource/

drivers/fwctl/Kconfig

0 → 100644
+9 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
menuconfig FWCTL
	tristate "fwctl device firmware access framework"
	help
	  fwctl provides a userspace API for restricted access to communicate
	  with on-device firmware. The communication channel is intended to
	  support a wide range of lockdown compatible device behaviors including
	  manipulating device FLASH, debugging, and other activities that don't
	  fit neatly into an existing subsystem.

drivers/fwctl/Makefile

0 → 100644
+4 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_FWCTL) += fwctl.o

fwctl-y += main.o
Loading