Skip to contentSkip to conversation

ARM: aspeed: add support for the BT IPMI host device

PATCH Superseded Cédric Le Goater 4 participants 13 messages Aug 31, 2016 – Sep 15, 2016

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ARM: aspeed: add support for the BT IPMI host device

Hello,

This serie adds support for the BT IPMI host device on Aspeed SoCs ast2400 and ast2500.

Cheers,

C.

Alistair Popple (1):
misc: Add Aspeed BT IPMI host driver

C?dric Le Goater (2):
ARM: aspeed: Add defconfigs for CONFIG_ASPEED_BT_IPMI_HOST
ARM: dts: aspeed: Enable BT IPMI host device

 .../devicetree/bindings/misc/aspeed,bt-host.txt    |  19 +
 arch/arm/boot/dts/aspeed-g4.dtsi                   |   6 +
 arch/arm/boot/dts/aspeed-g5.dtsi                   |   6 +
 arch/arm/configs/aspeed_g4_defconfig               |   1 +
 arch/arm/configs/aspeed_g5_defconfig               |   1 +
 drivers/misc/Kconfig                               |   5 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/bt-host.c                             | 433 +++++++++++++++++++++
 include/uapi/linux/Kbuild                          |   1 +
 include/uapi/linux/bt-host.h                       |  18 +
 10 files changed, 491 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/aspeed,bt-host.txt
 create mode 100644 drivers/misc/bt-host.c
 create mode 100644 include/uapi/linux/bt-host.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

From: Alistair Popple <[email protected]>

This patch adds a simple device driver to expose the iBT interface on Aspeed chips as a character device (/dev/bt).

The iBT interface is used to perform in-band IPMI communication from a BMC to the host.

[clg: checkpatch fixes
devicetree binding documentation]

---
 .../devicetree/bindings/misc/aspeed,bt-host.txt    |  19 +
 drivers/misc/Kconfig                               |   5 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/bt-host.c                             | 433 +++++++++++++++++++++
 include/uapi/linux/Kbuild                          |   1 +
 include/uapi/linux/bt-host.h                       |  18 +
 6 files changed, 477 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/aspeed,bt-host.txt
 create mode 100644 drivers/misc/bt-host.c
 create mode 100644 include/uapi/linux/bt-host.h
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +19 -0
new file mode 100644
index 000000000000..938c5998c331
@@ -0,0 +1,19 @@
+* Aspeed BT IPMI interface
+
+Required properties:
+
+- compatible : should be "aspeed,bt-host"
+- reg: physical address and size of the registers
+
+Optional properties:
+
+- interrupts: interrupt generated by the BT interface. without an
+  interrupt, the driver will operate in poll mode.
+
+Example:
+
+	ibt at 1e789140 {
+		compatible = "aspeed,bt-host";
+		reg = <0x1e789140 0x18>;
+		interrupts = <8>;
+	};
drivers/misc/Kconfig +5 -0
index a216b4667742..47f761861120 100644
@@ -804,6 +804,11 @@ config PANEL_BOOT_MESSAGE
 	  An empty message will only clear the display at driver init time. Any other
 	  printf()-formatted message is valid with newline and escape codes.
 
+config ASPEED_BT_IPMI_HOST
+	tristate "BT IPMI host driver"
+	help
+	  Support for the Aspeed BT IPMI host.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index 7410c6d9a34d..71a7b9feb0f0 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_ASPEED_BT_IPMI_HOST)	+= bt-host.o
 
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_bugs.o
drivers/misc/bt-host.c new file +433 -0

433 lines not on this page · raw message

include/uapi/linux/Kbuild +1 -0
index 185f8ea2702f..c763a35c2147 100644
@@ -74,6 +74,7 @@ header-y += bpf_common.h
 header-y += bpf.h
 header-y += bpqether.h
 header-y += bsg.h
+header-y += bt-host.h
 header-y += btrfs.h
 header-y += can.h
 header-y += capability.h
include/uapi/linux/bt-host.h new file +18 -0
new file mode 100644
index 000000000000..e2aedddf0bf4
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2015-2016, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _UAPI_LINUX_BT_HOST_H
+#define _UAPI_LINUX_BT_HOST_H
+
+#include <linux/ioctl.h>
+
+#define __BT_HOST_IOCTL_MAGIC	0xb1
+#define BT_HOST_IOCTL_SMS_ATN	_IO(__BT_HOST_IOCTL_MAGIC, 0x00)
+
+#endif /* _UAPI_LINUX_BT_HOST_H */
Signature · 1 line
2.7.4
maintainer
#2 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt

Quoted 31 lines · CEST C?dric Le Goater

From: Alistair Popple <[email protected]>

This patch adds a simple device driver to expose the iBT interface on Aspeed chips as a character device (/dev/bt).

The iBT interface is used to perform in-band IPMI communication from a BMC to the host.

[clg: checkpatch fixes
devicetree binding documentation]

---
 .../devicetree/bindings/misc/aspeed,bt-host.txt    |  19 +
 drivers/misc/Kconfig                               |   5 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/bt-host.c                             | 433 +++++++++++++++++++++
 include/uapi/linux/Kbuild                          |   1 +
 include/uapi/linux/bt-host.h                       |  18 +
 6 files changed, 477 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/aspeed,bt-host.txt
 create mode 100644 drivers/misc/bt-host.c
 create mode 100644 include/uapi/linux/bt-host.h
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +0 -0
new file mode 100644
index 000000000000..938c5998c331

"misc" seems like a bad category here. Does this fit nowhere else?

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt line 1

Quoted 2 lines
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +1 -0
@@ -0,0 +1,19 @@
+* Aspeed BT IPMI interface

What does "BT" stand for? IPMI is a more commonly known acronym, but maybe list both with their full name as well.

drivers/misc/Makefile obj-$(CONFIG_ECHO) += echo/ · line 63

Quoted 12 lines
drivers/misc/Makefile +1 -0
index 7410c6d9a34d..71a7b9feb0f0 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_ASPEED_BT_IPMI_HOST)	+= bt-host.o
 
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_bugs.o

Maybe put this in a subdirectory of drivers/char/ipmi? I understand that this is the other end of the protocol, but they are closely related after all.

Quoted 1 line

+#define DEVICE_NAME "bt-host"

here maybe "ipmi/bt-host" or "ipmi-bt-host"?

Quoted 22 lines
drivers/misc/Makefile +22 -0
+static ssize_t bt_host_read(struct file *file, char __user *buf,
+				size_t count, loff_t *ppos)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+	char __user *p = buf;
+	u8 len;
+
+	if (!access_ok(VERIFY_WRITE, buf, count))
+		return -EFAULT;
+
+	WARN_ON(*ppos);
+
+	if (wait_event_interruptible(bt_host->queue,
+				bt_inb(bt_host, BT_CTRL) & BT_CTRL_H2B_ATN))
+		return -ERESTARTSYS;
+
+	set_b_busy(bt_host);
+	clr_h2b_atn(bt_host);
+	clr_rd_ptr(bt_host);
+
+	len = bt_read(bt_host);
+	__put_user(len, p++);

drivers/misc/Makefile

Quoted 10 lines
drivers/misc/Makefile +10 -0
+
+	/* We pass the length back as well */
+	if (len + 1 > count)
+		len = count - 1;
+
+	while (len) {
+		if (__put_user(bt_read(bt_host), p))
+			return -EFAULT;
+		len--; p++;
+	}

If there are larger chunks of data to be transferred, using a temporary buffer with copy_from_user/copy_to_user would be more efficient. Since the size appears to be limited to 256 bytes anyway, that easily fits on the stack.

drivers/misc/Makefile

Quoted 5 lines
drivers/misc/Makefile +5 -0
+
+	clr_b_busy(bt_host);
+
+	return p - buf;
+}

What is the motivation for only allowing complete messages to be transferred or truncated for short buffers?

Have you considered reading the message into a device specific buffer and allowing continued reads?

I don't see an obvious reason one way or another, and I suppose you had an idea of what you were doing, so maybe explain it in a comment.

drivers/misc/Makefile

Quoted 12 lines
drivers/misc/Makefile +12 -0
+static long bt_host_ioctl(struct file *file, unsigned int cmd,
+		unsigned long param)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+
+	switch (cmd) {
+	case BT_HOST_IOCTL_SMS_ATN:
+		set_sms_atn(bt_host);
+		return 0;
+	}
+	return -EINVAL;
+}

Is this ioctl interface defined in a way that makes sense on any IPMI host hardware, or did you just do it like this because it is the easiest way on the hardware. I think it's important for the user interface to be extensible to other implementations if we ever add any.

drivers/misc/Makefile

Quoted 10 lines
drivers/misc/Makefile +10 -0
+static int bt_host_config_irq(struct bt_host *bt_host,
+		struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	uint32_t reg;
+	int rc;
+
+	bt_host->irq = irq_of_parse_and_map(dev->of_node, 0);
+	if (!bt_host->irq)
+		return -ENODEV;

I think platform_get_irq() is the preferred interface here.

Arnd

#3 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Arnd is suggesting to put this IPMI BT driver under drivers/char/ipmi which is indeed a better place than drivers/misc.

Below some comments,

Quoted 35 lines · Arnd Bergmann

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt

Quoted 31 lines · CEST C?dric Le Goater

From: Alistair Popple <[email protected]>

This patch adds a simple device driver to expose the iBT interface on Aspeed chips as a character device (/dev/bt).

The iBT interface is used to perform in-band IPMI communication from a BMC to the host.

[clg: checkpatch fixes
devicetree binding documentation]

---
 .../devicetree/bindings/misc/aspeed,bt-host.txt    |  19 +
 drivers/misc/Kconfig                               |   5 +
 drivers/misc/Makefile                              |   1 +
 drivers/misc/bt-host.c                             | 433 +++++++++++++++++++++
 include/uapi/linux/Kbuild                          |   1 +
 include/uapi/linux/bt-host.h                       |  18 +
 6 files changed, 477 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/aspeed,bt-host.txt
 create mode 100644 drivers/misc/bt-host.c
 create mode 100644 include/uapi/linux/bt-host.h
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +0 -0
new file mode 100644
index 000000000000..938c5998c331

"misc" seems like a bad category here. Does this fit nowhere else?

Quoted 5 lines

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt line 1

Quoted 2 lines
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +1 -0
@@ -0,0 +1,19 @@
+* Aspeed BT IPMI interface

What does "BT" stand for? IPMI is a more commonly known acronym, but maybe list both with their full name as well.

"Block Transfer" which is described in the IPMI specs.

yes, I need to rephrase the commit log a bit and put some references to the specs.

Quoted 11 lines
Quoted 11 lines
drivers/misc/Makefile +1 -0
index 7410c6d9a34d..71a7b9feb0f0 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_ASPEED_BT_IPMI_HOST)	+= bt-host.o
 
Quoted 6 lines

drivers/misc/Makefile obj-$(CONFIG_ECHO) += echo/ · line 63

Quoted 2 lines
drivers/misc/Makefile +0 -0
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_bugs.o

Maybe put this in a subdirectory of drivers/char/ipmi? I understand that this is the other end of the protocol, but they are closely related after all.

I agree. There are also some definitions we could make common.

Let's see what Corey thinks about it.

Quoted 3 lines
Quoted 1 line

+#define DEVICE_NAME "bt-host"

here maybe "ipmi/bt-host" or "ipmi-bt-host"?

yes. a name containing 'ipmi' is certainly wanted.

Quoted 29 lines
Quoted 29 lines
drivers/misc/Makefile +29 -0
+static ssize_t bt_host_read(struct file *file, char __user *buf,
+				size_t count, loff_t *ppos)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+	char __user *p = buf;
+	u8 len;
+
+	if (!access_ok(VERIFY_WRITE, buf, count))
+		return -EFAULT;
+
+	WARN_ON(*ppos);
+
+	if (wait_event_interruptible(bt_host->queue,
+				bt_inb(bt_host, BT_CTRL) & BT_CTRL_H2B_ATN))
+		return -ERESTARTSYS;
+
+	set_b_busy(bt_host);
+	clr_h2b_atn(bt_host);
+	clr_rd_ptr(bt_host);
+
+	len = bt_read(bt_host);
+	__put_user(len, p++);
+
+	/* We pass the length back as well */
+	if (len + 1 > count)
+		len = count - 1;
+
+	while (len) {
+		if (__put_user(bt_read(bt_host), p))
Quoted 8 lines

drivers/misc/Makefile

Quoted 3 lines
drivers/misc/Makefile +3 -0
+			return -EFAULT;
+		len--; p++;
+	}

If there are larger chunks of data to be transferred, using a temporary buffer with copy_from_user/copy_to_user would be more efficient. Since the size appears to be limited to 256 bytes anyway, that easily fits on the stack.

ok. I will change that.

Quoted 9 lines

drivers/misc/Makefile

Quoted 5 lines
drivers/misc/Makefile +5 -0
+
+	clr_b_busy(bt_host);
+
+	return p - buf;
+}

What is the motivation for only allowing complete messages to be transferred or truncated for short buffers?

Quoted 6 lines

Have you considered reading the message into a device specific buffer and allowing continued reads?

I don't see an obvious reason one way or another, and I suppose you had an idea of what you were doing, so maybe explain it in a comment.

The interface is not byte oriented. It is called 'Block Transfer' because an entire message is buffered and then the host or the bmc is notified that there is data to be read.

I will add a comment on that.

Quoted 8 lines
Quoted 8 lines
drivers/misc/Makefile +8 -0
+static long bt_host_ioctl(struct file *file, unsigned int cmd,
+		unsigned long param)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+
+	switch (cmd) {
+	case BT_HOST_IOCTL_SMS_ATN:
+		set_sms_atn(bt_host);
Quoted 8 lines

drivers/misc/Makefile

Quoted 4 lines
drivers/misc/Makefile +4 -0
+		return 0;
+	}
+	return -EINVAL;
+}

Is this ioctl interface defined in a way that makes sense on any IPMI host hardware, or did you just do it like this because it is the easiest way on the hardware.

This platform runs OpenBMC on which a dbus daemon acts as a proxy between the IPMI BT char device and the rest of the system. So yes, the ioctl is relatively easy to use.

Quoted 2 lines

I think it's important for the user interface to be extensible to other implementations if we ever add any.

I agree but I don't know of any other BMC side implementations. May be others ?

Quoted 4 lines
Quoted 4 lines
drivers/misc/Makefile +4 -0
+static int bt_host_config_irq(struct bt_host *bt_host,
+		struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
Quoted 8 lines

drivers/misc/Makefile

Quoted 6 lines
drivers/misc/Makefile +6 -0
+	uint32_t reg;
+	int rc;
+
+	bt_host->irq = irq_of_parse_and_map(dev->of_node, 0);
+	if (!bt_host->irq)
+		return -ENODEV;

I think platform_get_irq() is the preferred interface here.

OK.

Thanks,

C.

#4 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

-corey

Quoted 177 lines

Arnd is suggesting to put this IPMI BT driver under drivers/char/ipmi which is indeed a better place than drivers/misc.

Below some comments,

Quoted 34 lines · Arnd Bergmann

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt

Quoted 31 lines · CEST C?dric Le Goater

From: Alistair Popple <[email protected]>

This patch adds a simple device driver to expose the iBT interface on Aspeed chips as a character device (/dev/bt).

The iBT interface is used to perform in-band IPMI communication from a BMC to the host.

[clg: checkpatch fixes
devicetree binding documentation]

---
  .../devicetree/bindings/misc/aspeed,bt-host.txt    |  19 +
  drivers/misc/Kconfig                               |   5 +
  drivers/misc/Makefile                              |   1 +
  drivers/misc/bt-host.c                             | 433 +++++++++++++++++++++
  include/uapi/linux/Kbuild                          |   1 +
  include/uapi/linux/bt-host.h                       |  18 +
  6 files changed, 477 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/aspeed,bt-host.txt create mode 100644 drivers/misc/bt-host.c
create mode 100644 include/uapi/linux/bt-host.h

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +0 -0
new file mode 100644
index 000000000000..938c5998c331

"misc" seems like a bad category here. Does this fit nowhere else?

Quoted 4 lines

Documentation/devicetree/bindings/misc/aspeed,bt-host.txt line 1

Quoted 2 lines
Documentation/devicetree/bindings/misc/aspeed,bt-host.txt new file +1 -0
@@ -0,0 +1,19 @@
+* Aspeed BT IPMI interface

What does "BT" stand for? IPMI is a more commonly known acronym, but maybe list both with their full name as well.

"Block Transfer" which is described in the IPMI specs.

yes, I need to rephrase the commit log a bit and put some references to the specs.

Quoted 10 lines
Quoted 10 lines
drivers/misc/Makefile +1 -0
index 7410c6d9a34d..71a7b9feb0f0 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_ECHO)		+= echo/
  obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
  obj-$(CONFIG_CXL_BASE)		+= cxl/
  obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_ASPEED_BT_IPMI_HOST)	+= bt-host.o
 
Quoted 5 lines

drivers/misc/Makefile obj-$(CONFIG_ECHO) += echo/ · line 63

Quoted 2 lines
drivers/misc/Makefile +0 -0
  lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
  lkdtm-$(CONFIG_LKDTM)		+= lkdtm_bugs.o

Maybe put this in a subdirectory of drivers/char/ipmi? I understand that this is the other end of the protocol, but they are closely related after all.

I agree. There are also some definitions we could make common.

Let's see what Corey thinks about it.

Quoted 2 lines
Quoted 1 line

+#define DEVICE_NAME "bt-host"

here maybe "ipmi/bt-host" or "ipmi-bt-host"?

yes. a name containing 'ipmi' is certainly wanted.

Quoted 28 lines
Quoted 28 lines
drivers/misc/Makefile +28 -0
+static ssize_t bt_host_read(struct file *file, char __user *buf,
+				size_t count, loff_t *ppos)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+	char __user *p = buf;
+	u8 len;
+
+	if (!access_ok(VERIFY_WRITE, buf, count))
+		return -EFAULT;
+
+	WARN_ON(*ppos);
+
+	if (wait_event_interruptible(bt_host->queue,
+				bt_inb(bt_host, BT_CTRL) & BT_CTRL_H2B_ATN))
+		return -ERESTARTSYS;
+
+	set_b_busy(bt_host);
+	clr_h2b_atn(bt_host);
+	clr_rd_ptr(bt_host);
+
+	len = bt_read(bt_host);
+	__put_user(len, p++);
+
+	/* We pass the length back as well */
+	if (len + 1 > count)
+		len = count - 1;
+
+	while (len) {
Quoted 8 lines

drivers/misc/Makefile

Quoted 4 lines
drivers/misc/Makefile +4 -0
+		if (__put_user(bt_read(bt_host), p))
+			return -EFAULT;
+		len--; p++;
+	}

If there are larger chunks of data to be transferred, using a temporary buffer with copy_from_user/copy_to_user would be more efficient. Since the size appears to be limited to 256 bytes anyway, that easily fits on the stack.

ok. I will change that.

Quoted 8 lines

drivers/misc/Makefile

Quoted 5 lines
drivers/misc/Makefile +5 -0
+
+	clr_b_busy(bt_host);
+
+	return p - buf;
+}

What is the motivation for only allowing complete messages to be transferred or truncated for short buffers?

Quoted 6 lines

Have you considered reading the message into a device specific buffer and allowing continued reads?

I don't see an obvious reason one way or another, and I suppose you had an idea of what you were doing, so maybe explain it in a comment.

The interface is not byte oriented. It is called 'Block Transfer' because an entire message is buffered and then the host or the bmc is notified that there is data to be read.

I will add a comment on that.

Quoted 7 lines
Quoted 7 lines
drivers/misc/Makefile +7 -0
+static long bt_host_ioctl(struct file *file, unsigned int cmd,
+		unsigned long param)
+{
+	struct bt_host *bt_host = file_bt_host(file);
+
+	switch (cmd) {
+	case BT_HOST_IOCTL_SMS_ATN:
Quoted 8 lines

drivers/misc/Makefile

Quoted 5 lines
drivers/misc/Makefile +5 -0
+		set_sms_atn(bt_host);
+		return 0;
+	}
+	return -EINVAL;
+}

Is this ioctl interface defined in a way that makes sense on any IPMI host hardware, or did you just do it like this because it is the easiest way on the hardware.

This platform runs OpenBMC on which a dbus daemon acts as a proxy between the IPMI BT char device and the rest of the system. So yes, the ioctl is relatively easy to use.

Quoted 2 lines

I think it's important for the user interface to be extensible to other implementations if we ever add any.

I agree but I don't know of any other BMC side implementations. May be others ?

Quoted 11 lines

drivers/misc/Makefile

Quoted 10 lines
drivers/misc/Makefile +10 -0
+static int bt_host_config_irq(struct bt_host *bt_host,
+		struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	uint32_t reg;
+	int rc;
+
+	bt_host->irq = irq_of_parse_and_map(dev->of_node, 0);
+	if (!bt_host->irq)
+		return -ENODEV;

I think platform_get_irq() is the preferred interface here.

OK.

Thanks,

C.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#5 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Quoted 10 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

#6 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

Quoted 6 lines
Quoted 2 lines

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

Ok, that's not really clear from the documentation or the Kconfig. In the IPMI spec the "host" side is the computer side, not the BMC side. Like:

11.6.1 BT Host Interface Registers
The Host BT interface provides an independent set of registers and interrupts to allow the Host driver to
communicate with the baseboard management controller without conflicting with the O/S ACPI driver.

In light of that, this should probably be named the bt-bmc driver.

I haven't reviewed this in detail, but I'm ok with putting it in drivers/char/ipmi. The state machine part looks reasonably generic. The configuration part isn't, but that could be split out later if necessary.

The biggest thing I don't like is the byte at a time interfaces from userspace. That seems fairly inefficient if the system does extra work for each userspace access. IIRC some systems do and some don't.

-corey

Quoted 5 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Hello,

Quoted 33 lines · Corey Minyard
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

Quoted 6 lines
Quoted 2 lines

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

Ok, that's not really clear from the documentation or the Kconfig. In the IPMI spec the "host" side is the computer side, not the BMC side. Like:

11.6.1 BT Host Interface Registers
The Host BT interface provides an independent set of registers and interrupts to allow the Host driver to
communicate with the baseboard management controller without conflicting with the O/S ACPI driver.

In light of that, this should probably be named the bt-bmc driver.

I haven't reviewed this in detail, but I'm ok with putting it in drivers/char/ipmi. The state machine part looks reasonably generic. The configuration part isn't, but that could be split out later if necessary.

Quoted 4 lines

The biggest thing I don't like is the byte at a time interfaces from userspace. That seems fairly inefficient if the system does extra work for each userspace access. IIRC some systems do and some don't.

What about the ioctl to send an SMS ATN event to the host ? Is that ok for you ?

Thanks,

C.

#8 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Quoted 35 lines · C?dric Le Goater

Hello,

Quoted 32 lines · Corey Minyard
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

Quoted 6 lines
Quoted 2 lines

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

Ok, that's not really clear from the documentation or the Kconfig. In the IPMI spec the "host" side is the computer side, not the BMC side. Like:

11.6.1 BT Host Interface Registers
The Host BT interface provides an independent set of registers and interrupts to allow the Host driver to
communicate with the baseboard management controller without conflicting with the O/S ACPI driver.

In light of that, this should probably be named the bt-bmc driver.

I haven't reviewed this in detail, but I'm ok with putting it in drivers/char/ipmi. The state machine part looks reasonably generic. The configuration part isn't, but that could be split out later if necessary.

Quoted 6 lines
Quoted 4 lines

The biggest thing I don't like is the byte at a time interfaces from userspace. That seems fairly inefficient if the system does extra work for each userspace access. IIRC some systems do and some don't.

What about the ioctl to send an SMS ATN event to the host ? Is that ok for you ?

Yeah, that's necessary, there's no way the low-level driver can know when to do that.

I have a similar piece of code in the qemu IPMI emulator, even the external IPMI emulator has a message it sends to set ATTN.

I did look at similarities between the two pieces of code, but the qemu one has to be register-read/write driven, so it's completely different in design.

-corey

Quoted 3 lines

Thanks,

C.

#9 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

In reply to Corey Minyard
Quoted 26 lines · Corey Minyard
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

Quoted 6 lines
Quoted 2 lines

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

Ok, that's not really clear from the documentation or the Kconfig. In the IPMI spec the "host" side is the computer side, not the BMC side. Like:

11.6.1 BT Host Interface Registers
The Host BT interface provides an independent set of registers and interrupts to allow the Host driver to
communicate with the baseboard management controller without conflicting with the O/S ACPI driver.

Quoted 6 lines

In light of that, this should probably be named the bt-bmc driver.

I haven't reviewed this in detail, but I'm ok with putting it in drivers/char/ipmi. The state machine part looks reasonably generic. The configuration part isn't, but that could be split out later if necessary.

what do you mean by configuration ? I am ready to send a v2. May be I can add a few other things.

Thanks,

C.

#10 lore raw

PATCH 1/3 misc: Add Aspeed BT IPMI host driver

Quoted 26 lines · C?dric Le Goater
Quoted 25 lines · Corey Minyard
Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · CEST Corey Minyard
Quoted 3 lines · C?dric Le Goater

Hello,

Adding Corey in cc: . I guess I should have done that in the first place.

Yes, probably so. I've been travelling and didn't see it on the mailing lists until now.

Quoted 6 lines
Quoted 2 lines

There is already a BT driver in the kernel, in drivers/char/ipmi, why won't that work?

The new driver is the host side (running on the BMC), the existing one is the client (running on the PC).

Arnd

Ok, that's not really clear from the documentation or the Kconfig. In the IPMI spec the "host" side is the computer side, not the BMC side. Like:

11.6.1 BT Host Interface Registers
The Host BT interface provides an independent set of registers and interrupts to allow the Host driver to
communicate with the baseboard management controller without conflicting with the O/S ACPI driver.

Quoted 8 lines
Quoted 6 lines

In light of that, this should probably be named the bt-bmc driver.

I haven't reviewed this in detail, but I'm ok with putting it in drivers/char/ipmi. The state machine part looks reasonably generic. The configuration part isn't, but that could be split out later if necessary.

what do you mean by configuration ? I am ready to send a v2. May be I can add a few other things.

The part that sets everything up, basically everything from bt_host_fops down.

If you were to use this on another system, that code would have to be made more generic and the machine-specific part split into different files, but that's not necessary now, I don't think.

-corey

Quoted 3 lines

Thanks,

C.

#11 lore raw

PATCH 2/3 ARM: aspeed: Add defconfigs for CONFIG_ASPEED_BT_IPMI_HOST

In reply to Cédric Le Goater
---
 arch/arm/configs/aspeed_g4_defconfig | 1 +
 arch/arm/configs/aspeed_g5_defconfig | 1 +
 2 files changed, 2 insertions(+)
arch/arm/configs/aspeed_g4_defconfig +1 -0
index ca39c04fec6b..7f39d64357fa 100644
@@ -40,6 +40,7 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_ASPEED_BT_IPMI_HOST=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
arch/arm/configs/aspeed_g5_defconfig +1 -0
index 4f366b0370e9..53d74afd05ea 100644
@@ -41,6 +41,7 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
+CONFIG_ASPEED_BT_IPMI_HOST=y
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
Signature · 1 line
2.7.4
#12 lore raw

PATCH 3/3 ARM: dts: aspeed: Enable BT IPMI host device

In reply to Cédric Le Goater
---
 arch/arm/boot/dts/aspeed-g4.dtsi | 6 ++++++
 arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++++++
 2 files changed, 12 insertions(+)
arch/arm/boot/dts/aspeed-g4.dtsi +6 -0
index 22dee5937d5c..1cf57a2b08d3 100644
@@ -82,6 +82,12 @@
 				clocks = <&clk_apb>;
 			};
 
+			ibt: ibt at 1e789140 {
+				compatible = "aspeed,bt-host";
+				reg = <0x1e789140 0x18>;
+				interrupts = <8>;
+			};
+
 			wdt1: wdt at 1e785000 {
 				compatible = "aspeed,wdt";
 				reg = <0x1e785000 0x1c>;
arch/arm/boot/dts/aspeed-g5.dtsi +6 -0
index dd94d9361fda..9f29c409d606 100644
@@ -86,6 +86,12 @@
 				clocks = <&clk_apb>;
 			};
 
+			ibt: ibt at 1e789140 {
+				compatible = "aspeed,bt-host";
+				reg = <0x1e789140 0x18>;
+				interrupts = <8>;
+			};
+
 			wdt1: wdt at 1e785000 {
 				compatible = "aspeed,wdt";
 				reg = <0x1e785000 0x1c>;
Signature · 1 line
2.7.4