Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3359453rdh; Mon, 27 Nov 2023 12:08:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1wRdu7HfqA26AvufkBqYLFr9v21Lk33P9FNgDZDDmmqkVeRd9wf03QwFN5Sy/f/07M7Eu X-Received: by 2002:a17:902:7d86:b0:1cf:b4d4:1381 with SMTP id a6-20020a1709027d8600b001cfb4d41381mr6592050plm.2.1701115718710; Mon, 27 Nov 2023 12:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701115718; cv=none; d=google.com; s=arc-20160816; b=wmNa0JGKZqGuxmavp6HkjDet8bbOvSJSDcxmQD1gPSEb666ri9IDK2G4lbkFSL+o6U lNGvFgLX/lgvhe+/Mi0nqbEtcuWAKNURLTMB0a34h1UHAYKYnMV5kpj4IEalM3Z7sjCa CIIDzO0GmMAwV2ul/4Hkxq+2iOWcwZ3ohu8iuMz4RBvHI6dTbszgTVnY5CDExNQNJh8e tY8MZz7NSVLu3SYdxlXbXZC+gzjVd+0jCrnd6NnxvU4UD2Zb5TtTWd1QA5iBz/u8eXHB hkqWASSUZkXDjbOiLwP9gM0QICWQpwzZJm7MwqwL0yYYz2v68aag2ONKrksDFbKd3ep+ 9iHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3O4ZRmciR+wHsAJ9W5qRG6w9TB013g8G4slV+9aIPT0=; fh=jcsQAysXbTlCLiGpVCA9OFkU09IRVEeInKyjrUz8Rfc=; b=KbBKAmVibFp5GJHufLKlmYlErrUD16a8XMIwjBIkBXUwcj0HQYdiBaWA+Cdn2SbLjz b58P9/iTQlSzE/4GwHjNTQ0EKJbcFoCkEI3APcwsj7UeBMRdGZ68eIqu/CcIXMMefTmc G0Rgfj0+YUGB79ZCFiLrn0RuHFaHBQ7x0CO3fl9KZ9FVecrC6BSqRK1Yj1LZQYTvlB9S X8SykZFThGcnhbJKvlrA/PHNF0F6X6ncIokmUXIRKE73Hx5iWeCNhwxRHLiDoxQmqzjX tVDXk2gsDh4xzxMbNDUafYZHG7fOsImX7s6SdCmnTCO9mcP6VC7FNAwqlAq23B07wKLL KSQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JACWPN+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id q12-20020a170902eb8c00b001bdca6456c3si10926296plg.46.2023.11.27.12.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 12:08:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JACWPN+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 32C2B80859BF; Mon, 27 Nov 2023 12:08:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbjK0UIS (ORCPT + 99 others); Mon, 27 Nov 2023 15:08:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbjK0UIR (ORCPT ); Mon, 27 Nov 2023 15:08:17 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294E8D62 for ; Mon, 27 Nov 2023 12:08:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701115702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3O4ZRmciR+wHsAJ9W5qRG6w9TB013g8G4slV+9aIPT0=; b=JACWPN+4ACEM0y0YKqcNHfKoROvQAZ/1MIm7dDpPIK3ZD69hH2IV4BwoB9sk/iQxms+ucA BVgg5J7P2QK3uIzo7LiQ/hq8j0hIBIciET7jZc5l0Z3vnXeUVAG50+QXag1wc5oE3OCJL9 7KK65N/e6e6B4AvGq+TsTmW3Avm0Nhc= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-qg9vcIXWN_CFEARSZwzMoQ-1; Mon, 27 Nov 2023 15:08:21 -0500 X-MC-Unique: qg9vcIXWN_CFEARSZwzMoQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-77d85c600d6so343240785a.2 for ; Mon, 27 Nov 2023 12:08:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701115700; x=1701720500; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3O4ZRmciR+wHsAJ9W5qRG6w9TB013g8G4slV+9aIPT0=; b=j67st5Fj7SqAJoQafWZplJTF4CIov22wEAEFDX7x+4CuItovRmp34gEMA8N69JqLQg jQnB/9QIkae7XqqQ2LF+ZhUFEfTT6rhrUdiQfGRBWpIwE3QU4grbawKbuxQSkRjg8zz7 Tdz7KAshX2RkRU1mAocuYRzg8u1MSkN/EBAE4sMSkwpiXLWMAEEnvERMO2ecPUETYYR1 peJIMga2+tk6SXX+AZTh4QHT8bCzeRkkQmzyOV7VcQhYf9dBorERD1lIHGyb8qUDrIuF zPLx/IzdcGKzWNMHZmyfmexK1rlBiBFJmseH3bNm3tsXakCqXb7mFyUuU4NtjCbXviIy 4w0g== X-Gm-Message-State: AOJu0Yw8ZGx5dE6BlekmUS/zK0onQQRxWb8CLtgqJ1Nf2+hH28Bmfk5H Q8r+hY2ca2ySsM5P3CoxB/P83giR6iIqOaXrJxcCEj6Zy5GnWAzE5+PwDZTddgB05ndjee9j12Q LJ/5mT7IBNSXt+zeximcp4gUJ X-Received: by 2002:a05:620a:4547:b0:77d:98a6:6482 with SMTP id u7-20020a05620a454700b0077d98a66482mr10312277qkp.5.1701115700630; Mon, 27 Nov 2023 12:08:20 -0800 (PST) X-Received: by 2002:a05:620a:4547:b0:77d:98a6:6482 with SMTP id u7-20020a05620a454700b0077d98a66482mr10312228qkp.5.1701115700263; Mon, 27 Nov 2023 12:08:20 -0800 (PST) Received: from fedora ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id dt32-20020a05620a47a000b0077d71d46887sm3926285qkb.112.2023.11.27.12.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 12:08:19 -0800 (PST) Date: Mon, 27 Nov 2023 14:08:16 -0600 From: Andrew Halaney To: Suraj Jaiswal Cc: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Torgue , Jose Abreu , Maxime Coquelin , netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Prasad Sodagudi , kernel@quicinc.com Subject: Re: [PATCH net-next v3 3/3] net: stmmac: Add driver support for DWMAC5 fault IRQ Support Message-ID: References: <62eaaace3713751cb1ecac3163e857737107ca0e.1700737841.git.quic_jsuraj@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62eaaace3713751cb1ecac3163e857737107ca0e.1700737841.git.quic_jsuraj@quicinc.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 12:08:35 -0800 (PST) On Thu, Nov 23, 2023 at 05:08:15PM +0530, Suraj Jaiswal wrote: > Add IRQ support to listen HW fault like ECC,DPP,FSM > fault and print the fault information in the kernel > log. > > Signed-off-by: Suraj Jaiswal > --- > drivers/net/ethernet/stmicro/stmmac/common.h | 1 + > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++ > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 +++++++++++++++++ > .../ethernet/stmicro/stmmac/stmmac_platform.c | 20 +++++++++++++++++++ > 4 files changed, 41 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h > index 6b935922054d..c4821c7ab674 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/common.h > +++ b/drivers/net/ethernet/stmicro/stmmac/common.h > @@ -347,6 +347,7 @@ enum request_irq_err { > REQ_IRQ_ERR_SFTY_UE, > REQ_IRQ_ERR_SFTY_CE, > REQ_IRQ_ERR_LPI, > + REQ_IRQ_ERR_SAFETY, > REQ_IRQ_ERR_WOL, > REQ_IRQ_ERR_MAC, > REQ_IRQ_ERR_NO, > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > index cd7a9768de5f..8893d4b7fa38 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h > @@ -33,6 +33,7 @@ struct stmmac_resources { > int irq; > int sfty_ce_irq; > int sfty_ue_irq; > + int safety_common_intr; > int rx_irq[MTL_MAX_RX_QUEUES]; > int tx_irq[MTL_MAX_TX_QUEUES]; > }; > @@ -331,6 +332,7 @@ struct stmmac_priv { > /* XDP BPF Program */ > unsigned long *af_xdp_zc_qps; > struct bpf_prog *xdp_prog; > + int safety_common_intr; > }; > > enum stmmac_state { > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 8964fc8a955f..2ae4f34444de 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -3530,6 +3530,10 @@ static void stmmac_free_irq(struct net_device *dev, > if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) > free_irq(priv->wol_irq, dev); > fallthrough; > + case REQ_IRQ_ERR_SAFETY: > + if (priv->safety_common_intr > 0 && priv->safety_common_intr != dev->irq) > + free_irq(priv->safety_common_intr, dev); > + fallthrough; > case REQ_IRQ_ERR_WOL: > free_irq(dev->irq, dev); > fallthrough; > @@ -3736,6 +3740,18 @@ static int stmmac_request_irq_single(struct net_device *dev) > } > } > > + if (priv->safety_common_intr > 0 && priv->safety_common_intr != dev->irq) { > + ret = request_irq(priv->safety_common_intr, stmmac_safety_interrupt, > + 0, "safety", dev); > + if (unlikely(ret < 0)) { > + netdev_err(priv->dev, > + "%s: alloc safety failed %d (error: %d)\n", > + __func__, priv->safety_common_intr, ret); > + irq_err = REQ_IRQ_ERR_SAFETY; > + goto irq_error; > + } > + } > + > return 0; > > irq_error: > @@ -7398,6 +7414,8 @@ int stmmac_dvr_probe(struct device *device, > priv->lpi_irq = res->lpi_irq; > priv->sfty_ce_irq = res->sfty_ce_irq; > priv->sfty_ue_irq = res->sfty_ue_irq; > + priv->safety_common_intr = res->safety_common_intr; > + > for (i = 0; i < MTL_MAX_RX_QUEUES; i++) > priv->rx_irq[i] = res->rx_irq[i]; > for (i = 0; i < MTL_MAX_TX_QUEUES; i++) > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 1ffde555da47..bae1704d5f4b 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -690,9 +690,25 @@ devm_stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) > #endif /* CONFIG_OF */ > EXPORT_SYMBOL_GPL(devm_stmmac_probe_config_dt); > > +int stmmac_get_fault_intr_config(struct platform_device *pdev, struct stmmac_resources *res) > +{ > + int ret = 0; > + > + res->safety_common_intr = platform_get_irq_byname(pdev, "safety"); > + > + if (res->safety_common_intr < 0) { > + if (res->safety_common_intr != -EPROBE_DEFER) > + dev_err(&pdev->dev, "safety IRQ configuration information not found\n"); > + ret = 1; > + } > + > + return ret; > +} I think other reviewers have covered most of what I want to say, but I think this doesn't deserve its own function and should just be done directly, as is done for eth_lpi for example. I think it also should be considered an optional interrupt based on my understanding of its purpose (just like eth_lpi). > + > int stmmac_get_platform_resources(struct platform_device *pdev, > struct stmmac_resources *stmmac_res) > { > + int ret = 0; > memset(stmmac_res, 0, sizeof(*stmmac_res)); > > /* Get IRQ information early to have an ability to ask for deferred > @@ -702,6 +718,10 @@ int stmmac_get_platform_resources(struct platform_device *pdev, > if (stmmac_res->irq < 0) > return stmmac_res->irq; > > + ret = stmmac_get_fault_intr_config(pdev, stmmac_res); > + if (ret) > + dev_err(&pdev->dev, "Fault interrupt not present\n"); > + > /* On some platforms e.g. SPEAr the wake up irq differs from the mac irq > * The external wake up irq can be passed through the platform code > * named as "eth_wake_irq" > -- > 2.25.1 >