Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6235110iob; Tue, 10 May 2022 13:33:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAqCztWDNaPL/FK6V+tgGS4QSEzOtCbRvLTakmEhXHR8kKg0laXR5/tpIJhgTJCDlRVZV+ X-Received: by 2002:a17:907:6090:b0:6fa:14ca:fba2 with SMTP id ht16-20020a170907609000b006fa14cafba2mr12187337ejc.564.1652214832669; Tue, 10 May 2022 13:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652214832; cv=none; d=google.com; s=arc-20160816; b=T5Hux/vvkGw3iRvTuZ+zqoq7lW5ARelhckvGk0jUQHf3anR9PgmgyUW2wF4RsC+8t3 8KFxWZldo1Q9tnOXzdv3Av1XlDD13UacSThTlKQ/qNA1r++bqjNkrdVPrSZbjesLExVy cfl6AzAOT0u6AAEVCzUy2XdGIxvCBWQFE2wEXdOZHS8NnMw5focAvGI3p0Dw2WY5UpDq BHLX3x5Qc5MwmoI+JrHfdGLJQOLkTragmtqaQvuu+dFinhP0Q9/qkhRLgyszv+qC+7Ou nPwNcAeMAWXhCmUZyTZOuzlgDTHy1x47xKfmgYuwSNP1e3DC5dVrULpvOrtotVI8UTTe bWvQ== 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=/gnz+feyFAqtgRpwJid9Xh9JzgMMUfNLjC/LeeT96iQ=; b=U+JqBhtLNNgEGTfOXYrznc7XTBH/KooW+NZGg5+T7Jj8etarsnHJ39HQpJKoGjZ/gU MKKHezT979xTdOQeodjuqt2cz+ALvO4JbEmaTALzJvEfz0DS869xf09q4sN1x4YdrhPk +mvL5iddX88Fr2trp9lLpnHuwAeK9w0wBZVsHcxKAKhr2DZ0pJjWsrjbdcxdsBgT56Ab b+tl1wnXfUIQJTjjVyn5uDqHDmSmwQEEtnkSexHXPRL18zDs2AWzuE9NmEgHPYikyzit +plVjdHu1DkjuNAXpfkvudh+yM6M4kSp/TLdB6We/ZVVZhIcErutSgZUbD2MeQ52O4N9 ynrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Di9MqFst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id va14-20020a17090711ce00b006f3a817a503si272351ejb.816.2022.05.10.13.33.27; Tue, 10 May 2022 13:33:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Di9MqFst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S244640AbiEJNvH (ORCPT + 99 others); Tue, 10 May 2022 09:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243336AbiEJNdM (ORCPT ); Tue, 10 May 2022 09:33:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F922380E2; Tue, 10 May 2022 06:24:22 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id DD0CDB81DB1; Tue, 10 May 2022 13:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 499B3C385C9; Tue, 10 May 2022 13:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189056; bh=p66mXbbVKTuTCV9wvWvuCcAImiMsmy9tH8s+oB4xHXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Di9MqFst3LMVDOP/gg3pOd7KhKTklTRGFWavhGeE4QcpZZ7WLG6EYd7z9nMWMQkvJ 4eVVrsGHGlIw8VyOtDEEEfjIIRM6XkatoVxVmXeC/MmPJlEi9vYeNJiUtUyIAvsKg6 4UB5ouLoo6rsMyRPTOR7PA8LiiCf5HyDhr7zr5R8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Lorenzo Pieralisi Subject: [PATCH 5.4 51/52] PCI: aardvark: Fix reading MSI interrupt number Date: Tue, 10 May 2022 15:08:20 +0200 Message-Id: <20220510130731.345785180@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130729.852544477@linuxfoundation.org> References: <20220510130729.852544477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Rohár commit 805dfc18dd3d4dd97a987d4406593b5a225b1253 upstream. In advk_pcie_handle_msi() it is expected that when bit i in the W1C register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is updated to contain the MSI number corresponding to index i. Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG always contains the number of the last received MSI, overall. Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt number. Since Aardvark already forbids more than 32 interrupts and uses own allocated hwirq numbers, the msi_idx already corresponds to the received MSI number. Link: https://lore.kernel.org/r/20220110015018.26359-3-kabel@kernel.org Fixes: 8c39d710363c ("PCI: aardvark: Add Aardvark PCI host controller driver") Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Signed-off-by: Lorenzo Pieralisi Signed-off-by: Marek Behún Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/pci-aardvark.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1372,7 +1372,7 @@ static void advk_pcie_remove_irq_domain( static void advk_pcie_handle_msi(struct advk_pcie *pcie) { u32 msi_val, msi_mask, msi_status, msi_idx; - u16 msi_data; + int virq; msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG); msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG); @@ -1382,13 +1382,9 @@ static void advk_pcie_handle_msi(struct if (!(BIT(msi_idx) & msi_status)) continue; - /* - * msi_idx contains bits [4:0] of the msi_data and msi_data - * contains 16bit MSI interrupt number - */ advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG); - msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK; - generic_handle_irq(msi_data); + virq = irq_find_mapping(pcie->msi_inner_domain, msi_idx); + generic_handle_irq(virq); } advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,