Received: by 10.192.165.148 with SMTP id m20csp4269444imm; Tue, 8 May 2018 05:57:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq14BEMpci0skuxSXJRBtma4y3Afw+V+JJQQyS7nR9qR9YpnDz7OmCHRO7/XkbItFMqk2I/ X-Received: by 2002:a63:6aca:: with SMTP id f193-v6mr2113441pgc.244.1525784247896; Tue, 08 May 2018 05:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525784247; cv=none; d=google.com; s=arc-20160816; b=ou81Ts/Xdon2fd2uLYbbXIWr3aFsZhbyepqNxumbDMZuccwb7Cjcf+RyFyP46j9h2d 3uT5rxwX+HWXTj/f3iN002Wr+JOr2p/7LJWzAmlTEFceQMnTw4BSUpeBZp+8gyaonGm0 QJviD2iFUzKJWTbaIF8OZ6VEnn/nj9L2dbDgVbgTBJx4PMDCd7d0GRo8YP6Yazft2fkc vHgHZ7py3FrR4WybA0Z96XfuN2OgUZj+Z/f+3BB6SteHf8RcWy8Sm6hplTHB6tAgCK6k OiBF7/O8/684UOYcQYgNs+0L6flNGHK2KeS6Q4N3CP2UQnALMtCHk5M1aZWfzLBxTGZf amHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=mfu3J8NZgxJXH4MYOk7bSuEuSqEmswoR+4uWv4yHOzw=; b=PYHIe3aaboTWeZfEdnXn02TQNXqsoMZrPgw+R+SwXu4uIRN8l/cjUOjhxJjegUTUQE poHQ5XfPLqVo7KphztvZ2891qB+gsIn4wjFhzIlV8s7TxPsDbd0VNeCc9qAgdDvDO1r2 1HmOzt5jPvQyq0U38VZZdXOzI8m5mGNV3V8ov086v+EJToojvTLMPwaM16zX0Ja+6stW j5JN74QNQtNDNsMSN+Hop1iCqlbzhZOALNKLKlLH160T326TzrkM7tJc6e9Jt/2LeeKp a8LRK/hDrL8q5ZfEabzIq9oAbf9qyaWG/8aEeF9JapKK1Ip3djzEI4n3Zuhh45248oIx rVvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h0iW2EKm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id x4-v6si19015117pgc.411.2018.05.08.05.57.12; Tue, 08 May 2018 05:57:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h0iW2EKm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1755080AbeEHM5C (ORCPT + 99 others); Tue, 8 May 2018 08:57:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:44548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755001AbeEHM5A (ORCPT ); Tue, 8 May 2018 08:57:00 -0400 Received: from localhost (50-81-23-193.client.mchsi.com [50.81.23.193]) (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 4CBD921783; Tue, 8 May 2018 12:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525784219; bh=+kIPCpu6DcA7riHQsgqkjAkNiLzP4UlP9fpvij87Efk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h0iW2EKmCpsS5h9NgoeuyS3m4BmieuiJf6oJb05Ow5Ndw6AoyLcsG+e8JR8McNQQe wbgZHccJXq27rcO/K8Y35zxfYlM9Xb5JBAorxIf6cJJh4WoOFfdr0IEGRatQNhe4Yq 9NFf7afPzU01uSQZAg0I8fwm7qYSj2goAD1a9+b4= Date: Tue, 8 May 2018 07:56:58 -0500 From: Bjorn Helgaas To: Yao Chen Cc: songxiaowei@hisilicon.com, wangbinghui@hisilicon.com, lorenzo.pieralisi@arm.com, bhelgaas@google.com, xuwei5@hisilicon.com, robh+dt@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dimitrysh@google.com, guodong.xu@linaro.org, Stanimir Varbanov , Jianguo Sun , Shawn Guo Subject: Re: [PATCH] Kirin-PCIe: Add kirin pcie msi feature. Message-ID: <20180508125658.GK161390@bhelgaas-glaptop.roam.corp.google.com> References: <1525763028-107417-1-git-send-email-chenyao11@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1525763028-107417-1-git-send-email-chenyao11@huawei.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Stanimir, Jianguo, Shawn for qcom, histb comments below] On Tue, May 08, 2018 at 03:03:48PM +0800, Yao Chen wrote: > This patch adds kirin pcie msi feature. Thanks for the patch! Please update your subject and changelog like this: PCI: kirin: Add MSI support Add support for MSI. You can figure out what style to use for the subject by running: git log --oneline drivers/pci/dwc/pcie-kirin.c Then follow the existing style. > Signed-off-by: Yao Chen > --- > arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 ++ > drivers/pci/dwc/pcie-kirin.c | 38 +++++++++++++++++++++++++++++++ > 2 files changed, 40 insertions(+) > > diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi > index ec3eb8e..4ef684f 100644 > --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi > +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi > @@ -872,6 +872,8 @@ > 0x0 0x02000000>; > num-lanes = <1>; > #interrupt-cells = <1>; > + interrupts = <0 283 4>; > + interrupts-names = "msi"; > interrupt-map-mask = <0xf800 0 0 7>; > interrupt-map = <0x0 0 0 1 > &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>, > diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c > index d2970a0..2319c9c 100644 > --- a/drivers/pci/dwc/pcie-kirin.c > +++ b/drivers/pci/dwc/pcie-kirin.c > @@ -426,9 +426,28 @@ static int kirin_pcie_establish_link(struct pcie_port *pp) > return 0; > } > > +static irqreturn_t kirin_pcie_msi_irq_handler(int irq, void *arg) > +{ > + struct pcie_port *pp = arg; > + > + return dw_handle_msi_irq(pp); > +} > + > +static void kirin_pcie_msi_init(struct pcie_port *pp) > +{ > + dw_pcie_msi_init(pp); > +} > + > +static void kirin_pcie_enable_interrupts(struct pcie_port *pp) > +{ > + if (IS_ENABLED(CONFIG_PCI_MSI)) > + kirin_pcie_msi_init(pp); > +} > + > static int kirin_pcie_host_init(struct pcie_port *pp) > { > kirin_pcie_establish_link(pp); > + kirin_pcie_enable_interrupts(pp); > > return 0; > } > @@ -448,6 +467,25 @@ static int kirin_pcie_host_init(struct pcie_port *pp) > static int __init kirin_add_pcie_port(struct dw_pcie *pci, > struct platform_device *pdev) > { > + int ret; > + > + if (IS_ENABLED(CONFIG_PCI_MSI)) { > + pci->pp.msi_irq = platform_get_irq(pdev, 0); > + if (!pci->pp.msi_irq) { > + dev_err(&pdev->dev, "failed to get msi irq\n"); s/msi irq/MSI IRQ/ > + return -ENODEV; > + } > + ret = devm_request_irq(&pdev->dev, pci->pp.msi_irq, > + kirin_pcie_msi_irq_handler, > + IRQF_SHARED | IRQF_NO_THREAD, > + "kirin_pcie_msi", &pci->pp); > + if (ret) { > + dev_err(&pdev->dev, "failed to request msi irq\n"); s/msi irq/MSI IRQ/ Also, please include the IRQ number (pci->pp.msi_irq) in the message. > + return ret; > + } > + } > + > + pci->pp.root_bus_nr = -1; Setting root_bus_nr looks like an unrelated change that should be in a separate patch. But I'm not sure why you need to set root_bus_nr at all, since dw_pcie_host_init() always sets it. Some other callers of dw_pcie_host_init() do set it: exynos_add_pcie_port() imx6_add_pcie_port() armada8k_add_pcie_port() artpec6_add_pcie_port() dw_plat_add_pcie_port() histb_pcie_probe() qcom_pcie_probe() spear13xx_add_pcie_port() But I don't see *why* any of these need to set it. If they don't need to set it, they shouldn't. And it would be nice if histb and qcom followed the structure and naming conventions of the other drivers, i.e., they should have histb_add_pcie_port() and qcom_add_pcie_port(). > pci->pp.ops = &kirin_pcie_host_ops; > > return dw_pcie_host_init(&pci->pp); > -- > 1.9.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel