cxl: Export optional AFU configuration record in sysfs
authorIan Munsie <imunsie@au1.ibm.com>
Wed, 4 Feb 2015 08:09:01 +0000 (19:09 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 6 Feb 2015 00:16:56 +0000 (11:16 +1100)
commitb087e6190ddcd9ae4e8ff2c788d2b32f193e946b
treef62802d81710bb9a4c9c8b15ceb5fe4498828383
parentc2c896bee08e1461fc24f9bf7dd57e2c63f6db70
cxl: Export optional AFU configuration record in sysfs

An AFU may optionally contain one or more PCIe like configuration
records, which can be used to identify the AFU.

This patch adds support for exposing the raw config space and the
vendor, device and class code under sysfs. These will appear in a
subdirectory of the AFU device corresponding with the configuration
record number, e.g.

cat /sys/class/cxl/afu0.0/cr0/vendor
0x1014

cat /sys/class/cxl/afu0.0/cr0/device
0x4350

cat /sys/class/cxl/afu0.0/cr0/class
0x120000

hexdump -C /sys/class/cxl/afu0.0/cr0/config
00000000  14 10 50 43 00 00 00 00  06 00 00 12 00 00 00 00  |..PC............|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100

These files behave in much the same way as the equivalent files for PCI
devices, with one exception being that the config file is currently
read-only and restricted to the root user. It is not necessarily
required to be this strict, but we currently do not have a compelling
use-case to make it writable and/or world-readable, so I erred on the
side of being restrictive.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Documentation/ABI/testing/sysfs-class-cxl
drivers/misc/cxl/cxl.h
drivers/misc/cxl/pci.c
drivers/misc/cxl/sysfs.c
This page took 0.025936 seconds and 5 git commands to generate.