Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1330815ybb; Wed, 1 Apr 2020 21:37:25 -0700 (PDT) X-Google-Smtp-Source: APiQypJevS5/6YOO0+3Gi1EbkZYsSS8fN+3A3iHhcOB9N4nfbIhE09qqVbKKr2HlRPsjMAkmdA6d X-Received: by 2002:a05:6830:1003:: with SMTP id a3mr1057552otp.128.1585802245699; Wed, 01 Apr 2020 21:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585802245; cv=none; d=google.com; s=arc-20160816; b=P0uD+FNdCdEYaurMlKaYyT3wNu9TBXnub1qRmvzQrsPm5k+fNQ2ikdxc10nrx00001 gFrn6MMTbTIi9vExewoVUZbllwA5sXdceaJHPkXqoNUnHbnKca/dUKDn1Y1SiLRFQ9xm XJgpcyg2DZLItCycgFQSdv9KpYKIBTKLSCsNkiftM2d4ghLw6SmbFki98Dndjv/e/n73 RLIoNCOr0Ta6VOGw+PrS9b2T3xuXYR19K1T8hlxhyskgt79sCRsnTe7L/1UH7NanRYax ccNh4tCnCMYw9hJtRzZ7UcRZt/KfnByT9IHF/C4MwRg4NXFwxKPAlueSmJqvhzVll6nG R/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature; bh=USPWsRE5657zZgcGAPrDir4dN+tY+s1ED4KQL9NLcvU=; b=VAxvSYvJQaU9cVB84DbcntE3oewtHvGlIZkf5tAcTZ78LNLjqTWYvDNl5g5cBJFvd7 U3AusVo1j+cQS8hevdsih/nxUkoQW+GhyNU3DKBlAWyUU+5haDDEsGv4bATzXiIfohJv AbdRWYbysB58tiVWY9m8g7/98SSbA9aQwdGe1k7+6h3bXiUyEQbfpQutqOMGR9i8dsUS lxfbu+4/R3KDSRXezTnwXkB+goNG1+Y+mf4aj87txNYWdHWfyuYlG8fnm+hLeNYsuDul AuHsmrGXIgfb76EUAJ/TgjteRs2fSmK7mr/nRAYW9RxybU8bqaHd2b+ZnQ8PfiTxQjsX xEMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=Jz8kb+Zq; 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 r205si1858594oig.174.2020.04.01.21.37.13; Wed, 01 Apr 2020 21:37:25 -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=@d-silva.org header.s=201810a header.b=Jz8kb+Zq; 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 S1727746AbgDBEgh (ORCPT + 99 others); Thu, 2 Apr 2020 00:36:37 -0400 Received: from ushosting.nmnhosting.com ([66.55.73.32]:35148 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbgDBEgh (ORCPT ); Thu, 2 Apr 2020 00:36:37 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id DF6822DC3330; Thu, 2 Apr 2020 15:36:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1585802195; bh=NccxCUYjczr9RvJe6ZTHFYb1tTCAe/GnhOOeFES5kJE=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=Jz8kb+ZqAkhBJz5YLsHaQKojre1PdBeC66XBqXJQ8a8X2PccH0Dv62iTVxCqzvGGQ OeuYyWbib6UfsFA/H18d3WqaClbH81AFv+78QikStXxty8qAqEfLaqmBBk+wGtiyhF i57SXsCyuhK6cEjCs9urekR21w+AaH456c0LDsahaYjkxgwMut1ThTSr6NXO95fDcw 9DRM0+cm19LAgtTE7XwJJNRAMAjttX6YHJhXBZEKnlpt2xkKzyVKbonW0ji2+d74q2 A9zVjvao5NUfXSYGc5mDoH4FzUOfj0JhAST5fHLLql3MZpnoEle4riAHhhABY7qOWc wgttMOa3WsQQNz5WsdmJke9tHiMIlZlGmnn+hd0eldvP5sZkEZbyjFRrJtnI8t7sO3 5YfTreAKhMOakHe20beq/v+vsjO3AdceKXgubt8seYGhPVH3yj5BOE+NlYbHgISAtl yaiStNEd9hUsx6lkUPZZpYysp9ejEhXJplbWCMDMUXeNnvOvcIZmkX/b8xMEARO6R4 zregEeDmv83PjfVNNrvC0D4C7pDNACeW+w/hd4o6zlBViUKQM5o6ERRGGWYkWQc2TS cPUcSJ67/1Q9f91p+Mg1avH9moJVwb142w//tmZLr/vbbOeBnApG25uWljoO1XCyob yeR3Byh0UdfSXnuOTHsK/Rz4= Received: from Hawking (ntp.lan [10.0.1.1]) (authenticated bits=0) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTPSA id 0324aU03089960 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 2 Apr 2020 15:36:30 +1100 (AEDT) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: "'Dan Williams'" Cc: "'Aneesh Kumar K . V'" , "'Oliver O'Halloran'" , "'Benjamin Herrenschmidt'" , "'Paul Mackerras'" , "'Michael Ellerman'" , "'Frederic Barrat'" , "'Andrew Donnellan'" , "'Arnd Bergmann'" , "'Greg Kroah-Hartman'" , "'Vishal Verma'" , "'Dave Jiang'" , "'Ira Weiny'" , "'Andrew Morton'" , "'Mauro Carvalho Chehab'" , "'David S. Miller'" , "'Rob Herring'" , "'Anton Blanchard'" , "'Krzysztof Kozlowski'" , "'Mahesh Salgaonkar'" , "'Madhavan Srinivasan'" , "=?utf-8?Q?'C=C3=A9dric_Le_Goater'?=" , "'Anju T Sudhakar'" , "'Hari Bathini'" , "'Thomas Gleixner'" , "'Greg Kurz'" , "'Nicholas Piggin'" , "'Masahiro Yamada'" , "'Alexey Kardashevskiy'" , "'Linux Kernel Mailing List'" , "'linuxppc-dev'" , "'linux-nvdimm'" , "'Linux MM'" References: <20200327071202.2159885-1-alastair@d-silva.org> <20200327071202.2159885-4-alastair@d-silva.org> In-Reply-To: Subject: RE: [PATCH v4 03/25] powerpc/powernv: Map & release OpenCAPI LPC memory Date: Thu, 2 Apr 2020 15:36:28 +1100 Message-ID: <2e7701d608a8$473a0140$d5ae03c0$@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-au Thread-Index: AQJ5L4Hn/mp5p0p1jYAFWLJ+xmWSbgIEmlkbAeDU20mm/8VSIA== X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Thu, 02 Apr 2020 15:36:30 +1100 (AEDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Dan Williams > Sent: Wednesday, 1 April 2020 7:49 PM > To: Alastair D'Silva > Cc: Aneesh Kumar K . V ; Oliver O'Halloran > ; Benjamin Herrenschmidt > ; Paul Mackerras ; Michael > Ellerman ; Frederic Barrat = ; > Andrew Donnellan ; Arnd Bergmann > ; Greg Kroah-Hartman ; > Vishal Verma ; Dave Jiang > ; Ira Weiny ; Andrew Morton > ; Mauro Carvalho Chehab > ; David S. Miller ; > Rob Herring ; Anton Blanchard ; > Krzysztof Kozlowski ; Mahesh Salgaonkar > ; Madhavan Srinivasan > ; C=C3=A9dric Le Goater ; Anju = T > Sudhakar ; Hari Bathini > ; Thomas Gleixner ; Greg > Kurz ; Nicholas Piggin ; Masahiro > Yamada ; Alexey Kardashevskiy > ; Linux Kernel Mailing List = ; > linuxppc-dev ; linux-nvdimm nvdimm@lists.01.org>; Linux MM > Subject: Re: [PATCH v4 03/25] powerpc/powernv: Map & release OpenCAPI > LPC memory >=20 > On Sun, Mar 29, 2020 at 10:23 PM Alastair D'Silva = > wrote: > > > > This patch adds OPAL calls to powernv so that the OpenCAPI driver = can > > map & release LPC (Lowest Point of Coherency) memory. > > > > Signed-off-by: Alastair D'Silva > > Reviewed-by: Andrew Donnellan > > --- > > arch/powerpc/include/asm/pnv-ocxl.h | 2 ++ > > arch/powerpc/platforms/powernv/ocxl.c | 43 > > +++++++++++++++++++++++++++ > > 2 files changed, 45 insertions(+) > > > > diff --git a/arch/powerpc/include/asm/pnv-ocxl.h > > b/arch/powerpc/include/asm/pnv-ocxl.h > > index 7de82647e761..560a19bb71b7 100644 > > --- a/arch/powerpc/include/asm/pnv-ocxl.h > > +++ b/arch/powerpc/include/asm/pnv-ocxl.h > > @@ -32,5 +32,7 @@ extern int > pnv_ocxl_spa_remove_pe_from_cache(void > > *platform_data, int pe_handle) > > > > extern int pnv_ocxl_alloc_xive_irq(u32 *irq, u64 *trigger_addr); > > extern void pnv_ocxl_free_xive_irq(u32 irq); > > +u64 pnv_ocxl_platform_lpc_setup(struct pci_dev *pdev, u64 size); = void > > +pnv_ocxl_platform_lpc_release(struct pci_dev *pdev); > > > > #endif /* _ASM_PNV_OCXL_H */ > > diff --git a/arch/powerpc/platforms/powernv/ocxl.c > > b/arch/powerpc/platforms/powernv/ocxl.c > > index 8c65aacda9c8..f13119a7c026 100644 > > --- a/arch/powerpc/platforms/powernv/ocxl.c > > +++ b/arch/powerpc/platforms/powernv/ocxl.c > > @@ -475,6 +475,49 @@ void pnv_ocxl_spa_release(void *platform_data) > } > > EXPORT_SYMBOL_GPL(pnv_ocxl_spa_release); > > > > +u64 pnv_ocxl_platform_lpc_setup(struct pci_dev *pdev, u64 size) { > > + struct pci_controller *hose =3D pci_bus_to_host(pdev->bus); > > + struct pnv_phb *phb =3D hose->private_data; >=20 > Is calling the local variable 'hose' instead of 'host' on purpose? >=20 Yes, this follows the convention used in other functions in this file. > > + u32 bdfn =3D pci_dev_id(pdev); > > + __be64 base_addr_be64; > > + u64 base_addr; > > + int rc; > > + > > + rc =3D opal_npu_mem_alloc(phb->opal_id, bdfn, size, > &base_addr_be64); > > + if (rc) { > > + dev_warn(&pdev->dev, > > + "OPAL could not allocate LPC memory, = rc=3D%d\n", rc); > > + return 0; > > + } > > + > > + base_addr =3D be64_to_cpu(base_addr_be64); > > + > > +#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE >=20 > With the proposed cleanup in patch2 the ifdef can be elided here. Ok >=20 > > + rc =3D check_hotplug_memory_addressable(base_addr >> = PAGE_SHIFT, > > + size >> PAGE_SHIFT); > > + if (rc) > > + return 0; >=20 > Is this an error worth logging if someone is wondering why their = device is not > showing up? >=20 Yes, I'll add a message. >=20 > > +#endif > > + > > + return base_addr; > > +} > > +EXPORT_SYMBOL_GPL(pnv_ocxl_platform_lpc_setup); > > + > > +void pnv_ocxl_platform_lpc_release(struct pci_dev *pdev) { > > + struct pci_controller *hose =3D pci_bus_to_host(pdev->bus); > > + struct pnv_phb *phb =3D hose->private_data; > > + u32 bdfn =3D pci_dev_id(pdev); > > + int rc; > > + > > + rc =3D opal_npu_mem_release(phb->opal_id, bdfn); > > + if (rc) > > + dev_warn(&pdev->dev, > > + "OPAL reported rc=3D%d when releasing LPC > > +memory\n", rc); } > EXPORT_SYMBOL_GPL(pnv_ocxl_platform_lpc_release); > > + > > int pnv_ocxl_spa_remove_pe_from_cache(void *platform_data, int > > pe_handle) { > > struct spa_data *data =3D (struct spa_data *) platform_data; > > -- > > 2.24.1 > > >=20 >=20 > -- > This email has been checked for viruses by AVG. > https://www.avg.com