summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIwona Winiarska <iwona.winiarska@intel.com>2022-06-06 22:48:21 +0300
committerIwona Winiarska <iwona.winiarska@intel.com>2022-06-09 20:57:41 +0300
commit51062a295e5ab5e8cf485dc78301ef2bdff6f8a6 (patch)
treeeeead9bc8c2a560bcf3e21efffa8a56b736f18d5 /drivers
parent01b3a074fe4b9e5861cf0e8ed2be8d703bda3cc0 (diff)
downloadlinux-51062a295e5ab5e8cf485dc78301ef2bdff6f8a6.tar.xz
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 <iwona.winiarska@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/aspeed/aspeed-mctp.c18
1 files changed, 18 insertions, 0 deletions
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;