aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch
new file mode 100644
index 00000000..6b5c1c6f
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71-e3000/0003-amd-xgbe-Remove-use-of-comm_owned-field.patch
@@ -0,0 +1,76 @@
+From 34f2152820350514007573625e85cf97366d3172 Mon Sep 17 00:00:00 2001
+From: Tom Lendacky <thomas.lendacky@amd.com>
+Date: Wed, 23 May 2018 11:38:29 -0500
+Subject: [PATCH 03/95] amd-xgbe: Remove use of comm_owned field
+
+The comm_owned field can hide logic where double locking is attempted
+and prevent multiple threads for the same device from accessing the
+mutex properly. Remove the comm_owned field and use the mutex API
+exclusively for gaining ownership. The current driver has been audited
+and is obtaining communications ownership properly.
+
+Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
+---
+ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+index 123ceb0..05003be 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+@@ -327,8 +327,6 @@ struct xgbe_phy_data {
+
+ unsigned int mdio_addr;
+
+- unsigned int comm_owned;
+-
+ /* SFP Support */
+ enum xgbe_sfp_comm sfp_comm;
+ unsigned int sfp_mux_address;
+@@ -382,12 +380,6 @@ static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata);
+ static int xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata,
+ struct xgbe_i2c_op *i2c_op)
+ {
+- struct xgbe_phy_data *phy_data = pdata->phy_data;
+-
+- /* Be sure we own the bus */
+- if (WARN_ON(!phy_data->comm_owned))
+- return -EIO;
+-
+ return pdata->i2c_if.i2c_xfer(pdata, i2c_op);
+ }
+
+@@ -549,10 +541,6 @@ static int xgbe_phy_sfp_get_mux(struct xgbe_prv_data *pdata)
+
+ static void xgbe_phy_put_comm_ownership(struct xgbe_prv_data *pdata)
+ {
+- struct xgbe_phy_data *phy_data = pdata->phy_data;
+-
+- phy_data->comm_owned = 0;
+-
+ mutex_unlock(&xgbe_phy_comm_lock);
+ }
+
+@@ -562,9 +550,6 @@ static int xgbe_phy_get_comm_ownership(struct xgbe_prv_data *pdata)
+ unsigned long timeout;
+ unsigned int mutex_id;
+
+- if (phy_data->comm_owned)
+- return 0;
+-
+ /* The I2C and MDIO/GPIO bus is multiplexed between multiple devices,
+ * the driver needs to take the software mutex and then the hardware
+ * mutexes before being able to use the busses.
+@@ -593,7 +578,6 @@ static int xgbe_phy_get_comm_ownership(struct xgbe_prv_data *pdata)
+ XP_IOWRITE(pdata, XP_I2C_MUTEX, mutex_id);
+ XP_IOWRITE(pdata, XP_MDIO_MUTEX, mutex_id);
+
+- phy_data->comm_owned = 1;
+ return 0;
+ }
+
+--
+2.7.4
+