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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 3B694C433DB for ; Tue, 30 Mar 2021 15:30:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C44B7619AB for ; Tue, 30 Mar 2021 15:30:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C44B7619AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zjZDLKbGTg4BR1lV1O5Q9T7oys4MemlLoEAgvVMBcDg=; b=dXsFzlWC02p7+sTQh8LL1GLNX 4P1J/jLZT3NQZAD2ARY91dw5T76zQxS2heuUffoweS0XUc3xeugL7ChVZTlDr3HeeK2/JIzY0DgMM +iH/ZWNyeSMN/5VjmpGAqX5lLfBL18d6gFh9PI1LObzyfyZUIz9ofLiB83MHsFoUII79sHwLPoesX hkhvLIck/uiWSI3wvFRw0IkqVqpkwAZN8ZS2F+WIdMnmgI8b7/xcNQ9FcomYArfhsiQXR5j4P4/M1 CaXUUOBs/hnLE/ogjRtEhhW4DdWL4x6bQt+3GUWjA8QSyzi/zxZ250mx8cvYb/Ad5cUGBN3y7VOOy TGRXUfryQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRGIs-004Bsb-Sz; Tue, 30 Mar 2021 15:29:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRGIo-004Bqz-3N; Tue, 30 Mar 2021 15:29:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A653C31B; Tue, 30 Mar 2021 08:29:05 -0700 (PDT) Received: from lpieralisi (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 263A73F719; Tue, 30 Mar 2021 08:29:02 -0700 (PDT) Date: Tue, 30 Mar 2021 16:28:57 +0100 From: Lorenzo Pieralisi To: Marc Zyngier , Yoshihiro Shimoda , Marek Vasut Cc: Bjorn Helgaas , Frank Wunderlich , Thierry Reding , Thomas Gleixner , Rob Herring , Will Deacon , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Michael Kelley , Wei Liu , Thierry Reding , Jonathan Hunter , Ryder Lee , Marek Vasut , Yoshihiro Shimoda , Michal Simek , Paul Walmsley , Bharat Kumar Gogada , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v3 02/14] PCI: rcar: Don't allocate extra memory for the MSI capture address Message-ID: <20210330152857.GA27749@lpieralisi> References: <20210330151145.997953-1-maz@kernel.org> <20210330151145.997953-3-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210330151145.997953-3-maz@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210330_162910_439755_534F2758 X-CRM114-Status: GOOD ( 27.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 30, 2021 at 04:11:33PM +0100, Marc Zyngier wrote: > A long cargo-culted behaviour of PCI drivers is to allocate memory > to obtain an address that is fed to the controller as the MSI > capture address (i.e. the MSI doorbell). > > But there is no actual requirement for this address to be RAM. > All it needs to be is a suitable aligned address that will > *not* be DMA'd to. > > Since the rcar platform already has a requirement that this > address should be in the first 4GB of the physical address space, > use the controller's own base address as the capture address. > > Signed-off-by: Marc Zyngier > --- > drivers/pci/controller/pcie-rcar-host.c | 18 +++++++----------- > 1 file changed, 7 insertions(+), 11 deletions(-) Marek, Yoshihiro, can you test this patch please and report back ? It is not fundamental for the rest of the series (ie the rest of the series does not depend on it) and we can still merge the series without it but it would be good if you can review and test anyway. I'd like to merge this series into -next shortly. Thanks, Lorenzo > diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c > index a728e8f9ad3c..ce952403e22c 100644 > --- a/drivers/pci/controller/pcie-rcar-host.c > +++ b/drivers/pci/controller/pcie-rcar-host.c > @@ -36,7 +36,6 @@ struct rcar_msi { > DECLARE_BITMAP(used, INT_PCI_MSI_NR); > struct irq_domain *domain; > struct msi_controller chip; > - unsigned long pages; > struct mutex lock; > int irq1; > int irq2; > @@ -680,14 +679,15 @@ static void rcar_pcie_unmap_msi(struct rcar_pcie_host *host) > static void rcar_pcie_hw_enable_msi(struct rcar_pcie_host *host) > { > struct rcar_pcie *pcie = &host->pcie; > - struct rcar_msi *msi = &host->msi; > - unsigned long base; > + struct device *dev = pcie->dev; > + struct resource res; > > - /* setup MSI data target */ > - base = virt_to_phys((void *)msi->pages); > + if (WARN_ON(of_address_to_resource(dev->of_node, 0, &res))) > + return; > > - rcar_pci_write_reg(pcie, lower_32_bits(base) | MSIFE, PCIEMSIALR); > - rcar_pci_write_reg(pcie, upper_32_bits(base), PCIEMSIAUR); > + /* setup MSI data target */ > + rcar_pci_write_reg(pcie, lower_32_bits(res.start) | MSIFE, PCIEMSIALR); > + rcar_pci_write_reg(pcie, upper_32_bits(res.start), PCIEMSIAUR); > > /* enable all MSI interrupts */ > rcar_pci_write_reg(pcie, 0xffffffff, PCIEMSIIER); > @@ -735,7 +735,6 @@ static int rcar_pcie_enable_msi(struct rcar_pcie_host *host) > } > > /* setup MSI data target */ > - msi->pages = __get_free_pages(GFP_KERNEL | GFP_DMA32, 0); > rcar_pcie_hw_enable_msi(host); > > return 0; > @@ -748,7 +747,6 @@ static int rcar_pcie_enable_msi(struct rcar_pcie_host *host) > static void rcar_pcie_teardown_msi(struct rcar_pcie_host *host) > { > struct rcar_pcie *pcie = &host->pcie; > - struct rcar_msi *msi = &host->msi; > > /* Disable all MSI interrupts */ > rcar_pci_write_reg(pcie, 0, PCIEMSIIER); > @@ -756,8 +754,6 @@ static void rcar_pcie_teardown_msi(struct rcar_pcie_host *host) > /* Disable address decoding of the MSI interrupt, MSIFE */ > rcar_pci_write_reg(pcie, 0, PCIEMSIALR); > > - free_pages(msi->pages, 0); > - > rcar_pcie_unmap_msi(host); > } > > -- > 2.29.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel