* [PATCH net-next v5 4/5] dt-bindings: net: fsl: enetc: Add bindings for the central MDIO PCIe endpoint
From: Claudiu Manoil @ 2019-08-01 11:52 UTC (permalink / raw)
To: David S . Miller
Cc: andrew, devicetree, netdev, alexandru.marginean, linux-kernel,
Li Yang, Rob Herring, linux-arm-kernel
In-Reply-To: <1564660373-4607-1-git-send-email-claudiu.manoil@nxp.com>
The on-chip PCIe root complex that integrates the ENETC ethernet
controllers also integrates a PCIe endpoint for the MDIO controller
providing for centralized control of the ENETC mdio bus.
Add bindings for this "central" MDIO Integrated PCIe Endpoint.
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v1 - none
v2 - none
v3 - fixed spelling (commit message mostly)
v4 - none
v4 - none
.../devicetree/bindings/net/fsl-enetc.txt | 42 +++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/fsl-enetc.txt b/Documentation/devicetree/bindings/net/fsl-enetc.txt
index 25fc687419db..b7034ccbc1bd 100644
--- a/Documentation/devicetree/bindings/net/fsl-enetc.txt
+++ b/Documentation/devicetree/bindings/net/fsl-enetc.txt
@@ -11,7 +11,9 @@ Required properties:
to parent node bindings.
- compatible : Should be "fsl,enetc".
-1) The ENETC external port is connected to a MDIO configurable phy:
+1. The ENETC external port is connected to a MDIO configurable phy
+
+1.1. Using the local ENETC Port MDIO interface
In this case, the ENETC node should include a "mdio" sub-node
that in turn should contain the "ethernet-phy" node describing the
@@ -47,8 +49,42 @@ Example:
};
};
-2) The ENETC port is an internal port or has a fixed-link external
-connection:
+1.2. Using the central MDIO PCIe endpoint device
+
+In this case, the mdio node should be defined as another PCIe
+endpoint node, at the same level with the ENETC port nodes.
+
+Required properties:
+
+- reg : Specifies PCIe Device Number and Function
+ Number of the ENETC endpoint device, according
+ to parent node bindings.
+- compatible : Should be "fsl,enetc-mdio".
+
+The remaining required mdio bus properties are standard, their bindings
+already defined in Documentation/devicetree/bindings/net/mdio.txt.
+
+Example:
+
+ ethernet@0,0 {
+ compatible = "fsl,enetc";
+ reg = <0x000000 0 0 0 0>;
+ phy-handle = <&sgmii_phy0>;
+ phy-connection-type = "sgmii";
+ };
+
+ mdio@0,3 {
+ compatible = "fsl,enetc-mdio";
+ reg = <0x000300 0 0 0 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ sgmii_phy0: ethernet-phy@2 {
+ reg = <0x2>;
+ };
+ };
+
+2. The ENETC port is an internal port or has a fixed-link external
+connection
In this case, the ENETC port node defines a fixed link connection,
as specified by Documentation/devicetree/bindings/net/fixed-link.txt.
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH net-next v5 1/5] enetc: Clean up local mdio bus allocation
From: Claudiu Manoil @ 2019-08-01 11:52 UTC (permalink / raw)
To: David S . Miller
Cc: andrew, devicetree, netdev, alexandru.marginean, linux-kernel,
Li Yang, Rob Herring, linux-arm-kernel
In-Reply-To: <1564660373-4607-1-git-send-email-claudiu.manoil@nxp.com>
What's needed is basically a pointer to the mdio registers.
This is one way to store it inside bus->priv allocated space,
without upsetting sparse.
Reworked accessors to avoid __iomem casting.
Used devm_* variant to further clean up the init error /
remove paths.
Fixes following sparse warning:
warning: incorrect type in assignment (different address spaces)
expected void *priv
got struct enetc_mdio_regs [noderef] <asn:2>*[assigned] regs
Fixes: ebfcb23d62ab ("enetc: Add ENETC PF level external MDIO support")
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v1 - added this patch
v2 - reworked accessors as per Andrew Lunn's request
v3 - cleaned up commit message
v4 - none
v5 - none
.../net/ethernet/freescale/enetc/enetc_mdio.c | 94 +++++++++----------
1 file changed, 46 insertions(+), 48 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
index 77b9cd10ba2b..05094601ece8 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
@@ -8,16 +8,22 @@
#include "enetc_pf.h"
-struct enetc_mdio_regs {
- u32 mdio_cfg; /* MDIO configuration and status */
- u32 mdio_ctl; /* MDIO control */
- u32 mdio_data; /* MDIO data */
- u32 mdio_addr; /* MDIO address */
+#define ENETC_MDIO_REG_OFFSET 0x1c00
+#define ENETC_MDIO_CFG 0x0 /* MDIO configuration and status */
+#define ENETC_MDIO_CTL 0x4 /* MDIO control */
+#define ENETC_MDIO_DATA 0x8 /* MDIO data */
+#define ENETC_MDIO_ADDR 0xc /* MDIO address */
+
+#define enetc_mdio_rd(hw, off) \
+ enetc_port_rd(hw, ENETC_##off + ENETC_MDIO_REG_OFFSET)
+#define enetc_mdio_wr(hw, off, val) \
+ enetc_port_wr(hw, ENETC_##off + ENETC_MDIO_REG_OFFSET, val)
+#define enetc_mdio_rd_reg(off) enetc_mdio_rd(hw, off)
+
+struct enetc_mdio_priv {
+ struct enetc_hw *hw;
};
-#define bus_to_enetc_regs(bus) (struct enetc_mdio_regs __iomem *)((bus)->priv)
-
-#define ENETC_MDIO_REG_OFFSET 0x1c00
#define ENETC_MDC_DIV 258
#define MDIO_CFG_CLKDIV(x) ((((x) >> 1) & 0xff) << 8)
@@ -33,18 +39,19 @@ struct enetc_mdio_regs {
#define MDIO_DATA(x) ((x) & 0xffff)
#define TIMEOUT 1000
-static int enetc_mdio_wait_complete(struct enetc_mdio_regs __iomem *regs)
+static int enetc_mdio_wait_complete(struct enetc_hw *hw)
{
u32 val;
- return readx_poll_timeout(enetc_rd_reg, ®s->mdio_cfg, val,
+ return readx_poll_timeout(enetc_mdio_rd_reg, MDIO_CFG, val,
!(val & MDIO_CFG_BSY), 10, 10 * TIMEOUT);
}
static int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
u16 value)
{
- struct enetc_mdio_regs __iomem *regs = bus_to_enetc_regs(bus);
+ struct enetc_mdio_priv *mdio_priv = bus->priv;
+ struct enetc_hw *hw = mdio_priv->hw;
u32 mdio_ctl, mdio_cfg;
u16 dev_addr;
int ret;
@@ -59,29 +66,29 @@ static int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
mdio_cfg &= ~MDIO_CFG_ENC45;
}
- enetc_wr_reg(®s->mdio_cfg, mdio_cfg);
+ enetc_mdio_wr(hw, MDIO_CFG, mdio_cfg);
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
/* set port and dev addr */
mdio_ctl = MDIO_CTL_PORT_ADDR(phy_id) | MDIO_CTL_DEV_ADDR(dev_addr);
- enetc_wr_reg(®s->mdio_ctl, mdio_ctl);
+ enetc_mdio_wr(hw, MDIO_CTL, mdio_ctl);
/* set the register address */
if (regnum & MII_ADDR_C45) {
- enetc_wr_reg(®s->mdio_addr, regnum & 0xffff);
+ enetc_mdio_wr(hw, MDIO_ADDR, regnum & 0xffff);
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
}
/* write the value */
- enetc_wr_reg(®s->mdio_data, MDIO_DATA(value));
+ enetc_mdio_wr(hw, MDIO_DATA, MDIO_DATA(value));
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
@@ -90,7 +97,8 @@ static int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
static int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
{
- struct enetc_mdio_regs __iomem *regs = bus_to_enetc_regs(bus);
+ struct enetc_mdio_priv *mdio_priv = bus->priv;
+ struct enetc_hw *hw = mdio_priv->hw;
u32 mdio_ctl, mdio_cfg;
u16 dev_addr, value;
int ret;
@@ -104,41 +112,41 @@ static int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
mdio_cfg &= ~MDIO_CFG_ENC45;
}
- enetc_wr_reg(®s->mdio_cfg, mdio_cfg);
+ enetc_mdio_wr(hw, MDIO_CFG, mdio_cfg);
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
/* set port and device addr */
mdio_ctl = MDIO_CTL_PORT_ADDR(phy_id) | MDIO_CTL_DEV_ADDR(dev_addr);
- enetc_wr_reg(®s->mdio_ctl, mdio_ctl);
+ enetc_mdio_wr(hw, MDIO_CTL, mdio_ctl);
/* set the register address */
if (regnum & MII_ADDR_C45) {
- enetc_wr_reg(®s->mdio_addr, regnum & 0xffff);
+ enetc_mdio_wr(hw, MDIO_ADDR, regnum & 0xffff);
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
}
/* initiate the read */
- enetc_wr_reg(®s->mdio_ctl, mdio_ctl | MDIO_CTL_READ);
+ enetc_mdio_wr(hw, MDIO_CTL, mdio_ctl | MDIO_CTL_READ);
- ret = enetc_mdio_wait_complete(regs);
+ ret = enetc_mdio_wait_complete(hw);
if (ret)
return ret;
/* return all Fs if nothing was there */
- if (enetc_rd_reg(®s->mdio_cfg) & MDIO_CFG_RD_ER) {
+ if (enetc_mdio_rd(hw, MDIO_CFG) & MDIO_CFG_RD_ER) {
dev_dbg(&bus->dev,
"Error while reading PHY%d reg at %d.%hhu\n",
phy_id, dev_addr, regnum);
return 0xffff;
}
- value = enetc_rd_reg(®s->mdio_data) & 0xffff;
+ value = enetc_mdio_rd(hw, MDIO_DATA) & 0xffff;
return value;
}
@@ -146,12 +154,12 @@ static int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
int enetc_mdio_probe(struct enetc_pf *pf)
{
struct device *dev = &pf->si->pdev->dev;
- struct enetc_mdio_regs __iomem *regs;
+ struct enetc_mdio_priv *mdio_priv;
struct device_node *np;
struct mii_bus *bus;
- int ret;
+ int err;
- bus = mdiobus_alloc_size(sizeof(regs));
+ bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
if (!bus)
return -ENOMEM;
@@ -159,41 +167,31 @@ int enetc_mdio_probe(struct enetc_pf *pf)
bus->read = enetc_mdio_read;
bus->write = enetc_mdio_write;
bus->parent = dev;
+ mdio_priv = bus->priv;
+ mdio_priv->hw = &pf->si->hw;
snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));
- /* store the enetc mdio base address for this bus */
- regs = pf->si->hw.port + ENETC_MDIO_REG_OFFSET;
- bus->priv = regs;
-
np = of_get_child_by_name(dev->of_node, "mdio");
if (!np) {
dev_err(dev, "MDIO node missing\n");
- ret = -EINVAL;
- goto err_registration;
+ return -EINVAL;
}
- ret = of_mdiobus_register(bus, np);
- if (ret) {
+ err = of_mdiobus_register(bus, np);
+ if (err) {
of_node_put(np);
dev_err(dev, "cannot register MDIO bus\n");
- goto err_registration;
+ return err;
}
of_node_put(np);
pf->mdio = bus;
return 0;
-
-err_registration:
- mdiobus_free(bus);
-
- return ret;
}
void enetc_mdio_remove(struct enetc_pf *pf)
{
- if (pf->mdio) {
+ if (pf->mdio)
mdiobus_unregister(pf->mdio);
- mdiobus_free(pf->mdio);
- }
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH net-next v5 5/5] arm64: dts: fsl: ls1028a: Enable eth port1 on the ls1028a QDS board
From: Claudiu Manoil @ 2019-08-01 11:52 UTC (permalink / raw)
To: David S . Miller
Cc: andrew, devicetree, netdev, alexandru.marginean, linux-kernel,
Li Yang, Rob Herring, linux-arm-kernel
In-Reply-To: <1564660373-4607-1-git-send-email-claudiu.manoil@nxp.com>
LS1028a has one Ethernet management interface. On the QDS board, the
MDIO signals are multiplexed to either on-board AR8035 PHY device or
to 4 PCIe slots allowing for SGMII cards.
To enable the Ethernet ENETC Port 1, which can only be connected to a
RGMII PHY, the multiplexer needs to be configured to route the MDIO to
the AR8035 PHY. The MDIO/MDC routing is controlled by bits 7:4 of FPGA
board config register 0x54, and value 0 selects the on-board RGMII PHY.
The FPGA board config registers are accessible on the i2c bus, at address
0x66.
The PF3 MDIO PCIe integrated endpoint device allows for centralized access
to the MDIO bus. Add the corresponding devicetree node and set it to be
the MDIO bus parent.
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v1-v5 - none
.../boot/dts/freescale/fsl-ls1028a-qds.dts | 40 +++++++++++++++++++
.../arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 6 +++
2 files changed, 46 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts
index de6ef39f3118..663c4b728c07 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a-qds.dts
@@ -85,6 +85,26 @@
system-clock-frequency = <25000000>;
};
};
+
+ mdio-mux {
+ compatible = "mdio-mux-multiplexer";
+ mux-controls = <&mux 0>;
+ mdio-parent-bus = <&enetc_mdio_pf3>;
+ #address-cells=<1>;
+ #size-cells = <0>;
+
+ /* on-board RGMII PHY */
+ mdio@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ qds_phy1: ethernet-phy@5 {
+ /* Atheros 8035 */
+ reg = <5>;
+ };
+ };
+ };
};
&duart0 {
@@ -164,6 +184,26 @@
};
};
};
+
+ fpga@66 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "fsl,ls1028aqds-fpga", "fsl,fpga-qixis-i2c",
+ "simple-mfd";
+ reg = <0x66>;
+
+ mux: mux-controller {
+ compatible = "reg-mux";
+ #mux-control-cells = <1>;
+ mux-reg-masks = <0x54 0xf0>; /* 0: reg 0x54, bits 7:4 */
+ };
+ };
+
+};
+
+&enetc_port1 {
+ phy-handle = <&qds_phy1>;
+ phy-connection-type = "rgmii-id";
};
&sai1 {
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
index 7975519b4f56..de71153fda00 100644
--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
+++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
@@ -536,6 +536,12 @@
compatible = "fsl,enetc";
reg = <0x000100 0 0 0 0>;
};
+ enetc_mdio_pf3: mdio@0,3 {
+ compatible = "fsl,enetc-mdio";
+ reg = <0x000300 0 0 0 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
ethernet@0,4 {
compatible = "fsl,enetc-ptp";
reg = <0x000400 0 0 0 0>;
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH net-next v5 3/5] enetc: Add mdio bus driver for the PCIe MDIO endpoint
From: Claudiu Manoil @ 2019-08-01 11:52 UTC (permalink / raw)
To: David S . Miller
Cc: andrew, devicetree, netdev, alexandru.marginean, linux-kernel,
Li Yang, Rob Herring, linux-arm-kernel
In-Reply-To: <1564660373-4607-1-git-send-email-claudiu.manoil@nxp.com>
ENETC ports can manage the MDIO bus via local register
interface. However there's also a centralized way
to manage the MDIO bus, via the MDIO PCIe endpoint
device integrated by the same root complex that also
integrates the ENETC ports (eth controllers).
Depending on board design and use case, centralized
access to MDIO may be better than using local ENETC
port registers. For instance, on the LS1028A QDS board
where MDIO muxing is required. Also, the LS1028A on-chip
switch doesn't have a local MDIO register interface.
The current patch registers the above PCIe endpoint as a
separate MDIO bus and provides a driver for it by re-using
the code used for local MDIO access. It also allows the
ENETC port PHYs to be managed by this driver if the local
"mdio" node is missing from the ENETC port node.
Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v1 - fixed mdio bus allocation
- requested only BAR0 region, as it's the only one used by the driver
v2 - reworked accessors as per Andrew Lunn's request
v3 - none
v4 - err path check fix
v5 - refactored as separate kbuild module, to fix loadable module build
drivers/net/ethernet/freescale/enetc/Kconfig | 9 ++
drivers/net/ethernet/freescale/enetc/Makefile | 3 +
.../net/ethernet/freescale/enetc/enetc_mdio.c | 11 +-
.../net/ethernet/freescale/enetc/enetc_mdio.h | 12 +++
.../ethernet/freescale/enetc/enetc_pci_mdio.c | 101 ++++++++++++++++++
.../net/ethernet/freescale/enetc/enetc_pf.c | 5 +-
6 files changed, 132 insertions(+), 9 deletions(-)
create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_mdio.h
create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
index ed0d010c7cf2..9c530f75134f 100644
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -18,6 +18,15 @@ config FSL_ENETC_VF
If compiled as module (M), the module name is fsl-enetc-vf.
+config FSL_ENETC_MDIO
+ tristate "ENETC MDIO driver"
+ depends on PCI && (ARCH_LAYERSCAPE || COMPILE_TEST)
+ help
+ This driver supports NXP ENETC Central MDIO controller as a PCIe
+ physical function (PF) device.
+
+ If compiled as module (M), the module name is fsl-enetc-mdio.
+
config FSL_ENETC_PTP_CLOCK
tristate "ENETC PTP clock driver"
depends on PTP_1588_CLOCK_QORIQ && (FSL_ENETC || FSL_ENETC_VF)
diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/ethernet/freescale/enetc/Makefile
index 164453a5dc1d..d200c27c3bf6 100644
--- a/drivers/net/ethernet/freescale/enetc/Makefile
+++ b/drivers/net/ethernet/freescale/enetc/Makefile
@@ -9,5 +9,8 @@ fsl-enetc-$(CONFIG_PCI_IOV) += enetc_msg.o
obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o
fsl-enetc-vf-y := enetc_vf.o $(common-objs)
+obj-$(CONFIG_FSL_ENETC_MDIO) += fsl-enetc-mdio.o
+fsl-enetc-mdio-y := enetc_pci_mdio.o enetc_mdio.o
+
obj-$(CONFIG_FSL_ENETC_PTP_CLOCK) += fsl-enetc-ptp.o
fsl-enetc-ptp-y := enetc_ptp.o
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
index 05094601ece8..149883c8f0b8 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.c
@@ -6,7 +6,7 @@
#include <linux/iopoll.h>
#include <linux/of.h>
-#include "enetc_pf.h"
+#include "enetc_mdio.h"
#define ENETC_MDIO_REG_OFFSET 0x1c00
#define ENETC_MDIO_CFG 0x0 /* MDIO configuration and status */
@@ -20,10 +20,6 @@
enetc_port_wr(hw, ENETC_##off + ENETC_MDIO_REG_OFFSET, val)
#define enetc_mdio_rd_reg(off) enetc_mdio_rd(hw, off)
-struct enetc_mdio_priv {
- struct enetc_hw *hw;
-};
-
#define ENETC_MDC_DIV 258
#define MDIO_CFG_CLKDIV(x) ((((x) >> 1) & 0xff) << 8)
@@ -47,8 +43,7 @@ static int enetc_mdio_wait_complete(struct enetc_hw *hw)
!(val & MDIO_CFG_BSY), 10, 10 * TIMEOUT);
}
-static int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
- u16 value)
+int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value)
{
struct enetc_mdio_priv *mdio_priv = bus->priv;
struct enetc_hw *hw = mdio_priv->hw;
@@ -95,7 +90,7 @@ static int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
return 0;
}
-static int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
+int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
{
struct enetc_mdio_priv *mdio_priv = bus->priv;
struct enetc_hw *hw = mdio_priv->hw;
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_mdio.h b/drivers/net/ethernet/freescale/enetc/enetc_mdio.h
new file mode 100644
index 000000000000..60c9a3889824
--- /dev/null
+++ b/drivers/net/ethernet/freescale/enetc/enetc_mdio.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/* Copyright 2019 NXP */
+
+#include <linux/phy.h>
+#include "enetc_pf.h"
+
+struct enetc_mdio_priv {
+ struct enetc_hw *hw;
+};
+
+int enetc_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value);
+int enetc_mdio_read(struct mii_bus *bus, int phy_id, int regnum);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
new file mode 100644
index 000000000000..fbd41ce01f06
--- /dev/null
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pci_mdio.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/* Copyright 2019 NXP */
+#include <linux/of_mdio.h>
+#include "enetc_mdio.h"
+
+#define ENETC_MDIO_DEV_ID 0xee01
+#define ENETC_MDIO_DEV_NAME "FSL PCIe IE Central MDIO"
+#define ENETC_MDIO_BUS_NAME ENETC_MDIO_DEV_NAME " Bus"
+#define ENETC_MDIO_DRV_NAME ENETC_MDIO_DEV_NAME " driver"
+
+static int enetc_pci_mdio_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ struct enetc_mdio_priv *mdio_priv;
+ struct device *dev = &pdev->dev;
+ struct enetc_hw *hw;
+ struct mii_bus *bus;
+ int err;
+
+ hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
+ if (!hw)
+ return -ENOMEM;
+
+ bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
+ if (!bus)
+ return -ENOMEM;
+
+ bus->name = ENETC_MDIO_BUS_NAME;
+ bus->read = enetc_mdio_read;
+ bus->write = enetc_mdio_write;
+ bus->parent = dev;
+ mdio_priv = bus->priv;
+ mdio_priv->hw = hw;
+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));
+
+ pcie_flr(pdev);
+ err = pci_enable_device_mem(pdev);
+ if (err) {
+ dev_err(dev, "device enable failed\n");
+ return err;
+ }
+
+ err = pci_request_region(pdev, 0, KBUILD_MODNAME);
+ if (err) {
+ dev_err(dev, "pci_request_region failed\n");
+ goto err_pci_mem_reg;
+ }
+
+ hw->port = pci_iomap(pdev, 0, 0);
+ if (!hw->port) {
+ err = -ENXIO;
+ dev_err(dev, "iomap failed\n");
+ goto err_ioremap;
+ }
+
+ err = of_mdiobus_register(bus, dev->of_node);
+ if (err)
+ goto err_mdiobus_reg;
+
+ pci_set_drvdata(pdev, bus);
+
+ return 0;
+
+err_mdiobus_reg:
+ iounmap(mdio_priv->hw->port);
+err_ioremap:
+ pci_release_mem_regions(pdev);
+err_pci_mem_reg:
+ pci_disable_device(pdev);
+
+ return err;
+}
+
+static void enetc_pci_mdio_remove(struct pci_dev *pdev)
+{
+ struct mii_bus *bus = pci_get_drvdata(pdev);
+ struct enetc_mdio_priv *mdio_priv;
+
+ mdiobus_unregister(bus);
+ mdio_priv = bus->priv;
+ iounmap(mdio_priv->hw->port);
+ pci_release_mem_regions(pdev);
+ pci_disable_device(pdev);
+}
+
+static const struct pci_device_id enetc_pci_mdio_id_table[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_MDIO_DEV_ID) },
+ { 0, } /* End of table. */
+};
+MODULE_DEVICE_TABLE(pci, enetc_pci_mdio_id_table);
+
+static struct pci_driver enetc_pci_mdio_driver = {
+ .name = KBUILD_MODNAME,
+ .id_table = enetc_pci_mdio_id_table,
+ .probe = enetc_pci_mdio_probe,
+ .remove = enetc_pci_mdio_remove,
+};
+module_pci_driver(enetc_pci_mdio_driver);
+
+MODULE_DESCRIPTION(ENETC_MDIO_DRV_NAME);
+MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index 258b3cb38a6f..7d6513ff8507 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -750,6 +750,7 @@ static int enetc_of_get_phy(struct enetc_ndev_priv *priv)
{
struct enetc_pf *pf = enetc_si_priv(priv->si);
struct device_node *np = priv->dev->of_node;
+ struct device_node *mdio_np;
int err;
if (!np) {
@@ -773,7 +774,9 @@ static int enetc_of_get_phy(struct enetc_ndev_priv *priv)
priv->phy_node = of_node_get(np);
}
- if (!of_phy_is_fixed_link(np)) {
+ mdio_np = of_get_child_by_name(np, "mdio");
+ if (mdio_np) {
+ of_node_put(mdio_np);
err = enetc_mdio_probe(pf);
if (err) {
of_node_put(priv->phy_node);
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH v3 5/7] drivers: Introduce device lookup variants by ACPI_COMPANION device
From: Andy Shevchenko @ 2019-08-01 11:58 UTC (permalink / raw)
To: Wolfram Sang
Cc: rafael, gregkh, Suzuki K Poulose, linux-kernel, linux-spi,
linux-acpi, Mark Brown, Jarkko Nikula, linux-i2c, Mika Westerberg,
linux-arm-kernel, Len Brown
In-Reply-To: <20190726202353.GA963@kunai>
On Fri, Jul 26, 2019 at 10:23:54PM +0200, Wolfram Sang wrote:
> On Tue, Jul 23, 2019 at 11:18:36PM +0100, Suzuki K Poulose wrote:
> > Add a generic helper to match a device by the ACPI_COMPANION device
> > and provide wrappers for the device lookup APIs.
> >
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: linux-acpi@vger.kernel.org
> > Cc: linux-spi@vger.kernel.org
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Cc: Wolfram Sang <wsa@the-dreams.de>
> > Cc: linux-i2c@vger.kernel.org
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> From my side, OK:
>
> Acked-by: Wolfram Sang <wsa@the-dreams.de> # I2C parts
>
> yet you missed to cc the I2C ACPI maintainers. Done so now.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks, Wolfram, for notifying.
>
> > ---
> > drivers/base/core.c | 6 ++++
> > drivers/i2c/i2c-core-acpi.c | 11 ++-----
> > drivers/spi/spi.c | 8 +----
> > include/linux/device.h | 65 +++++++++++++++++++++++++++++++++++++
> > 4 files changed, 74 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index 3abc32b60c0a..57d71bc2c559 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -3373,3 +3373,9 @@ int device_match_devt(struct device *dev, const void *pdevt)
> > return dev->devt == *(dev_t *)pdevt;
> > }
> > EXPORT_SYMBOL_GPL(device_match_devt);
> > +
> > +int device_match_acpi_dev(struct device *dev, const void *adev)
> > +{
> > + return ACPI_COMPANION(dev) == adev;
> > +}
> > +EXPORT_SYMBOL(device_match_acpi_dev);
> > diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
> > index 4dbbc9a35f65..bc80aafb521f 100644
> > --- a/drivers/i2c/i2c-core-acpi.c
> > +++ b/drivers/i2c/i2c-core-acpi.c
> > @@ -354,17 +354,11 @@ static int i2c_acpi_find_match_adapter(struct device *dev, const void *data)
> > return ACPI_HANDLE(dev) == (acpi_handle)data;
> > }
> >
> > -static int i2c_acpi_find_match_device(struct device *dev, const void *data)
> > -{
> > - return ACPI_COMPANION(dev) == data;
> > -}
> >
> > struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
> > {
> > - struct device *dev;
> > + struct device *dev = bus_find_device_by_acpi_dev(&i2c_bus_type, handle);
> >
> > - dev = bus_find_device(&i2c_bus_type, NULL, handle,
> > - i2c_acpi_find_match_adapter);
> > return dev ? i2c_verify_adapter(dev) : NULL;
> > }
> > EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);
> > @@ -373,8 +367,7 @@ static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
> > {
> > struct device *dev;
> >
> > - dev = bus_find_device(&i2c_bus_type, NULL, adev,
> > - i2c_acpi_find_match_device);
> > + dev = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
> > return dev ? i2c_verify_client(dev) : NULL;
> > }
> >
> > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> > index a591da87981a..c486a6f84c2c 100644
> > --- a/drivers/spi/spi.c
> > +++ b/drivers/spi/spi.c
> > @@ -3741,11 +3741,6 @@ static int spi_acpi_controller_match(struct device *dev, const void *data)
> > return ACPI_COMPANION(dev->parent) == data;
> > }
> >
> > -static int spi_acpi_device_match(struct device *dev, const void *data)
> > -{
> > - return ACPI_COMPANION(dev) == data;
> > -}
> > -
> > static struct spi_controller *acpi_spi_find_controller_by_adev(struct acpi_device *adev)
> > {
> > struct device *dev;
> > @@ -3765,8 +3760,7 @@ static struct spi_device *acpi_spi_find_device_by_adev(struct acpi_device *adev)
> > {
> > struct device *dev;
> >
> > - dev = bus_find_device(&spi_bus_type, NULL, adev, spi_acpi_device_match);
> > -
> > + dev = bus_find_device_by_acpi_dev(&spi_bus_type, adev);
> > return dev ? to_spi_device(dev) : NULL;
> > }
> >
> > diff --git a/include/linux/device.h b/include/linux/device.h
> > index 93b2f55ef44e..7514ef3d3f1a 100644
> > --- a/include/linux/device.h
> > +++ b/include/linux/device.h
> > @@ -168,6 +168,7 @@ int device_match_name(struct device *dev, const void *name);
> > int device_match_of_node(struct device *dev, const void *np);
> > int device_match_fwnode(struct device *dev, const void *fwnode);
> > int device_match_devt(struct device *dev, const void *pdevt);
> > +int device_match_acpi_dev(struct device *dev, const void *adev);
> >
> > int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
> > int (*fn)(struct device *dev, void *data));
> > @@ -224,6 +225,28 @@ static inline struct device *bus_find_device_by_devt(struct bus_type *bus,
> > return bus_find_device(bus, NULL, &devt, device_match_devt);
> > }
> >
> > +#ifdef CONFIG_ACPI
> > +struct acpi_device;
> > +
> > +/**
> > + * bus_find_device_by_acpi_dev : device iterator for locating a particular device
> > + * matching the ACPI COMPANION device.
> > + * @bus: bus type
> > + * @adev: ACPI COMPANION device to match.
> > + */
> > +static inline struct device *
> > +bus_find_device_by_acpi_dev(struct bus_type *bus, const struct acpi_device *adev)
> > +{
> > + return bus_find_device(bus, NULL, adev, device_match_acpi_dev);
> > +}
> > +#else
> > +static inline struct device *
> > +bus_find_device_by_acpi_dev(struct bus_type *bus, const void *adev)
> > +{
> > + return NULL;
> > +}
> > +#endif
> > +
> > struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
> > struct device *hint);
> > int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
> > @@ -442,6 +465,27 @@ static inline struct device *driver_find_device_by_devt(struct device_driver *dr
> > return driver_find_device(drv, NULL, &devt, device_match_devt);
> > }
> >
> > +#ifdef CONFIG_ACPI
> > +/**
> > + * driver_find_device_by_acpi_dev : device iterator for locating a particular
> > + * device matching the ACPI_COMPANION device.
> > + * @driver: the driver we're iterating
> > + * @adev: ACPI_COMPANION device to match.
> > + */
> > +static inline struct device *
> > +driver_find_device_by_acpi_dev(struct device_driver *drv,
> > + const struct acpi_device *adev)
> > +{
> > + return driver_find_device(drv, NULL, adev, device_match_acpi_dev);
> > +}
> > +#else
> > +static inline struct device *
> > +driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
> > +{
> > + return NULL;
> > +}
> > +#endif
> > +
> > void driver_deferred_probe_add(struct device *dev);
> > int driver_deferred_probe_check_state(struct device *dev);
> > int driver_deferred_probe_check_state_continue(struct device *dev);
> > @@ -620,6 +664,27 @@ static inline struct device *class_find_device_by_devt(struct class *class,
> > return class_find_device(class, NULL, &devt, device_match_devt);
> > }
> >
> > +#ifdef CONFIG_ACPI
> > +struct acpi_device;
> > +/**
> > + * class_find_device_by_acpi_dev : device iterator for locating a particular
> > + * device matching the ACPI_COMPANION device.
> > + * @class: class type
> > + * @adev: ACPI_COMPANION device to match.
> > + */
> > +static inline struct device *
> > +class_find_device_by_acpi_dev(struct class *class, const struct acpi_device *adev)
> > +{
> > + return class_find_device(class, NULL, adev, device_match_acpi_dev);
> > +}
> > +#else
> > +static inline struct device *
> > +class_find_device_by_acpi_dev(struct class *class, const void *adev)
> > +{
> > + return NULL;
> > +}
> > +#endif
> > +
> > struct class_attribute {
> > struct attribute attr;
> > ssize_t (*show)(struct class *class, struct class_attribute *attr,
> > --
> > 2.21.0
> >
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/mm: fix variable 'tag' set but not used
From: Will Deacon @ 2019-08-01 12:01 UTC (permalink / raw)
To: Qian Cai; +Cc: catalin.marinas, linux-kernel, linux-arm-kernel, andreyknvl
In-Reply-To: <1564605498-17629-1-git-send-email-cai@lca.pw>
On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
> warning,
>
> mm/kasan/common.c: In function '__kasan_kmalloc':
> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
> [-Wunused-but-set-variable]
> u8 tag = 0xff;
> ^~~
>
> Fix it by making __tag_set() a static inline function.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
> arch/arm64/include/asm/memory.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index b7ba75809751..9645b1340afe 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
> #define __tag_reset(addr) untagged_addr(addr)
> #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
> #else
> -#define __tag_set(addr, tag) (addr)
> +static inline const void *__tag_set(const void *addr, u8 tag)
> +{
> + return addr;
> +}
Why doesn't this trigger a warning in page_to_virt(), which passes an
unsigned long for the address parameter?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/mm: fix variable 'pud' set but not used
From: Will Deacon @ 2019-08-01 12:04 UTC (permalink / raw)
To: Qian Cai; +Cc: catalin.marinas, linux-kernel, linux-arm-kernel
In-Reply-To: <1564603545-14776-1-git-send-email-cai@lca.pw>
On Wed, Jul 31, 2019 at 04:05:45PM -0400, Qian Cai wrote:
> GCC throws a warning,
>
> arch/arm64/mm/mmu.c: In function 'pud_free_pmd_page':
> arch/arm64/mm/mmu.c:1033:8: warning: variable 'pud' set but not used
> [-Wunused-but-set-variable]
> pud_t pud;
> ^~~
>
> because pud_table() is a macro and compiled away. Fix it by making it a
> static inline function and for pud_sect() as well.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
> arch/arm64/include/asm/pgtable.h | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 3f5461f7b560..541cb4a15341 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -447,8 +447,15 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
> PMD_TYPE_SECT)
>
> #if defined(CONFIG_ARM64_64K_PAGES) || CONFIG_PGTABLE_LEVELS < 3
> -#define pud_sect(pud) (0)
> -#define pud_table(pud) (1)
> +static inline bool pud_sect(pud_t pud)
> +{
> + return false;
> +}
> +
> +static inline bool pud_table(pud_t pud)
> +{
> + return true;
> +}
Applied for 5.3.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3] arm64: Add support for relocating the kernel with RELR relocations
From: Will Deacon @ 2019-08-01 12:05 UTC (permalink / raw)
To: Peter Collingbourne
Cc: Mark Rutland, clang-built-linux, Catalin Marinas, Ard Biesheuvel,
Nick Desaulniers, Masahiro Yamada, linux-arm-kernel
In-Reply-To: <20190801011842.199786-1-pcc@google.com>
On Wed, Jul 31, 2019 at 06:18:42PM -0700, Peter Collingbourne wrote:
> RELR is a relocation packing format for relative relocations.
> The format is described in a generic-abi proposal:
> https://groups.google.com/d/topic/generic-abi/bX460iggiKg/discussion
>
> The LLD linker can be instructed to pack relocations in the RELR
> format by passing the flag --pack-dyn-relocs=relr.
>
> This patch adds a new config option, CONFIG_RELR. Enabling this option
> instructs the linker to pack vmlinux's relative relocations in the RELR
> format, and causes the kernel to apply the relocations at startup along
> with the RELA relocations. RELA relocations still need to be applied
> because the linker will emit RELA relative relocations if they are
> unrepresentable in the RELR format (i.e. address not a multiple of 2).
>
> Enabling CONFIG_RELR reduces the size of a defconfig kernel image
> with CONFIG_RANDOMIZE_BASE by 3.5MB/16% uncompressed, or 550KB/5%
> compressed (lz4).
>
> Signed-off-by: Peter Collingbourne <pcc@google.com>
> Tested-by: Nick Desaulniers <ndesaulniers@google.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>
> Notes:
> Changes in v3:
> - Move Kconfig/Makefile logic to arch-independent location
> - Tweak CONFIG_RELR documentation to remove "currently"
Excellent, thanks. Queued for 5.4.
One more question: is there any benefit to supporting this for loadable
modules as well?
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/mm: fix variable 'tag' set but not used
From: Qian Cai @ 2019-08-01 12:07 UTC (permalink / raw)
To: Will Deacon; +Cc: Catalin Marinas, linux-kernel, linux-arm-kernel, andreyknvl
In-Reply-To: <20190801120121.6cmtho3wd32nzfoz@willie-the-truck>
> On Aug 1, 2019, at 8:01 AM, Will Deacon <will@kernel.org> wrote:
>
> On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
>> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
>> warning,
>>
>> mm/kasan/common.c: In function '__kasan_kmalloc':
>> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
>> [-Wunused-but-set-variable]
>> u8 tag = 0xff;
>> ^~~
>>
>> Fix it by making __tag_set() a static inline function.
>>
>> Signed-off-by: Qian Cai <cai@lca.pw>
>> ---
>> arch/arm64/include/asm/memory.h | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
>> index b7ba75809751..9645b1340afe 100644
>> --- a/arch/arm64/include/asm/memory.h
>> +++ b/arch/arm64/include/asm/memory.h
>> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
>> #define __tag_reset(addr) untagged_addr(addr)
>> #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
>> #else
>> -#define __tag_set(addr, tag) (addr)
>> +static inline const void *__tag_set(const void *addr, u8 tag)
>> +{
>> + return addr;
>> +}
>
> Why doesn't this trigger a warning in page_to_virt(), which passes an
> unsigned long for the address parameter?
#define page_to_virt(page) … __tag_set(__addr, page_kasan_tag(page)); …
static inline u8 page_kasan_tag(const struct page *page)
{
return 0xff;
}
GCC will see that “page” is used.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 5/7] drivers: Introduce device lookup variants by ACPI_COMPANION device
From: Wolfram Sang @ 2019-08-01 12:08 UTC (permalink / raw)
To: Andy Shevchenko
Cc: rafael, gregkh, Suzuki K Poulose, linux-kernel, linux-spi,
linux-acpi, Mark Brown, Jarkko Nikula, linux-i2c, Mika Westerberg,
linux-arm-kernel, Len Brown
In-Reply-To: <20190801115856.GS23480@smile.fi.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 1287 bytes --]
On Thu, Aug 01, 2019 at 02:58:56PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 26, 2019 at 10:23:54PM +0200, Wolfram Sang wrote:
> > On Tue, Jul 23, 2019 at 11:18:36PM +0100, Suzuki K Poulose wrote:
> > > Add a generic helper to match a device by the ACPI_COMPANION device
> > > and provide wrappers for the device lookup APIs.
> > >
> > > Cc: Len Brown <lenb@kernel.org>
> > > Cc: linux-acpi@vger.kernel.org
> > > Cc: linux-spi@vger.kernel.org
> > > Cc: Mark Brown <broonie@kernel.org>
> > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> > > Cc: Wolfram Sang <wsa@the-dreams.de>
> > > Cc: linux-i2c@vger.kernel.org
> > > Cc: Mark Brown <broonie@kernel.org>
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> >
> > From my side, OK:
> >
> > Acked-by: Wolfram Sang <wsa@the-dreams.de> # I2C parts
> >
> > yet you missed to cc the I2C ACPI maintainers. Done so now.
>
> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Thanks, Wolfram, for notifying.
Sure. There seems to be a problem, though? Please check:
[PATCH 1/3] i2c: Revert incorrect conversion to use generic helper
which came in today.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/mm: fix variable 'tag' set but not used
From: Qian Cai @ 2019-08-01 12:09 UTC (permalink / raw)
To: Will Deacon; +Cc: Catalin Marinas, linux-kernel, linux-arm-kernel, andreyknvl
In-Reply-To: <5E9F5456-3B82-4CB8-868B-1C7B4CBE4CBC@lca.pw>
> On Aug 1, 2019, at 8:07 AM, Qian Cai <cai@lca.pw> wrote:
>
>
>
>> On Aug 1, 2019, at 8:01 AM, Will Deacon <will@kernel.org> wrote:
>>
>> On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
>>> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
>>> warning,
>>>
>>> mm/kasan/common.c: In function '__kasan_kmalloc':
>>> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
>>> [-Wunused-but-set-variable]
>>> u8 tag = 0xff;
>>> ^~~
>>>
>>> Fix it by making __tag_set() a static inline function.
>>>
>>> Signed-off-by: Qian Cai <cai@lca.pw>
>>> ---
>>> arch/arm64/include/asm/memory.h | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
>>> index b7ba75809751..9645b1340afe 100644
>>> --- a/arch/arm64/include/asm/memory.h
>>> +++ b/arch/arm64/include/asm/memory.h
>>> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
>>> #define __tag_reset(addr) untagged_addr(addr)
>>> #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
>>> #else
>>> -#define __tag_set(addr, tag) (addr)
>>> +static inline const void *__tag_set(const void *addr, u8 tag)
>>> +{
>>> + return addr;
>>> +}
>>
>> Why doesn't this trigger a warning in page_to_virt(), which passes an
>> unsigned long for the address parameter?
>
> #define page_to_virt(page) … __tag_set(__addr, page_kasan_tag(page)); …
>
> static inline u8 page_kasan_tag(const struct page *page)
> {
> return 0xff;
> }
>
> GCC will see that “page” is used.
If you are talking about “addr”,
#define __tag_set(addr, tag) (addr)
It is actually used.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v19 00/15] arm64: untag user pointers passed to the kernel
From: Kevin Brodsky @ 2019-08-01 12:11 UTC (permalink / raw)
To: Dave Hansen, Andrey Konovalov, linux-arm-kernel, linux-mm,
linux-kernel, amd-gfx, dri-devel, linux-rdma, linux-media, kvm,
linux-kselftest
Cc: Mark Rutland, Szabolcs Nagy, Catalin Marinas, Will Deacon,
Kostya Serebryany, Khalid Aziz, Felix Kuehling, Vincenzo Frascino,
Jacob Bramley, Leon Romanovsky, Christoph Hellwig,
Jason Gunthorpe, Dave Martin, Evgeniy Stepanov, Kees Cook,
Ruben Ayrapetyan, Ramana Radhakrishnan, Alex Williamson,
Mauro Carvalho Chehab, Dmitry Vyukov, Greg Kroah-Hartman,
Yishai Hadas, Jens Wiklander, Lee Smith, Alexander Deucher,
Andrew Morton, enh, Robin Murphy, Christian Koenig,
Luc Van Oostenryck
In-Reply-To: <8c618cc9-ae68-9769-c5bb-67f1295abc4e@intel.com>
On 31/07/2019 17:50, Dave Hansen wrote:
> On 7/23/19 10:58 AM, Andrey Konovalov wrote:
>> The mmap and mremap (only new_addr) syscalls do not currently accept
>> tagged addresses. Architectures may interpret the tag as a background
>> colour for the corresponding vma.
> What the heck is a "background colour"? :)
Good point, this is some jargon that we started using for MTE, the idea being that
the kernel could set a tag value (specified during mmap()) as "background colour" for
anonymous pages allocated in that range.
Anyway, this patch series is not about MTE. Andrey, for v20 (if any), I think it's
best to drop this last sentence to avoid any confusion.
Kevin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64/mm: fix variable 'tag' set but not used
From: Will Deacon @ 2019-08-01 12:12 UTC (permalink / raw)
To: Qian Cai; +Cc: Catalin Marinas, linux-kernel, linux-arm-kernel, andreyknvl
In-Reply-To: <5E9F5456-3B82-4CB8-868B-1C7B4CBE4CBC@lca.pw>
On Thu, Aug 01, 2019 at 08:07:12AM -0400, Qian Cai wrote:
>
>
> > On Aug 1, 2019, at 8:01 AM, Will Deacon <will@kernel.org> wrote:
> >
> > On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
> >> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
> >> warning,
> >>
> >> mm/kasan/common.c: In function '__kasan_kmalloc':
> >> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
> >> [-Wunused-but-set-variable]
> >> u8 tag = 0xff;
> >> ^~~
> >>
> >> Fix it by making __tag_set() a static inline function.
> >>
> >> Signed-off-by: Qian Cai <cai@lca.pw>
> >> ---
> >> arch/arm64/include/asm/memory.h | 6 +++++-
> >> 1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> >> index b7ba75809751..9645b1340afe 100644
> >> --- a/arch/arm64/include/asm/memory.h
> >> +++ b/arch/arm64/include/asm/memory.h
> >> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
> >> #define __tag_reset(addr) untagged_addr(addr)
> >> #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
> >> #else
> >> -#define __tag_set(addr, tag) (addr)
> >> +static inline const void *__tag_set(const void *addr, u8 tag)
> >> +{
> >> + return addr;
> >> +}
> >
> > Why doesn't this trigger a warning in page_to_virt(), which passes an
> > unsigned long for the address parameter?
>
> #define page_to_virt(page) … __tag_set(__addr, page_kasan_tag(page)); …
>
> static inline u8 page_kasan_tag(const struct page *page)
> {
> return 0xff;
> }
>
> GCC will see that “page” is used.
No, I mean because you're making addr 'const void *'.
/me finds a toolchain.
Look:
In file included from ./arch/arm64/include/asm/pgtable-hwdef.h:8,
from ./arch/arm64/include/asm/processor.h:35,
from ./include/linux/mutex.h:19,
from ./include/linux/kernfs.h:12,
from ./include/linux/sysfs.h:16,
from ./include/linux/kobject.h:20,
from ./include/linux/of.h:17,
from ./include/linux/irqdomain.h:35,
from ./include/linux/acpi.h:13,
from ./include/acpi/apei.h:9,
from ./include/acpi/ghes.h:5,
from ./include/linux/arm_sdei.h:14,
from arch/arm64/kernel/asm-offsets.c:10:
./include/linux/mm.h: In function ‘lowmem_page_address’:
./arch/arm64/include/asm/memory.h:309:14: warning: passing argument 1 of ‘__tag_set’ makes pointer from integer without a cast [-Wint-conversion]
__tag_set(__addr, page_kasan_tag(page)); \
^~~~~~
./include/linux/mm.h:1302:9: note: in expansion of macro ‘page_to_virt’
return page_to_virt(page);
^~~~~~~~~~~~
./arch/arm64/include/asm/memory.h:213:49: note: expected ‘const void *’ but argument is of type ‘long unsigned int’
static inline const void *__tag_set(const void *addr, u8 tag)
~~~~~~~~~~~~^~~~
./arch/arm64/include/asm/memory.h:309:4: warning: initialization of ‘long unsigned int’ from ‘const void *’ makes integer from pointer without a cast [-Wint-conversion]
__tag_set(__addr, page_kasan_tag(page)); \
^~~~~~~~~
./include/linux/mm.h:1302:9: note: in expansion of macro ‘page_to_virt’
return page_to_virt(page);
^~~~~~~~~~~~
If you're going to send patches removing compiler warnings, please have the
courtesy to test them first.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 02/13] drm/radeon: Eliminate possible use of an uninitialized variable
From: Neil Armstrong @ 2019-08-01 12:15 UTC (permalink / raw)
To: Andrzej Pietrasiewicz, dri-devel
Cc: David Airlie, Matthias Brugger, Thierry Reding,
Krzysztof Kozlowski, Shawn Guo, kernel, Anthony Koo,
linux-samsung-soc, Tomi Valkeinen, David Francis, Mamta Shukla,
Jonathan Hunter, linux-rockchip, Kukjin Kim, Allison Randal,
Leo Li, linux-arm-msm, intel-gfx, Jyri Sarha, linux-mediatek,
Rodrigo Vivi, linux-tegra, Thomas Gleixner, Bhawanpreet Lakha,
linux-arm-kernel, Sean Paul, amd-gfx, Greg Kroah-Hartman,
Seung-Woo Kim, linux-kernel, Christian König, Todor Tomov,
Kyungmin Park, Alex Deucher, freedreno, Nicholas Kazlauskas
In-Reply-To: <cfff357a07bfa572baad058947f281b7095e1794.1564591626.git.andrzej.p@collabora.com>
Hi Andrzej,
I had to revert the previous patch, so you should re-spin it entirely :
================================
After merging the drm-misc tree, today's linux-next build (x86_64
allmodconfig) failed like this:
drivers/gpu/drm/radeon/radeon_connectors.c: In function 'radeon_add_legacy_connector':
drivers/gpu/drm/radeon/radeon_connectors.c:2433:5: error: 'ddc' undeclared (first use in this function)
ddc = &radeon_connector->ddc_bus->adapter;
^~~
drivers/gpu/drm/radeon/radeon_connectors.c:2433:5: note: each undeclared identifier is reported only once for each function it appears in
Caused by commit
bed7a2182de6 ("drm/radeon: Provide ddc symlink in connector sysfs directory")
I have used the drm-misc tree from next-20190731 for today.
==================================
Neil
On 31/07/2019 18:58, Andrzej Pietrasiewicz wrote:
> ddc local variable is passed to drm_connector_init_with_ddc() and should
> be NULL if no ddc is available.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
> ---
> drivers/gpu/drm/radeon/radeon_connectors.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index b3ad8d890801..d11131d03ed6 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -1870,7 +1870,7 @@ radeon_add_atom_connector(struct drm_device *dev,
> struct radeon_connector_atom_dig *radeon_dig_connector;
> struct drm_encoder *encoder;
> struct radeon_encoder *radeon_encoder;
> - struct i2c_adapter *ddc;
> + struct i2c_adapter *ddc = NULL;
> uint32_t subpixel_order = SubPixelNone;
> bool shared_ddc = false;
> bool is_dp_bridge = false;
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 1/4] arm64: kprobes: Recover pstate.D in single-step exception handler
From: Will Deacon @ 2019-08-01 12:16 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Dan Rue, Daniel Diaz, Anders Roxell, Catalin Marinas,
Naresh Kamboju, Will Deacon, linux-kernel, James Morse, Matt Hart,
linux-arm-kernel
In-Reply-To: <156404255444.2020.3301023170351823334.stgit@devnote2>
On Thu, Jul 25, 2019 at 05:15:54PM +0900, Masami Hiramatsu wrote:
> kprobes manipulates the interrupted PSTATE for single step, and
> doesn't restore it. Thus, if we put a kprobe where the pstate.D
> (debug) masked, the mask will be cleared after the kprobe hits.
>
> Moreover, in the most complicated case, this can lead a kernel
> crash with below message when a nested kprobe hits.
>
> [ 152.118921] Unexpected kernel single-step exception at EL1
>
> When the 1st kprobe hits, do_debug_exception() will be called.
> At this point, debug exception (= pstate.D) must be masked (=1).
> But if another kprobes hits before single-step of the first kprobe
> (e.g. inside user pre_handler), it unmask the debug exception
> (pstate.D = 0) and return.
> Then, when the 1st kprobe setting up single-step, it saves current
> DAIF, mask DAIF, enable single-step, and restore DAIF.
> However, since "D" flag in DAIF is cleared by the 2nd kprobe, the
> single-step exception happens soon after restoring DAIF.
>
> This has been introduced by commit 7419333fa15e ("arm64: kprobe:
> Always clear pstate.D in breakpoint exception handler")
>
> To solve this issue, this stores all DAIF bits and restore it
> after single stepping.
>
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Fixes: commit 7419333fa15e ("arm64: kprobe: Always clear pstate.D in breakpoint exception handler")
> Reviewed-by: James Morse <james.morse@arm.com>
> Tested-by: James Morse <james.morse@arm.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
> Changes in v3:
> - Update patch description
> - move PSR_DAIF_MASK in daifflags.h
> Changes in v2:
> - Save and restore all DAIF flags.
> - Operate pstate directly and remove spsr_set_debug_flag().
> ---
> arch/arm64/include/asm/daifflags.h | 2 ++
> arch/arm64/kernel/probes/kprobes.c | 39 +++++-------------------------------
> 2 files changed, 7 insertions(+), 34 deletions(-)
I'm seeing an allmodconfig build failure with this:
arch/arm64/kernel/probes/kprobes.c: In function ‘kprobes_save_local_irqflag’:
arch/arm64/kernel/probes/kprobes.c:181:38: error: ‘DAIF_MASK’ undeclared (first use in this function); did you mean ‘BIT_MASK’?
kcb->saved_irqflag = regs->pstate & DAIF_MASK;
^~~~~~~~~
BIT_MASK
arch/arm64/kernel/probes/kprobes.c:181:38: note: each undeclared identifier is reported only once for each function it appears in
arch/arm64/kernel/probes/kprobes.c: In function ‘kprobes_restore_local_irqflag’:
arch/arm64/kernel/probes/kprobes.c:190:19: error: ‘DAIF_MASK’ undeclared (first use in this function); did you mean ‘BIT_MASK’?
regs->pstate &= ~DAIF_MASK;
^~~~~~~~~
BIT_MASK
make[2]: *** [scripts/Makefile.build:274: arch/arm64/kernel/probes/kprobes.o] Error 1
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 5/7] drivers: Introduce device lookup variants by ACPI_COMPANION device
From: Andy Shevchenko @ 2019-08-01 12:21 UTC (permalink / raw)
To: Wolfram Sang
Cc: rafael, gregkh, Suzuki K Poulose, linux-kernel, linux-spi,
linux-acpi, Mark Brown, Jarkko Nikula, linux-i2c, Mika Westerberg,
linux-arm-kernel, Len Brown
In-Reply-To: <20190801120830.GA1659@ninjato>
On Thu, Aug 01, 2019 at 02:08:30PM +0200, Wolfram Sang wrote:
> On Thu, Aug 01, 2019 at 02:58:56PM +0300, Andy Shevchenko wrote:
> > On Fri, Jul 26, 2019 at 10:23:54PM +0200, Wolfram Sang wrote:
> > > On Tue, Jul 23, 2019 at 11:18:36PM +0100, Suzuki K Poulose wrote:
> > > > Add a generic helper to match a device by the ACPI_COMPANION device
> > > > and provide wrappers for the device lookup APIs.
> > > >
> > > > Cc: Len Brown <lenb@kernel.org>
> > > > Cc: linux-acpi@vger.kernel.org
> > > > Cc: linux-spi@vger.kernel.org
> > > > Cc: Mark Brown <broonie@kernel.org>
> > > > Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> > > > Cc: Wolfram Sang <wsa@the-dreams.de>
> > > > Cc: linux-i2c@vger.kernel.org
> > > > Cc: Mark Brown <broonie@kernel.org>
> > > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > >
> > > From my side, OK:
> > >
> > > Acked-by: Wolfram Sang <wsa@the-dreams.de> # I2C parts
> > >
> > > yet you missed to cc the I2C ACPI maintainers. Done so now.
> >
> > Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Thanks, Wolfram, for notifying.
>
> Sure. There seems to be a problem, though? Please check:
>
> [PATCH 1/3] i2c: Revert incorrect conversion to use generic helper
>
> which came in today.
It's again not Cc'ed to all parties.
But OK, looks good to me.
Tough may be Jarkko can test all this.
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] iommu/arm-smmu-v3: add nr_ats_masters to avoid unnecessary operations
From: Zhen Lei @ 2019-08-01 12:20 UTC (permalink / raw)
To: Jean-Philippe Brucker, John Garry, Robin Murphy, Will Deacon,
Joerg Roedel, linux-arm-kernel, iommu, linux-kernel
Cc: Zhen Lei
When (smmu_domain->smmu->features & ARM_SMMU_FEAT_ATS) is true, even if a
smmu domain does not contain any ats master, the operations of
arm_smmu_atc_inv_to_cmd() and lock protection in arm_smmu_atc_inv_domain()
are always executed. This will impact performance, especially in
multi-core and stress scenarios. For my FIO test scenario, about 8%
performance reduced.
In fact, we can use a atomic member to record how many ats masters the
smmu contains. And check that without traverse the list and check all
masters one by one in the lock protection.
Fixes: 9ce27afc0830 ("iommu/arm-smmu-v3: Add support for PCI ATS")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/arm-smmu-v3.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index a9a9fabd396804a..1b370d9aca95f94 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -631,6 +631,7 @@ struct arm_smmu_domain {
struct io_pgtable_ops *pgtbl_ops;
bool non_strict;
+ atomic_t nr_ats_masters;
enum arm_smmu_domain_stage stage;
union {
@@ -1531,7 +1532,7 @@ static int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain,
struct arm_smmu_cmdq_ent cmd;
struct arm_smmu_master *master;
- if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_ATS))
+ if (!atomic_read(&smmu_domain->nr_ats_masters))
return 0;
arm_smmu_atc_inv_to_cmd(ssid, iova, size, &cmd);
@@ -1869,6 +1870,7 @@ static int arm_smmu_enable_ats(struct arm_smmu_master *master)
size_t stu;
struct pci_dev *pdev;
struct arm_smmu_device *smmu = master->smmu;
+ struct arm_smmu_domain *smmu_domain = master->domain;
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev);
if (!(smmu->features & ARM_SMMU_FEAT_ATS) || !dev_is_pci(master->dev) ||
@@ -1887,12 +1889,15 @@ static int arm_smmu_enable_ats(struct arm_smmu_master *master)
return ret;
master->ats_enabled = true;
+ atomic_inc(&smmu_domain->nr_ats_masters);
+
return 0;
}
static void arm_smmu_disable_ats(struct arm_smmu_master *master)
{
struct arm_smmu_cmdq_ent cmd;
+ struct arm_smmu_domain *smmu_domain = master->domain;
if (!master->ats_enabled || !dev_is_pci(master->dev))
return;
@@ -1901,6 +1906,7 @@ static void arm_smmu_disable_ats(struct arm_smmu_master *master)
arm_smmu_atc_inv_master(master, &cmd);
pci_disable_ats(to_pci_dev(master->dev));
master->ats_enabled = false;
+ atomic_dec(&smmu_domain->nr_ats_masters);
}
static void arm_smmu_detach_dev(struct arm_smmu_master *master)
@@ -1915,10 +1921,10 @@ static void arm_smmu_detach_dev(struct arm_smmu_master *master)
list_del(&master->domain_head);
spin_unlock_irqrestore(&smmu_domain->devices_lock, flags);
- master->domain = NULL;
arm_smmu_install_ste_for_dev(master);
arm_smmu_disable_ats(master);
+ master->domain = NULL;
}
static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
--
1.8.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 1/2] iommu/iova: introduce iova_magazine_compact_pfns()
From: Zhen Lei @ 2019-08-01 12:21 UTC (permalink / raw)
To: Jean-Philippe Brucker, John Garry, Robin Murphy, Will Deacon,
Joerg Roedel, linux-arm-kernel, iommu, linux-kernel
Cc: Zhen Lei
iova_magazine_free_pfns() can only free the whole magazine buffer, add
iova_magazine_compact_pfns() to support free part of it.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/iova.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 3e1a8a6755723a9..4b7a9efa0ef40af 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -795,18 +795,19 @@ static void iova_magazine_free(struct iova_magazine *mag)
kfree(mag);
}
-static void
-iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
+static void iova_magazine_compact_pfns(struct iova_magazine *mag,
+ struct iova_domain *iovad,
+ unsigned long newsize)
{
unsigned long flags;
int i;
- if (!mag)
+ if (!mag || mag->size <= newsize)
return;
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
- for (i = 0 ; i < mag->size; ++i) {
+ for (i = newsize; i < mag->size; ++i) {
struct iova *iova = private_find_iova(iovad, mag->pfns[i]);
BUG_ON(!iova);
@@ -815,7 +816,13 @@ static void iova_magazine_free(struct iova_magazine *mag)
spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);
- mag->size = 0;
+ mag->size = newsize;
+}
+
+static void
+iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
+{
+ iova_magazine_compact_pfns(mag, iovad, 0);
}
static bool iova_magazine_full(struct iova_magazine *mag)
--
1.8.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH 2/2] iommu/iova: enhance the rcache optimization
From: Zhen Lei @ 2019-08-01 12:21 UTC (permalink / raw)
To: Jean-Philippe Brucker, John Garry, Robin Murphy, Will Deacon,
Joerg Roedel, linux-arm-kernel, iommu, linux-kernel
Cc: Zhen Lei
In-Reply-To: <20190801122154.18820-1-thunder.leizhen@huawei.com>
The rcache method caches the freed IOVAs, to improve the performance of
IOVAs allocation and release. This is usually okay, but it maybe declined
in some special scenarios.
For example, currently the IOVA_RANGE_CACHE_MAX_SIZE is 6, and for ecch
size, contains: MAX_GLOBAL_MAGS=32 shareable depot magazines, each vcpu
has two magazines(cpu_rcaches->loaded and cpu_rcaches->prev). In an
extreme case, it can max cache ((num_possible_cpus() * 2 + 32) * 128 * 6)
IOVAs, it's very large. The worst case happens when the depot magazines
of a certain size(usually 4K) is full, further free_iova_fast() invoking
will cause iova_magazine_free_pfns() to be called. As the above saied,
too many IOVAs buffered, so that the RB tree is very large, the
iova_magazine_free_pfns()-->private_find_iova(), and the missed iova
allocation: alloc_iova()-->__alloc_and_insert_iova_range() will spend too
much time. And that the current rcache method have no cleanup operation,
the buffered IOVAs will only increase but not decrease.
For my FIO stress test scenario, the performance drop about 35%, and can
not recover even if re-execute the test cases.
Jobs: 21 (f=21): [2.3% done] [8887M/0K /s] [2170K/0 iops]
Jobs: 21 (f=21): [2.3% done] [8902M/0K /s] [2173K/0 iops]
Jobs: 21 (f=21): [2.3% done] [6010M/0K /s] [1467K/0 iops]
Jobs: 21 (f=21): [2.3% done] [5397M/0K /s] [1318K/0 iops]
So that, I add the statistic about the rcache, when the above case
happened, release the IOVAs which are not hit.
Jobs: 21 (f=21): [100.0% done] [10324M/0K /s] [2520K/0 iops]
Jobs: 21 (f=21): [100.0% done] [10290M/0K /s] [2512K/0 iops]
Jobs: 21 (f=21): [100.0% done] [10035M/0K /s] [2450K/0 iops]
Jobs: 21 (f=21): [100.0% done] [10214M/0K /s] [2494K/0 iops]
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/iova.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++-
include/linux/iova.h | 1 +
2 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index 4b7a9efa0ef40af..f3828f4add25375 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -23,6 +23,8 @@ static unsigned long iova_rcache_get(struct iova_domain *iovad,
unsigned long limit_pfn);
static void init_iova_rcaches(struct iova_domain *iovad);
static void free_iova_rcaches(struct iova_domain *iovad);
+static void iova_compact_rcache(struct iova_domain *iovad,
+ struct iova_rcache *curr_rcache);
static void fq_destroy_all_entries(struct iova_domain *iovad);
static void fq_flush_timeout(struct timer_list *t);
@@ -781,6 +783,8 @@ struct iova_magazine {
struct iova_cpu_rcache {
spinlock_t lock;
+ bool prev_mag_hit;
+ unsigned long nr_hit;
struct iova_magazine *loaded;
struct iova_magazine *prev;
};
@@ -934,6 +938,7 @@ static bool __iova_rcache_insert(struct iova_domain *iovad,
if (mag_to_free) {
iova_magazine_free_pfns(mag_to_free, iovad);
iova_magazine_free(mag_to_free);
+ iova_compact_rcache(iovad, rcache);
}
return can_insert;
@@ -971,18 +976,22 @@ static unsigned long __iova_rcache_get(struct iova_rcache *rcache,
} else if (!iova_magazine_empty(cpu_rcache->prev)) {
swap(cpu_rcache->prev, cpu_rcache->loaded);
has_pfn = true;
+ cpu_rcache->prev_mag_hit = true;
} else {
spin_lock(&rcache->lock);
if (rcache->depot_size > 0) {
iova_magazine_free(cpu_rcache->loaded);
cpu_rcache->loaded = rcache->depot[--rcache->depot_size];
has_pfn = true;
+ rcache->depot_mags_hit = true;
}
spin_unlock(&rcache->lock);
}
- if (has_pfn)
+ if (has_pfn) {
+ cpu_rcache->nr_hit++;
iova_pfn = iova_magazine_pop(cpu_rcache->loaded, limit_pfn);
+ }
spin_unlock_irqrestore(&cpu_rcache->lock, flags);
@@ -1049,5 +1058,77 @@ void free_cpu_cached_iovas(unsigned int cpu, struct iova_domain *iovad)
}
}
+static void iova_compact_percpu_mags(struct iova_domain *iovad,
+ struct iova_rcache *rcache)
+{
+ unsigned int cpu;
+
+ for_each_possible_cpu(cpu) {
+ unsigned long flags;
+ struct iova_cpu_rcache *cpu_rcache;
+
+ cpu_rcache = per_cpu_ptr(rcache->cpu_rcaches, cpu);
+
+ spin_lock_irqsave(&cpu_rcache->lock, flags);
+ if (!cpu_rcache->prev_mag_hit)
+ iova_magazine_free_pfns(cpu_rcache->prev, iovad);
+
+ if (cpu_rcache->nr_hit < IOVA_MAG_SIZE)
+ iova_magazine_compact_pfns(cpu_rcache->loaded,
+ iovad,
+ cpu_rcache->nr_hit);
+
+ cpu_rcache->nr_hit = 0;
+ cpu_rcache->prev_mag_hit = false;
+ spin_unlock_irqrestore(&cpu_rcache->lock, flags);
+ }
+}
+
+static void iova_compact_depot_mags(struct iova_domain *iovad,
+ struct iova_rcache *rcache)
+{
+ int i;
+ unsigned long depot_size;
+ struct iova_magazine *depot[MAX_GLOBAL_MAGS];
+
+ spin_lock(&rcache->lock);
+ if (!rcache->depot_size || rcache->depot_mags_hit) {
+ spin_unlock(&rcache->lock);
+ return;
+ }
+
+ depot_size = rcache->depot_size;
+ for (i = 0; i < depot_size; i++)
+ depot[i] = rcache->depot[i];
+ rcache->depot_size = 0;
+ rcache->depot_mags_hit = false;
+ spin_unlock(&rcache->lock);
+
+ for (i = 0; i < depot_size; i++) {
+ iova_magazine_free_pfns(depot[i], iovad);
+ iova_magazine_free(depot[i]);
+ }
+}
+
+static void iova_compact_rcache(struct iova_domain *iovad,
+ struct iova_rcache *curr_rcache)
+{
+ int i;
+ struct iova_rcache *rcache;
+
+ for (i = 0; i < IOVA_RANGE_CACHE_MAX_SIZE; i++) {
+ rcache = &iovad->rcaches[i];
+
+ /*
+ * Don's compact current rcache, that maybe reused immediately
+ */
+ if (rcache == curr_rcache)
+ continue;
+
+ iova_compact_percpu_mags(iovad, rcache);
+ iova_compact_depot_mags(iovad, rcache);
+ }
+}
+
MODULE_AUTHOR("Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>");
MODULE_LICENSE("GPL");
diff --git a/include/linux/iova.h b/include/linux/iova.h
index a0637abffee88b0..44f35b2641b736c 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -30,6 +30,7 @@ struct iova {
struct iova_rcache {
spinlock_t lock;
+ bool depot_mags_hit;
unsigned long depot_size;
struct iova_magazine *depot[MAX_GLOBAL_MAGS];
struct iova_cpu_rcache __percpu *cpu_rcaches;
--
1.8.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH v9 10/21] mm: Add generic p?d_leaf() macros
From: Steven Price @ 2019-08-01 12:22 UTC (permalink / raw)
To: Anshuman Khandual, Mark Rutland
Cc: x86, Arnd Bergmann, Ard Biesheuvel, Peter Zijlstra,
Catalin Marinas, Dave Hansen, linux-kernel, linux-mm,
Jérôme Glisse, Ingo Molnar, Borislav Petkov,
Andy Lutomirski, H. Peter Anvin, James Morse, Thomas Gleixner,
Will Deacon, Andrew Morton, linux-arm-kernel, Liang, Kan
In-Reply-To: <0979d4b4-7a97-2dc3-67cf-3aa6569bfdcd@arm.com>
On 01/08/2019 07:09, Anshuman Khandual wrote:
>
>
> On 07/29/2019 05:08 PM, Steven Price wrote:
>> On 28/07/2019 12:44, Anshuman Khandual wrote:
>>>
>>>
>>> On 07/23/2019 03:11 PM, Mark Rutland wrote:
>>>> On Mon, Jul 22, 2019 at 04:41:59PM +0100, Steven Price wrote:
>>>>> Exposing the pud/pgd levels of the page tables to walk_page_range() means
>>>>> we may come across the exotic large mappings that come with large areas
>>>>> of contiguous memory (such as the kernel's linear map).
>>>>>
>>>>> For architectures that don't provide all p?d_leaf() macros, provide
>>>>> generic do nothing default that are suitable where there cannot be leaf
>>>>> pages that that level.
>>>>>
>>>>> Signed-off-by: Steven Price <steven.price@arm.com>
>>>>
>>>> Not a big deal, but it would probably make sense for this to be patch 1
>>>> in the series, given it defines the semantic of p?d_leaf(), and they're
>>>> not used until we provide all the architectural implemetnations anyway.
>>>
>>> Agreed.
>>>
>>>>
>>>> It might also be worth pointing out the reasons for this naming, e.g.
>>>> p?d_large() aren't currently generic, and this name minimizes potential
>>>> confusion between p?d_{large,huge}().
>>>
>>> Agreed. But these fallback also need to first check non-availability of large
>>> pages. I am not sure whether CONFIG_HUGETLB_PAGE config being clear indicates
>>> that conclusively or not. Being a page table leaf entry has a broader meaning
>>> than a large page but that is really not the case today. All leaf entries here
>>> are large page entries from MMU perspective. This dependency can definitely be
>>> removed when there are other types of leaf entries but for now IMHO it feels
>>> bit problematic not to directly associate leaf entries with large pages in
>>> config restriction while doing exactly the same.
>>
>> The intention here is that the page walkers are able to walk any type of
>> page table entry which the kernel may use. CONFIG_HUGETLB_PAGE only
>> controls whether "huge TLB pages" are used by user space processes. It's
>> quite possible that option to not be selected but the linear mapping to
>> have been mapped using "large pages" (i.e. leaf entries further up the
>> tree than normal).
>
> I understand that kernel page table might use large pages where as user space
> never enabled HugeTLB. The point to make here was CONFIG_HUGETLB approximately
> indicates the presence of large pages though the absence of same does not
> conclusively indicate that large pages are really absent on the MMU. Perhaps it
> will requires something new like MMU_[LARGE|HUGE]_PAGES.
CONFIG_HUGETLB doesn't necessarily mean leaf entries can appear anywhere
other than PTE. Some architectures always have a full tree of page
tables, but can program their TLBs with larger entries - I think all the
architectures I've come across have software page table walking, but in
theory the arm64 contiguous hint bit could be considered similar.
Steve
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 5/7] drivers: Introduce device lookup variants by ACPI_COMPANION device
From: Wolfram Sang @ 2019-08-01 12:27 UTC (permalink / raw)
To: Andy Shevchenko
Cc: rafael, gregkh, Suzuki K Poulose, linux-kernel, linux-spi,
linux-acpi, Mark Brown, Jarkko Nikula, linux-i2c, Mika Westerberg,
linux-arm-kernel, Len Brown
In-Reply-To: <20190801122106.GU23480@smile.fi.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 220 bytes --]
> It's again not Cc'ed to all parties.
> But OK, looks good to me.
> Tough may be Jarkko can test all this.
To be fair, only Mika is listed as I2C ACPI maintainer. Feel free to add
more :) I assume Mika doesn't mind.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v1 1/1] i2c: iproc: Fix i2c master read more than 63 bytes
From: Wolfram Sang @ 2019-08-01 12:31 UTC (permalink / raw)
To: Rayagonda Kokatanur
Cc: Mark Rutland, devicetree, Florian Fainelli, linux-kernel,
Rob Herring, bcm-kernel-feedback-list, linux-i2c, Ray Jui,
linux-arm-kernel
In-Reply-To: <1563956907-21255-1-git-send-email-rayagonda.kokatanur@broadcom.com>
[-- Attachment #1.1: Type: text/plain, Size: 527 bytes --]
On Wed, Jul 24, 2019 at 01:58:27PM +0530, Rayagonda Kokatanur wrote:
> Use SMBUS_MASTER_DATA_READ.MASTER_RD_STATUS bit to check for RX
> FIFO empty condition because SMBUS_MASTER_FIFO_CONTROL.MASTER_RX_PKT_COUNT
> is not updated for read >= 64 bytes. This fixes the issue when trying to
> read from the I2C slave more than 63 bytes.
>
> Fixes: c24b8d574b7c ("i2c: iproc: Extend I2C read up to 255 bytes")
>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Applied to for-current, thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH net-next] net: mediatek: use devm_platform_ioremap_resource() to simplify code
From: YueHaibing @ 2019-08-01 12:33 UTC (permalink / raw)
To: davem, nbd, john, sean.wang, nelson.chang, matthias.bgg
Cc: netdev, YueHaibing, linux-mediatek, linux-kernel,
linux-arm-kernel
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e529d86..ddbffeb 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2447,7 +2447,6 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
static int mtk_probe(struct platform_device *pdev)
{
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct device_node *mac_np;
struct mtk_eth *eth;
int err;
@@ -2460,7 +2459,7 @@ static int mtk_probe(struct platform_device *pdev)
eth->soc = of_device_get_match_data(&pdev->dev);
eth->dev = &pdev->dev;
- eth->base = devm_ioremap_resource(&pdev->dev, res);
+ eth->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(eth->base))
return PTR_ERR(eth->base);
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH v19 02/15] arm64: Introduce prctl() options to control the tagged user addresses ABI
From: Kevin Brodsky @ 2019-08-01 12:38 UTC (permalink / raw)
To: Dave Hansen, Andrey Konovalov, linux-arm-kernel, linux-mm,
linux-kernel, amd-gfx, dri-devel, linux-rdma, linux-media, kvm,
linux-kselftest
Cc: Mark Rutland, Szabolcs Nagy, Catalin Marinas, Will Deacon,
Kostya Serebryany, Khalid Aziz, Felix Kuehling, Vincenzo Frascino,
Jacob Bramley, Leon Romanovsky, Christoph Hellwig,
Jason Gunthorpe, Dave Martin, Evgeniy Stepanov, Kees Cook,
Ruben Ayrapetyan, Ramana Radhakrishnan, Alex Williamson,
Mauro Carvalho Chehab, Dmitry Vyukov, Greg Kroah-Hartman,
Yishai Hadas, Jens Wiklander, Lee Smith, Alexander Deucher,
Andrew Morton, enh, Robin Murphy, Christian Koenig,
Luc Van Oostenryck
In-Reply-To: <7a34470c-73f0-26ac-e63d-161191d4b1e4@intel.com>
On 31/07/2019 18:05, Dave Hansen wrote:
> On 7/23/19 10:58 AM, Andrey Konovalov wrote:
>> +long set_tagged_addr_ctrl(unsigned long arg)
>> +{
>> + if (!tagged_addr_prctl_allowed)
>> + return -EINVAL;
>> + if (is_compat_task())
>> + return -EINVAL;
>> + if (arg & ~PR_TAGGED_ADDR_ENABLE)
>> + return -EINVAL;
>> +
>> + update_thread_flag(TIF_TAGGED_ADDR, arg & PR_TAGGED_ADDR_ENABLE);
>> +
>> + return 0;
>> +}
> Instead of a plain enable/disable, a more flexible ABI would be to have
> the tag mask be passed in. That way, an implementation that has a
> flexible tag size can select it. It also ensures that userspace
> actually knows what the tag size is and isn't surprised if a hardware
> implementation changes the tag size or position.
>
> Also, this whole set deals with tagging/untagging, but there's an
> effective loss of address space when you do this. Is that dealt with
> anywhere? How do we ensure that allocations don't get placed at a
> tagged address before this gets turned on? Where's that checking?
This patch series only changes what is allowed or not at the syscall interface. It
does not change the address space size. On arm64, TBI (Top Byte Ignore) has always
been enabled for userspace, so it has never been possible to use the upper 8 bits of
user pointers for addressing.
If other architectures were to support a similar functionality, then I agree that a
common and more generic interface (if needed) would be helpful, but as it stands this
is an arm64-specific prctl, and on arm64 the address tag is defined by the
architecture as bits [63:56].
Kevin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH net-next] bcm63xx_enet: use devm_platform_ioremap_resource() to simplify code
From: YueHaibing @ 2019-08-01 12:39 UTC (permalink / raw)
To: davem, f.fainelli, bcm-kernel-feedback-list, andrew,
linux-arm-kernel
Cc: netdev, YueHaibing, linux-kernel
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/broadcom/bcm63xx_enet.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 291e4af..620cd3f 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1693,7 +1693,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
struct bcm_enet_priv *priv;
struct net_device *dev;
struct bcm63xx_enet_platform_data *pd;
- struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
+ struct resource *res_irq, *res_irq_rx, *res_irq_tx;
struct mii_bus *bus;
int i, ret;
@@ -1719,8 +1719,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
if (ret)
goto out;
- res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
goto out;
@@ -2762,15 +2761,13 @@ struct platform_driver bcm63xx_enetsw_driver = {
/* reserve & remap memory space shared between all macs */
static int bcm_enet_shared_probe(struct platform_device *pdev)
{
- struct resource *res;
void __iomem *p[3];
unsigned int i;
memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
for (i = 0; i < 3; i++) {
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
- p[i] = devm_ioremap_resource(&pdev->dev, res);
+ p[i] = devm_platform_ioremap_resource(pdev, i);
if (IS_ERR(p[i]))
return PTR_ERR(p[i]);
}
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox