From 51062a295e5ab5e8cf485dc78301ef2bdff6f8a6 Mon Sep 17 00:00:00 2001 From: Iwona Winiarska Date: Mon, 6 Jun 2022 21:48:21 +0200 Subject: soc: aspeed: mctp: Add IOCTL to set own EID The driver doesn't implement MCTP logic, which means that it requires its clients to prepare valid MCTP over PCIe packets. Because we support MCTP stacks in both kernel and userspace, and since MCTP protocol is a part of userspace, we need userspace to update own EID information in kernel to provide it for in-kernel aspeed-mctp clients. Previously, own EID information was updated by userspace using SET_EID_INFO which now is deprecated and replaced by SET_EID_EXT_INFO to pass CPU EID and Domain ID mappings. To provide own EID information for in-kernel clients, add a dedicated IOCTL. Signed-off-by: Iwona Winiarska --- drivers/soc/aspeed/aspeed-mctp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'drivers') diff --git a/drivers/soc/aspeed/aspeed-mctp.c b/drivers/soc/aspeed/aspeed-mctp.c index 5073f0e14dc3..befee29501b3 100644 --- a/drivers/soc/aspeed/aspeed-mctp.c +++ b/drivers/soc/aspeed/aspeed-mctp.c @@ -1297,6 +1297,20 @@ out: return ret; } +static int aspeed_mctp_set_own_eid(struct aspeed_mctp *priv, void __user *userbuf) +{ + struct aspeed_mctp_set_own_eid data; + + if (copy_from_user(&data, userbuf, sizeof(data))) { + dev_err(priv->dev, "copy from user failed\n"); + return -EFAULT; + } + + priv->eid = data.eid; + + return 0; +} + static long aspeed_mctp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { @@ -1350,6 +1364,10 @@ aspeed_mctp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = aspeed_mctp_set_eid_info(priv, userbuf, ASPEED_MCTP_EXTENDED_ADDR_FORMAT); break; + case ASPEED_MCTP_IOCTL_SET_OWN_EID: + ret = aspeed_mctp_set_own_eid(priv, userbuf); + break; + default: dev_err(priv->dev, "Command not found\n"); ret = -ENOTTY; -- cgit v1.2.3