From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F369C433E1 for ; Thu, 11 Jun 2020 20:56:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A35420836 for ; Thu, 11 Jun 2020 20:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591908981; bh=I7VTRYMygcoRkETikINL4G9/wiU/fdFp/taCs3SNdu0=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=eAkNKgArTaB8IUMbtRVFQNbWcA44hlEJ7vh5MOpXy1Jfn1EhwAKt49+p4mGjTHLMD RrQK6fZ3nngUA20yYCjkSCxALS/OBbV70vsw/TAmMOiIzEmQipua5Y5N1pxsEJsFpY WNNnVz7XkVGMy8RTk6mPyPuVUMHy2HcK3hddfQww= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbgFKU4T (ORCPT ); Thu, 11 Jun 2020 16:56:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:48842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbgFKU4T (ORCPT ); Thu, 11 Jun 2020 16:56:19 -0400 Received: from localhost (mobile-166-170-222-206.mycingular.net [166.170.222.206]) (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 139C82073E; Thu, 11 Jun 2020 20:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591908978; bh=I7VTRYMygcoRkETikINL4G9/wiU/fdFp/taCs3SNdu0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=sVtjv5WYQd2qsXrOK+GJ7G1REPZUXHv9KFx3qk9I1rX8KACvKhdM4y+KKXrQorpXx CTFHrMrA4dj4IDP44dJIQU1v9u3VJjjd0E43X016IJo0qutrI8ajWueXjvjQ5Robkb ZyHJ47Uku1P0EEZDSG4xg+kvUYFZcjbrHZiReP5A= Date: Thu, 11 Jun 2020 15:56:16 -0500 From: Bjorn Helgaas To: Bharat Kumar Gogada Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, lorenzo.pieralisi@arm.com, robh@kernel.org, Marc Zyngier Subject: Re: [PATCH v8 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver Message-ID: <20200611205616.GA1607864@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1591622338-22652-3-git-send-email-bharat.kumar.gogada@xilinx.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 08, 2020 at 06:48:58PM +0530, Bharat Kumar Gogada wrote: > - Add support for Versal CPM as Root Port. > - The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated > block for CPM along with the integrated bridge can function > as PCIe Root Port. > - Bridge error and legacy interrupts in Versal CPM are handled using > Versal CPM specific interrupt line. > +static irqreturn_t xilinx_cpm_pcie_intr_handler(int irq, void *dev_id) > +{ > + struct xilinx_cpm_pcie_port *port = dev_id; > + struct device *dev = port->dev; > + struct irq_data *d; > + > + d = irq_domain_get_irq_data(port->cpm_domain, irq); > + > + switch (d->hwirq) { > + case XILINX_CPM_PCIE_INTR_CORRECTABLE: > + case XILINX_CPM_PCIE_INTR_NONFATAL: > + case XILINX_CPM_PCIE_INTR_FATAL: > + cpm_pcie_clear_err_interrupts(port); > + fallthrough; > + > + default: > + if (intr_cause[d->hwirq].str) > + dev_warn(dev, "%s\n", intr_cause[d->hwirq].str); > + else > + dev_warn(dev, "Unknown interrupt\n"); Maybe include d->hwirq in the "Unknown interrupt" message? I assume if we take the default case, there's no need to clear the interrupt? > + } > + > + return IRQ_HANDLED; > +} > +static int xilinx_cpm_setup_irq(struct xilinx_cpm_pcie_port *port) > +{ > + struct device *dev = port->dev; > + struct platform_device *pdev = to_platform_device(dev); > + int i, irq; > + > + port->irq = platform_get_irq(pdev, 0); > + if (port->irq < 0) { > + dev_err(dev, "Unable to find misc IRQ line\n"); platform_get_irq() already prints an error message; you probably don't need another. > + return port->irq; > + } > + > + for (i = 0; i < ARRAY_SIZE(intr_cause); i++) { > + int err; > + > + if (!intr_cause[i].str) > + continue; > + > + irq = irq_create_mapping(port->cpm_domain, i); > + if (WARN_ON(irq <= 0)) I'm not a huge fan of WARN_ON() inside "if" statements, but ... OK. Why do these all need to be WARN_ON() instead of dev_warn()? > + return -ENXIO; > + > + err = devm_request_irq(dev, irq, xilinx_cpm_pcie_intr_handler, > + 0, intr_cause[i].sym, port); > + if (WARN_ON(err)) > + return err; > + } > + > + port->intx_irq = irq_create_mapping(port->cpm_domain, > + XILINX_CPM_PCIE_INTR_INTX); > + if (WARN_ON(port->intx_irq <= 0)) > + return -ENXIO; > + > + /* Plug the INTx chained handler */ > + irq_set_chained_handler_and_data(port->intx_irq, > + xilinx_cpm_pcie_intx_flow, port);