[{"id":3675753,"web_url":"http://patchwork.ozlabs.org/comment/3675753/","msgid":"<515bb9be-5623-4589-ba5c-d8e5e8a4f10c@redhat.com>","list_archive_url":null,"date":"2026-04-10T09:33:21","subject":"Re: [Intel-wired-lan] [PATCH iwl-net 1/4] ice: fix timestamp\n interrupt configuration for E825C","submitter":{"id":74657,"url":"http://patchwork.ozlabs.org/api/people/74657/","name":"Petr Oros","email":"poros@redhat.com"},"content":"On 4/8/26 20:46, Jacob Keller wrote:\n> From: Grzegorz Nitka <grzegorz.nitka@intel.com>\n>\n> The E825C ice_phy_cfg_intr_eth56g() function is responsible for programming\n> the PHY interrupt for a given port. This function writes to the\n> PHY_REG_TS_INT_CONFIG register of the port. The register is responsible for\n> configuring whether the port interrupt logic is enabled, as well as\n> programming the threshold of waiting timestamps that will trigger an\n> interrupt from this port.\n>\n> This threshold value must not be programmed to zero while the interrupt is\n> enabled. Doing so puts the port in a misconfigured state where the PHY\n> timestamp interrupt for the quad of connected ports will become stuck.\n>\n> This occurs, because a threshold of zero results in the timestamp interrupt\n> status for the port becoming stuck high. The four ports in the connected\n> quad have their timestamp status indicators muxed together. A new interrupt\n> cannot be generated until the timestamp status indicators return low for\n> all four ports.\n>\n> Normally, the timestamp status for a port will clear once there are fewer\n> timestamps in that ports timestamp memory bank than the threshold. A\n> threshold of zero makes this impossible, so the timestamp status for the\n> port does not clear.\n>\n> The ice driver never intentionally programs the threshold to zero, indeed\n> the driver always programs it to a value of 1, intending to get an\n> interrupt immediately as soon as even a single packet is waiting for a\n> timestamp.\n>\n> However, there is a subtle flaw in the programming logic in the\n> ice_phy_cfg_intr_eth56g() function. Due to the way that the hardware\n> handles enabling the PHY interrupt. If the threshold value is modified at\n> the same time as the interrupt is enabled, the HW PHY state machine might\n> enable the interrupt before the new threshold value is actually updated.\n> This leaves a potential race condition caused by the hardware logic where\n> a PHY timestamp interrupt might be triggered before the non-zero threshold\n> is written, resulting in the PHY timestamp logic becoming stuck.\n>\n> Once the PHY timestamp status is stuck high, it will remain stuck even\n> after attempting to reprogram the PHY block by changing its threshold or\n> disabling the interrupt. Even a typical PF or CORE reset will not reset the\n> particular block of the PHY that becomes stuck. Even a warm power cycle is\n> not guaranteed to cause the PHY block to reset, and a cold power cycle is\n> required.\n>\n> Prevent this by always writing the PHY_REG_TS_INT_CONFIG in two stages.\n> First write the threshold value with the interrupt disabled, and only write\n> the enable bit after the threshold has been programmed. When disabling the\n> interrupt, leave the threshold unchanged. Additionally, re-read the\n> register after writing it to guarantee that the write to the PHY has been\n> flushed upon exit of the function.\n>\n> While we're modifying this function implementation, explicitly reject\n> programming a threshold of 0 when enabling the interrupt. No caller does\n> this today, but the consequences of doing so are significant. An explicit\n> rejection in the code makes this clear.\n>\n> Fixes: 7cab44f1c35f (\"ice: Introduce ETH56G PHY model for E825C products\")\n> Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>\n> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>\n> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>\n> ---\n>   drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 36 +++++++++++++++++++++++++----\n>   1 file changed, 32 insertions(+), 4 deletions(-)\n>\n> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\n> index e3db252c3918..67775beb9449 100644\n> --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\n> +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c\n> @@ -1847,6 +1847,8 @@ static int ice_phy_cfg_mac_eth56g(struct ice_hw *hw, u8 port)\n>    * @ena: enable or disable interrupt\n>    * @threshold: interrupt threshold\n>    *\n> + * The threshold cannot be 0 while the interrupt is enabled.\n> + *\n>    * Configure TX timestamp interrupt for the specified port\n>    *\n>    * Return:\n> @@ -1858,19 +1860,45 @@ int ice_phy_cfg_intr_eth56g(struct ice_hw *hw, u8 port, bool ena, u8 threshold)\n>   \tint err;\n>   \tu32 val;\n>   \n> +\tif (ena && !threshold)\n> +\t\treturn -EINVAL;\n> +\n>   \terr = ice_read_ptp_reg_eth56g(hw, port, PHY_REG_TS_INT_CONFIG, &val);\n>   \tif (err)\n>   \t\treturn err;\n>   \n> +\tval &= ~PHY_TS_INT_CONFIG_ENA_M;\n>   \tif (ena) {\n> -\t\tval |= PHY_TS_INT_CONFIG_ENA_M;\n>   \t\tval &= ~PHY_TS_INT_CONFIG_THRESHOLD_M;\n>   \t\tval |= FIELD_PREP(PHY_TS_INT_CONFIG_THRESHOLD_M, threshold);\n> -\t} else {\n> -\t\tval &= ~PHY_TS_INT_CONFIG_ENA_M;\n> +\t\terr = ice_write_ptp_reg_eth56g(hw, port, PHY_REG_TS_INT_CONFIG,\n> +\t\t\t\t\t       val);\n> +\t\tif (err) {\n> +\t\t\tice_debug(hw, ICE_DBG_PTP,\n> +\t\t\t\t  \"Failed to update 'threshold' PHY_REG_TS_INT_CONFIG port=%u ena=%u threshold=%u\\n\",\n> +\t\t\t\t  port, !!ena, threshold);\n> +\t\t\treturn err;\n> +\t\t}\n> +\t\tval |= PHY_TS_INT_CONFIG_ENA_M;\n>   \t}\n>   \n> -\treturn ice_write_ptp_reg_eth56g(hw, port, PHY_REG_TS_INT_CONFIG, val);\n> +\terr = ice_write_ptp_reg_eth56g(hw, port, PHY_REG_TS_INT_CONFIG, val);\n> +\tif (err) {\n> +\t\tice_debug(hw, ICE_DBG_PTP,\n> +\t\t\t  \"Failed to update 'ena' PHY_REG_TS_INT_CONFIG port=%u ena=%u threshold=%u\\n\",\n> +\t\t\t  port, !!ena, threshold);\n> +\t\treturn err;\n> +\t}\n> +\n> +\terr = ice_read_ptp_reg_eth56g(hw, port, PHY_REG_TS_INT_CONFIG, &val);\n> +\tif (err) {\n> +\t\tice_debug(hw, ICE_DBG_PTP,\n> +\t\t\t  \"Failed to read PHY_REG_TS_INT_CONFIG port=%u ena=%u threshold=%u\\n\",\n> +\t\t\t  port, !!ena, threshold);\n> +\t\treturn err;\n> +\t}\n> +\n> +\treturn 0;\n>   }\n>   \n>   /**\n>\nReviewed-by: Petr Oros <poros@redhat.com>","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=okM18uYR;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.137; helo=smtp4.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 4fsWnr4mG4z1yGS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 19:33:34 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 556CA40D78;\n\tFri, 10 Apr 2026 09:33:32 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id hetVX6rHll9g; Fri, 10 Apr 2026 09:33:31 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 908BD40CF7;\n\tFri, 10 Apr 2026 09:33:31 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n by lists1.osuosl.org (Postfix) with ESMTP id D617E237\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 09:33:29 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id C82CF40CEB\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 09:33:29 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 2gmMFl9FcY43 for <intel-wired-lan@lists.osuosl.org>;\n Fri, 10 Apr 2026 09:33:29 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp4.osuosl.org (Postfix) with ESMTPS id A773640CC8\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 09:33:27 +0000 (UTC)","from mail-wr1-f69.google.com (mail-wr1-f69.google.com\n [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-68-7lTZv_f0O_WXbOyrURm0_A-1; Fri, 10 Apr 2026 05:33:25 -0400","by mail-wr1-f69.google.com with SMTP id\n ffacd0b85a97d-43d03bad787so1671015f8f.1\n for <intel-wired-lan@lists.osuosl.org>; Fri, 10 Apr 2026 02:33:25 -0700 (PDT)","from [192.168.2.83] ([46.175.183.46])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d63e468c5sm6393551f8f.20.2026.04.10.02.33.22\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Fri, 10 Apr 2026 02:33:22 -0700 (PDT)"],"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 smtp4.osuosl.org 908BD40CF7","OpenDKIM Filter v2.11.0 smtp4.osuosl.org A773640CC8"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1775813611;\n\tbh=7B/UUfZnQvrc2YpSzdcD/g7Oh2oh/jVTzJlkculeTRk=;\n\th=Date:To:Cc:References:From:In-Reply-To:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=okM18uYR0aJQ6IvDmJYEUDuPOlPIvO0N+zvj5ITEKaE3bPKc17U26mW9aZ7aBQi6o\n\t WCjfo1D5ORtkZCO95lLVB0InxybtlQk481OLtKRNAamWogJMrI34CgvS7QMYc0Z3ZM\n\t lk37bA5iz8GstVErB1XO3cPKeqStpoRyvebOdFGLpaqapcRH2KM+fpmD5l+fs6s8yi\n\t pHOci2CEGywWGF8C7ug/0POdwHaNks/hrNlwJQPV7WEDtLez/2UJZ4/QE59X8yqk96\n\t Q1iRDyej8v9XTx9dH0/PCbOET8yHq85Z6A8wxQ900LnHzilRax7DMku95J/sR35uAU\n\t DYenDZxcYeF6Q==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=poros@redhat.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org A773640CC8","X-MC-Unique":"7lTZv_f0O_WXbOyrURm0_A-1","X-Mimecast-MFC-AGG-ID":"7lTZv_f0O_WXbOyrURm0_A_1775813604","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775813604; x=1776418404;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=7B/UUfZnQvrc2YpSzdcD/g7Oh2oh/jVTzJlkculeTRk=;\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BsvpiJ04gME8aBQ6ItWbroX\n taMhtvSLqxEHj+SkJcyPs","X-Received":["by 2002:a05:6000:26c4:b0:43c:f1da:488a with SMTP id\n ffacd0b85a97d-43d642a4d54mr3403320f8f.13.1775813603832;\n Fri, 10 Apr 2026 02:33:23 -0700 (PDT)","by 2002:a05:6000:26c4:b0:43c:f1da:488a with SMTP id\n ffacd0b85a97d-43d642a4d54mr3403266f8f.13.1775813603236;\n Fri, 10 Apr 2026 02:33:23 -0700 (PDT)"],"Message-ID":"<515bb9be-5623-4589-ba5c-d8e5e8a4f10c@redhat.com>","Date":"Fri, 10 Apr 2026 11:33:21 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","To":"Jacob Keller <jacob.e.keller@intel.com>,\n Anthony Nguyen <anthony.l.nguyen@intel.com>,\n Intel Wired LAN <intel-wired-lan@lists.osuosl.org>, netdev@vger.kernel.org","Cc":"Aleksandr Loktionov <aleksandr.loktionov@intel.com>,\n Timothy Miskell <timothy.miskell@intel.com>","References":"<20260408-jk-even-more-e825c-fixes-v1-0-b959da91a81f@intel.com>\n <20260408-jk-even-more-e825c-fixes-v1-1-b959da91a81f@intel.com>","From":"Petr Oros <poros@redhat.com>","In-Reply-To":"<20260408-jk-even-more-e825c-fixes-v1-1-b959da91a81f@intel.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"vBkJpYCvldWTbvg2fri5tom02JHPfI4rNVgC1ZXwibY_1775813604","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com;\n s=mimecast20190719; t=1775813606;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=7B/UUfZnQvrc2YpSzdcD/g7Oh2oh/jVTzJlkculeTRk=;\n b=T0/66fIpRHrsdn7f3i8LnGhqNcOXMPfEXOyaoV1AVOWeKsrWNq2zUQPt1pV/RBSQVTNJ7/\n D/bHZA/FxaaLw/BzW9RjILjWXg7ycMqv+Em0TLeKjn1vxCY4x5WSDZDBQcvM0XSxdoxfYG\n xK9LRtydYLkgkeAQYjiKkktIWubilF4=","X-Mailman-Original-Authentication-Results":["smtp4.osuosl.org;\n dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","smtp4.osuosl.org;\n dkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=T0/66fIp"],"Subject":"Re: [Intel-wired-lan] [PATCH iwl-net 1/4] ice: fix timestamp\n interrupt configuration for E825C","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>"}}]