{"id":2232321,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232321/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260504110058.2373236-4-sergey.temerkhanov@intel.com/","project":{"id":46,"url":"http://patchwork.ozlabs.org/api/1.1/projects/46/?format=json","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":""},"msgid":"<20260504110058.2373236-4-sergey.temerkhanov@intel.com>","date":"2026-05-04T11:00:58","name":"[iwl-net,v1,3/3] ice: Cache struct ice_hw pointer for split register reads","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"cc1ddd912c90acbecc89077d9baea1ed7df759e5","submitter":{"id":85162,"url":"http://patchwork.ozlabs.org/api/1.1/people/85162/?format=json","name":"Temerkhanov, Sergey","email":"sergey.temerkhanov@intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20260504110058.2373236-4-sergey.temerkhanov@intel.com/mbox/","series":[{"id":502644,"url":"http://patchwork.ozlabs.org/api/1.1/series/502644/?format=json","web_url":"http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=502644","date":"2026-05-04T11:00:55","name":"Rework ctrl_pf pointer usage in struct ice_adapter","version":1,"mbox":"http://patchwork.ozlabs.org/series/502644/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232321/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232321/checks/","tags":{},"headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=n+ekkMpG;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g8Jbt5PrPz1yJV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 04 May 2026 21:01:14 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 372618451E;\n\tMon,  4 May 2026 11:01:07 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id B6vkMoqK-Nri; Mon,  4 May 2026 11:01:06 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 9A11484520;\n\tMon,  4 May 2026 11:01:06 +0000 (UTC)","from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n by lists1.osuosl.org (Postfix) with ESMTP id 22164190\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:04 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 0C3B06139D\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:03 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id ZAz9AzadZv7C for <intel-wired-lan@lists.osuosl.org>;\n Mon,  4 May 2026 11:01:02 +0000 (UTC)","from mgamail.intel.com (mgamail.intel.com [198.175.65.16])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 6821D6139A\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2026 11:01:02 +0000 (UTC)","from orviesa004.jf.intel.com ([10.64.159.144])\n by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 May 2026 04:01:03 -0700","from gnrd8.igk.intel.com (HELO GNRD8) ([10.123.232.137])\n by orviesa004.jf.intel.com with ESMTP; 04 May 2026 04:01:01 -0700"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9A11484520","OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6821D6139A"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777892466;\n\tbh=CejRnIOSXG7TH6lOmpRYm3VtCiFL2GlkRfG+lsH49MA=;\n\th=From:To:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=n+ekkMpGIx4e6f6gv8IkGbywHBuMq5DT6ASKdi36M8MzLTEuQhRfVi9hxuUstJwYV\n\t hShceXm+K8GrPgO6UntUey60yxk3eoVWwRlkhuDtOk7BLrC+oXA34mvYY/x3zPoHAe\n\t 3WUhkXWVo5HKS/pNDRWINl+v6rsLc8Blb4DhroNrBO4T+9wS2WSp55Pjjg99w96WNv\n\t cSaA569LPQY749Su3522YncrxNAoOAAZb1OCVZTDO3q/NhsLnSAov1RTW/Y8XSLTPo\n\t dAdCfNs1Jai8a1tSGZHRo/hwLNwrnxJ3CmfEQ4Mj7Be7HSs/hWK5+TwEomdYL8I6fB\n\t CddEC8GOWiSdQ==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.16;\n helo=mgamail.intel.com; envelope-from=sergey.temerkhanov@intel.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp3.osuosl.org 6821D6139A","X-CSE-ConnectionGUID":["79LRunjCSD2U9ZLy9o0CjQ==","1Jr09M9ZRjCWXsJ9erLfmQ=="],"X-CSE-MsgGUID":["iv4QTy+JQz2vi0cMwd740Q==","X24t4QpYRCS3srp9wepcXQ=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11775\"; a=\"78939690\"","E=Sophos;i=\"6.23,215,1770624000\"; d=\"scan'208\";a=\"78939690\"","E=Sophos;i=\"6.23,215,1770624000\"; d=\"scan'208\";a=\"239792124\""],"X-ExtLoop1":"1","From":"Sergey Temerkhanov <sergey.temerkhanov@intel.com>","To":"intel-wired-lan@lists.osuosl.org","Date":"Mon,  4 May 2026 11:00:58 +0000","Message-ID":"<20260504110058.2373236-4-sergey.temerkhanov@intel.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260504110058.2373236-1-sergey.temerkhanov@intel.com>","References":"<20260504110058.2373236-1-sergey.temerkhanov@intel.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777892463; x=1809428463;\n h=from:to:subject:date:message-id:in-reply-to:references:\n mime-version:content-transfer-encoding;\n bh=NYS+R40mOjYf6fmrJkydT5fr4ckbVWfdyHgaoqz5wAk=;\n b=hvco6sQHC/4mnw+3P6+DjZqbtH660IjkDVnB6cUHV1joM/gVzGELnAf0\n sKUqKuWm45MtnvIdfxGhaMGRMzQ8YKt6dMnQYK4FGCkZCMAUMK4mJ+dv/\n fX/3nxUqE25n0o3u9H2z4eyK0pZTKP5n7Q4R8h3S9iPqM1If4uRrJyfJ7\n VQD0TDwEs9ksOjYJjN8BSMf+/h3rkOkg0talv4uDC+AM/ZdeUMoDo/C6H\n +BnNYAkPBYkmESV8kkTqBUhw6Sc6+nZlIjiFXmn8ivHoLhs9FTZMQoXs1\n ++X1Mai9j4qR4sUA2nLyso+LA0J5I4X8geom4WXkgIubuCtxG+rX69jw8\n w==;","X-Mailman-Original-Authentication-Results":["smtp3.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=intel.com","smtp3.osuosl.org;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.a=rsa-sha256 header.s=Intel header.b=hvco6sQH"],"Subject":"[Intel-wired-lan] [PATCH iwl-net v1 3/3] ice: Cache struct ice_hw\n pointer for split register reads","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"},"content":"Cache the primary ice_hw pointer to ensure consistency between\ncalls (both parts of a value will be read from the same NAC).\nice_get_primary_hw() will never return NULL, but during the\nctrl_pf cleanup there may be a case when one call will return\nthe pointer to the ctrl_pf->hw and the subsequent one - to the\npf->hw which generally are not the same.\nStruct ice_hw is embedded in the struct ice_pf so it is protected\nby the same critical section - no additional synchronization is\nneeded.\n\nFixes: e2193f9f9ec9 (\"ice: enable timesync operation on 2xNAC E825 devices\")\n\nSigned-off-by: Sergey Temerkhanov <sergey.temerkhanov@intel.com>\nReviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\nReviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)","diff":"diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\nindex 892bcc50e82f..95238224b59a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\n@@ -4,6 +4,7 @@\n #include <linux/cleanup.h>\n #include <linux/delay.h>\n #include <linux/iopoll.h>\n+#include \"ice.h\"\n #include \"ice_common.h\"\n #include \"ice_ptp_hw.h\"\n #include \"ice_ptp_consts.h\"\n@@ -1988,10 +1989,14 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,\n \t\tzo = rd32(hw, GLTSYN_SHTIME_0(tmr_idx));\n \t\tlo = rd32(hw, GLTSYN_SHTIME_L(tmr_idx));\n \t} else {\n+\t\tstruct ice_hw *pri_hw;\n+\n \t\tguard(rcu)();\n \n-\t\tzo = rd32(ice_get_primary_hw(pf), GLTSYN_SHTIME_0(tmr_idx));\n-\t\tlo = rd32(ice_get_primary_hw(pf), GLTSYN_SHTIME_L(tmr_idx));\n+\t\tpri_hw = ice_get_primary_hw(pf);\n+\n+\t\tzo = rd32(pri_hw, GLTSYN_SHTIME_0(tmr_idx));\n+\t\tlo = rd32(pri_hw, GLTSYN_SHTIME_L(tmr_idx));\n \t}\n \t*phc_time = (u64)lo << 32 | zo;\n \n@@ -2159,10 +2164,14 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)\n \t\tlo = rd32(hw, GLTSYN_INCVAL_L(tmr_idx));\n \t\thi = rd32(hw, GLTSYN_INCVAL_H(tmr_idx));\n \t} else {\n+\t\tstruct ice_hw *pri_hw;\n+\n \t\tguard(rcu)();\n \n-\t\tlo = rd32(ice_get_primary_hw(pf), GLTSYN_INCVAL_L(tmr_idx));\n-\t\thi = rd32(ice_get_primary_hw(pf), GLTSYN_INCVAL_H(tmr_idx));\n+\t\tpri_hw = ice_get_primary_hw(pf);\n+\n+\t\tlo = rd32(pri_hw, GLTSYN_INCVAL_L(tmr_idx));\n+\t\thi = rd32(pri_hw, GLTSYN_INCVAL_H(tmr_idx));\n \t}\n \tincval = (u64)hi << 32 | lo;\n \n","prefixes":["iwl-net","v1","3/3"]}