Received: by 10.223.164.221 with SMTP id h29csp63976wrb; Tue, 31 Oct 2017 13:59:10 -0700 (PDT) X-Google-Smtp-Source: ABhQp+StXgAtPqZtBpmdRsv7ybJ08EZJWQ992beSUii8fsnl87xu3S1lAKIir81daj9r1x8ftC/i X-Received: by 10.98.12.212 with SMTP id 81mr3492608pfm.88.1509483550244; Tue, 31 Oct 2017 13:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509483550; cv=none; d=google.com; s=arc-20160816; b=LkkXMJv5656Advfo9Tt4BJ7BLzCSG/Eh3Hi5UoIG47zBBXsc56UMdIeGL9BUxtr0R4 ld+8fr5hl9fJYuQTV19Ic/HdPhyo3WnvwzUZvABK7r9X0z9d+VLLX6CmPeZGruOkTqnH wWefN/YGcAKZJef74iJapLDo1kEVv/ZhFwHrOA0LOoVOaBvyjWfvez7fZCNdy+b8NMOE PNMzzI2AOTYL0AXLono6U35+nON8N5PSGV4iN1dQhzsCl65XXwZACj07fDF5RzzTfBio faAOyw/RwGr7yDH+2xH2KeoBYbCqnP8CRA6+3RoVlNlfPhJql0sMXj97cse5KNNleD/e tIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=8hil9waU5lf1aSsQXaARwf8B3F9SmEKFJ2abxLN1Gro=; b=UM7j0LSW19KXjtAsGyrfvtj/LYMW95ngglzojGzJ+HwqQiX2TLBOzImGe3qexaxr13 w78HRnX9RGChM1HnhP1kyttEc5T7b32EC1FfCoA6z+voJaKDp1xeU0PhbLEm1vLNPwuD dH75olDa3nSAZquv6MhyzpqtnKwQ7ghjyXZ1SpsMK2lcb1otm5E5yLs67cJdHsY2cl1h lE/9z4O6p1O8Se1dNWLzHX1D8K7V3lKjbICPWIFiTJgVpNFHyXtYxwxJiEt4Bx0Uct5D AYA9X0gvlzkR41mYzB67pkULVA3WCC/DC0RWZCCBEFQFBTHQjx3QTe/Fh/FUSODPTNZH 2DNw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si2555567pfk.350.2017.10.31.13.58.55; Tue, 31 Oct 2017 13:59:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932812AbdJaU5l (ORCPT + 99 others); Tue, 31 Oct 2017 16:57:41 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:45950 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753803AbdJaU5j (ORCPT ); Tue, 31 Oct 2017 16:57:39 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id CC08D18734; Tue, 31 Oct 2017 21:57:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q_OiDQXHFbT5; Tue, 31 Oct 2017 21:57:37 +0100 (CET) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id BA72E18733; Tue, 31 Oct 2017 21:57:36 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A1D91A0A0; Tue, 31 Oct 2017 21:57:36 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EF0A1A091; Tue, 31 Oct 2017 21:57:36 +0100 (CET) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder02.se.axis.com (Postfix) with ESMTP; Tue, 31 Oct 2017 21:57:36 +0100 (CET) Received: from XBOX02.axis.com (xbox02.axis.com [10.0.5.16]) by thoth.se.axis.com (Postfix) with ESMTP id 5250B2360; Tue, 31 Oct 2017 21:57:36 +0100 (CET) Received: from [10.88.4.10] (10.0.5.60) by XBOX02.axis.com (10.0.5.16) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 31 Oct 2017 21:57:26 +0100 Subject: Re: [PATCH v2 04/17] PCI: designware-ep: Pre-allocate memory for MSI in dw_pcie_ep_init To: Kishon Vijay Abraham I , Jingoo Han , Joao Pinto , Bjorn Helgaas CC: , References: <20171030124221.20690-1-niklas.cassel@axis.com> <20171030124221.20690-5-niklas.cassel@axis.com> <9d4c17b7-94ec-fd79-4bd8-8165019f04ce@ti.com> From: Niklas Cassel Message-ID: Date: Tue, 31 Oct 2017 21:57:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <9d4c17b7-94ec-fd79-4bd8-8165019f04ce@ti.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: XBOX03.axis.com (10.0.5.17) To XBOX02.axis.com (10.0.5.16) X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/31/2017 07:01 AM, Kishon Vijay Abraham I wrote: > Hi Niklas, > > On Monday 30 October 2017 06:12 PM, Niklas Cassel wrote: >> Certain SoCs need to map the MSI address in raise_irq. >> To map an address, you first need to call pci_epc_mem_alloc_addr, >> however, pci_epc_mem_alloc_addr calls ioremap (which can sleep). >> >> Since raise_irq is only called from atomic context, we can't call >> pci_epc_mem_alloc_addr from raise_irq, instead we pre-allocate >> a page in dw_pcie_ep_init, so this page can later be used to map/unmap >> the MSI address in raise_irq. >> >> Signed-off-by: Niklas Cassel >> --- >> V2: >> * No change. >> >> drivers/pci/dwc/pcie-designware-ep.c | 8 ++++++++ >> drivers/pci/dwc/pcie-designware.h | 2 ++ >> 2 files changed, 10 insertions(+) >> >> diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c >> index 3fb34be99715..c291da2a10ba 100644 >> --- a/drivers/pci/dwc/pcie-designware-ep.c >> +++ b/drivers/pci/dwc/pcie-designware-ep.c >> @@ -286,6 +286,8 @@ void dw_pcie_ep_exit(struct dw_pcie_ep *ep) >> { >> struct pci_epc *epc = ep->epc; >> >> + pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem, PAGE_SIZE); >> + >> pci_epc_mem_exit(epc); >> } >> >> @@ -341,6 +343,12 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) >> return ret; >> } >> >> + ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, PAGE_SIZE); > > ep->page_size instead of PAGE_SIZE? Hello Kishon, Sure thing, will fix in V3. Regards, Niklas From 1582751851577820345@xxx Tue Oct 31 06:03:10 +0000 2017 X-GM-THRID: 1582686746258533661 X-Gmail-Labels: Inbox,Category Forums