[PATCH v2] net/ncsi: Use real net-device for response handler
When aggregating ncsi interfaces and dedicated interfaces to bond interfaces, the ncsi response handler will use the wrong net device to find ncsi_dev, so that the ncsi interface will not work properly. Here, we use the original net device to fix it. Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler") Signed-off-by: John Wang --- v2: Use orig_dev instead of pt->dev --- net/ncsi/ncsi-rsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index a94bb59793f0..e1c6bb4ab98f 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c @@ -1120,7 +1120,7 @@ int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev, int payload, i, ret; /* Find the NCSI device */ - nd = ncsi_find_dev(dev); + nd = ncsi_find_dev(orig_dev); ndp = nd ? TO_NCSI_DEV_PRIV(nd) : NULL; if (!ndp) return -ENODEV; -- 2.25.1
Re: [External] Re: [PATCH] net/ncsi: Use real net-device for response handler
On Wed, Dec 23, 2020 at 10:25 AM Jakub Kicinski wrote: > > On Tue, 22 Dec 2020 10:38:21 -0800 Samuel Mendoza-Jonas wrote: > > On Tue, 2020-12-22 at 06:13 +, Joel Stanley wrote: > > > On Sun, 20 Dec 2020 at 12:40, John Wang wrote: > > > > When aggregating ncsi interfaces and dedicated interfaces to bond > > > > interfaces, the ncsi response handler will use the wrong net device > > > > to > > > > find ncsi_dev, so that the ncsi interface will not work properly. > > > > Here, we use the net device registered to packet_type to fix it. > > > > > > > > Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler") > > > > Signed-off-by: John Wang > > This sounds like exactly the case for which orig_dev was introduced. > I think you should use the orig_dev argument, rather than pt->dev. will send a v2 > > Can you test if that works? Yes, it works. > > > > Can you show me how to reproduce this? On g220a, eth1 is the dedicated interface, eth0 is the ncsi interface kernel cfg: CONFIG_BONDING=y cat /etc/systemd/network/00-bmc-bond1.netdev [NetDev] Name=bond1 Description=Bond eth0 and eth1 Kind=bond [Bond] Mode=active-backup cat /etc/systemd/network/00-bmc-eth0.network [Match] Name=eth0 [Network] Bond=bond1 cat /etc/systemd/network/00-bmc-eth0.network [Match] Name=eth1 [Network] Bond=bond1 PrimarySlave=true ip addr 6: bond1: mtu 1500 qdisc noqueue qlen 1000 link/ether b4:05:5d:8f:6a:ad brd ff:ff:ff:ff:ff:ff inet 169.254.11.178/16 brd 169.254.255.255 scope link bond1 valid_lft forever preferred_lft forever inet 192.168.1.108/24 brd 192.168.1.255 scope global bond1 valid_lft forever preferred_lft forever inet 10.2.16.118/24 brd 10.2.16.255 scope global bond1 valid_lft forever preferred_lft forever inet6 fe80::b605:5dff:fe8f:6aad/64 scope link ... Without this patch: After bmc boots: echo eth0 > /sys/class/net/bond1/bonding/active_slave admin@g220a:~# admin@g220a:~# echo eth0 > /sys/class/net/bond1/bonding/active_slave [ 105.964357] bond1: (slave eth0): making interface the new active one admin@g220a:~# ping 10.2.16.1 PING 10.2.16.1 (10.2.16.1): 56 data bytes 64 bytes from 10.2.16.1: seq=0 ttl=255 time=7.096 ms 64 bytes from 10.2.16.1: seq=1 ttl=255 time=2.143 ms 64 bytes from 10.2.16.1: seq=2 ttl=255 time=2.111 ms [ 112.642734] ftgmac100 1e66.ethernet eth0: NCSI Channel 0 timed out! 64 bytes from 10.2.16.1: seq=3 ttl=255 time=2.039 ms 64 bytes from 10.2.16.1: seq=4 ttl=255 time=2.037 ms [ 117.842814] ftgmac100 1e66.ethernet eth0: NCSI: No channel with link found, configuring channel 0 [ 134.482746] ftgmac100 1e66.ethernet eth0: NCSI Channel 0 timed out! [ 139.682820] ftgmac100 1e66.ethernet eth0: NCSI: No channel with link found, configuring channel 0 with this patch: After bmc boots: admin@g220a:~# echo eth0 > /sys/class/net/bond1/bonding/active_slave [58332.123754] bond1: (slave eth0): making interface the new active one admin@g220a:~# ping 10.2.16.1 PING 10.2.16.1 (10.2.16.1): 56 data bytes 64 bytes from 10.2.16.1: seq=0 ttl=255 time=7.279 ms ... ... 64 bytes from 10.2.16.1: seq=N ttl=255 time=2.037 ms > > > > > > I don't know the ncsi or net code well enough to know if this is the > > > correct fix. If you are confident it is correct then I have no > > > objections. > > > > This looks like it is probably right; pt->dev will be the original > > device from ncsi_register_dev(), if a response comes in to > > ncsi_rcv_rsp() associated with a different device then the driver will > > fail to find the correct ncsi_dev_priv. An example of the broken case > > would be good to see though. > > From the description sounds like the case is whenever the ncsi > interface is in a bond, the netdev from the second argument is > the bond not the interface from which the frame came. It should > be possible to repro even with only one interface on the system, > create a bond or a team and add the ncsi interface to it. > > Does that make sense? I'm likely missing the subtleties here. :) I guess so.
[PATCH] net/ncsi: Use real net-device for response handler
When aggregating ncsi interfaces and dedicated interfaces to bond interfaces, the ncsi response handler will use the wrong net device to find ncsi_dev, so that the ncsi interface will not work properly. Here, we use the net device registered to packet_type to fix it. Fixes: 138635cc27c9 ("net/ncsi: NCSI response packet handler") Signed-off-by: John Wang --- net/ncsi/ncsi-rsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index a94bb59793f0..60ae32682904 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c @@ -1120,7 +1120,7 @@ int ncsi_rcv_rsp(struct sk_buff *skb, struct net_device *dev, int payload, i, ret; /* Find the NCSI device */ - nd = ncsi_find_dev(dev); + nd = ncsi_find_dev(pt->dev); ndp = nd ? TO_NCSI_DEV_PRIV(nd) : NULL; if (!ndp) return -ENODEV; -- 2.25.1
Re: [External] Re: [PATCH 1/3] misc: aspeed: Add Aspeed UART routing control driver.
On Thu, Dec 10, 2020 at 5:42 PM Greg Kroah-Hartman wrote: > > On Thu, Dec 10, 2020 at 05:28:53PM +0800, John Wang wrote: > > From: Oskar Senft > > > > This driver adds sysfs files that allow the BMC userspace to configure > > how UARTs and physical serial I/O ports are routed. > > > > Tested: Checked correct behavior (both read & write) on TYAN S7106 > > board by manually changing routing settings and confirming that bits > > flow as expected. Tested for UART1 and UART3 as this board doesn't have > > the other UARTs wired up in a testable way. > > > > Signed-off-by: Oskar Senft > > Signed-off-by: Yong Li > > Signed-off-by: Vernon Mauery > > Signed-off-by: John Wang > > --- > > .../stable/sysfs-driver-aspeed-uart-routing | 14 + > > .../misc-devices/aspeed-uart-routing.txt | 49 +++ > > drivers/misc/Kconfig | 6 + > > drivers/misc/Makefile | 1 + > > drivers/misc/aspeed-uart-routing.c| 383 ++ > > 5 files changed, 453 insertions(+) > > create mode 100644 > > Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > create mode 100644 Documentation/misc-devices/aspeed-uart-routing.txt > > create mode 100644 drivers/misc/aspeed-uart-routing.c > > > > diff --git a/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > new file mode 100644 > > index ..5068737d9c12 > > --- /dev/null > > +++ b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing > > @@ -0,0 +1,14 @@ > > +What:/sys/bus/platform/drivers/aspeed-uart-routing/*/io* > > +Date:August 2018 > > +Contact: Oskar Senft > > +Description: Configures the input source for the specific physical > > + serial I/O port. > > +Users: OpenBMC. Proposed changes should be mailed to > > + open...@lists.ozlabs.org > > + > > +What:/sys/bus/platform/drivers/aspeed-uart-routing/*/uart* > > +Date:August 2018 > > +Contact: Oskar Senft > > +Description: Configures the input source for the specific UART. > > +Users: OpenBMC. Proposed changes should be mailed to > > + open...@lists.ozlabs.org > > diff --git a/Documentation/misc-devices/aspeed-uart-routing.txt > > b/Documentation/misc-devices/aspeed-uart-routing.txt > > new file mode 100644 > > index ..cf1c2a466875 > > --- /dev/null > > +++ b/Documentation/misc-devices/aspeed-uart-routing.txt > > @@ -0,0 +1,49 @@ > > +Kernel driver aspeed-uart-routing > > += > > + > > +Supported chips: > > +ASPEED AST2500/AST2600 > > + > > +Author: > > +Google LLC > > + > > +Description > > +--- > > + > > +The Aspeed AST2500/AST2600 allows to dynamically route the inputs for the > > +built-in UARTS and physical serial I/O ports. > > + > > +This allows, for example, to connect the output of UART to another UART. > > +This can be used to enable host<->BMC communication via UARTs, e.g. to > > allow > > +access to the host's serial console. > > + > > +This driver is for the BMC side. The sysfs files allow the BMC userspace > > +which owns the system configuration policy, to configure how UARTs and > > +physical serial I/O ports are routed. > > + > > +The driver provides the following files in sysfs: > > +uart1Configure the input signal to UART1. > > +uart2Configure the input signal to UART2. > > +uart3Configure the input signal to UART3. > > +uart4Configure the input signal to UART4. > > +uart5Configure the input signal to UART5. > > +io1 Configure the input signal to physical serial port 1. > > +io2 Configure the input signal to physical serial port 2. > > +io3 Configure the input signal to physical serial port 3. > > +io4 Configure the input signal to physical serial port 4. > > +io5 Configure the input signal to physical serial port 5. > > + > > +When read, each file shows the list of available options with the currently > > +selected option marked by square brackets "[]". The list of available > > options > > +depends on the selected file. > > + > > +Example: > > +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1
[PATCH 2/3] ARM: dts: aspeed: Add uart-routing node
Signed-off-by: John Wang --- arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++ arch/arm/boot/dts/aspeed-g6.dtsi | 6 ++ 2 files changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index 30bbf7452b90..bf40e8960244 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -523,6 +523,12 @@ sio_regs: regs { compatible = "aspeed,bmc-misc"; }; }; + + uart_routing: uart_routing@9c { + compatible = "aspeed,ast2500-uart-routing"; + reg = <0x9c 0x4>; + status = "disabled"; + }; }; peci: bus@1e78b000 { diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 4b1013870fb1..8b37182e8f36 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -311,6 +311,12 @@ pinctrl: pinctrl { compatible = "aspeed,ast2600-pinctrl"; }; + uart_routing: uart_routing@9c { + compatible = "aspeed,ast2500-uart-routing"; + reg = <0x9c 0x4>; + status = "disabled"; + }; + smp-memram@180 { compatible = "aspeed,ast2600-smpmem"; reg = <0x180 0x40>; -- 2.25.1
[PATCH 3/3] ARM: dts: aspeed: Enable g220a uart route
Signed-off-by: John Wang --- arch/arm/boot/dts/aspeed-bmc-bytedance-g220a.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-bmc-bytedance-g220a.dts b/arch/arm/boot/dts/aspeed-bmc-bytedance-g220a.dts index 89916a2eec18..e3a82679ed9c 100644 --- a/arch/arm/boot/dts/aspeed-bmc-bytedance-g220a.dts +++ b/arch/arm/boot/dts/aspeed-bmc-bytedance-g220a.dts @@ -929,3 +929,7 @@ { { status = "okay"; }; + +_routing { + status = "okay"; +}; -- 2.25.1
[PATCH 1/3] misc: aspeed: Add Aspeed UART routing control driver.
From: Oskar Senft This driver adds sysfs files that allow the BMC userspace to configure how UARTs and physical serial I/O ports are routed. Tested: Checked correct behavior (both read & write) on TYAN S7106 board by manually changing routing settings and confirming that bits flow as expected. Tested for UART1 and UART3 as this board doesn't have the other UARTs wired up in a testable way. Signed-off-by: Oskar Senft Signed-off-by: Yong Li Signed-off-by: Vernon Mauery Signed-off-by: John Wang --- .../stable/sysfs-driver-aspeed-uart-routing | 14 + .../misc-devices/aspeed-uart-routing.txt | 49 +++ drivers/misc/Kconfig | 6 + drivers/misc/Makefile | 1 + drivers/misc/aspeed-uart-routing.c| 383 ++ 5 files changed, 453 insertions(+) create mode 100644 Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing create mode 100644 Documentation/misc-devices/aspeed-uart-routing.txt create mode 100644 drivers/misc/aspeed-uart-routing.c diff --git a/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing new file mode 100644 index ..5068737d9c12 --- /dev/null +++ b/Documentation/ABI/stable/sysfs-driver-aspeed-uart-routing @@ -0,0 +1,14 @@ +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/io* +Date: August 2018 +Contact: Oskar Senft +Description: Configures the input source for the specific physical + serial I/O port. +Users: OpenBMC. Proposed changes should be mailed to + open...@lists.ozlabs.org + +What: /sys/bus/platform/drivers/aspeed-uart-routing/*/uart* +Date: August 2018 +Contact: Oskar Senft +Description: Configures the input source for the specific UART. +Users: OpenBMC. Proposed changes should be mailed to + open...@lists.ozlabs.org diff --git a/Documentation/misc-devices/aspeed-uart-routing.txt b/Documentation/misc-devices/aspeed-uart-routing.txt new file mode 100644 index ..cf1c2a466875 --- /dev/null +++ b/Documentation/misc-devices/aspeed-uart-routing.txt @@ -0,0 +1,49 @@ +Kernel driver aspeed-uart-routing += + +Supported chips: +ASPEED AST2500/AST2600 + +Author: +Google LLC + +Description +--- + +The Aspeed AST2500/AST2600 allows to dynamically route the inputs for the +built-in UARTS and physical serial I/O ports. + +This allows, for example, to connect the output of UART to another UART. +This can be used to enable host<->BMC communication via UARTs, e.g. to allow +access to the host's serial console. + +This driver is for the BMC side. The sysfs files allow the BMC userspace +which owns the system configuration policy, to configure how UARTs and +physical serial I/O ports are routed. + +The driver provides the following files in sysfs: +uart1 Configure the input signal to UART1. +uart2 Configure the input signal to UART2. +uart3 Configure the input signal to UART3. +uart4 Configure the input signal to UART4. +uart5 Configure the input signal to UART5. +io1Configure the input signal to physical serial port 1. +io2Configure the input signal to physical serial port 2. +io3Configure the input signal to physical serial port 3. +io4Configure the input signal to physical serial port 4. +io5Configure the input signal to physical serial port 5. + +When read, each file shows the list of available options with the currently +selected option marked by square brackets "[]". The list of available options +depends on the selected file. + +Example: +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 +[io1] io2 io3 io4 uart2 uart3 uart4 io6 + +In this case, UART1 gets its input signal from IO1 (physical serial port 1). + +$ echo -n "uart3" \ + >/sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 +$ cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 +io1 io2 io3 io4 uart2 [uart3] uart4 io6 diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index d8626a0d3e31..48a519c59bdf 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -451,6 +451,12 @@ config MCTP_LPC Implements the MCTP LPC binding via KCS LPC IO cycles for control and LPC FWH cycles for data +config ASPEED_UART_ROUTING + tristate "Aspeed ast2500 UART routing control" + help + If you want to configure UART routing on Aspeed BMC platforms, enable + this option. + config MISC_RTSX tristate default MISC_RTSX_PCI || MISC_RTSX_USB diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 183970192ced..4e67e21c2e65 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -60,3 +60,4 @@ obj-$(CONFIG_XILINX_SDFEC)+= x
[PATCH v2 2/2] ARM: dts: aspeed: Add LCLK to lpc-snoop
Fixes: d558ce0ff0730 (ARM: dts: aspeed: Add LPC Snoop device) Fixes: 12ce8bd361c72 (ARM: dts: aspeed-g6: Add lpc devices) Signed-off-by: John Wang --- v2: reword: Add fixes lines --- arch/arm/boot/dts/aspeed-g4.dtsi | 1 + arch/arm/boot/dts/aspeed-g5.dtsi | 1 + arch/arm/boot/dts/aspeed-g6.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi index f606fc01ff13..2364b660f2e4 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi @@ -370,6 +370,7 @@ lpc_snoop: lpc-snoop@10 { compatible = "aspeed,ast2400-lpc-snoop"; reg = <0x10 0x8>; interrupts = <8>; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index 19288495f41a..30bbf7452b90 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -496,6 +496,7 @@ lpc_snoop: lpc-snoop@10 { compatible = "aspeed,ast2500-lpc-snoop"; reg = <0x10 0x8>; interrupts = <8>; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 97ca743363d7..4b1013870fb1 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -520,6 +520,7 @@ lpc_snoop: lpc-snoop@0 { compatible = "aspeed,ast2600-lpc-snoop"; reg = <0x0 0x80>; interrupts = ; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; -- 2.25.1
[PATCH v2 1/2] misc: Add clock control logic into Aspeed LPC SNOOP driver
From: Jae Hyun Yoo If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC SNOOP block will be enabled without heart beating of LCLK until lpc-ctrl enables the LCLK. This issue causes improper handling on host interrupts when the host sends interrupt in that time frame. Then kernel eventually forcibly disables the interrupt with dumping stack and printing a 'nobody cared this irq' message out. To prevent this issue, all LPC sub-nodes should enable LCLK individually so this patch adds clock control logic into the LPC SNOOP driver. Fixes: 3772e5da4454 ("drivers/misc: Aspeed LPC snoop output using misc chardev") Signed-off-by: Jae Hyun Yoo Signed-off-by: Vernon Mauery Signed-off-by: John Wang --- v2: reword: Add fixes line --- drivers/soc/aspeed/aspeed-lpc-snoop.c | 30 --- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c index 682ba0eb4eba..20acac6342ef 100644 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel { struct aspeed_lpc_snoop { struct regmap *regmap; int irq; + struct clk *clk; struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; }; @@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) return -ENODEV; } + lpc_snoop->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_snoop->clk)) { + rc = PTR_ERR(lpc_snoop->clk); + if (rc != -EPROBE_DEFER) + dev_err(dev, "couldn't get clock\n"); + return rc; + } + rc = clk_prepare_enable(lpc_snoop->clk); + if (rc) { + dev_err(dev, "couldn't enable clock\n"); + return rc; + } + rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); if (rc) - return rc; + goto err; rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); if (rc) - return rc; + goto err; /* Configuration of 2nd snoop channel port is optional */ if (of_property_read_u32_index(dev->of_node, "snoop-ports", 1, ) == 0) { rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); - if (rc) + if (rc) { aspeed_lpc_disable_snoop(lpc_snoop, 0); + goto err; + } } + return 0; + +err: + clk_disable_unprepare(lpc_snoop->clk); + return rc; } @@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev) aspeed_lpc_disable_snoop(lpc_snoop, 0); aspeed_lpc_disable_snoop(lpc_snoop, 1); + clk_disable_unprepare(lpc_snoop->clk); + return 0; } -- 2.25.1
Re: [External] Re: [PATCH 1/2] misc: Add clock control logic into Aspeed LPC SNOOP driver
On Tue, Dec 8, 2020 at 10:19 AM Joel Stanley wrote: > > On Wed, 2 Dec 2020 at 05:16, John Wang wrote: > > > > From: Jae Hyun Yoo > > > > If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC > > SNOOP block will be enabled without heart beating of LCLK until > > lpc-ctrl enables the LCLK. This issue causes improper handling on > > host interrupts when the host sends interrupt in that time frame. > > Then kernel eventually forcibly disables the interrupt with > > dumping stack and printing a 'nobody cared this irq' message out. > > > > To prevent this issue, all LPC sub-nodes should enable LCLK > > individually so this patch adds clock control logic into the LPC > > SNOOP driver. > > > > Signed-off-by: Jae Hyun Yoo > > Signed-off-by: Vernon Mauery > > Signed-off-by: John Wang > > Reviewed-by: Joel Stanley > > Thanks for sending these John. It is an excellent idea to upstream > fixes that have been developed. > > I assume we will have the same issue for all devices that use the LPC > bus? eg. vuart, bt, kcs, lpc2ahb? It looks like only the lpc-ctrl > (lpc2ahb) does this so far: ok that's on my todo list. :) > > git grep -l clk drivers/soc/aspeed/aspeed-p2a-ctrl.c > drivers/soc/aspeed/aspeed-lpc-ctrl.c > drivers/char/ipmi/kcs_bmc_aspeed.c drivers/char/ipmi/bt-bmc.c > drivers/soc/aspeed/aspeed-lpc-ctrl.c > > > > > > --- > > drivers/soc/aspeed/aspeed-lpc-snoop.c | 30 --- > > 1 file changed, 27 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c > > b/drivers/soc/aspeed/aspeed-lpc-snoop.c > > index 682ba0eb4eba..20acac6342ef 100644 > > --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c > > +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c > > @@ -11,6 +11,7 @@ > > */ > > > > #include > > +#include > > #include > > #include > > #include > > @@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel { > > struct aspeed_lpc_snoop { > > struct regmap *regmap; > > int irq; > > + struct clk *clk; > > struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; > > }; > > > > @@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct > > platform_device *pdev) > > return -ENODEV; > > } > > > > + lpc_snoop->clk = devm_clk_get(dev, NULL); > > + if (IS_ERR(lpc_snoop->clk)) { > > + rc = PTR_ERR(lpc_snoop->clk); > > + if (rc != -EPROBE_DEFER) > > + dev_err(dev, "couldn't get clock\n"); > > + return rc; > > + } > > + rc = clk_prepare_enable(lpc_snoop->clk); > > + if (rc) { > > + dev_err(dev, "couldn't enable clock\n"); > > + return rc; > > + } > > + > > rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); > > if (rc) > > - return rc; > > + goto err; > > > > rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); > > if (rc) > > - return rc; > > + goto err; > > > > /* Configuration of 2nd snoop channel port is optional */ > > if (of_property_read_u32_index(dev->of_node, "snoop-ports", > >1, ) == 0) { > > rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); > > - if (rc) > > + if (rc) { > > aspeed_lpc_disable_snoop(lpc_snoop, 0); > > + goto err; > > + } > > } > > > > + return 0; > > + > > +err: > > + clk_disable_unprepare(lpc_snoop->clk); > > + > > return rc; > > } > > > > @@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct > > platform_device *pdev) > > aspeed_lpc_disable_snoop(lpc_snoop, 0); > > aspeed_lpc_disable_snoop(lpc_snoop, 1); > > > > + clk_disable_unprepare(lpc_snoop->clk); > > + > > return 0; > > } > > > > -- > > 2.25.1 > >
[PATCH 2/2] ARM: dts: aspeed: Add LCLK to lpc-snoop
Signed-off-by: John Wang --- arch/arm/boot/dts/aspeed-g4.dtsi | 1 + arch/arm/boot/dts/aspeed-g5.dtsi | 1 + arch/arm/boot/dts/aspeed-g6.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g4.dtsi b/arch/arm/boot/dts/aspeed-g4.dtsi index f606fc01ff13..2364b660f2e4 100644 --- a/arch/arm/boot/dts/aspeed-g4.dtsi +++ b/arch/arm/boot/dts/aspeed-g4.dtsi @@ -370,6 +370,7 @@ lpc_snoop: lpc-snoop@10 { compatible = "aspeed,ast2400-lpc-snoop"; reg = <0x10 0x8>; interrupts = <8>; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi index 19288495f41a..30bbf7452b90 100644 --- a/arch/arm/boot/dts/aspeed-g5.dtsi +++ b/arch/arm/boot/dts/aspeed-g5.dtsi @@ -496,6 +496,7 @@ lpc_snoop: lpc-snoop@10 { compatible = "aspeed,ast2500-lpc-snoop"; reg = <0x10 0x8>; interrupts = <8>; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi index 97ca743363d7..4b1013870fb1 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -520,6 +520,7 @@ lpc_snoop: lpc-snoop@0 { compatible = "aspeed,ast2600-lpc-snoop"; reg = <0x0 0x80>; interrupts = ; + clocks = < ASPEED_CLK_GATE_LCLK>; status = "disabled"; }; -- 2.25.1
[PATCH 1/2] misc: Add clock control logic into Aspeed LPC SNOOP driver
From: Jae Hyun Yoo If LPC SNOOP driver is registered ahead of lpc-ctrl module, LPC SNOOP block will be enabled without heart beating of LCLK until lpc-ctrl enables the LCLK. This issue causes improper handling on host interrupts when the host sends interrupt in that time frame. Then kernel eventually forcibly disables the interrupt with dumping stack and printing a 'nobody cared this irq' message out. To prevent this issue, all LPC sub-nodes should enable LCLK individually so this patch adds clock control logic into the LPC SNOOP driver. Signed-off-by: Jae Hyun Yoo Signed-off-by: Vernon Mauery Signed-off-by: John Wang --- drivers/soc/aspeed/aspeed-lpc-snoop.c | 30 --- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c index 682ba0eb4eba..20acac6342ef 100644 --- a/drivers/soc/aspeed/aspeed-lpc-snoop.c +++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -67,6 +68,7 @@ struct aspeed_lpc_snoop_channel { struct aspeed_lpc_snoop { struct regmap *regmap; int irq; + struct clk *clk; struct aspeed_lpc_snoop_channel chan[NUM_SNOOP_CHANNELS]; }; @@ -282,22 +284,42 @@ static int aspeed_lpc_snoop_probe(struct platform_device *pdev) return -ENODEV; } + lpc_snoop->clk = devm_clk_get(dev, NULL); + if (IS_ERR(lpc_snoop->clk)) { + rc = PTR_ERR(lpc_snoop->clk); + if (rc != -EPROBE_DEFER) + dev_err(dev, "couldn't get clock\n"); + return rc; + } + rc = clk_prepare_enable(lpc_snoop->clk); + if (rc) { + dev_err(dev, "couldn't enable clock\n"); + return rc; + } + rc = aspeed_lpc_snoop_config_irq(lpc_snoop, pdev); if (rc) - return rc; + goto err; rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 0, port); if (rc) - return rc; + goto err; /* Configuration of 2nd snoop channel port is optional */ if (of_property_read_u32_index(dev->of_node, "snoop-ports", 1, ) == 0) { rc = aspeed_lpc_enable_snoop(lpc_snoop, dev, 1, port); - if (rc) + if (rc) { aspeed_lpc_disable_snoop(lpc_snoop, 0); + goto err; + } } + return 0; + +err: + clk_disable_unprepare(lpc_snoop->clk); + return rc; } @@ -309,6 +331,8 @@ static int aspeed_lpc_snoop_remove(struct platform_device *pdev) aspeed_lpc_disable_snoop(lpc_snoop, 0); aspeed_lpc_disable_snoop(lpc_snoop, 1); + clk_disable_unprepare(lpc_snoop->clk); + return 0; } -- 2.25.1
[PATCH v6 1/2] dt-bindings: Add ipsps1 as a trivial device
The ipsps1 is an Inspur Power System power supply unit Signed-off-by: John Wang Reviewed-by: Rob Herring --- v6: - No changes v5: - No changes v4: - Rebased on 5.3-rc4 instead of 5.2, No changes v3: - Fix adding entry to the inappropriate line v2: - No changes. --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 2e742d399e87..870ac52d2225 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -104,6 +104,8 @@ properties: - infineon,slb9645tt # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor - infineon,tlv493d-a1b6 +# Inspur Power System power supply unit version 1 + - inspur,ipsps1 # Intersil ISL29028 Ambient Light and Proximity Sensor - isil,isl29028 # Intersil ISL29030 Ambient Light and Proximity Sensor -- 2.17.1
[PATCH v5 1/2] dt-bindings: Add ipsps1 as a trivial device
The ipsps1 is an Inspur Power System power supply unit Signed-off-by: John Wang Reviewed-by: Rob Herring --- v5: - No changes v4: - Rebased on 5.3-rc4 instead of 5.2, No changes v3: - Fix adding entry to the inappropriate line v2: - No changes. --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 2e742d399e87..870ac52d2225 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -104,6 +104,8 @@ properties: - infineon,slb9645tt # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor - infineon,tlv493d-a1b6 +# Inspur Power System power supply unit version 1 + - inspur,ipsps1 # Intersil ISL29028 Ambient Light and Proximity Sensor - isil,isl29028 # Intersil ISL29030 Ambient Light and Proximity Sensor -- 2.17.1
[PATCH v4 1/2] dt-bindings: Add ipsps1 as a trivial device
The ipsps1 is an Inspur Power System power supply unit Signed-off-by: John Wang Reviewed-by: Rob Herring --- v4: - Rebased on 5.3-rc4 instead of 5.2, No changes v3: - Fix adding entry to the inappropriate line v2: - No changes. --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 2e742d399e87..870ac52d2225 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -104,6 +104,8 @@ properties: - infineon,slb9645tt # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor - infineon,tlv493d-a1b6 +# Inspur Power System power supply unit version 1 + - inspur,ipsps1 # Intersil ISL29028 Ambient Light and Proximity Sensor - isil,isl29028 # Intersil ISL29030 Ambient Light and Proximity Sensor -- 2.17.1
[PATCH v3 1/2] dt-bindings: Add ipsps1 as a trivial device
The ipsps1 is an Inspur Power System power supply unit Signed-off-by: John Wang --- v3: - Fix adding entry to the inappropriate line v2: - No changes. --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 747fd3f689dc..8f21498faa92 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -100,6 +100,8 @@ properties: - infineon,slb9645tt # Infineon TLV493D-A1B6 I2C 3D Magnetic Sensor - infineon,tlv493d-a1b6 +# Inspur Power System power supply unit version 1 + - inspur,ipsps1 # Intersil ISL29028 Ambient Light and Proximity Sensor - isil,isl29028 # Intersil ISL29030 Ambient Light and Proximity Sensor -- 2.17.1
[PATCH] dt-bindings: Add vendor prefix for Inspur Corporation
Signed-off-by: John Wang --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 33a65a45e319..cc07237b8b89 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -401,6 +401,8 @@ patternProperties: description: Innolux Corporation "^inside-secure,.*": description: INSIDE Secure + "^inspur,.*": +description: Inspur Corporation "^intel,.*": description: Intel Corporation "^intercontrol,.*": -- 2.17.1
[PATCH v2 2/2] hwmon: pmbus: Add Inspur Power System power supply driver
Add the driver to monitor Inspur Power System power supplies with hwmon over pmbus. This driver adds sysfs attributes for additional power supply data, including vendor, model, part_number, serial number, firmware revision, hardware revision, and psu mode(active/standby). Signed-off-by: John Wang --- v2: - Fix typos in commit message - Invert Christmas tree - Configure device with sysfs attrs, not debugfs entries - Fix errno in fw_version_read, ENODATA to EPROTO - Change the print format of fw-version - Use sysfs_streq instead of strcmp("xxx" "\n", "xxx") - Document sysfs attributes --- Documentation/hwmon/inspur-ipsps1.rst | 79 + drivers/hwmon/pmbus/Kconfig | 9 + drivers/hwmon/pmbus/Makefile | 1 + drivers/hwmon/pmbus/inspur-ipsps.c| 236 ++ 4 files changed, 325 insertions(+) create mode 100644 Documentation/hwmon/inspur-ipsps1.rst create mode 100644 drivers/hwmon/pmbus/inspur-ipsps.c diff --git a/Documentation/hwmon/inspur-ipsps1.rst b/Documentation/hwmon/inspur-ipsps1.rst new file mode 100644 index ..aa19f0ccc8b0 --- /dev/null +++ b/Documentation/hwmon/inspur-ipsps1.rst @@ -0,0 +1,79 @@ +Kernel driver inspur-ipsps1 +=== + +Supported chips: + + * Inspur Power System power supply unit + +Author: John Wang + +Description +--- + +This driver supports Inspur Power System power supplies. This driver +is a client to the core PMBus driver. + +Usage Notes +--- + +This driver does not auto-detect devices. You will have to instantiate the +devices explicitly. Please see Documentation/i2c/instantiating-devices for +details. + +Sysfs entries +- + +The following attributes are supported: + +=== == +curr1_input Measured input current +curr1_label "iin" +curr1_max Maximum current +curr1_max_alarm Current high alarm +curr2_inputMeasured output current in mA. +curr2_label"iout1" +curr2_crit Critical maximum current +curr2_crit_alarmCurrent critical high alarm +curr2_max Maximum current +curr2_max_alarm Current high alarm + +fan1_alarm Fan 1 warning. +fan1_fault Fan 1 fault. +fan1_input Fan 1 speed in RPM. + +in1_alarm Input voltage under-voltage alarm. +in1_input Measured input voltage in mV. +in1_label "vin" +in2_input Measured output voltage in mV. +in2_label "vout1" +in2_lcrit Critical minimum output voltage +in2_lcrit_alarm Output voltage critical low alarm +in2_max Maximum output voltage +in2_max_alarm Output voltage high alarm +in2_min Minimum output voltage +in2_min_alarm Output voltage low alarm + +power1_alarm Input fault or alarm. +power1_input Measured input power in uW. +power1_label "pin" +power1_max Input power limit +power2_max_alarm Output power high alarm +power2_max Output power limit +power2_input Measured output power in uW. +power2_label "pout" + +temp[1-3]_inputMeasured temperature +temp[1-2]_max Maximum temperature +temp[1-3]_max_alarmTemperature high alarm + +vendor Manufacturer name +model Product model +part_number Product part number +serial_number Product serial number +fw_version Firmware version +hw_version Hardware version +modeWork mode. Can be set to active or +standby, when set to standby, PSU will +automatically switch between standby +and redundancy mode. +=== == diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 30751eb9550a..c09357c26b10 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig @@ -203,4 +203,13 @@ config SENSORS_ZL6100 This driver can also be built as a module. If so, the module will be called zl6100. +config SENSORS_INSPUR_IPSPS + tristate "INSPUR Power System Power Supply" + help + If you say yes here you get hardware monitoring support for the INSPUR + Power System power supply. + + This driver can also be built as a module. If so, the module will + be called inspur-ipsps. + endif # PMBUS diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 2219b9300316..fde2d10cd05c 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile @@ -23,3 +23,4 @@ o