Skip to contentSkip to conversation

bus/memory: Add Baikal-T1 SoC APB/AXI/L2 drivers

PATCH In review Serge Semin 5 participants 26 messages May 26, 2020 – May 31, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover bus/memory: Add Baikal-T1 SoC APB/AXI/L2 drivers

Baikal-T1 SoC CPU is based on two MIPS Warrior P5600 cores. Their main memory Non-Coherent IO interface is connected to the OCP2AXI bridge, which in turn is then connected to the DW AMBA 3 AXI Interconnect (so called Main Interconnect) with nine masters and four slaves ports. Main Interconnect is responsible for the AXI-bus traffic arbitration (QoS) and its routing from one component to another. In addition there is a Errors Handler Block (EHB) accesible by means of the Baikal-T1 SoC System Controller responsible to detect AXI protocol errors and device not responding situations built on top the interconnect. Baikal-T1 AXI-bus driver included in this patchset will be responsible for working with that functionality, though currently it doesn't support QoS tuning. Instead it's capable of detecting the error events, reporting an info about them to the system log, injecting artificial errors to test the driver functionality. Since AXI Interconnect doesn't provide a way to find out which devices are connected to it, so its DT node is supposed to be compatible with "simple-bus" driver, while sub-nodes shall represent the masters attached to the bus.

One of the AXI Interconnect slaves is an AXI-APB bridge used to access the Baikal-T1 SoC subsystems CSRs. MMIO request from CPU and DMAC masters are routed there if they are detected to be within [0x08000000 0x1FFFFFFF] range of the physical memory. In case if an attempted APB transaction stays with no response for a pre-defined time it will be detected by the APB-bus Errors Handler Block (EHB), which will raise an interrupt, then the bus gets freed for a next operation. The APB-bus driver provides the interrupt handler to detect the erroneous address, update an errors counter and prints an error message about the faulty address. The counter and the APB-bus operations timeout can be accessed via corresponding sysfs nodes. A dedicated sysfs-node can be also used to artificially cause the bus errors described above. Since APB-bus is a platform bus, it doesn't provide a way to detect slave devices connected to it, so similarly to the AXI-bus it's also supposed to be compatible with "simple-bus" driver.

Aside from PCIe/SATA/DDR/I2C/EHB/CPU/reboot specific settings the Baikal-T1 System Controller provides a MIPS P5600 CM2 L2-cache tuning block. It is responsible for the setting up the Tag/Data/WS L2-to-RAM latencies. The last small patch in this patchset provides a driver and DT-schema-based binding for the described device. So that the latencies can be tuned up by means of dedicated DT properties and sysfs nodes.

This patchset is rebased and tested on the mainline Linux kernel 5.7-rc4:
0e698dfa2822 ("Linux 5.7-rc4")
tag: v5.7-rc4

Changelog v2 (AXI/APB bus):
- Assign dual GPL/BSD licenses to the bindings.
- Use single lined copyright headers in the bindings.
- Replace "additionalProperties: false" property with "unevaluatedProperties: false" in the bindings.
- Don't use a multi-arg clock phandle reference in DT binding examples. Thus remove includes from there.
- Fix some commit message and Kconfig help text spelling.
- Move drivers from soc to the bus subsystem.
- Convert a simple EHB drivers to the Baikal-T1 AXI and APB bus ones.
- Convert APB bus driver to using regmap MMIO API.
- Use syscon regmap to access the AXI-bus erroneous address.
- Add reset line support.
- Add Main Interconnect clock support to the AXI-bus driver.
- Remove probe-status info string printout.
- Discard of_match_ptr() macro utilization.
- Don't print error-message if no platform IRQ found. Just return an error.
- Use generic FIELD_{GET,PREP} macros instead of handwritten ones in the AXI-bus driver.

Changelog v2 (l2 driver):
- Fix some commit message and Kconfig help text spelling.
- Move the driver to the memory subsystem.
- Assign dual GPL/BSD license to the DT binding.
- Use single lined copyright header in the binding.
- Discard reg property and syscon compatible string.
- Move "allOf" restrictions to the root level of the properties.
- The DT node is supposed to be a child of the Baikal-T1 system controller node. So regmap will be fetched from there.
- Use generic FIELD_{GET,PREP} macro.
- Remove probe-status info string printout.
- Since the driver depends on the OF config we can remove of_match_ptr() macro utilization.

Changelog v3:
- Combine l2 and AXI/APB bus patches in a single patchset.
- Retrieve AXI-bus QoS registers by resource name "qos".
- Discard CONFIG_OF dependency since there is none at compile-time.
- Add syscon EHB registers range to the AXI-bus reg property as optional entry.
- Fix invalid of_property_read_u32() return value test in the l2-ctl driver.
- Get the reg property back into the l2-ctl DT bindings even though the driver is using the parental syscon regmap.
- The l2-ctl DT schema will live separately from the system controller, but the corresponding sub-node of the later DT schema will $ref this one.
- Set non-default latencies in the l2-ctl DT example.

Cc Alexey Malahov <[email protected]>
Cc Maxim Kaurkin <[email protected]>
Cc Pavel Parkhomenko <[email protected]>
Cc Ramil Zaripov <[email protected]>
Cc Ekaterina Skachko <[email protected]>
Cc Vadim Vlasov <[email protected]>
Cc Alexey Kolotnikov <[email protected]>
Cc Paul Burton <[email protected]>
Cc Rob Herring <[email protected]>
Cc Olof Johansson <[email protected]>

Serge Semin (6):
dt-bindings: bus: Add Baikal-T1 AXI-bus binding
dt-bindings: bus: Add Baikal-T1 APB-bus binding
dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding
bus: Add Baikal-T1 AXI-bus driver
bus: Add Baikal-T1 APB-bus driver
memory: Add Baikal-T1 L2-cache Control Block driver

 .../bindings/bus/baikal,bt1-apb.yaml          |  90 ++++
 .../bindings/bus/baikal,bt1-axi.yaml          | 107 +++++
 .../memory-controllers/baikal,bt1-l2-ctl.yaml |  63 +++
 drivers/bus/Kconfig                           |  30 ++
 drivers/bus/Makefile                          |   2 +
 drivers/bus/bt1-apb.c                         | 421 ++++++++++++++++++
 drivers/bus/bt1-axi.c                         | 318 +++++++++++++
 drivers/memory/Kconfig                        |  11 +
 drivers/memory/Makefile                       |   1 +
 drivers/memory/bt1-l2-ctl.c                   | 322 ++++++++++++++
 10 files changed, 1365 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-apb.yaml
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-axi.yaml
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml
 create mode 100644 drivers/bus/bt1-apb.c
 create mode 100644 drivers/bus/bt1-axi.c
 create mode 100644 drivers/memory/bt1-l2-ctl.c
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 1/6 dt-bindings: bus: Add Baikal-T1 AXI-bus binding

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and with MIPS P5600 cores on Baikal-T1 SoC. This binding describes the DW AMBA 3 AXI Inteconnect and Errors Handler Block synthesized on top of it, which are responsible for the AXI-bus traffic arbitration and errors reporting upstream to CPU. Baikal-T1 AXI-bus DT node is supposed to be compatible with "be,bt1-axi" and "simple-bus" drivers, should have reg property with AXI-bus QOS registers space, syscon phandle reference to the Baikal-T1 System Controller, IRQ line declared, AXI Interconnect reference clock and reset line.

---

Changelog v2:
- Move driver to the bus subsystem.
- Use dual GPL/BSD license.
- Use single lined copyright header.
- Lowercase the unit-address.
- Convert a simple EHB block binding to the Baikal-T1 AXI-bus one with interconnect capabilities support.
- Replace "additionalProperties: false" property with "unevaluatedProperties: false".
- Add AXI reference clock and reset support.
- Add syscon phandle reference to the Baikal-T1 System Controller node.

Changelog v3:
- Add syscon EHB registers range to the reg property as optional entry.

---
 .../bindings/bus/baikal,bt1-axi.yaml          | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-axi.yaml
Documentation/devicetree/bindings/bus/baikal,bt1-axi.yaml new file +107 -0
new file mode 100644
index 000000000000..203bc0e5346b
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/baikal,bt1-axi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Baikal-T1 AXI-bus
+
+maintainers:
+  - Serge Semin <[email protected]>
+
+description: |
+  AXI3-bus is the main communication bus of Baikal-T1 SoC connecting all
+  high-speed peripheral IP-cores with RAM controller and with MIPS P5600
+  cores. Traffic arbitration is done by means of DW AXI Interconnect (so
+  called AXI Main Interconnect) routing IO requests from one block to
+  another: from CPU to SoC peripherals and between some SoC peripherals
+  (mostly between peripheral devices and RAM, but also between DMA and
+  some peripherals). In case of any protocol error, device not responding
+  an IRQ is raised and a faulty situation is reported to the AXI EHB
+  (Errors Handler Block) embedded on top of the DW AXI Interconnect and
+  accessible by means of the Baikal-T1 System Controller.
+
+allOf:
+ - $ref: /schemas/simple-bus.yaml#
+
+properties:
+  compatible:
+    contains:
+      const: baikal,bt1-axi
+
+  reg:
+    minItems: 1
+    items:
+      - description: Synopsys DesignWare AXI Interconnect QoS registers
+      - description: AXI EHB MMIO system controller registers
+
+  reg-names:
+    minItems: 1
+    items:
+      - const: qos
+      - const: ehb
+
+  '#interconnect-cells':
+    const: 1
+
+  syscon:
+    $ref: /schemas/types.yaml#definitions/phandle
+    description: Phandle to the Baikal-T1 System Controller DT node
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: Main Interconnect uplink reference clock
+
+  clock-names:
+    items:
+      - const: aclk
+
+  resets:
+    items:
+      - description: Main Interconnect reset line
+
+  reset-names:
+    items:
+      - const: arst
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - syscon
+  - interrupts
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+
+    bus@1f05a000 {
+      compatible = "baikal,bt1-axi", "simple-bus";
+      reg = <0 0x1f05a000 0 0x1000>,
+            <0 0x1f04d110 0 0x8>;
+      reg-names = "qos", "ehb";
+      #address-cells = <1>;
+      #size-cells = <1>;
+      #interconnect-cells = <1>;
+
+      syscon = <&syscon>;
+
+      ranges;
+
+      interrupts = <GIC_SHARED 127 IRQ_TYPE_LEVEL_HIGH>;
+
+      clocks = <&ccu_axi 0>;
+      clock-names = "aclk";
+
+      resets = <&ccu_axi 0>;
+      reset-names = "arst";
+    };
+...
Signature · 1 line
2.26.2
#2 lore raw

PATCH v3 2/6 dt-bindings: bus: Add Baikal-T1 APB-bus binding

In reply to Serge Semin

Baikal-T1 CPU or DMAC MMIO requests are handled by the AMBA 3 AXI Interconnect which routes them to the AXI-APB bridge, which in turn serializes accesses and routes them to the corresponding APB slave device. This binding describes the AXI-APB bridge considered as the APB-bus. It is supposed to be compatible with "be,bt1-apb" and "simple-bus" drivers, should be equipped with EHB MMIO region and a region with no slave device mapped, interrupts line number, APB reference clock and domain reset line.

---

Changelog v2:
- Move driver to the bus subsystem.
- Don't use a multi-arg clock phandle reference in the examples dt-bindings property. Thus redundant include statement can be removed.
- Use dual GPL/BSD license.
- Use single lined copyright header.
- Lowercase the unit-address.
- Convert a dedicated EHB block binding to the Baikal-T1 APB-bus one.
- Add APB reference clock and reset support.
- Replace "additionalProperties: false" property with "unevaluatedProperties: false".
- Add reg-names property.

---
 .../bindings/bus/baikal,bt1-apb.yaml          | 90 +++++++++++++++++++
 1 file changed, 90 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-apb.yaml
Documentation/devicetree/bindings/bus/baikal,bt1-apb.yaml new file +90 -0
new file mode 100644
index 000000000000..d6a3b71ea835
@@ -0,0 +1,90 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bus/baikal,bt1-apb.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Baikal-T1 APB-bus
+
+maintainers:
+  - Serge Semin <[email protected]>
+
+description: |
+  Baikal-T1 CPU or DMAC MMIO requests are handled by the AMBA 3 AXI Interconnect
+  which routes them to the AXI-APB bridge. This interface is a single master
+  multiple slaves bus in turn serializing IO accesses and routing them to the
+  addressed APB slave devices. In case of any APB protocol collisions, slave
+  device not responding on timeout an IRQ is raised with an erroneous address
+  reported to the APB terminator (APB Errors Handler Block).
+
+allOf:
+ - $ref: /schemas/simple-bus.yaml#
+
+properties:
+  compatible:
+    contains:
+      const: baikal,bt1-apb
+
+  reg:
+    items:
+      - description: APB EHB MMIO registers
+      - description: APB MMIO region with no any device mapped
+
+  reg-names:
+    items:
+      - const: ehb
+      - const: nodev
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: APB reference clock
+
+  clock-names:
+    items:
+      - const: pclk
+
+  resets:
+    items:
+      - description: APB domain reset line
+
+  reset-names:
+    items:
+      - const: prst
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+  - clocks
+  - clock-names
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/mips-gic.h>
+
+    bus@1f059000 {
+      compatible = "baikal,bt1-apb", "simple-bus";
+      reg = <0 0x1f059000 0 0x1000>,
+            <0 0x1d000000 0 0x2040000>;
+      reg-names = "ehb", "nodev";
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      ranges;
+
+      interrupts = <GIC_SHARED 16 IRQ_TYPE_LEVEL_HIGH>;
+
+      clocks = <&ccu_sys 1>;
+      clock-names = "pclk";
+
+      resets = <&ccu_sys 1>;
+      reset-names = "prst";
+    };
+...
Signature · 1 line
2.26.2
#3 lore raw

PATCH v3 3/6 dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding

In reply to Serge Semin

There is a single register provided by the SoC system controller, which can be used to tune the L2-cache RAM up. It only provides a way to change the L2-RAM access latencies. So aside from "be,bt1-l2-ctl" compatible string the device node can be optionally equipped with the properties of Tag/Data/WS latencies.

---

Changelog v2:
- Move driver to the memory subsystem.
- Use dual GPL/BSD license.
- Use single lined copyright header.
- Move "allOf" restrictions to the root level of the properties.
- Discard syscon compatible string and reg property.
- The DT node is supposed to be a child of the Baikal-T1 system controller node.

Changelog v3:
- Get the reg property back even though the driver is using the parental syscon regmap.
- The DT schema will live separately from the system controller, but the corresponding sub-node of the later DT schema will $ref this one.
- Set non-default latencies in the example.

---
 .../memory-controllers/baikal,bt1-l2-ctl.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml
Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml new file +63 -0
new file mode 100644
index 000000000000..1fca282f64a2
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/baikal,bt1-l2-ctl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Baikal-T1 L2-cache Control Block
+
+maintainers:
+  - Serge Semin <[email protected]>
+
+description: |
+  By means of the System Controller Baikal-T1 SoC exposes a few settings to
+  tune the MIPS P5600 CM2 L2 cache performance up. In particular it's possible
+  to change the Tag, Data and Way-select RAM access latencies. Baikal-T1
+  L2-cache controller block is responsible for the tuning. Its DT node is
+  supposed to be a child of the system controller.
+
+properties:
+  compatible:
+    const: baikal,bt1-l2-ctl
+
+  reg:
+    maxItems: 1
+
+  baikal,l2-ws-latency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cycles of latency for Way-select RAM accesses
+    default: 0
+    minimum: 0
+    maximum: 3
+
+  baikal,l2-tag-latency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cycles of latency for Tag RAM accesses
+    default: 0
+    minimum: 0
+    maximum: 3
+
+  baikal,l2-data-latency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Cycles of latency for Data RAM accesses
+    default: 1
+    minimum: 0
+    maximum: 3
+
+additionalProperties: false
+
+required:
+  - compatible
+
+examples:
+  - |
+    l2@1f04d028 {
+      compatible = "baikal,bt1-l2-ctl";
+      reg = <0x1f04d028 0x004>;
+
+      baikal,l2-ws-latency = <1>;
+      baikal,l2-tag-latency = <1>;
+      baikal,l2-data-latency = <2>;
+    };
+...
Signature · 1 line
2.26.2
maintainer Reviewed-by on v3 3/6
#4 lore raw

Re: [PATCH v3 3/6] dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding

Quoted 30 lines · Serge Semin

There is a single register provided by the SoC system controller, which can be used to tune the L2-cache RAM up. It only provides a way to change the L2-RAM access latencies. So aside from "be,bt1-l2-ctl" compatible string the device node can be optionally equipped with the properties of Tag/Data/WS latencies.

---

Changelog v2:
- Move driver to the memory subsystem.
- Use dual GPL/BSD license.
- Use single lined copyright header.
- Move "allOf" restrictions to the root level of the properties.
- Discard syscon compatible string and reg property.
- The DT node is supposed to be a child of the Baikal-T1 system controller node.

Changelog v3:
- Get the reg property back even though the driver is using the parental syscon regmap.
- The DT schema will live separately from the system controller, but the corresponding sub-node of the later DT schema will $ref this one.
- Set non-default latencies in the example.

Quoted 5 lines
---
 .../memory-controllers/baikal,bt1-l2-ctl.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml
#5 lore raw

Re: [PATCH v3 3/6] dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding

Quoted 37 lines · Rob Herring
Quoted 30 lines · Serge Semin

There is a single register provided by the SoC system controller, which can be used to tune the L2-cache RAM up. It only provides a way to change the L2-RAM access latencies. So aside from "be,bt1-l2-ctl" compatible string the device node can be optionally equipped with the properties of Tag/Data/WS latencies.

---

Changelog v2:
- Move driver to the memory subsystem.
- Use dual GPL/BSD license.
- Use single lined copyright header.
- Move "allOf" restrictions to the root level of the properties.
- Discard syscon compatible string and reg property.
- The DT node is supposed to be a child of the Baikal-T1 system controller node.

Changelog v3:
- Get the reg property back even though the driver is using the parental syscon regmap.
- The DT schema will live separately from the system controller, but the corresponding sub-node of the later DT schema will $ref this one.
- Set non-default latencies in the example.

Quoted 5 lines
---
 .../memory-controllers/baikal,bt1-l2-ctl.yaml | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml
Quoted 1 line

Great! Thanks.

-Sergey

#6 lore raw

PATCH v3 4/6 bus: Add Baikal-T1 AXI-bus driver

In reply to Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

---

Changelog v2:
- Fix commit message and Kconfig help text spelling.
- Move driver from soc to the bus subsystem.
- Convert a simple EHB driver to the Baikal-T1 AXI-bus one.
- Use syscon regmap to access the AXI-bus erroneous address.
- Add interconnect reset line support.
- Remove probe-status info string printout.
- Use generic FIELD_{GET,PREP} macros instead of handwritten ones.
- Since the driver depends on the OF config we can remove of_match_ptr() macro utilization.
- Don't print error-message if no platform IRQ found. Just return an error.
- Select MFD_SYSCON config.

Changelog v3:
- Retrieve QoS registers by resource name "qos".
- Discard CONFIG_OF dependency since there is none at compile-time.

---
 drivers/bus/Kconfig   |  15 ++
 drivers/bus/Makefile  |   1 +
 drivers/bus/bt1-axi.c | 318 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 334 insertions(+)
 create mode 100644 drivers/bus/bt1-axi.c
drivers/bus/Kconfig +15 -0
index 6d4e4497b59b..1080dd26e268 100644
@@ -29,6 +29,21 @@ config BRCMSTB_GISB_ARB
 	  arbiter. This driver provides timeout and target abort error handling
 	  and internal bus master decoding.
 
+config BT1_AXI
+	tristate "Baikal-T1 AXI-bus driver"
+	depends on MIPS_BAIKAL_T1 || COMPILE_TEST
+	select MFD_SYSCON
+	help
+	  AXI3-bus is the main communication bus connecting all high-speed
+	  peripheral IP-cores with RAM controller and with MIPS P5600 cores on
+	  Baikal-T1 SoC. Traffic arbitration is done by means of DW AMBA 3 AXI
+	  Interconnect (so called AXI Main Interconnect) routing IO requests
+	  from one SoC block to another. This driver provides a way to detect
+	  any bus protocol errors and device not responding situations by
+	  means of an embedded on top of the interconnect errors handler
+	  block (EHB). AXI Interconnect QoS arbitration tuning is currently
+	  unsupported.
+
 config MOXTET
 	tristate "CZ.NIC Turris Mox module configuration bus"
 	depends on SPI_MASTER && OF
drivers/bus/Makefile +1 -0
index 05f32cd694a4..eaa25d171ebd 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MOXTET)		+= moxtet.o
 # DPAA2 fsl-mc bus
 obj-$(CONFIG_FSL_MC_BUS)	+= fsl-mc/
 
+obj-$(CONFIG_BT1_AXI)		+= bt1-axi.o
 obj-$(CONFIG_IMX_WEIM)		+= imx-weim.o
 obj-$(CONFIG_MIPS_CDMM)		+= mips_cdmm.o
 obj-$(CONFIG_MVEBU_MBUS) 	+= mvebu-mbus.o
drivers/bus/bt1-axi.c new file +318 -0

318 lines not on this page · raw message

Signature · 1 line
2.26.2
#7 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

I love your patch! Yet something to improve:

Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7 next-20200526] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/bus-memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/bus/bt1-axi.c:301:34: error: array type has incomplete element type 'struct of_device_id'
301 | static const struct of_device_id bt1_axi_of_match[] = {
|                                  ^~~~~~~~~~~~~~~~
>> drivers/bus/bt1-axi.c:302:4: error: field name not in record or union initializer

302 | { .compatible = "baikal,bt1-axi" },
| ^
drivers/bus/bt1-axi.c:302:4: note: (near initialization for 'bt1_axi_of_match') drivers/bus/bt1-axi.c:301:34: warning: 'bt1_axi_of_match' defined but not used [-Wunused-variable] 301 | static const struct of_device_id bt1_axi_of_match[] = {
| ^~~~~~~~~~~~~~~~

vim +301 drivers/bus/bt1-axi.c

300

 > 301	static const struct of_device_id bt1_axi_of_match[] = {
 > 302		{ .compatible = "baikal,bt1-axi" },

303 { }
304 };
305 MODULE_DEVICE_TABLE(of, bt1_axi_of_match);
306

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#8 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 34 lines · kbuild test robot

Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7 next-20200526] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/
37406982]

url: https://github.com/0day-ci/linux/commits/Serge-Semin/bus-
memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
for-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):

        # save the attached .config to linux build tree
        make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

Quoted 1 line
Quoted 1 line

drivers/bus/bt1-axi.c:301:34: error: array type has incomplete element

type 'struct of_device_id'
301 | static const struct of_device_id bt1_axi_of_match[] = {
| ^~~~~~~~~~~~~~~~

Quoted 1 line
Quoted 1 line

drivers/bus/bt1-axi.c:302:4: error: field name not in record or union

Quoted 11 lines

initializer
302 | { .compatible = "baikal,bt1-axi" },
| ^
drivers/bus/bt1-axi.c:302:4: note: (near initialization for 'bt1_axi_of_match')
drivers/bus/bt1-axi.c:301:34: warning: 'bt1_axi_of_match' defined but not used [-Wunused-variable]
301 | static const struct of_device_id bt1_axi_of_match[] = {
| ^~~~~~~~~~~~~~~~

I wish kbuild bot be intelligent for such cases ;)

#include <linux/mod_devicetable.h>
will fix this.

vim +301 drivers/bus/bt1-axi.c

Quoted 13 lines
   300
Quoted 2 lines

301 static const struct of_device_id bt1_axi_of_match[] = {
302 { .compatible = "baikal,bt1-axi" },

303 { }

   304  };
   305  MODULE_DEVICE_TABLE(of, bt1_axi_of_match);
   306

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

In reply to Serge Semin
I love your patch! Yet something to improve:

Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7 next-20200526] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/bus-memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc

If you fix the issue, kindly add following tag as appropriate

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

drivers/bus/bt1-axi.c: In function 'inject_error_store':
drivers/bus/bt1-axi.c:228:3: error: implicit declaration of function 'readb' [-Werror=implicit-function-declaration]
228 | readb(axi->qos_regs);
| ^~~~~
drivers/bus/bt1-axi.c:230:3: error: implicit declaration of function 'writeb' [-Werror=implicit-function-declaration]
230 | writeb(0, axi->qos_regs);
| ^~~~~~
In file included from include/linux/kobject.h:20,
from include/linux/module.h:20,
from drivers/bus/bt1-axi.c:12:
drivers/bus/bt1-axi.c: At top level:

>> drivers/bus/bt1-axi.c:236:23: error: initialization of 'ssize_t (*)(struct device *, struct device_attribute *, char *)' {aka 'long int (*)(struct device *, struct device_attribute *, char *)'} from incompatible pointer type 'int (*)(struct device *, struct device_attribute *, char *)' [-Werror=incompatible-pointer-types]

236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, | ^~~~~

>> include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 |  struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
|                                             ^~~~~~~~~
>> drivers/bus/bt1-axi.c:236:8: note: in expansion of macro 'DEVICE_ATTR_RW'

236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
drivers/bus/bt1-axi.c:236:23: note: (near initialization for 'dev_attr_inject_error.show') 236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, | ^~~~~

>> include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 |  struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
|                                             ^~~~~~~~~
>> drivers/bus/bt1-axi.c:236:8: note: in expansion of macro 'DEVICE_ATTR_RW'
236 | static DEVICE_ATTR_RW(inject_error);
|        ^~~~~~~~~~~~~~
>> drivers/bus/bt1-axi.c:236:23: error: initialization of 'ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t)' {aka 'long int (*)(struct device *, struct device_attribute *, const char *, long unsigned int)'} from incompatible pointer type 'int (*)(struct device *, struct device_attribute *, const char *, size_t)' {aka 'int (*)(struct device *, struct device_attribute *, const char *, long unsigned int)'} [-Werror=incompatible-pointer-types]

236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, | ^~~~~~

>> include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 |  struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
|                                             ^~~~~~~~~
>> drivers/bus/bt1-axi.c:236:8: note: in expansion of macro 'DEVICE_ATTR_RW'

236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
drivers/bus/bt1-axi.c:236:23: note: (near initialization for 'dev_attr_inject_error.store') 236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, | ^~~~~~

>> include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 |  struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
|                                             ^~~~~~~~~
>> drivers/bus/bt1-axi.c:236:8: note: in expansion of macro 'DEVICE_ATTR_RW'

236 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +236 drivers/bus/bt1-axi.c

215
216 static int inject_error_store(struct device *dev,
217 struct device_attribute *attr,
218 const char *data, size_t count)
219 {
220 struct bt1_axi *axi = dev_get_drvdata(dev);
221
222 /*
223 * Performing unaligned read from the memory will cause the CM2 bus
224 * error while unaligned writing - the AXI bus write error handled
225 * by this driver.
226 */
227 if (!strncmp(data, "bus", 3))
228 readb(axi->qos_regs);
229 else if (!strncmp(data, "unaligned", 9))
230 writeb(0, axi->qos_regs);
231 else
232 return -EINVAL;
233
234 return count;
235 }

 > 236	static DEVICE_ATTR_RW(inject_error);

237

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

A message that is not in the archive (sent off-list or not yet received): CAHp75VcfkPPy5YjNrcv8c6doyQz5C47QyREE0v6tfQjXYrBijQ@mail.gmail.com

#11 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 16 lines · Andy Shevchenko
Quoted 12 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 1 line

Few comments in case if you need a new version. Main point is about sysfs_streq().

I've applied the patch now and folded in fixes for the build warnings and errors pointed out by the test robot, but I did not include the changes you suggested.

Serge, could you send a follow-up patch to address those?

Arnd

#12 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 18 lines · Arnd Bergmann
Quoted 16 lines · Andy Shevchenko
Quoted 12 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 5 lines
Quoted 1 line

Few comments in case if you need a new version. Main point is about sysfs_streq().

I've applied the patch now and folded in fixes for the build warnings and errors pointed out by the test robot, but I did not include the changes you suggested.

Are you saying that the build-errors and warnings have already been fixed by you, right? If so could you please give me a link to the repo with those commits, so I'd work with the up-to-date code?

Quoted 2 lines

Serge, could you send a follow-up patch to address those?

Ok.

-Sergey

Quoted 2 lines

Arnd

#13 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 22 lines · Serge Semin
Quoted 20 lines · Arnd Bergmann
Quoted 17 lines · Andy Shevchenko
Quoted 12 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Few comments in case if you need a new version. Main point is about sysfs_streq().

Quoted 7 lines
Quoted 3 lines

I've applied the patch now and folded in fixes for the build warnings and errors pointed out by the test robot, but I did not include the changes you suggested.

Are you saying that the build-errors and warnings have already been fixed by you, right? If so could you please give me a link to the repo with those commits, so I'd work with the up-to-date code?

I've pushed it to https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git/,

I made a local "baikal/drivers" branch with just your patches, updated to address the build reports. This is merged into the "arm/drivers" branch that contains all driver specific changes across all SoCs and this is what I'll send to Linus next week.

There is also the "for-next" branch that contains all arm/* branches, and this is what gets pulled into linux-next, so your patches will show up there tomorrow as well.

You can normally check the status of any submission to [email protected] at https://patchwork.kernel.org/project/linux-soc/list/, but it seems that has not picked up the status yet, and I'll have to update it manually.

Arnd

#14 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 35 lines · Arnd Bergmann
Quoted 22 lines · Serge Semin
Quoted 20 lines · Arnd Bergmann
Quoted 17 lines · Andy Shevchenko
Quoted 12 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Few comments in case if you need a new version. Main point is about sysfs_streq().

Quoted 7 lines
Quoted 3 lines

I've applied the patch now and folded in fixes for the build warnings and errors pointed out by the test robot, but I did not include the changes you suggested.

Are you saying that the build-errors and warnings have already been fixed by you, right? If so could you please give me a link to the repo with those commits, so I'd work with the up-to-date code?

I've pushed it to https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git/,

Quoted 8 lines

I made a local "baikal/drivers" branch with just your patches, updated to address the build reports. This is merged into the "arm/drivers" branch that contains all driver specific changes across all SoCs and this is what I'll send to Linus next week.

There is also the "for-next" branch that contains all arm/* branches, and this is what gets pulled into linux-next, so your patches will show up there tomorrow as well.

I see. Thanks for explanation. I've monitored the soc/soc.git a few minutes ago, but the gitolite web-interface showed me that the last update was made 9 hours ago. So I thought you could be using some another repo. Now I see the fresh updates and the drivers being merges.

I'll address the Andy's comments and send a follow-up patches with fixes shortly today.

BTW I don't see the next commit:
[PATCH v3 3/6] dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding in the baikal/drivers, so the l2-ctl binding hasn't been merged into the arm/drivers and for-next branches. You must have missed that patch. Could you please make sure it's also merged in?

Thanks
-Sergey

Quoted 6 lines

You can normally check the status of any submission to [email protected] at https://patchwork.kernel.org/project/linux-soc/list/, but it seems that has not picked up the status yet, and I'll have to update it manually.

Arnd

#15 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

In reply to Arnd Bergmann
Quoted 18 lines · Arnd Bergmann
Quoted 16 lines · Andy Shevchenko
Quoted 12 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 5 lines
Quoted 1 line

Few comments in case if you need a new version. Main point is about sysfs_streq().

I've applied the patch now and folded in fixes for the build warnings and errors pointed out by the test robot, but I did not include the changes you suggested.

On the other hand if you haven't pushed the patches to the public repo yet, I could just resend the series. So have you?

-Sergey

Quoted 6 lines

Serge, could you send a follow-up patch to address those?

Arnd

#16 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

In reply to a message not in the archive
Quoted 17 lines · Andy Shevchenko
Quoted 11 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 2 lines

Few comments in case if you need a new version. Main point is about sysfs_streq().

Hello, Andy. Thanks for your comments. I'll address most of them in a follow-up patches. See just one note below.

Quoted 11 lines
Quoted 11 lines

[nip]

Quoted 11 lines

drivers/bus/bt1-axi.c line 87

Quoted 7 lines
drivers/bus/bt1-axi.c new file +7 -0
+
+static void bt1_axi_clear_data(void *data)
+{
+       struct bt1_axi *axi = data;
+       struct platform_device *pdev = to_platform_device(axi->dev);
+
+       platform_set_drvdata(pdev, NULL);

Doesn't device driver core do this already?

It doesn't on remove. This cleanups the drvdata pointer when the driver is unloaded at the moment of remove() callback calling. This is a good practice to leave the device the same as it has been before usage including the pointer value. In this case if theoretically someone (though very unlikely, but anyway) would try to use the pointer without having it initialized, the NULL-dereference would pop up, otherwise we may corrupt someones memory, which is very nasty.

-Sergey

#17 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 49 lines · Serge Semin
Quoted 17 lines · Andy Shevchenko
Quoted 11 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 2 lines

Few comments in case if you need a new version. Main point is about sysfs_streq().

Hello, Andy. Thanks for your comments. I'll address most of them in a follow-up patches. See just one note below.

Quoted 11 lines
Quoted 11 lines

[nip]

Quoted 9 lines
Quoted 7 lines
drivers/bus/bt1-axi.c new file +7 -0
+
+static void bt1_axi_clear_data(void *data)
+{
+       struct bt1_axi *axi = data;
+       struct platform_device *pdev = to_platform_device(axi->dev);
+
+       platform_set_drvdata(pdev, NULL);
Quoted 3 lines
Quoted 1 line

Doesn't device driver core do this already?

It doesn't on remove.

__device_release_driver() calls dev_set_drvdata(dev, NULL); What did I miss?

Quoted 7 lines

This cleanups the drvdata pointer when the driver is
unloaded at the moment of remove() callback calling. This is a good practice to leave the device the same as it has been before usage including the pointer value. In this case if theoretically someone (though very unlikely, but anyway) would try to use the pointer without having it initialized, the NULL-dereference would pop up, otherwise we may corrupt someones memory, which is very nasty.

The above is right and I agree with.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#18 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

Quoted 67 lines · Andy Shevchenko
Quoted 49 lines · Serge Semin
Quoted 17 lines · Andy Shevchenko
Quoted 11 lines · Serge Semin

AXI3-bus is the main communication bus connecting all high-speed peripheral IP-cores with RAM controller and MIPS P5600 cores on Baikal-T1 SoC. Bus traffic arbitration is done by means of DW AMBA 3 AXI Interconnect (so called AXI Main Interconnect) routing IO requests from one SoC block to another. This driver provides a way to detect any bus protocol errors and device not responding situations by means of an embedded on top of the interconnect errors handler block (EHB). AXI Interconnect QoS arbitration tuning is currently unsupported. The bus doesn't provide a way to detect the interconnected devices, so they are supposed to be statically defined like by means of the simple-bus sub-nodes.

Quoted 2 lines

Few comments in case if you need a new version. Main point is about sysfs_streq().

Hello, Andy. Thanks for your comments. I'll address most of them in a follow-up patches. See just one note below.

Quoted 11 lines
Quoted 11 lines

[nip]

Quoted 9 lines
Quoted 7 lines
drivers/bus/bt1-axi.c new file +7 -0
+
+static void bt1_axi_clear_data(void *data)
+{
+       struct bt1_axi *axi = data;
+       struct platform_device *pdev = to_platform_device(axi->dev);
+
+       platform_set_drvdata(pdev, NULL);
Quoted 3 lines
Quoted 1 line

Doesn't device driver core do this already?

It doesn't on remove.

__device_release_driver() calls dev_set_drvdata(dev, NULL); What did I miss?

Quoted 7 lines

This cleanups the drvdata pointer when the driver is
unloaded at the moment of remove() callback calling. This is a good practice to leave the device the same as it has been before usage including the pointer value. In this case if theoretically someone (though very unlikely, but anyway) would try to use the pointer without having it initialized, the NULL-dereference would pop up, otherwise we may corrupt someones memory, which is very nasty.

Quoted 1 line

The above is right and I agree with.

Hm, good point. I missed that part of __device_release_driver(). So do you suggest to remove that cleanup?

-Sergey

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko
#19 lore raw

Re: [PATCH v3 4/6] bus: Add Baikal-T1 AXI-bus driver

In reply to Serge Semin
I love your patch! Perhaps something to improve:

Hi Serge,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7] [cannot apply to next-20200529]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/bus-memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate

cppcheck warnings: (new ones prefixed by >>)

>> drivers/net/ethernet/netronome/nfp/flower/offload.c:1129:44: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
     size = key_layer & NFP_FLOWER_LAYER_IPV4 ?
                                              ^
--
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:3555:2: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
    data = qlcnic_83xx_fill_stats(adapter, &cmd, data,
    ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic.h:1836:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return adapter->ahw->extra_capability[0] &
    ^
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:3858:9: warning: Identical condition 'err', second condition is always false [identicalConditionAfterEarlyExit]
    return err;
           ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:3853:6: note: first condition
    if (err)
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:3858:9: note: second condition
    return err;
           ^
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:485:12: warning: Variable 'intr_val' is reassigned a value before the old one has been used. [redundantAssignment]
     intr_val = readl(adapter->tgt_status_reg);
              ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:483:11: note: Variable 'intr_val' is reassigned a value before the old one has been used.
    intr_val = readl(adapter->isr_int_vec);
             ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:485:12: note: Variable 'intr_val' is reassigned a value before the old one has been used.
     intr_val = readl(adapter->tgt_status_reg);
              ^
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2385:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2375:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int i, err = -EIO;
   ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2385:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO);
        ^
>> drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2825:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2809:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    int ret = -EIO;
   ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2825:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2881:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2874:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    int ret = -EIO;
   ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2881:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2917:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2895:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    int ret = -EIO, err = 0;
   ^
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c:2917:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = qlcnic_83xx_poll_flash_status_reg(adapter);
        ^
>> drivers/net/macvlan.c:83:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return port->flags & MACVLAN_F_ADDRCHANGE;
    ^
>> drivers/net/macvlan.c:763:57: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
      dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1);
                                                           ^
   drivers/net/macvlan.c:766:35: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
            dev->flags & IFF_PROMISC ? 1 : -1);
                                     ^
>> drivers/net/macvlan.c:1092:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = __netpoll_setup(netpoll, real_dev);
        ^
   drivers/net/macvlan.c:1088:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = -ENOMEM;
        ^
   drivers/net/macvlan.c:1092:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = __netpoll_setup(netpoll, real_dev);
        ^
--
>> drivers/net/ethernet/realtek/r8169_main.c:800:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, GPHY_OCP) & OCPAR_FLAG;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:893:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, PHYAR) & 0x80000000;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:928:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, OCPAR) & OCPAR_FLAG;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:1032:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, EPHYAR) & EPHYAR_FLAG;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:1055:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, ERIAR) & ERIAR_FLAG;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:1157:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return r8168dp_ocp_read(tp, 0x0f, reg) & 0x00000800;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:1167:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R8(tp, IBISR0) & 0x20;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:1275:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, EFUSEAR) & EFUSEAR_FLAG;
    ^
   drivers/net/ethernet/realtek/r8169_main.c:2694:2: warning: Non-boolean value returned from function returning bool [returnNonBoolInBooleanFunction]
    return RTL_R32(tp, CSIAR) & CSIAR_FLAG;
    ^
>> drivers/net/ethernet/realtek/r8169_main.c:4740:9: warning: Variable 'retval' is reassigned a value before the old one has been used. [redundantAssignment]
    retval = rtl8169_init_ring(tp);
           ^
   drivers/net/ethernet/realtek/r8169_main.c:4722:0: note: Variable 'retval' is reassigned a value before the old one has been used.
    int retval = -ENOMEM;
   ^
   drivers/net/ethernet/realtek/r8169_main.c:4740:9: note: Variable 'retval' is reassigned a value before the old one has been used.
    retval = rtl8169_init_ring(tp);
           ^
>> drivers/net/ethernet/realtek/r8169_main.c:474:16: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    DescOwn  = (1 << 31), /* Descriptor is owned by NIC */
                  ^
   drivers/net/ethernet/realtek/r8169_main.c:514:18: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    TD1_UDP_CS = (1 << 31),  /* Calculate UDP/IP checksum */
                    ^
--
   In file included from drivers/net/ethernet/sfc/ef10.c:
>> drivers/net/ethernet/sfc/ef10.c:308:21: warning: Either the condition 'rc<0' is redundant or there is division by zero@line 308. [zerodivcond]
     quantum = 1536000 / rc; /* 1536 cycles */
                       ^
   drivers/net/ethernet/sfc/ef10.c:305:10: note: Assuming that condition 'rc<0' is not redundant
     if (rc < 0)
            ^
   drivers/net/ethernet/sfc/ef10.c:308:21: note: Division by zero
     quantum = 1536000 / rc; /* 1536 cycles */
                       ^
>> drivers/net/ethernet/sfc/ef10.c:2718:29: warning: Local variable nic_data shadows outer variable [shadowVar]
     struct efx_ef10_nic_data *nic_data = efx->nic_data;
                               ^
   drivers/net/ethernet/sfc/ef10.c:2682:28: note: Shadowed declaration
    struct efx_ef10_nic_data *nic_data = efx->nic_data;
                              ^
   drivers/net/ethernet/sfc/ef10.c:2718:29: note: Shadow variable
     struct efx_ef10_nic_data *nic_data = efx->nic_data;
                               ^
>> drivers/net/ethernet/sfc/ef10.c:2700:7: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
      (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN) ?
         ^
   drivers/net/ethernet/sfc/ef10.c:3721:9: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
        (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN))) {
           ^
   drivers/net/ethernet/sfc/ef10.c:3842:11: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
          (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN)))
             ^
   drivers/net/ethernet/sfc/ef10.c:3903:11: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
          (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN)))
             ^
   drivers/net/ethernet/sfc/ef10.c:3924:11: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
          (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN)))
             ^
>> drivers/net/ethernet/sfc/ef10.c:2700:55: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
      (1 << MC_CMD_GET_CAPABILITIES_OUT_VXLAN_NVGRE_LBN) ?
                                                         ^
   drivers/net/ethernet/sfc/ef10.c:3255:30: warning: Local variable nic_data shadows outer variable [shadowVar]
      struct efx_ef10_nic_data *nic_data = efx_pf->nic_data;
                                ^
   drivers/net/ethernet/sfc/ef10.c:3214:28: note: Shadowed declaration
    struct efx_ef10_nic_data *nic_data = efx->nic_data;
                              ^
   drivers/net/ethernet/sfc/ef10.c:3255:30: note: Shadow variable
      struct efx_ef10_nic_data *nic_data = efx_pf->nic_data;
                                ^
>> drivers/net/ethernet/qlogic/qed/qed_roce.c:809:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_sp_init_request(p_hwfn, &p_ent, ROCE_RAMROD_DESTROY_QP,
       ^
   drivers/net/ethernet/qlogic/qed/qed_roce.c:786:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -ENOMEM;
   ^
   drivers/net/ethernet/qlogic/qed/qed_roce.c:809:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_sp_init_request(p_hwfn, &p_ent, ROCE_RAMROD_DESTROY_QP,
       ^
   drivers/net/ethernet/qlogic/qed/qed_roce.c:890:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_sp_init_request(p_hwfn, &p_ent, ROCE_RAMROD_QUERY_QP,
       ^
   drivers/net/ethernet/qlogic/qed/qed_roce.c:853:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -ENOMEM;
   ^
   drivers/net/ethernet/qlogic/qed/qed_roce.c:890:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_sp_init_request(p_hwfn, &p_ent, ROCE_RAMROD_QUERY_QP,
       ^
>> drivers/net/ethernet/qlogic/qed/qed_rdma.c:1692:9: warning: Identical condition 'rc', second condition is always false [identicalConditionAfterEarlyExit]
    return rc;
           ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1686:6: note: first condition
    if (rc)
        ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1692:9: note: second condition
    return rc;
           ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1735:9: warning: Identical condition 'rc', second condition is always false [identicalConditionAfterEarlyExit]
    return rc;
           ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1723:6: note: first condition
    if (rc)
        ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1735:9: note: second condition
    return rc;
           ^
>> drivers/net/ethernet/qlogic/qed/qed_rdma.c:206:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_rdma_bmap_alloc(p_hwfn, &p_rdma_info->pd_map, RDMA_MAX_PDS,
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:167:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -ENOMEM;
   ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:206:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_rdma_bmap_alloc(p_hwfn, &p_rdma_info->pd_map, RDMA_MAX_PDS,
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:761:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_sp_init_request(p_hwfn, &p_ent, RDMA_RAMROD_FUNC_CLOSE,
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:722:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -EBUSY;
   ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:761:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_sp_init_request(p_hwfn, &p_ent, RDMA_RAMROD_FUNC_CLOSE,
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1131:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_sp_init_request(p_hwfn, &p_ent,
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1109:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -ENOMEM;
   ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1131:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_sp_init_request(p_hwfn, &p_ent,
       ^
>> drivers/net/ethernet/qlogic/qed/qed_rdma.c:1771:13: warning: Variable 'opaque_fid' is reassigned a value before the old one has been used. [redundantAssignment]
    opaque_fid = p_hwfn->hw_info.opaque_fid;
               ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1769:13: note: Variable 'opaque_fid' is reassigned a value before the old one has been used.
    opaque_fid = p_hwfn->hw_info.opaque_fid;
               ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1771:13: note: Variable 'opaque_fid' is reassigned a value before the old one has been used.
    opaque_fid = p_hwfn->hw_info.opaque_fid;
               ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1860:5: warning: Variable 'rc' is reassigned a value before the old one has been used. [redundantAssignment]
    rc = qed_rdma_alloc(p_hwfn);
       ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1851:0: note: Variable 'rc' is reassigned a value before the old one has been used.
    int rc = -EBUSY;
   ^
   drivers/net/ethernet/qlogic/qed/qed_rdma.c:1860:5: note: Variable 'rc' is reassigned a value before the old one has been used.
    rc = qed_rdma_alloc(p_hwfn);
       ^
>> drivers/bus/bt1-axi.c:67:29: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
     high & BT1_AXI_WERRH_TYPE ? "no slave" : "slave protocol error",
                               ^
--
>> drivers/clk/ingenic/cgu.c:39:3: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
     ^ info->clear_to_gate;
     ^
>> drivers/clk/ingenic/cgu.c:729:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = clk_register_clkdev(clk, clk_info->name, NULL);
        ^
   drivers/clk/ingenic/cgu.c:604:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int err = -EINVAL;
   ^
   drivers/clk/ingenic/cgu.c:729:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = clk_register_clkdev(clk, clk_info->name, NULL);
        ^
>> drivers/clk/ingenic/jz4780-cgu.c:220:22: warning: Local variable cgu shadows outer variable [shadowVar]
    struct ingenic_cgu *cgu = ingenic_clk->cgu;
                        ^
   drivers/clk/ingenic/jz4780-cgu.c:100:28: note: Shadowed declaration
   static struct ingenic_cgu *cgu;
                              ^
   drivers/clk/ingenic/jz4780-cgu.c:220:22: note: Shadow variable
    struct ingenic_cgu *cgu = ingenic_clk->cgu;
                        ^
--
>> fs/ceph/inode.c:1042:6: warning: Variable 'err' is reassigned a value before the old one has been used. 'break;' missing? [redundantAssignInSwitch]
    err = 0;
        ^
   fs/ceph/inode.c:950:8: note: Variable 'err' is reassigned a value before the old one has been used. 'break;' missing?
      err = -ENOMEM;
          ^
   fs/ceph/inode.c:1042:6: note: Variable 'err' is reassigned a value before the old one has been used. 'break;' missing?
    err = 0;
        ^
>> fs/ceph/dir.c:966:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = ceph_pre_init_acls(dir, &mode, &as_ctx);
        ^
   fs/ceph/dir.c:944:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int err = -EROFS;
   ^
   fs/ceph/dir.c:966:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = ceph_pre_init_acls(dir, &mode, &as_ctx);
        ^
   fs/ceph/dir.c:1161:7: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
     err = ceph_mdsc_submit_request(mdsc, dir, req);
         ^
   fs/ceph/dir.c:1125:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int err = -EROFS;
   ^
   fs/ceph/dir.c:1161:7: note: Variable 'err' is reassigned a value before the old one has been used.
     err = ceph_mdsc_submit_request(mdsc, dir, req);
         ^
>> fs/ceph/file.c:2324:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = file_write_and_wait_range(src_file, src_off, (src_off + len));
        ^
   fs/ceph/file.c:2271:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    ssize_t ret = -EIO, bytes;
   ^
   fs/ceph/file.c:2324:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = file_write_and_wait_range(src_file, src_off, (src_off + len));
        ^
>> fs/ceph/file.c:938:12: warning: Local variable len shadows outer variable [shadowVar]
       size_t len, copied;
              ^
   fs/ceph/file.c:840:6: note: Shadowed declaration
    u64 len = iov_iter_count(to);
        ^
   fs/ceph/file.c:938:12: note: Shadow variable
       size_t len, copied;
              ^
   fs/ceph/file.c:612:70: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ?
                                                                        ^
--
>> fs/ceph/export.c:79:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = FILEID_BTRFS_WITH_PARENT;
        ^
   fs/ceph/export.c:51:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret =  -EINVAL;
        ^
   fs/ceph/export.c:79:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = FILEID_BTRFS_WITH_PARENT;
        ^
>> fs/ceph/export.c:494:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = -ENOENT;
        ^
   fs/ceph/export.c:416:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int err = -EINVAL;
   ^
   fs/ceph/export.c:494:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = -ENOENT;
        ^
>> fs/ceph/caps.c:2253:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = ceph_wait_on_async_create(inode);
        ^
   fs/ceph/caps.c:2249:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = file_write_and_wait_range(file, start, end);
        ^
   fs/ceph/caps.c:2253:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = ceph_wait_on_async_create(inode);
        ^
   fs/ceph/caps.c:2752:38: warning: Same expression on both sides of '||'. [duplicateExpression]
    if (ret == -EAGAIN || ret == -EFBIG || ret == -EAGAIN)
                                        ^
   fs/ceph/caps.c:609:33: warning: Function 'ceph_add_cap' argument order different: declaration 'inode, session, cap_id, issued, wanted, cap, seq, realmino, flags, new_cap' definition 'inode, session, cap_id, issued, wanted, seq, mseq, realmino, flags, new_cap' [funcArgOrderDifferent]
   void ceph_add_cap(struct inode *inode,
                                   ^
   fs/ceph/super.h:1051:40: note: Function 'ceph_add_cap' argument order different: declaration 'inode, session, cap_id, issued, wanted, cap, seq, realmino, flags, new_cap' definition 'inode, session, cap_id, issued, wanted, seq, mseq, realmino, flags, new_cap'
   extern void ceph_add_cap(struct inode *inode,
                                          ^
   fs/ceph/caps.c:609:33: note: Function 'ceph_add_cap' argument order different: declaration 'inode, session, cap_id, issued, wanted, cap, seq, realmino, flags, new_cap' definition 'inode, session, cap_id, issued, wanted, seq, mseq, realmino, flags, new_cap'
   void ceph_add_cap(struct inode *inode,
                                   ^
>> drivers/hwmon/nct7904.c:208:18: warning: Either the condition 'ret<0' is redundant or there is division by zero@line 208. [zerodivcond]
      rpm = 1350000 / cnt;
                    ^
   drivers/hwmon/nct7904.c:202:11: note: Assuming that condition 'ret<0' is not redundant
     if (ret < 0)
             ^
   drivers/hwmon/nct7904.c:204:31: note: Assignment 'cnt=((ret&65280)>>3)|(ret&31)', assigned value is 0
     cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
                                 ^
   drivers/hwmon/nct7904.c:208:18: note: Division by zero
      rpm = 1350000 / cnt;
                    ^
   drivers/hwmon/nct7904.c:220:18: warning: Either the condition 'ret<0' is redundant or there is division by zero@line 220. [zerodivcond]
      rpm = 1350000 / cnt;
                    ^
   drivers/hwmon/nct7904.c:214:11: note: Assuming that condition 'ret<0' is not redundant
     if (ret < 0)
             ^
   drivers/hwmon/nct7904.c:216:31: note: Assignment 'cnt=((ret&65280)>>3)|(ret&31)', assigned value is 0
     cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
                                 ^
   drivers/hwmon/nct7904.c:220:18: note: Division by zero
      rpm = 1350000 / cnt;
                    ^
>> drivers/hwmon/nct7904.c:398:29: warning: Shifting a negative value is technically undefined behaviour [shiftNegativeLHS]
                ((channel - 5) >> 3));
                               ^
--
   In file included from drivers/md/raid5.c:
   drivers/md/md.h:617:9: warning: Identical condition 'sd', second condition is always false [identicalConditionAfterEarlyExit]
    return sd;
           ^
   drivers/md/md.h:615:6: note: first condition
    if (sd)
        ^
   drivers/md/md.h:617:9: note: second condition
    return sd;
           ^
>> drivers/md/raid5.c:179:26: warning: Local variable group shadows outer variable [shadowVar]
     struct r5worker_group *group;
                            ^
   drivers/md/raid5.c:169:25: note: Shadowed declaration
    struct r5worker_group *group;
                           ^
   drivers/md/raid5.c:179:26: note: Shadow variable
     struct r5worker_group *group;
                            ^
>> drivers/md/raid5.c:3181:7: warning: Local variable qd_idx shadows outer variable [shadowVar]
     int qd_idx = sh->qd_idx;
         ^
   drivers/md/raid5.c:3095:30: note: Shadowed declaration
    int i, pd_idx = sh->pd_idx, qd_idx = sh->qd_idx, disks = sh->disks;
                                ^
   drivers/md/raid5.c:3181:7: note: Shadow variable
     int qd_idx = sh->qd_idx;
         ^
>> drivers/md/raid5.c:1508:9: warning: Uninitialized variable: target [uninitvar]
    BUG_ON(target < 0);
           ^
--
>> drivers/net/ethernet/freescale/fec_main.c:2097:6: warning: Variable 'err' is reassigned a value before the old one has been used. [redundantAssignment]
    err = of_mdiobus_register(fep->mii_bus, node);
        ^
   drivers/net/ethernet/freescale/fec_main.c:2016:0: note: Variable 'err' is reassigned a value before the old one has been used.
    int err = -ENXIO;
   ^
   drivers/net/ethernet/freescale/fec_main.c:2097:6: note: Variable 'err' is reassigned a value before the old one has been used.
    err = of_mdiobus_register(fep->mii_bus, node);
        ^
>> drivers/net/ethernet/freescale/fec_main.c:868:34: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(rxq->bd.dma, fep->hwp + FEC_R_DES_START(i));
                                    ^
   drivers/net/ethernet/freescale/fec_main.c:869:38: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(PKT_MAXBUF_SIZE, fep->hwp + FEC_R_BUFF_SIZE(i));
                                        ^
   drivers/net/ethernet/freescale/fec_main.c:874:22: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
             fep->hwp + FEC_RCMR(i));
                        ^
   drivers/net/ethernet/freescale/fec_main.c:879:34: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
     writel(txq->bd.dma, fep->hwp + FEC_X_DES_START(i));
                                    ^
   drivers/net/ethernet/freescale/fec_main.c:883:26: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
      writel(DMA_CLASS_EN | IDLE_SLOPE(i),
                            ^
   drivers/net/ethernet/freescale/fec_main.c:884:22: warning: Same value in both branches of ternary operator. [duplicateValueTernary]
             fep->hwp + FEC_DMA_CFG(i));
                        ^
>> drivers/net/ethernet/freescale/fec_main.c:1524:23: warning: Local variable ebdp shadows outer variable [shadowVar]
      struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
                         ^
   drivers/net/ethernet/freescale/fec_main.c:1370:21: note: Shadowed declaration
    struct bufdesc_ex *ebdp = NULL;
                       ^
   drivers/net/ethernet/freescale/fec_main.c:1524:23: note: Shadow variable
      struct bufdesc_ex *ebdp = (struct bufdesc_ex *)bdp;
                         ^
>> drivers/net/ethernet/freescale/fec_main.c:1074:11: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    writel(0 << 31, fep->hwp + FEC_MIB_CTRLSTAT);
             ^
   drivers/net/ethernet/freescale/fec_main.c:2481:12: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    rx_itr |= FEC_ITR_EN;
              ^
   drivers/net/ethernet/freescale/fec_main.c:2482:12: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    tx_itr |= FEC_ITR_EN;
              ^
>> drivers/net/ethernet/freescale/fec_main.c:3050:18: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour. See condition at line 3047. [shiftTooManyBitsSigned]
      hash_low |= 1 << hash;
                    ^
   drivers/net/ethernet/freescale/fec_main.c:3047:12: note: Assuming that condition 'hash>31' is not redundant
     if (hash > 31)
              ^
   drivers/net/ethernet/freescale/fec_main.c:3050:18: note: Shift
      hash_low |= 1 << hash;
                    ^
>> drivers/net/ethernet/freescale/fec_main.c:2612:54: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
     wol->wolopts = fep->wol_flag & FEC_WOL_FLAG_ENABLE ? WAKE_MAGIC : 0;
                                                        ^
>> drivers/net/ethernet/freescale/fec_main.c:915:6: warning: Unused variable: val [unusedVariable]
    u32 val;
        ^
>> drivers/net/ethernet/8390/ne2k-pci.c:185:18: warning: struct member 'ne2k_pci_card::pci_dev' is never used. [unusedStructMember]
    struct pci_dev *pci_dev;
                    ^
>> drivers/net/ethernet/8390/ne2k-pci.c:346:35: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    stop_page = flags & STOP_PG_0x60 ? 0x60 : NESM_STOP_PG;
                                     ^
--
>> drivers/pci/pcie/aer.c:673:1: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
   aer_stats_dev_attr(aer_dev_correctable, dev_cor_errs,
   ^
   drivers/pci/pcie/aer.c:676:1: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
   aer_stats_dev_attr(aer_dev_fatal, dev_fatal_errs,
   ^
   drivers/pci/pcie/aer.c:679:1: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
   aer_stats_dev_attr(aer_dev_nonfatal, dev_nonfatal_errs,
   ^
>> drivers/pci/quirks.c:3208:54: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    pci_write_config_dword(dev, VTUNCERRMSK_REG, word | VTD_MSK_SPEC_ERRORS);
                                                        ^

vim +67 drivers/bus/bt1-axi.c

    55	
    56	static irqreturn_t bt1_axi_isr(int irq, void *data)
    57	{
    58		struct bt1_axi *axi = data;
    59		u32 low = 0, high = 0;
    60	
    61		regmap_read(axi->sys_regs, BT1_AXI_WERRL, &low);
    62		regmap_read(axi->sys_regs, BT1_AXI_WERRH, &high);
    63	
    64		dev_crit_ratelimited(axi->dev,
    65			"AXI-bus fault %d: %s at 0x%x%08x\n",
    66			atomic_inc_return(&axi->count),
  > 67			high & BT1_AXI_WERRH_TYPE ? "no slave" : "slave protocol error",
    68			high, low);
    69	
    70		/*
    71		 * Print backtrace on each CPU. This might be pointless if the fault
    72		 * has happened on the same CPU as the IRQ handler is executed or
    73		 * the other core proceeded further execution despite the error.
    74		 * But if it's not, by looking at the trace we would get straight to
    75		 * the cause of the problem.
    76		 */
    77		trigger_all_cpu_backtrace();
    78	
    79		return IRQ_HANDLED;
    80	}
    81	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#20 lore raw

PATCH v3 5/6 bus: Add Baikal-T1 APB-bus driver

In reply to Serge Semin

Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs. IO requests are routed to this bus by means of the DW AMBA 3 AXI Interconnect. In case if an attempted APB transaction stays with no response for a pre-defined time an interrupt occurs and the bus gets freed for a next operation. This driver provides the interrupt handler to detect the erroneous address, prints an error message about the address fault, updates an errors counter. The counter and the APB-bus operations timeout can be accessed via corresponding sysfs nodes. A dedicated sysfs-node can be also used to artificially cause the bus errors described above.

---

Changelog v2:
- Fix commit message and Kconfig help text spelling.
- Move driver from soc to the bus subsystem.
- Convert a simple EHB driver to the Baikal-T1 AXI-bus one.
- Convert registers MMIO to the regmap.
- Add reset line support.
- Remove probe-status info string printout.
- Since the driver depends on the OF config we can remove of_match_ptr() macro utilization.
- Don't print error-message if no platform IRQ found. Just return an error.

Changelog v3:
- Discard CONFIG_OF dependency since there is none at compile-time.

---
 drivers/bus/Kconfig   |  15 ++
 drivers/bus/Makefile  |   1 +
 drivers/bus/bt1-apb.c | 421 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 437 insertions(+)
 create mode 100644 drivers/bus/bt1-apb.c
drivers/bus/Kconfig +15 -0
index 1080dd26e268..030f0e59f193 100644
@@ -29,6 +29,21 @@ config BRCMSTB_GISB_ARB
 	  arbiter. This driver provides timeout and target abort error handling
 	  and internal bus master decoding.
 
+config BT1_APB
+	tristate "Baikal-T1 APB-bus driver"
+	depends on MIPS_BAIKAL_T1 || COMPILE_TEST
+	select REGMAP_MMIO
+	help
+	  Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs.
+	  IO requests are routed to this bus by means of the DW AMBA 3 AXI
+	  Interconnect. In case of any APB protocol collisions, slave device
+	  not responding on timeout an IRQ is raised with an erroneous address
+	  reported to the APB terminator (APB Errors Handler Block). This
+	  driver provides the interrupt handler to detect the erroneous
+	  address, prints an error message about the address fault, updates an
+	  errors counter. The counter and the APB-bus operations timeout can be
+	  accessed via corresponding sysfs nodes.
+
 config BT1_AXI
 	tristate "Baikal-T1 AXI-bus driver"
 	depends on MIPS_BAIKAL_T1 || COMPILE_TEST
drivers/bus/Makefile +1 -0
index eaa25d171ebd..08ccbfaf7705 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MOXTET)		+= moxtet.o
 # DPAA2 fsl-mc bus
 obj-$(CONFIG_FSL_MC_BUS)	+= fsl-mc/
 
+obj-$(CONFIG_BT1_APB)		+= bt1-apb.o
 obj-$(CONFIG_BT1_AXI)		+= bt1-axi.o
 obj-$(CONFIG_IMX_WEIM)		+= imx-weim.o
 obj-$(CONFIG_MIPS_CDMM)		+= mips_cdmm.o
drivers/bus/bt1-apb.c new file +421 -0

421 lines not on this page · raw message

Signature · 1 line
2.26.2
#21 lore raw

Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver

I love your patch! Yet something to improve:

Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7 next-20200526] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/bus-memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/bus/bt1-apb.c:404:34: error: array type has incomplete element type 'struct of_device_id'
404 | static const struct of_device_id bt1_apb_of_match[] = {
|                                  ^~~~~~~~~~~~~~~~
>> drivers/bus/bt1-apb.c:405:4: error: field name not in record or union initializer

405 | { .compatible = "baikal,bt1-apb" },
| ^
drivers/bus/bt1-apb.c:405:4: note: (near initialization for 'bt1_apb_of_match') drivers/bus/bt1-apb.c:404:34: warning: 'bt1_apb_of_match' defined but not used [-Wunused-variable] 404 | static const struct of_device_id bt1_apb_of_match[] = {
| ^~~~~~~~~~~~~~~~

vim +404 drivers/bus/bt1-apb.c

403

 > 404	static const struct of_device_id bt1_apb_of_match[] = {
 > 405		{ .compatible = "baikal,bt1-apb" },

406 { }
407 };
408 MODULE_DEVICE_TABLE(of, bt1_apb_of_match);
409

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#22 lore raw

Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver

In reply to Serge Semin
I love your patch! Yet something to improve:

Hi Serge,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on char-misc/char-misc-testing staging/staging-testing linus/master v5.7-rc7 next-20200526] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/bus-memory-Add-Baikal-T1-SoC-APB-AXI-L2-drivers/20200526-210837
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc

If you fix the issue, kindly add following tag as appropriate

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

drivers/bus/bt1-apb.c: In function 'inject_error_store':
drivers/bus/bt1-apb.c:329:3: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]
329 | readl(apb->res);
| ^~~~~
In file included from include/linux/kobject.h:20,
from include/linux/module.h:20,
from drivers/bus/bt1-apb.c:12:
drivers/bus/bt1-apb.c: At top level:

>> drivers/bus/bt1-apb.c:338:23: error: initialization of 'ssize_t (*)(struct device *, struct device_attribute *, char *)' {aka 'long int (*)(struct device *, struct device_attribute *, char *)'} from incompatible pointer type 'int (*)(struct device *, struct device_attribute *, char *)' [-Werror=incompatible-pointer-types]

338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, | ^~~~~
include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW' 130 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
| ^~~~~~~~~

>> drivers/bus/bt1-apb.c:338:8: note: in expansion of macro 'DEVICE_ATTR_RW'

338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
drivers/bus/bt1-apb.c:338:23: note: (near initialization for 'dev_attr_inject_error.show') 338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, | ^~~~~
include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
| ^~~~~~~~~

>> drivers/bus/bt1-apb.c:338:8: note: in expansion of macro 'DEVICE_ATTR_RW'
338 | static DEVICE_ATTR_RW(inject_error);
|        ^~~~~~~~~~~~~~
>> drivers/bus/bt1-apb.c:338:23: error: initialization of 'ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t)' {aka 'long int (*)(struct device *, struct device_attribute *, const char *, long unsigned int)'} from incompatible pointer type 'int (*)(struct device *, struct device_attribute *, const char *, size_t)' {aka 'int (*)(struct device *, struct device_attribute *, const char *, long unsigned int)'} [-Werror=incompatible-pointer-types]

338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, | ^~~~~~
include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW' 130 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
| ^~~~~~~~~

>> drivers/bus/bt1-apb.c:338:8: note: in expansion of macro 'DEVICE_ATTR_RW'

338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
drivers/bus/bt1-apb.c:338:23: note: (near initialization for 'dev_attr_inject_error.store') 338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, | ^~~~~~
include/linux/device.h:130:45: note: in expansion of macro '__ATTR_RW'
130 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
| ^~~~~~~~~

>> drivers/bus/bt1-apb.c:338:8: note: in expansion of macro 'DEVICE_ATTR_RW'

338 | static DEVICE_ATTR_RW(inject_error);
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +338 drivers/bus/bt1-apb.c

317
318 static int inject_error_store(struct device *dev,
319 struct device_attribute *attr,
320 const char *data, size_t count)
321 {
322 struct bt1_apb *apb = dev_get_drvdata(dev);
323
324 /*
325 * Either dummy read from the unmapped address in the APB IO area
326 * or manually set the IRQ status.
327 */
328 if (!strncmp(data, "nodev", 5))
329 readl(apb->res);
330 else if (!strncmp(data, "irq", 3))
331 regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING,
332 APB_EHB_ISR_PENDING);
333 else
334 return -EINVAL;
335
336 return count;
337 }

 > 338	static DEVICE_ATTR_RW(inject_error);

339

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#23 lore raw

Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver

In reply to Serge Semin
Quoted 21 lines · Serge Semin

Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs. IO requests are routed to this bus by means of the DW AMBA 3 AXI Interconnect. In case if an attempted APB transaction stays with no response for a pre-defined time an interrupt occurs and the bus gets freed for a next operation. This driver provides the interrupt handler to detect the erroneous address, prints an error message about the address fault, updates an errors counter. The counter and the APB-bus operations timeout can be accessed via corresponding sysfs nodes. A dedicated sysfs-node can be also used to artificially cause the bus errors described above.

Quoted 1 line

---

Applied with this fixup:

drivers/bus/bt1-apb.c +2 -1
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/nmi.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/clk.h>
 #include <linux/reset.h>
@@ -309,13 +310,13 @@ static ssize_t timeout_store(struct device *dev,
 }
 static DEVICE_ATTR_RW(timeout);
 
-static int inject_error_show(struct device *dev, struct device_attribute *attr,
+static ssize_t inject_error_show(struct device *dev, struct

device_attribute *attr,
char *buf)

 {
        return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");

}

-static int inject_error_store(struct device *dev, +static ssize_t inject_error_store(struct device *dev,
struct device_attribute *attr, const char *data, size_t count)
{

#24 lore raw

Re: [PATCH v3 5/6] bus: Add Baikal-T1 APB-bus driver

Quoted 23 lines · Arnd Bergmann
Quoted 21 lines · Serge Semin

Baikal-T1 AXI-APB bridge is used to access the SoC subsystem CSRs. IO requests are routed to this bus by means of the DW AMBA 3 AXI Interconnect. In case if an attempted APB transaction stays with no response for a pre-defined time an interrupt occurs and the bus gets freed for a next operation. This driver provides the interrupt handler to detect the erroneous address, prints an error message about the address fault, updates an errors counter. The counter and the APB-bus operations timeout can be accessed via corresponding sysfs nodes. A dedicated sysfs-node can be also used to artificially cause the bus errors described above.

Quoted 3 lines
Quoted 1 line

---

Applied with this fixup:

I'm afraid linux/io.h is also needed here.(

-Sergey

Quoted 28 lines
drivers/bus/bt1-apb.c +3 -2
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/nmi.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/clk.h>
 #include <linux/reset.h>
@@ -309,13 +310,13 @@ static ssize_t timeout_store(struct device *dev,
 }
 static DEVICE_ATTR_RW(timeout);
 
-static int inject_error_show(struct device *dev, struct device_attribute *attr,
+static ssize_t inject_error_show(struct device *dev, struct
 device_attribute *attr,
                             char *buf)
 {
        return scnprintf(buf, PAGE_SIZE, "Error injection: nodev irq\n");
 }
 
-static int inject_error_store(struct device *dev,
+static ssize_t inject_error_store(struct device *dev,
                              struct device_attribute *attr,
                              const char *data, size_t count)

{

#25 lore raw

PATCH v3 6/6 memory: Add Baikal-T1 L2-cache Control Block driver

In reply to Serge Semin

Baikal-T1 SoC provides a way to tune the MIPS P5600 CM2 L2-cache performance up. It can be done by changing the L2-RAM Data/Tag/WS latencies in a dedicated register exposed by the system controller. The driver added by this commit provides a dts properties-based and sysfs-based interface for it. The device DT node is supposed to be a child of Baikal-T1 System Controller node.

---

Changelog v2:
- Move driver from soc to memory subsystem.
- Get regmap from the parental syscon DT node.
- Use generic FIELD_{GET,PREP} macro.
- Remove probe-status info string printout.
- Since the driver depends on the OF config we can remove of_match_ptr() macro utilization.
- Select MFD_SYSCON config.

Changelog v3:
- Discard CONFIG_OF dependency since there is non at compile-time.
- Fix invalid of_property_read_u32() return value test.

---
 drivers/memory/Kconfig      |  11 ++
 drivers/memory/Makefile     |   1 +
 drivers/memory/bt1-l2-ctl.c | 322 ++++++++++++++++++++++++++++++++++++
 3 files changed, 334 insertions(+)
 create mode 100644 drivers/memory/bt1-l2-ctl.c
drivers/memory/Kconfig +11 -0
index 9bddca292330..04368ee2a809 100644
@@ -46,6 +46,17 @@ config ATMEL_EBI
 	  tree is used. This bus supports NANDs, external ethernet controller,
 	  SRAMs, ATA devices, etc.
 
+config BT1_L2_CTL
+	bool "Baikal-T1 CM2 L2-RAM Cache Control Block"
+	depends on MIPS_BAIKAL_T1 || COMPILE_TEST
+	select MFD_SYSCON
+	help
+	  Baikal-T1 CPU is based on the MIPS P5600 Warrior IP-core. The CPU
+	  resides Coherency Manager v2 with embedded 1MB L2-cache. It's
+	  possible to tune the L2 cache performance up by setting the data,
+	  tags and way-select latencies of RAM access. This driver provides a
+	  dt properties-based and sysfs interface for it.
+
 config TI_AEMIF
 	tristate "Texas Instruments AEMIF driver"
 	depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
drivers/memory/Makefile +1 -0
index 27b493435e61..6d7e3e64ba62 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_ARM_PL172_MPMC)	+= pl172.o
 obj-$(CONFIG_ATMEL_SDRAMC)	+= atmel-sdramc.o
 obj-$(CONFIG_ATMEL_EBI)		+= atmel-ebi.o
 obj-$(CONFIG_ARCH_BRCMSTB)	+= brcmstb_dpfe.o
+obj-$(CONFIG_BT1_L2_CTL)	+= bt1-l2-ctl.o
 obj-$(CONFIG_TI_AEMIF)		+= ti-aemif.o
 obj-$(CONFIG_TI_EMIF)		+= emif.o
 obj-$(CONFIG_OMAP_GPMC)		+= omap-gpmc.o
drivers/memory/bt1-l2-ctl.c new file +322 -0

322 lines not on this page · raw message

Signature · 1 line
2.26.2
#26 lore raw
In reply to Serge Semin

Rob,
Could you pay attention to this patchset? There is only one DT binding left without your tag:
[PATCH v3 3/6] dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding After we get it, Arnd will merge the series into the soc repository.

Thanks
-Sergey

Quoted 137 lines · Serge Semin

Baikal-T1 SoC CPU is based on two MIPS Warrior P5600 cores. Their main memory Non-Coherent IO interface is connected to the OCP2AXI bridge, which in turn is then connected to the DW AMBA 3 AXI Interconnect (so called Main Interconnect) with nine masters and four slaves ports. Main Interconnect is responsible for the AXI-bus traffic arbitration (QoS) and its routing from one component to another. In addition there is a Errors Handler Block (EHB) accesible by means of the Baikal-T1 SoC System Controller responsible to detect AXI protocol errors and device not responding situations built on top the interconnect. Baikal-T1 AXI-bus driver included in this patchset will be responsible for working with that functionality, though currently it doesn't support QoS tuning. Instead it's capable of detecting the error events, reporting an info about them to the system log, injecting artificial errors to test the driver functionality. Since AXI Interconnect doesn't provide a way to find out which devices are connected to it, so its DT node is supposed to be compatible with "simple-bus" driver, while sub-nodes shall represent the masters attached to the bus.

One of the AXI Interconnect slaves is an AXI-APB bridge used to access the Baikal-T1 SoC subsystems CSRs. MMIO request from CPU and DMAC masters are routed there if they are detected to be within [0x08000000 0x1FFFFFFF] range of the physical memory. In case if an attempted APB transaction stays with no response for a pre-defined time it will be detected by the APB-bus Errors Handler Block (EHB), which will raise an interrupt, then the bus gets freed for a next operation. The APB-bus driver provides the interrupt handler to detect the erroneous address, update an errors counter and prints an error message about the faulty address. The counter and the APB-bus operations timeout can be accessed via corresponding sysfs nodes. A dedicated sysfs-node can be also used to artificially cause the bus errors described above. Since APB-bus is a platform bus, it doesn't provide a way to detect slave devices connected to it, so similarly to the AXI-bus it's also supposed to be compatible with "simple-bus" driver.

Aside from PCIe/SATA/DDR/I2C/EHB/CPU/reboot specific settings the Baikal-T1 System Controller provides a MIPS P5600 CM2 L2-cache tuning block. It is responsible for the setting up the Tag/Data/WS L2-to-RAM latencies. The last small patch in this patchset provides a driver and DT-schema-based binding for the described device. So that the latencies can be tuned up by means of dedicated DT properties and sysfs nodes.

This patchset is rebased and tested on the mainline Linux kernel 5.7-rc4:
0e698dfa2822 ("Linux 5.7-rc4")
tag: v5.7-rc4

Changelog v2 (AXI/APB bus):
- Assign dual GPL/BSD licenses to the bindings.
- Use single lined copyright headers in the bindings.
- Replace "additionalProperties: false" property with "unevaluatedProperties: false" in the bindings.
- Don't use a multi-arg clock phandle reference in DT binding examples. Thus remove includes from there.
- Fix some commit message and Kconfig help text spelling.
- Move drivers from soc to the bus subsystem.
- Convert a simple EHB drivers to the Baikal-T1 AXI and APB bus ones.
- Convert APB bus driver to using regmap MMIO API.
- Use syscon regmap to access the AXI-bus erroneous address.
- Add reset line support.
- Add Main Interconnect clock support to the AXI-bus driver.
- Remove probe-status info string printout.
- Discard of_match_ptr() macro utilization.
- Don't print error-message if no platform IRQ found. Just return an error.
- Use generic FIELD_{GET,PREP} macros instead of handwritten ones in the AXI-bus driver.

Changelog v2 (l2 driver):
- Fix some commit message and Kconfig help text spelling.
- Move the driver to the memory subsystem.
- Assign dual GPL/BSD license to the DT binding.
- Use single lined copyright header in the binding.
- Discard reg property and syscon compatible string.
- Move "allOf" restrictions to the root level of the properties.
- The DT node is supposed to be a child of the Baikal-T1 system controller node. So regmap will be fetched from there.
- Use generic FIELD_{GET,PREP} macro.
- Remove probe-status info string printout.
- Since the driver depends on the OF config we can remove of_match_ptr() macro utilization.

Changelog v3:
- Combine l2 and AXI/APB bus patches in a single patchset.
- Retrieve AXI-bus QoS registers by resource name "qos".
- Discard CONFIG_OF dependency since there is none at compile-time.
- Add syscon EHB registers range to the AXI-bus reg property as optional entry.
- Fix invalid of_property_read_u32() return value test in the l2-ctl driver.
- Get the reg property back into the l2-ctl DT bindings even though the driver is using the parental syscon regmap.
- The l2-ctl DT schema will live separately from the system controller, but the corresponding sub-node of the later DT schema will $ref this one.
- Set non-default latencies in the l2-ctl DT example.

Cc Alexey Malahov <[email protected]>
Cc Maxim Kaurkin <[email protected]>
Cc Pavel Parkhomenko <[email protected]>
Cc Ramil Zaripov <[email protected]>
Cc Ekaterina Skachko <[email protected]>
Cc Vadim Vlasov <[email protected]>
Cc Alexey Kolotnikov <[email protected]>
Cc Paul Burton <[email protected]>
Cc Rob Herring <[email protected]>
Cc Olof Johansson <[email protected]>

Serge Semin (6):
dt-bindings: bus: Add Baikal-T1 AXI-bus binding
dt-bindings: bus: Add Baikal-T1 APB-bus binding
dt-bindings: memory: Add Baikal-T1 L2-cache Control Block binding
bus: Add Baikal-T1 AXI-bus driver
bus: Add Baikal-T1 APB-bus driver
memory: Add Baikal-T1 L2-cache Control Block driver

 .../bindings/bus/baikal,bt1-apb.yaml          |  90 ++++
 .../bindings/bus/baikal,bt1-axi.yaml          | 107 +++++
 .../memory-controllers/baikal,bt1-l2-ctl.yaml |  63 +++
 drivers/bus/Kconfig                           |  30 ++
 drivers/bus/Makefile                          |   2 +
 drivers/bus/bt1-apb.c                         | 421 ++++++++++++++++++
 drivers/bus/bt1-axi.c                         | 318 +++++++++++++
 drivers/memory/Kconfig                        |  11 +
 drivers/memory/Makefile                       |   1 +
 drivers/memory/bt1-l2-ctl.c                   | 322 ++++++++++++++
 10 files changed, 1365 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-apb.yaml
 create mode 100644 Documentation/devicetree/bindings/bus/baikal,bt1-axi.yaml
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/baikal,bt1-l2-ctl.yaml
 create mode 100644 drivers/bus/bt1-apb.c
 create mode 100644 drivers/bus/bt1-axi.c
 create mode 100644 drivers/memory/bt1-l2-ctl.c
Signature · 1 line
2.26.2