Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/460446/?format=api
{ "id": 460446, "url": "http://patchwork.ozlabs.org/api/patches/460446/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1428793566-14375-1-git-send-email-yanirx.lubetkin@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1428793566-14375-1-git-send-email-yanirx.lubetkin@intel.com>", "list_archive_url": null, "date": "2015-04-11T23:06:06", "name": "[v4] e1000e i219 fix unit hang on reset and runtime D3", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "53f4182b3f1af2811c3b693f10fc1342b79687b0", "submitter": { "id": 66154, "url": "http://patchwork.ozlabs.org/api/people/66154/?format=api", "name": "Yanir Lubetkin", "email": "yanirx.lubetkin@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1428793566-14375-1-git-send-email-yanirx.lubetkin@intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/460446/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/460446/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Received": [ "from silver.osuosl.org (silver.osuosl.org [140.211.166.136])\n\tby ozlabs.org (Postfix) with ESMTP id 11E72140134\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 12 Apr 2015 09:07:06 +1000 (AEST)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id DE2B5320A6;\n\tSat, 11 Apr 2015 23:07:05 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id dvF1V-WBphBp; Sat, 11 Apr 2015 23:07:03 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 210FB26403;\n\tSat, 11 Apr 2015 23:07:03 +0000 (UTC)", "from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 857971C22C9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 11 Apr 2015 23:07:01 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id F10A894D30\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 11 Apr 2015 23:06:51 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ErRuBvvSfKRX for <intel-wired-lan@lists.osuosl.org>;\n\tSat, 11 Apr 2015 23:06:51 +0000 (UTC)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 3AE4B94D22\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tSat, 11 Apr 2015 23:06:51 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP; 11 Apr 2015 16:06:50 -0700", "from unknown (HELO ccdskly16.iil.intel.com) ([143.185.160.82])\n\tby fmsmga002.fm.intel.com with ESMTP; 11 Apr 2015 16:06:49 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.11,563,1422950400\"; d=\"scan'208\";a=\"707485189\"", "From": "Yanir Lubetkin <yanirx.lubetkin@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Sun, 12 Apr 2015 02:06:06 +0300", "Message-Id": "<1428793566-14375-1-git-send-email-yanirx.lubetkin@intel.com>", "X-Mailer": "git-send-email 2.1.0", "Subject": "[Intel-wired-lan] [PATCH v4] e1000e i219 fix unit hang on reset and\n\truntime D3", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "unit hang may occur if multiple descriptors are available in the rings during\nreset or runtime suspend. This state can be detected by testing the PCI config\nspace register FEXTNVM7 bit 8 (0x100 mask). if this bit is on, and there are\npending descriptors in one of the rings, we must flush them prior to reset.\nsame goes for entering runtime suspend.\n\nSigned-off-by: Yanir Lubetkin <yanirx.lubetkin@intel.com>\n---\n drivers/net/ethernet/intel/e1000e/ich8lan.h | 5 ++\n drivers/net/ethernet/intel/e1000e/netdev.c | 101 ++++++++++++++++++++++++++++\n drivers/net/ethernet/intel/e1000e/regs.h | 1 +\n 3 files changed, 107 insertions(+)", "diff": "diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h\nindex 770a573..69c4dbe 100644\n--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h\n+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h\n@@ -100,6 +100,11 @@\n #define E1000_FEXTNVM7_DISABLE_PB_READ\t0x00040000\n \n #define E1000_FEXTNVM7_DISABLE_SMB_PERST\t0x00000020\n+#define E1000_FEXTNVM7_NEED_DESCRING_FLUSH 0x00000100\n+#define E1000_FEXTNVM11_DISABLE_MULR_FIX 0x00002000\n+\n+/* bit24: RXDCTL thresholds granularity: 0 - cache lines, 1 - descriptors */\n+#define E1000_RXDCTL_THRESH_UNIT_DESC 0x01000000\n \n #define K1_ENTRY_LATENCY\t0\n #define K1_MIN_TIME\t\t1\ndiff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c\nindex 74ec185..4880a23 100644\n--- a/drivers/net/ethernet/intel/e1000e/netdev.c\n+++ b/drivers/net/ethernet/intel/e1000e/netdev.c\n@@ -3788,6 +3788,105 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)\n }\n \n /**\n+ * e1000_flush_tx_ring - remove all descriptors from the tx_ring\n+ *\n+ * We want to clear all pending descriptors from the TX ring.\n+ * zeroing happens when the HW reads the regs. We assign the ring itself as\n+ * the data of the next descriptor. We don't care about the data we are about\n+ * to reset the HW.\n+ */\n+static void e1000_flush_tx_ring(struct e1000_adapter *adapter)\n+{\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\tstruct e1000_ring *tx_ring = adapter->tx_ring;\n+\tstruct e1000_tx_desc *tx_desc = NULL;\n+\tu32 tctl, txd_lower = E1000_TXD_CMD_IFCS;\n+\tu16 size = 512;\n+\n+\ttctl = er32(TCTL);\n+\tew32(TCTL, tctl | E1000_TCTL_EN);\n+\n+\ttx_desc = E1000_TX_DESC(*tx_ring, tx_ring->next_to_use);\n+\ttx_desc->buffer_addr = tx_ring->dma;\n+\n+\ttx_desc->lower.data = cpu_to_le32(txd_lower | size);\n+\ttx_desc->upper.data = 0;\n+\t/* flush descriptors to memory before notifying the HW */\n+\twmb();\n+\ttx_ring->next_to_use++;\n+\tif (tx_ring->next_to_use == tx_ring->count)\n+\t\ttx_ring->next_to_use = 0;\n+\tew32(TDT(0), tx_ring->next_to_use);\n+\tmmiowb();\n+\tusleep_range(200, 250);\n+}\n+\n+/**\n+ * e1000_flush_rx_ring - remove all descriptors from the rx_ring\n+ *\n+ * Mark all descriptors in the RX ring as consumed and disable the rx ring\n+ */\n+static void e1000_flush_rx_ring(struct e1000_adapter *adapter)\n+{\n+\tu32 rctl, rxdctl;\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\n+\trctl = er32(RCTL);\n+\tew32(RCTL, rctl & ~E1000_RCTL_EN);\n+\tmmiowb();\n+\tusleep_range(100, 150);\n+\n+\trxdctl = er32(RXDCTL(0));\n+\t/* zero the lower 14 bits (prefetch and host thresholds) */\n+\trxdctl &= 0xffffc000;\n+\n+\t/* update thresholds: prefetch threshold to 31, host threshold to 1\n+\t * and make sure the granularity is \"descriptors\" and not \"cache lines\"\n+\t */\n+\trxdctl |= (0x1F | (1 << 8) | E1000_RXDCTL_THRESH_UNIT_DESC);\n+\n+\tew32(RXDCTL(0), rxdctl);\n+\t/* momentarily enable the RX ring for the changes to take effect */\n+\tew32(RCTL, rctl | E1000_RCTL_EN);\n+\tmmiowb();\n+\tusleep_range(100, 150);\n+\tew32(RCTL, rctl & ~E1000_RCTL_EN);\n+}\n+\n+/**\n+ * e1000_flush_desc_rings - remove all descriptors from the descriptor rings\n+ *\n+ * In i219, the descriptor rings must be emptied before resetting the HW\n+ * or before changing the device state to D3 during runtime (runtime PM).\n+ *\n+ * Failure to do this will cause the HW to enter a unit hang state which can\n+ * only be released by PCI reset on the device\n+ *\n+ */\n+\n+static void e1000_flush_desc_rings(struct e1000_adapter *adapter)\n+{\n+\tu32 hang_state;\n+\tu32 fext_nvm11, tdlen;\n+\tstruct e1000_hw *hw = &adapter->hw;\n+\n+\t/* First, disable MULR fix in FEXTNVM11 */\n+\tfext_nvm11 = er32(FEXTNVM11);\n+\tfext_nvm11 |= E1000_FEXTNVM11_DISABLE_MULR_FIX;\n+\tew32(FEXTNVM11, fext_nvm11);\n+\t/* do nothing if we're not in faulty state, or if the queue is empty */\n+\ttdlen = er32(TDLEN(0));\n+\thang_state = er32(FEXTNVM7);\n+\tif ((hang_state & E1000_FEXTNVM7_NEED_DESCRING_FLUSH) || tdlen)\n+\t\treturn;\n+\te1000_flush_tx_ring(adapter);\n+\t/* recheck, maybe the fault is caused by the rx ring */\n+\thang_state = er32(FEXTNVM7);\n+\tif (hang_state & E1000_FEXTNVM7_NEED_DESCRING_FLUSH)\n+\t\te1000_flush_rx_ring(adapter);\n+}\n+\n+/**\n * e1000e_reset - bring the hardware into a known good state\n *\n * This function boots the hardware and enables some settings that\n@@ -3943,6 +4042,8 @@ void e1000e_reset(struct e1000_adapter *adapter)\n \t\t}\n \t}\n \n+\tif (hw->mac.type == e1000_pch_spt)\n+\t\te1000_flush_desc_rings(adapter);\n \t/* Allow time for pending master requests to run */\n \tmac->ops.reset_hw(hw);\n \ndiff --git a/drivers/net/ethernet/intel/e1000e/regs.h b/drivers/net/ethernet/intel/e1000e/regs.h\nindex 85eefc4..fdaac8e 100644\n--- a/drivers/net/ethernet/intel/e1000e/regs.h\n+++ b/drivers/net/ethernet/intel/e1000e/regs.h\n@@ -38,6 +38,7 @@\n #define E1000_FEXTNVM4\t0x00024\t/* Future Extended NVM 4 - RW */\n #define E1000_FEXTNVM6\t0x00010\t/* Future Extended NVM 6 - RW */\n #define E1000_FEXTNVM7\t0x000E4\t/* Future Extended NVM 7 - RW */\n+#define E1000_FEXTNVM11 0x5BBC /* Future Extended NVM 11 - RW */\n #define E1000_PCIEANACFG\t0x00F18\t/* PCIE Analog Config */\n #define E1000_FCT\t0x00030\t/* Flow Control Type - RW */\n #define E1000_VET\t0x00038\t/* VLAN Ether Type - RW */\n", "prefixes": [ "v4" ] }