Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1820988pxx; Fri, 30 Oct 2020 22:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyUi8NNNZGyyPth4HwEQjNtmJCwjoBVWBxColLLIBBMz6/F4A7u69gqJw+adlh4nPxPQPT X-Received: by 2002:aa7:c84b:: with SMTP id g11mr5840967edt.86.1604121894310; Fri, 30 Oct 2020 22:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604121894; cv=none; d=google.com; s=arc-20160816; b=vxQnLc/lhYousdppZuAcpWhqaaxkBNeGSk+9WZWkmJLjtsgoTPlLiPxFnbfPTuyg6k odhekvx6bVkWSJAy7n4k0ExejxC9949j2Ig+IqQ2H6wPZ444mUmMgd5F8E5+tAlJDpnC j9SM6G9o1cC22W/zzRQ6ag5WI1Di3FrNAxNQ6j/DrytYfThTt3lEjZw0D7kgoeLiFLeQ hy/KkY+7CiFB0vfoBS7WLmcMVLjvH+KjM1mqovs4S9TPQZjB6DWGQLlWRh/Ult9+zhZM tvjrBkrBnGOeKBWcj+EhrZmv7VIzkV9Vrls2a6CLSqrTGy2KBc7I84ImotBSEFvZLgsS V6Bg== 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=1foCDvqNp97coSLrJHBgUrErmgwaD7+Kay2OQmrpnWM=; b=oxee5Zb1tNLmYcy46oA4FhNpY07sLIlbE2M/y62E69wX1nux7JqDumeEQaInDYASOU ZlNNGHkelVPMVcjcYxaJascXxg9s7K/XpM1tUc3o9gMk7JExOaiTCZ05K8E5KiWIaoJt s5pAQePJg6VBIE97vwxBII8LN1DxA+ZTuKrG0/JcO85pcd45iAIUC433huL8ckvXPv7f 5dXf6al/sZbkusyonxv+qDB5LvO1F2RVgyqvu74zO6pq0KAFC8ofrdoidbiWOXj0P8Q1 3oegNZykfdnr9w8ELXFDwleXolAeOQXDGiRwftdzJgl0ST42vkbeSszu7ygWRe2eViAR g44g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Tesbq+ux; 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 bc24si6202529edb.438.2020.10.30.22.24.31; Fri, 30 Oct 2020 22:24:54 -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=Tesbq+ux; 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 S1726227AbgJaFXF (ORCPT + 99 others); Sat, 31 Oct 2020 01:23:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbgJaFXE (ORCPT ); Sat, 31 Oct 2020 01:23:04 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98715C0613D5; Fri, 30 Oct 2020 22:23:04 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id p9so11475382eji.4; Fri, 30 Oct 2020 22:23:04 -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=1foCDvqNp97coSLrJHBgUrErmgwaD7+Kay2OQmrpnWM=; b=Tesbq+uxd7lnbEn16lk3Zk+u3qNWPtupkfDYn7+ZoeaISm1WbMjw9L6CYwy+Jy2p/x 3DEMiIDSxAjmAgEE7FB90eslRvF2P35DhnxhPKC13YWNu+ZOtlo8NJIb5gmbBViWXZ6J nfL1x8sedGwmgWCE6RUTUPmSlcvSk77ZtbJXFPUPCZnQ8FRozTHYhlYMu6rx6gqkPP5j Ibundcz0XC78XVw8L5eJI7G0y7UBNK9WnFr7pIYbwfIGvfpBmFddw4/NUSUzeK8KledF yiav5nfCm5ZPvtqqHH59LJArvK1AsQdWOgbZzam4+aXCAkJylaoP+qVTn4mHSu7TygBn nPhg== 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=1foCDvqNp97coSLrJHBgUrErmgwaD7+Kay2OQmrpnWM=; b=fV72RQ9yjqylqt895IbeqEMelGxfF9sUEMxynuIR+q43VzhKvHgKoGxIy5+4P/236u m4B3b4NYhnHMe1CnuYneE7uLlkKRosNoD7CfHs4HR5XBNZ5zUVmIHTfbMwjSG/fv+aCc y0LoTU/tRtdEe6FDiFFuUamZVIJcUeHvaP1I2ow3hlVCRDOSgDpvEg9/cAP1gvgPOH1P wmq3drAJHZ/aZ5klhcFF76JMHrvZXci5zH/6XsdmuX30kC2mJViHByv8ML9lCtr09WOg GznAb96tfxCZptP9WhKDzBipUiWnDM4MJPYT9qzf2pAaNVw5pnotoJPWRJsL2Mxz5Q7k ljxg== X-Gm-Message-State: AOAM533cjs9upJK4jm6hsnqCAAVEZYKc2bejfl6xg2+3JVDWF5tJQ+JY DIfiabP55cDShO7SwqI2XjM= X-Received: by 2002:a17:906:7096:: with SMTP id b22mr6089563ejk.335.1604121783156; Fri, 30 Oct 2020 22:23:03 -0700 (PDT) Received: from skbuf ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id x2sm4087695edr.65.2020.10.30.22.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 22:23:02 -0700 (PDT) From: Ioana Ciornei X-Google-Original-From: Ioana Ciornei Date: Sat, 31 Oct 2020 07:22:59 +0200 To: Andrew Lunn Cc: Heiner Kallweit , 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: <20201031052259.pmhkmlaq5sqndtwu@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: <20201030233627.GA1054829@lunn.ch> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 31, 2020 at 12:36:27AM +0100, 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 > > 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. > > For example code, what is listed above is O.K. The real implementation > in a driver need knowledge of the hardware. > Hi, As Andrew said, that is just an example code that could work for some devices but should be extended depending on how the actual PHY is working. For example, the VSC8584 will still be trigerring the link state machine just on the link change interrupt, I am not changing this: static irqreturn_t vsc8584_handle_interrupt(struct phy_device *phydev) { irqreturn_t ret; int irq_status; irq_status = phy_read(phydev, MII_VSC85XX_INT_STATUS); if (irq_status < 0) return IRQ_NONE; /* Timestamping IRQ does not set a bit in the global INT_STATUS, so * irq_status would be 0. */ ret = vsc8584_handle_ts_interrupt(phydev); if (!(irq_status & MII_VSC85XX_INT_MASK_MASK)) return ret; if (irq_status & MII_VSC85XX_INT_MASK_EXT) vsc8584_handle_macsec_interrupt(phydev); if (irq_status & MII_VSC85XX_INT_MASK_LINK_CHG) phy_trigger_machine(phydev); return IRQ_HANDLED; } Ioana