Skip to content

Commit b1ae17c

Browse files
committed
Merge tag 'for-linus-6.19-1' of https://github.com/cminyard/linux-ipmi
Pull IPMI updates from Corey Minyard: "Minor IPMI fixes: - Some device tree cleanups and a maintainer add - Fix a race when handling channel updates that could result in errors being reported to the user in some cases" * tag 'for-linus-6.19-1' of https://github.com/cminyard/linux-ipmi: MAINTAINERS: Add entry on Loongson-2K IPMI driver dt-bindings: ipmi: Convert aspeed,ast2400-ibt-bmc to DT schema dt-bindings: ipmi: Convert nuvoton,npcm750-kcs-bmc to DT schema ipmi: Skip channel scan if channels are already marked ready ipmi: Fix __scan_channels() failing to rescan channels ipmi: Fix the race between __scan_channels() and deliver_response()
2 parents 096571b + 35bcedc commit b1ae17c

6 files changed

Lines changed: 117 additions & 75 deletions

File tree

Documentation/devicetree/bindings/ipmi/aspeed,ast2400-ibt-bmc.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/ipmi/aspeed,ast2400-ibt-bmc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Aspeed Block Transfer (BT) IPMI interface
8+
9+
maintainers:
10+
- Joel Stanley <joel@jms.id.au>
11+
12+
properties:
13+
compatible:
14+
enum:
15+
- aspeed,ast2400-ibt-bmc
16+
- aspeed,ast2500-ibt-bmc
17+
- aspeed,ast2600-ibt-bmc
18+
19+
reg:
20+
maxItems: 1
21+
22+
clocks:
23+
maxItems: 1
24+
25+
interrupts:
26+
maxItems: 1
27+
28+
required:
29+
- compatible
30+
- reg
31+
- clocks
32+
33+
additionalProperties: false
34+
35+
examples:
36+
- |
37+
#include <dt-bindings/clock/aspeed-clock.h>
38+
39+
bt@1e789140 {
40+
compatible = "aspeed,ast2400-ibt-bmc";
41+
reg = <0x1e789140 0x18>;
42+
interrupts = <8>;
43+
clocks = <&syscon ASPEED_CLK_GATE_LCLK>;
44+
};

Documentation/devicetree/bindings/ipmi/npcm7xx-kcs-bmc.txt

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/ipmi/nuvoton,npcm750-kcs-bmc.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Nuvoton NPCM KCS BMC
8+
9+
maintainers:
10+
- Avi Fishman <avifishman70@gmail.com>
11+
- Tomer Maimon <tmaimon77@gmail.com>
12+
- Tali Perry <tali.perry1@gmail.com>
13+
14+
description:
15+
The Nuvoton SOCs (NPCM) are commonly used as BMCs (Baseboard Management
16+
Controllers) and the KCS interface can be used to perform in-band IPMI
17+
communication with their host.
18+
19+
properties:
20+
compatible:
21+
oneOf:
22+
- const: nuvoton,npcm750-kcs-bmc
23+
- items:
24+
- enum:
25+
- nuvoton,npcm845-kcs-bmc
26+
- const: nuvoton,npcm750-kcs-bmc
27+
28+
reg:
29+
maxItems: 1
30+
31+
interrupts:
32+
maxItems: 1
33+
34+
kcs_chan:
35+
description: The KCS channel number in the controller
36+
$ref: /schemas/types.yaml#/definitions/uint32
37+
minimum: 1
38+
maximum: 3
39+
40+
required:
41+
- compatible
42+
- reg
43+
- interrupts
44+
- kcs_chan
45+
46+
additionalProperties: false
47+
48+
examples:
49+
- |
50+
kcs@0 {
51+
compatible = "nuvoton,npcm750-kcs-bmc";
52+
reg = <0x0 0x40>;
53+
interrupts = <9 4>;
54+
kcs_chan = <1>;
55+
};

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14767,6 +14767,7 @@ LOONGSON-2K Board Management Controller (BMC) DRIVER
1476714767
M: Binbin Zhou <zhoubinbin@loongson.cn>
1476814768
M: Chong Qiao <qiaochong@loongson.cn>
1476914769
S: Maintained
14770+
F: drivers/char/ipmi/ipmi_si_ls2k.c
1477014771
F: drivers/mfd/ls2k-bmc-core.c
1477114772

1477214773
LOONGSON EDAC DRIVER

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ static void __ipmi_bmc_unregister(struct ipmi_smi *intf);
599599
static int __ipmi_bmc_register(struct ipmi_smi *intf,
600600
struct ipmi_device_id *id,
601601
bool guid_set, guid_t *guid, int intf_num);
602-
static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id);
602+
static int __scan_channels(struct ipmi_smi *intf,
603+
struct ipmi_device_id *id, bool rescan);
603604

604605
static void free_ipmi_user(struct kref *ref)
605606
{
@@ -2668,7 +2669,7 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
26682669
if (__ipmi_bmc_register(intf, &id, guid_set, &guid, intf_num))
26692670
need_waiter(intf); /* Retry later on an error. */
26702671
else
2671-
__scan_channels(intf, &id);
2672+
__scan_channels(intf, &id, false);
26722673

26732674

26742675
if (!intf_set) {
@@ -2688,7 +2689,7 @@ static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
26882689
goto out_noprocessing;
26892690
} else if (memcmp(&bmc->fetch_id, &bmc->id, sizeof(bmc->id)))
26902691
/* Version info changes, scan the channels again. */
2691-
__scan_channels(intf, &bmc->fetch_id);
2692+
__scan_channels(intf, &bmc->fetch_id, true);
26922693

26932694
bmc->dyn_id_expiry = jiffies + IPMI_DYN_DEV_ID_EXPIRY;
26942695

@@ -3417,8 +3418,6 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
34173418
intf->channels_ready = true;
34183419
wake_up(&intf->waitq);
34193420
} else {
3420-
intf->channel_list = intf->wchannels + set;
3421-
intf->channels_ready = true;
34223421
rv = send_channel_info_cmd(intf, intf->curr_channel);
34233422
}
34243423

@@ -3440,10 +3439,21 @@ channel_handler(struct ipmi_smi *intf, struct ipmi_recv_msg *msg)
34403439
/*
34413440
* Must be holding intf->bmc_reg_mutex to call this.
34423441
*/
3443-
static int __scan_channels(struct ipmi_smi *intf, struct ipmi_device_id *id)
3442+
static int __scan_channels(struct ipmi_smi *intf,
3443+
struct ipmi_device_id *id,
3444+
bool rescan)
34443445
{
34453446
int rv;
34463447

3448+
if (rescan) {
3449+
/* Clear channels_ready to force channels rescan. */
3450+
intf->channels_ready = false;
3451+
}
3452+
3453+
/* Skip channel scan if channels are already marked ready */
3454+
if (intf->channels_ready)
3455+
return 0;
3456+
34473457
if (ipmi_version_major(id) > 1
34483458
|| (ipmi_version_major(id) == 1
34493459
&& ipmi_version_minor(id) >= 5)) {
@@ -3658,7 +3668,7 @@ int ipmi_add_smi(struct module *owner,
36583668
}
36593669

36603670
mutex_lock(&intf->bmc_reg_mutex);
3661-
rv = __scan_channels(intf, &id);
3671+
rv = __scan_channels(intf, &id, false);
36623672
mutex_unlock(&intf->bmc_reg_mutex);
36633673
if (rv)
36643674
goto out_err_bmc_reg;

0 commit comments

Comments
 (0)