Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1909173rdb; Mon, 9 Oct 2023 06:52:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHBi1sHDqbZsSjOhAU0xJMNdwat+AGsdqFarogPZUIp1NNKG+ULF5yocG6vTbd/iybaeg0 X-Received: by 2002:a05:6358:7206:b0:13c:f631:bed with SMTP id h6-20020a056358720600b0013cf6310bedmr14663034rwa.32.1696859571611; Mon, 09 Oct 2023 06:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696859571; cv=none; d=google.com; s=arc-20160816; b=AeWB+jyrlNodHM5fBzz7OCIG71WaDoUyISe7p7s4Eaw9RcfSoqJDscGaY83idNbCRK 5eReJnVPKyDu4Kix/+yitH+mu25fZcGA++LUWct4lYtVs0tOrYFbEKBxiOfILPmiyTpL wCTu6iyvi41H5xshoggIjM4nPi9jlJwcUOSwjAFjv9YQgCTFmfg1rnSmDUq9J3jEG/kc KiWweZgje64VEwe1j+k3uZcVRx+WJycmXUrqqioTlImosNY5sxry/hkh1pxoDZUOS01x Yyl1b1WvOwPSMOdFg3G6XYaa6lLvkXG/VTR5qwJHqRdjdMk4Gif35X2o7gLVZbVqnRE1 Y3oQ== 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=JSwzBOscwT3n7cQTt6yDp6EH2ylskdox0jI7MjzlWXo=; fh=zyFAItzoHFGrd2AbUkrdG8zo9j3L2b9vW4Bs4ZsCj6U=; b=vk/VljwUninuYcaUdgdA5/zTnqt4vRH94npRPFms6m8ofsqWxHEDdMABDoqpHI2oOk zYwmw5s4gLceIJVWnSEABNOOhiXrIBjdGGz263DEXqwYsLXyXIlDKZduFa8So/sbh7uG t+JHivClqV8ahdapmcPwPPfqZKUrrB65Nm7un3Lz/peCcA8WXhiT6083CC32eBeE2FzO Qz7gwdD4+7vIK06om7v+UEKPDCjLK85xtWqZPEWK9fDu2O06nZW+myQffQKsz3o3MpId hOZKG5TRjDqO678gLzZpH6IsVGNeS6HFejjuSK+7OO39W9Bw1arYCPWJBVgR+jWHySwD XUZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="wNGl/KR7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id be3-20020a656e43000000b005859baa2aa9si108460pgb.567.2023.10.09.06.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 06:52:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="wNGl/KR7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 462358030D12; Mon, 9 Oct 2023 06:52:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377484AbjJINw2 (ORCPT + 99 others); Mon, 9 Oct 2023 09:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377457AbjJINw1 (ORCPT ); Mon, 9 Oct 2023 09:52:27 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E5BA3; Mon, 9 Oct 2023 06:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1696859543; x=1728395543; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=woWLvA+OZiwBOAnGAJHDSkgAYlJa502T4z/q/Xqpl9M=; b=wNGl/KR7BoYCjqevRPbNLuuCiTPZsrJSWyqQoRlYrOi6I3gzxGteIF/c kX88F6ZKXxXv0EKQscIxQSQ+FTsEOcta+rKsOfS6mH8e+SyrXEUyJar5H JDZwdznL2VAqSj8E9xpI1ukJXnv7JBI4QyDf25pgyJyoVm4dnD30XyN+S sWDQq6R9fSeOXa3UzGdKzhNOkZAkQLGg9qmsObYw5iDV3IoOWaRSn2fI9 FsY9l8x5EM9aezwdDVGzxSx0XzRG8QJIxvGifbsRqyUHVP63J0tuCb1Fk 5EzknoCYxzjA62fN5glNP0b5BDGleCmypYQgm7C6d/ntqrvzEnEOx/4Qy g==; X-CSE-ConnectionGUID: M2UGz3wCSraKDoNm0f0NgQ== X-CSE-MsgGUID: kDZEEEfbRYGInoeHmZQt0Q== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,210,1694761200"; d="asc'?scan'208";a="176451529" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 09 Oct 2023 06:52:17 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 9 Oct 2023 06:52:17 -0700 Received: from wendy (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Mon, 9 Oct 2023 06:52:13 -0700 Date: Mon, 9 Oct 2023 14:51:52 +0100 From: Conor Dooley To: Minda Chen CC: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Emil Renner Berthing , , , , , Paul Walmsley , "Palmer Dabbelt" , Albert Ou , "Philipp Zabel" , Mason Huo , Leyfoon Tan , Kevin Xie Subject: Re: [PATCH v7 13/19] PCI: microchip: Add get_events() callback function Message-ID: <20231009-ecologist-postage-f4e6d96d77cd@wendy> References: <20230927100802.46620-1-minda.chen@starfivetech.com> <20230927100802.46620-14-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GRp9b0oKyCUZcQwq" Content-Disposition: inline In-Reply-To: <20230927100802.46620-14-minda.chen@starfivetech.com> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 06:52:47 -0700 (PDT) X-Spam-Level: ** --GRp9b0oKyCUZcQwq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey, On Wed, Sep 27, 2023 at 06:07:56PM +0800, Minda Chen wrote: > For different interrupts to event num mapping function, > add get_events() function pointer. >=20 > Signed-off-by: Minda Chen > --- > drivers/pci/controller/plda/pcie-microchip-host.c | 14 +++++++++++++- > drivers/pci/controller/plda/pcie-plda.h | 2 ++ > 2 files changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/= pci/controller/plda/pcie-microchip-host.c > index fb09b6c34e01..875bdb03ce22 100644 > --- a/drivers/pci/controller/plda/pcie-microchip-host.c > +++ b/drivers/pci/controller/plda/pcie-microchip-host.c > @@ -646,7 +646,7 @@ static void plda_handle_event(struct irq_desc *desc) > =20 > chained_irq_enter(chip, desc); > =20 > - events =3D mc_get_events(port); > + events =3D port->event_ops->get_events(port); > =20 > for_each_set_bit(bit, &events, port->num_events) > generic_handle_domain_irq(port->event_domain, bit); > @@ -805,7 +805,12 @@ static int mc_request_event_irq(struct plda_pcie_rp = *plda, int event_irq, > 0, event_cause[event].sym, plda); > } > =20 > +static const struct plda_event_ops mc_event_ops =3D { > + .get_events =3D mc_get_events, > +}; > + > static const struct plda_event mc_event =3D { > + .event_ops =3D &mc_event_ops, > .request_event_irq =3D mc_request_event_irq, > .intx_event =3D EVENT_LOCAL_PM_MSI_INT_INTX, > .msi_event =3D EVENT_LOCAL_PM_MSI_INT_MSI, > @@ -919,6 +924,11 @@ static int plda_init_interrupts(struct platform_devi= ce *pdev, > int i, intx_irq, msi_irq, event_irq; > int ret; > =20 > + if (!event->event_ops || !event->event_ops->get_events) { > + dev_err(dev, "no get events ops\n"); > + return -EINVAL; > + } Dumb question maybe, but is this actually possible to trigger? This code is in the Microchip driver, so I assume there's a future patch moving this code that could actually trigger the problem? If so, the motivation for making this generic should be mentioned in the commit message IMO. Thanks, Conor. > + > ret =3D plda_pcie_init_irq_domains(port); > if (ret) { > dev_err(dev, "failed creating IRQ domains\n"); > @@ -929,6 +939,8 @@ static int plda_init_interrupts(struct platform_devic= e *pdev, > if (irq < 0) > return -ENODEV; > =20 > + port->event_ops =3D event->event_ops; > + > for (i =3D 0; i < port->num_events; i++) { > event_irq =3D irq_create_mapping(port->event_domain, i); > if (!event_irq) { > diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/contro= ller/plda/pcie-plda.h > index af5e69718342..48d7bc471137 100644 > --- a/drivers/pci/controller/plda/pcie-plda.h > +++ b/drivers/pci/controller/plda/pcie-plda.h > @@ -149,11 +149,13 @@ struct plda_pcie_rp { > struct irq_domain *event_domain; > raw_spinlock_t lock; > struct plda_msi msi; > + const struct plda_event_ops *event_ops; > void __iomem *bridge_addr; > int num_events; > }; > =20 > struct plda_event { > + const struct plda_event_ops *event_ops; > int (*request_event_irq)(struct plda_pcie_rp *pcie, > int event_irq, int event); > int intx_event; > --=20 > 2.17.1 >=20 --GRp9b0oKyCUZcQwq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZSQFeAAKCRB4tDGHoIJi 0sQDAQCmZ0rXA250TxGxywJjsr6LKhJtGnFd+6HHyhxRHgHgZgD/cXM805IrCm9N 65OncJLg0lDUUeiQLhzDEErT/hwwjgk= =9ZA0 -----END PGP SIGNATURE----- --GRp9b0oKyCUZcQwq--