Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1956569pxx; Sat, 31 Oct 2020 03:59:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzZLeMg9Jd5XtwejPqEzTy0/fYJzmXfy5U26nm57UPWD1S8FQWxuHnmmNvLAanCZemkkha X-Received: by 2002:aa7:da12:: with SMTP id r18mr6782902eds.169.1604141955438; Sat, 31 Oct 2020 03:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604141955; cv=none; d=google.com; s=arc-20160816; b=CvzeiiD+i9IAkzqyT4055INSuSlFSjtGkstRu/TLL6diI8pHnjb+MrX+BY9IV4e7Hw 0Hv8a8ZD0b9iPd7C3r224w9OR7v/POoACdLSmAAA4UiOIf4OOs9QI7YxC7S9vP/o7Lzl NZUYOJe5AOk8NEhTir046cX2MjsKEQPbQb36hsVK2zDwTcuQgR9D7HjbijXva3mCXoS1 XPwyeyccIlmBwT61aObfPqQtkdheCFu4iYr6BIXEW3jO+sZb9C+TT/w434zUbYn83YNt DbtcOvoHut56ctpkZEsTPRa3YkdHOokHbc7RbFkVaUpTACzf4KQshoMnH1R/hrCbFZZU eSGw== 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:date:from:dkim-signature; bh=s1a4ay/ZA0139gaJG0Uz6JXksI84uELFZprIp8P1IZo=; b=K1gGneEnlhQt4n5yrUg/lYVEglyblw1sRbxIqTDIIXxqBkyUwfcUJgKOH8Yl6SKWFj 0RDzJtyJJjJv3uHtXlEggipvUAAFJ7C28ZPEPYiW0aSagHpjaSUfJ27JxA4r0rbom/Um QET+MS0nd8VrBD+gO1C+BwBYqCQoUvanvQ1ZNA0rCa54go42OhNcUnMJz6SrMmyh0c4B UJCbwJKtEenJKP52zxzQ6ou8EnvcbKivfbJFk313wFwHmd+/UC+GlqYF6QQ432tmBW3r C0iB1cMh4Hj/FbG0XAupoodqPzkFrG9TD3fBTHBvfq6JVO4PgvFWd0kGvLsrWdorXXje aRlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VRYPTPDh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si436875ejf.392.2020.10.31.03.58.52; Sat, 31 Oct 2020 03:59:15 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=VRYPTPDh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726815AbgJaK51 (ORCPT + 99 others); Sat, 31 Oct 2020 06:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbgJaK50 (ORCPT ); Sat, 31 Oct 2020 06:57:26 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434B2C0613D5; Sat, 31 Oct 2020 03:57:26 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id a15so471304edy.1; Sat, 31 Oct 2020 03:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=s1a4ay/ZA0139gaJG0Uz6JXksI84uELFZprIp8P1IZo=; b=VRYPTPDho0rY696UeWs18IoBEPS9mNGREkTWV2t8/nPYb28kBWAdhFupECptmg2jsW 11pvQmv2uXiTnXNtelu7oC3J0+9G+Ec9mxmUcnDdsEVsxhNSG+tRFCU6HCYyg0lbnVf4 3WLgFCXJJy+uh7eim9+rbCv+fNfRz2I169vYvaJMw8sByZu1uZ7hxMr1BwvH2pi5oOJv JnulK6G6/fnnmCcEIkVmD7lrG5MkzFlc/z9vy4Pikj1/hxdqMPzAApg/1kz3slXOeJU0 XxawtTbFPgx9toR/9h9dMWP7yhn39hifcxJJe0Wu/gel41qWmBFvQAZjmbkmpXtDeN3N xw1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=s1a4ay/ZA0139gaJG0Uz6JXksI84uELFZprIp8P1IZo=; b=sFYJYXqVnRZB1AKape6XuoArCCV0xPuM76u09hbZauJVPrMcHvCcbjiGVdyIDoCohE XSFubXu8YnJ586BZ1WZKzbfhrRVTSRHUSIHOCXmZFn5z0xFuPNOhWVm/idHUfcU5LNCg 1b2vSR1nlP4bhbR67FjPgFW802NREbfYXOpwcXaUKVUX1Ubs0en6Wps/rhiAmw254Zvk LuRrDzd6EwUirYFuTZ82AfwQSqR/GNBLppjYBFMl7HWp+wiEgUN0C9K8goDO2EBZDvYI sObP1PnkyZD4buOhmUFOnjfLSNZaP5k15CxP9swDy/8yYjNraVK2OG/oNrViw/hlIirk Jn3g== X-Gm-Message-State: AOAM532IavXFkK8CO0AP66eUR1vUyqkQAeiwi19aklo33GEkfR13h3sJ g0U/VUkk6BCE64dMlT7cj7c= X-Received: by 2002:a50:eb0a:: with SMTP id y10mr7378971edp.342.1604141844993; Sat, 31 Oct 2020 03:57:24 -0700 (PDT) Received: from skbuf ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id rn2sm245144ejb.94.2020.10.31.03.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Oct 2020 03:57:24 -0700 (PDT) From: Ioana Ciornei X-Google-Original-From: Ioana Ciornei Date: Sat, 31 Oct 2020 12:57:21 +0200 To: Heiner Kallweit Cc: Andrew Lunn , Ioana Ciornei , Russell King , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ioana Ciornei , Alexandru Ardelean , Andre Edich , Antoine Tenart , Baruch Siach , Christophe Leroy , Dan Murphy , Divya Koppera , Florian Fainelli , Hauke Mehrtens , Jerome Brunet , Kavya Sree Kotagiri , Linus Walleij , Marco Felsch , Marek Vasut , Martin Blumenstingl , Mathias Kresin , Maxim Kochetkov , Michael Walle , Neil Armstrong , Nisar Sayed , Oleksij Rempel , Philippe Schenker , Willy Liu , Yuiko Oshino Subject: Re: [PATCH net-next 00/19] net: phy: add support for shared interrupts (part 1) Message-ID: <20201031105721.cc5g3he66ku6rm5b@skbuf> References: <20201029100741.462818-1-ciorneiioana@gmail.com> <20201030233627.GA1054829@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 31, 2020 at 11:18:18AM +0100, Heiner Kallweit wrote: > On 31.10.2020 00:36, Andrew Lunn wrote: > >>> - Every PHY driver gains a .handle_interrupt() implementation that, for > >>> the most part, would look like below: > >>> > >>> irq_status = phy_read(phydev, INTR_STATUS); > >>> if (irq_status < 0) { > >>> phy_error(phydev); > >>> return IRQ_NONE; > >>> } > >>> > >>> if (irq_status == 0) > >> > >> Here I have a concern, bits may be set even if the respective interrupt > >> source isn't enabled. Therefore we may falsely blame a device to have > >> triggered the interrupt. irq_status should be masked with the actually > >> enabled irq source bits. > > > > Hi Heiner > > > Hi Andrew, > > > I would say that is a driver implementation detail, for each driver to > > handle how it needs to handle it. I've seen some hardware where the > > interrupt status is already masked with the interrupt enabled > > bits. I've soon other hardware where it is not. > > > Sure, I just wanted to add the comment before others simply copy and > paste this (pseudo) code. And in patch 9 (aquantia) and 18 (realtek) > it is used as is. And IIRC at least the Aquantia PHY doesn't mask > the interrupt status. > Hi Heiner, If I understand correctly what you are suggesting, the .handle_interrupt() for the aquantia would look like this: static irqreturn_t aqr_handle_interrupt(struct phy_device *phydev) { int irq_status; irq_status = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_INT_STATUS2); if (irq_status < 0) { phy_error(phydev); return IRQ_NONE; } if (!(irq_status & MDIO_AN_TX_VEND_INT_STATUS2_MASK)) return IRQ_NONE; phy_trigger_machine(phydev); return IRQ_HANDLED; } So only return IRQ_HANDLED when one of the bits from INT_STATUS corresponding with the enabled interrupts are set, not if any other link status bit is set. Ok, I'll send a v2 with these kind of changes. Ioana