Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3668582pxb; Mon, 24 Jan 2022 14:56:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwC2vauSr2xafxNUByAS9bHFDmJ4orS1UQy4VI7z0/iwr6fdM4Gb5+3PTmJlKjgPPeM9svx X-Received: by 2002:a63:1562:: with SMTP id 34mr13168898pgv.15.1643064967171; Mon, 24 Jan 2022 14:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064967; cv=none; d=google.com; s=arc-20160816; b=JM1UjUS7HCzyUlUJwqh03Kj88P43h8ahfq+9HrOq2TPyzkFa1gRukVDnbOucH2TVk/ eUUJybSXsD7XGHwkc9Z3ibXRLEDW9Ad5rIeF1QafYF1IDaocR8h2zCn/26mI6bqCp8Eg iR8DP+ZKe3hW/1HhwnVWRFQAsS3R16M0sp8PDsNSqTgzxa5eREXstSr6Q1FDTy2H3sGm VciNZ7K2aIefzA/6cQQzYwWkBv1LFP9J1kRfnQ80XBgfWd5wnIPYh6DYTWn4hbVt/G3L dHxEb/O61zY5lprZVTc01xzzvDLcl9f85J/lK3Zkp+7HUBi1VyuD/sb6luySFKdBBGbH 7dvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wwPv9FWUYhshRaOHOEvB1RZWW2ECX9Wi6Ypx7vTyr5o=; b=SgkvqNFGYGNbC2eYkRElgWaDQGmibWT0JsfPAe6Tfl78JVI4oZayaxQAG/EKkXTzOl UfBhoB8I4DbUlMyemUoCfG4al2WncCJwWmatf7giiX5n7P++wIHBwB5q3O7vSIBWRXjy ENQzO4Pp8v7I1ORttba+a97ckbaH2M1ipJg9voxS1RSizoQA/gvvJmf3bkkTMRSeqoae tPHqyVEpFAWq2DbZAjDwrFomG0Yp+IbHbTWU1duJ4C6fWZlmZgBvqWQrkk71P2ikSdck kSgCkPLicCnhkX9QXMXFxmGZdv/uhL5JbbHd9m7E+OAa+jwrVt6to/yeEtSAZD413i2G fGvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qcGtQNoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si2794655plg.314.2022.01.24.14.55.55; Mon, 24 Jan 2022 14:56:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qcGtQNoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840053AbiAXWwb (ORCPT + 99 others); Mon, 24 Jan 2022 17:52:31 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33532 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449799AbiAXVoO (ORCPT ); Mon, 24 Jan 2022 16:44:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD3916150C; Mon, 24 Jan 2022 21:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917DAC340E4; Mon, 24 Jan 2022 21:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060653; bh=gR/N5qZK1VxOw5l/WNDdjtOvBhxoOw2tbdxKt3r7zlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcGtQNoYQcPKqwVNPPpe3ZIUfnxUiLWYn3k94JDKag518QBpyZb9dIHYvPya5mnhK H2uG6PMyj3n2Oh1MJtqtdyrNT4COBZtwOohxz4VL32MjMhZNOGEnjJt3YsPMO7a+BR 4ofIDk/P2a3gcS7qC1gHFYijCUwwHNTjEdnIpDnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 1020/1039] net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices Date: Mon, 24 Jan 2022 19:46:49 +0100 Message-Id: <20220124184159.586360232@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudiu Beznea commit f1131b9c23fb4a3540a774828ff49f421619f902 upstream. On a setup with KSZ9131 and MACB drivers it happens on suspend path, from time to time, that the PHY interrupt arrives after PHY and MACB were suspended (PHY via genphy_suspend(), MACB via macb_suspend()). In this case the phy_read() at the beginning of kszphy_handle_interrupt() will fail (as MACB driver is suspended at this time) leading to phy_error() being called and a stack trace being displayed on console. To solve this .suspend/.resume functions for all KSZ devices implementing .handle_interrupt were replaced with kszphy_suspend()/kszphy_resume() which disable/enable interrupt before/after calling genphy_suspend()/genphy_resume(). The fix has been adapted for all KSZ devices which implements .handle_interrupt but it has been tested only on KSZ9131. Fixes: 59ca4e58b917 ("net: phy: micrel: implement generic .handle_interrupt() callback") Signed-off-by: Claudiu Beznea Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/micrel.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1630,8 +1630,8 @@ static struct phy_driver ksphy_driver[] .config_init = kszphy_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8021, .phy_id_mask = 0x00ffffff, @@ -1645,8 +1645,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8031, .phy_id_mask = 0x00ffffff, @@ -1660,8 +1660,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8041, .phy_id_mask = MICREL_PHY_ID_MASK, @@ -1692,8 +1692,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .name = "Micrel KSZ8051", /* PHY_BASIC_FEATURES */ @@ -1706,8 +1706,8 @@ static struct phy_driver ksphy_driver[] .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, .match_phy_device = ksz8051_match_phy_device, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8001, .name = "Micrel KSZ8001 or KS8721", @@ -1721,8 +1721,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8081, .name = "Micrel KSZ8081 or KSZ8091", @@ -1752,8 +1752,8 @@ static struct phy_driver ksphy_driver[] .config_init = ksz8061_config_init, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ9021, .phy_id_mask = 0x000ffffe, @@ -1768,8 +1768,8 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, - .resume = genphy_resume, + .suspend = kszphy_suspend, + .resume = kszphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, }, { @@ -1787,7 +1787,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_LAN8814, @@ -1829,7 +1829,7 @@ static struct phy_driver ksphy_driver[] .get_sset_count = kszphy_get_sset_count, .get_strings = kszphy_get_strings, .get_stats = kszphy_get_stats, - .suspend = genphy_suspend, + .suspend = kszphy_suspend, .resume = kszphy_resume, }, { .phy_id = PHY_ID_KSZ8873MLL,