Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp194878pxj; Fri, 7 May 2021 06:50:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL0pOcAbbXOg1mLEgbrOo5AWfNJp4/UHP+DH57naU8PLUpPCZoLKvg6A81kjS47Dst+BuJ X-Received: by 2002:a17:906:3949:: with SMTP id g9mr10243279eje.7.1620395435069; Fri, 07 May 2021 06:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620395435; cv=none; d=google.com; s=arc-20160816; b=OCuQj47TGuTZTdLLYwTt6CAMfr0h3Xw29M283A61cIZtCyrA4h2fcqXS9z9LQZao25 ZOScZrJ7NVP/V5VFHkMSc8TiADAfh99ldltPjKsZwhafCNQdG6/k4U1OfFzZ6xXPfDMg NdL22M0aWbzpdzP9UIGjcVGz/tA2Iflt9hLV5SIGlbkXLYvZ9t1vJg6RiqG2aDBSBezv KLaAXGBWsueE5Cu13BmO/6j7bg0PLVRf4fE1lRDEBU1cJ+f7I/sl5S9dd8V/YJrLxCdb I401js2FJMFrJG/r9s2MzcuzS3CUexkWm1No1dOtMmD/W59ApcRR7pL1i0cb9rAgnsgv Oyew== 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:subject:cc:to:from:message-id :date; bh=Tw+15lOfTbEX3OpP+RkZUx+Jv2jLiqGfoTbJeXs3iCo=; b=phcbs83PmXRKob4ysGyz4ci4Om5n7ccno18LfsK80fXqLR86Xv/3YQL2jsCMESKfWN W/f3NkzaYZ8ztTFT2FCKQDYgTwMqTo+PPWyGEHhB+LEPtPNB+dS5uYyu7ccEchvwYm4z MllD8xLflhvTvklsvzbrzP6oshvt/DZfwo8+4a/Q+14n06RpFVdk4FPLuD4VQk4v9AY9 obCB60XQmHqIAyM+kKE8jpaHt5/ipNfJtb+HlVv454BwGV2KAG3j2/sK6Nrkavoaluha 9KnHlZAF5PBCeu72W/pHfiGrUDCR0hUUYxf8aLcsxDMz9VgVmD/czl8G/DiQjwt1Df0K GbYw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si5194267ejp.610.2021.05.07.06.50.08; Fri, 07 May 2021 06:50:35 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234081AbhEGKUv convert rfc822-to-8bit (ORCPT + 99 others); Fri, 7 May 2021 06:20:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:40442 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbhEGKUu (ORCPT ); Fri, 7 May 2021 06:20:50 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 095D761443; Fri, 7 May 2021 10:19:51 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lexaG-00BRP8-RS; Fri, 07 May 2021 11:19:48 +0100 Date: Fri, 07 May 2021 11:19:48 +0100 Message-ID: <87bl9mq20r.wl-maz@kernel.org> From: Marc Zyngier To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas , Russell King , Marek =?UTF-8?B?QmVow7pu?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 18/42] PCI: aardvark: Correctly clear and unmask all MSI interrupts In-Reply-To: <20210506153153.30454-19-pali@kernel.org> References: <20210506153153.30454-1-pali@kernel.org> <20210506153153.30454-19-pali@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: pali@kernel.org, lorenzo.pieralisi@arm.com, thomas.petazzoni@bootlin.com, robh@kernel.org, bhelgaas@google.com, rmk+kernel@armlinux.org.uk, kabel@kernel.org, repk@triplefau.lt, contact@xogium.me, tmn505@gmail.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 06 May 2021 16:31:29 +0100, Pali Rohár wrote: > > Define a new macro PCIE_MSI_ALL_MASK and use it for masking, unmasking and > clearing all MSI interrupts. > > Signed-off-by: Pali Rohár > Reviewed-by: Marek Behún > Cc: stable@vger.kernel.org > --- > drivers/pci/controller/pci-aardvark.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c > index 498810c00b6d..5e0243b2c473 100644 > --- a/drivers/pci/controller/pci-aardvark.c > +++ b/drivers/pci/controller/pci-aardvark.c > @@ -117,6 +117,7 @@ > #define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54) > #define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58) > #define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C) > +#define PCIE_MSI_ALL_MASK GENMASK(31, 0) > #define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C) > #define PCIE_MSI_DATA_MASK GENMASK(15, 0) > > @@ -386,19 +387,22 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) > advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG); > > /* Clear all interrupts */ > + advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG); > advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG); > advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG); > advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG); > > /* Disable All ISR0/1 Sources */ > - reg = PCIE_ISR0_ALL_MASK; > - reg &= ~PCIE_ISR0_MSI_INT_PENDING; > - advk_writel(pcie, reg, PCIE_ISR0_MASK_REG); > - > + advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_MASK_REG); > advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG); > > /* Unmask all MSIs */ > - advk_writel(pcie, 0, PCIE_MSI_MASK_REG); > + advk_writel(pcie, ~(u32)PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG); I really wonder why you'd unmask all MSIs. Yes, the current code does that already, but I'd expect MSIs to be individually unmasked as they get enabled by the core code. Thanks, M. > + > + /* Unmask summary MSI interrupt */ > + reg = advk_readl(pcie, PCIE_ISR0_MASK_REG); > + reg &= ~PCIE_ISR0_MSI_INT_PENDING; > + advk_writel(pcie, reg, PCIE_ISR0_MASK_REG); > > /* Enable summary interrupt for GIC SPI source */ > reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK); > @@ -1049,7 +1053,7 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie) > > msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); > msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); > - msi_status = msi_val & ~msi_mask; > + msi_status = msi_val & ((~msi_mask) & PCIE_MSI_ALL_MASK); > > for (msi_idx = 0; msi_idx < MSI_IRQ_NUM; msi_idx++) { > if (!(BIT(msi_idx) & msi_status)) > -- > 2.20.1 > > -- Without deviation from the norm, progress is not possible.