Commit 42bed52b authored by Iwona Winiarska's avatar Iwona Winiarska Committed by Greg Kroah-Hartman
Browse files

peci: Add sysfs interface for PECI bus



PECI devices may not be discoverable at the time when PECI controller is
being added (e.g. BMC can boot up when the Host system is still in S5).
Since we currently don't have the capabilities to figure out the Host
system state inside the PECI subsystem itself, we have to rely on
userspace to do it for us.

In the future, PECI subsystem may be expanded with mechanisms that allow
us to avoid depending on userspace interaction (e.g. CPU presence could
be detected using GPIO, and the information on whether it's discoverable
could be obtained over IPMI).
Unfortunately, those methods may ultimately not be available (support
will vary from platform to platform), which means that we still need
platform independent method triggered by userspace.

Acked-by: default avatarJoel Stanley <joel@jms.id.au>
Signed-off-by: default avatarIwona Winiarska <iwona.winiarska@intel.com>
Link: https://lore.kernel.org/r/20220208153639.255278-8-iwona.winiarska@intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 52857e68
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
What:		/sys/bus/peci/rescan
Date:		July 2021
KernelVersion:	5.18
Contact:	Iwona Winiarska <iwona.winiarska@intel.com>
Description:
		Writing a non-zero value to this attribute will
		initiate scan for PECI devices on all PECI controllers
		in the system.

What:		/sys/bus/peci/devices/<controller_id>-<device_addr>/remove
Date:		July 2021
KernelVersion:	5.18
Contact:	Iwona Winiarska <iwona.winiarska@intel.com>
Description:
		Writing a non-zero value to this attribute will
		remove the PECI device and any of its children.
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

# Core functionality
peci-y := core.o request.o device.o
peci-y := core.o request.o device.o sysfs.o
obj-$(CONFIG_PECI) += peci.o

# Hardware specific bus drivers
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ struct device_type peci_controller_type = {
	.release	= peci_controller_dev_release,
};

static int peci_controller_scan_devices(struct peci_controller *controller)
int peci_controller_scan_devices(struct peci_controller *controller)
{
	int ret;
	u8 addr;
@@ -162,6 +162,7 @@ EXPORT_SYMBOL_NS_GPL(devm_peci_controller_add, PECI);

struct bus_type peci_bus_type = {
	.name		= "peci",
	.bus_groups	= peci_bus_groups,
};

static int __init peci_init(void)
+1 −0
Original line number Diff line number Diff line
@@ -116,5 +116,6 @@ static void peci_device_release(struct device *dev)
}

struct device_type peci_device_type = {
	.groups		= peci_device_groups,
	.release	= peci_device_release,
};
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/types.h>

struct peci_controller;
struct attribute_group;
struct peci_device;
struct peci_request;

@@ -19,12 +20,16 @@ struct peci_request *peci_request_alloc(struct peci_device *device, u8 tx_len, u
void peci_request_free(struct peci_request *req);

extern struct device_type peci_device_type;
extern const struct attribute_group *peci_device_groups[];

int peci_device_create(struct peci_controller *controller, u8 addr);
void peci_device_destroy(struct peci_device *device);

extern struct bus_type peci_bus_type;
extern const struct attribute_group *peci_bus_groups[];

extern struct device_type peci_controller_type;

int peci_controller_scan_devices(struct peci_controller *controller);

#endif /* __PECI_INTERNAL_H */
Loading