Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1859860ybn; Thu, 26 Sep 2019 03:20:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZcqZ2wFf5243lPUHlUgjkiuDxa+4+xXatLp+sfLXtTERtaVoTnx+0YIOXjTqvpZcP5Fp/ X-Received: by 2002:a17:906:16cd:: with SMTP id t13mr2324771ejd.153.1569493207547; Thu, 26 Sep 2019 03:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569493207; cv=none; d=google.com; s=arc-20160816; b=qXwFo9UOH48rcpMFGcRsiM3HNhvjljMw5f4a6zWv+cMeKwrLKPE2mxZ2ZPMoSopsFd vhm6FjjVjpppKd97NS84mSUp8mqISAm3J6NTTWJKMgTQ0aWrcbfC4mf1mBh+ZJ/21xCV U5w1h4KjIkIdUEdM0mFt2WuAgUE42eveFhQQSDtjzi6ZQBIsyvyc9IhCqqVmlMhjn8zQ OFtVe4s214C5p77dtWLRv7f/XqlQ+HzFckdv6AjNzJ7JqK0q2xEtNShGrbfLBguSBYQv 1j0a1f/RUp/2hUpU3kB+tJhjhmuUg/lv7x65gnQA+zXQkOUjjWfSuBXCMO1vt23J2k02 Rtew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:user-agent:organization:references:in-reply-to:date:cc :to:from:subject; bh=jcsHN9TQasGuLOX5nAstoT6an+0A6xSNRMbRuMKuFlE=; b=dT6QJpjDzvI64pPLIhlCSIjmJ9iBnFOxJpDJx0vW4Fddp+1bPobaVdxkVdH4+N+PeE tAtoWwcw810qGOsMvwpf+rWgM2RfUTeTz43bzv6YoP58xPxX74ypkWoqUfIZCC7zqwV+ X9ik7DEqT26c9HBbpd58/LF80HTSUeLjR8ii1UClMFWoBYpHZj/QU1GVCRgC+MolM1uo af+h/EyPZWbIinvXwSJtQP9JfI8EjWmCiqp1fQy9InR4skv7OxQgKKQTDblCvWXVAROe A5oSta58FRUdVwSugUoYgqd5hi03R+FLs6ME89pr/DO15k0C4C0Y+up3lD6vOZc+MF4H 4bLg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b44si1025816ede.451.2019.09.26.03.19.44; Thu, 26 Sep 2019 03:20:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728878AbfIZC7h (ORCPT + 99 others); Wed, 25 Sep 2019 22:59:37 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34864 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728722AbfIZC7h (ORCPT ); Wed, 25 Sep 2019 22:59:37 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8Q2uma0002928 for ; Wed, 25 Sep 2019 22:59:35 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v8mgxh2wu-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Sep 2019 22:59:35 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Sep 2019 03:59:33 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 26 Sep 2019 03:59:28 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8Q2xR0g44302450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Sep 2019 02:59:27 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CD03A4040; Thu, 26 Sep 2019 02:59:27 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8FE4A4053; Thu, 26 Sep 2019 02:59:26 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 26 Sep 2019 02:59:26 +0000 (GMT) Received: from adsilva.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 6391BA00D3; Thu, 26 Sep 2019 12:59:25 +1000 (AEST) Subject: Re: [PATCH 4/5] ocxl: Add functions to map/unmap LPC memory From: "Alastair D'Silva" To: Frederic Barrat Cc: Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Nicholas Piggin , Mahesh Salgaonkar , Masahiro Yamada , Anju T Sudhakar , Paul Mackerras , =?ISO-8859-1?Q?C=E9dric?= Le Goater , Vaibhav Jain , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Allison Randal , David Gibson Date: Thu, 26 Sep 2019 12:59:25 +1000 In-Reply-To: References: <20190917014307.30485-1-alastair@au1.ibm.com> <20190917014307.30485-5-alastair@au1.ibm.com> Organization: IBM Australia Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19092602-4275-0000-0000-0000036B3D7E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19092602-4276-0000-0000-0000387DBA68 Message-Id: <1bea85d80c6662fa7e18c79a3dc35fa0672f824c.camel@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-25_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909260032 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-09-23 at 13:39 +0200, Frederic Barrat wrote: > > > > diff --git a/drivers/misc/ocxl/link.c b/drivers/misc/ocxl/link.c > > index 2874811a4398..9e303a5f4d85 100644 > > --- a/drivers/misc/ocxl/link.c > > +++ b/drivers/misc/ocxl/link.c > > @@ -738,7 +738,7 @@ int ocxl_link_add_lpc_mem(void *link_handle, > > u64 size) > > } > > EXPORT_SYMBOL_GPL(ocxl_link_add_lpc_mem); > > > > -u64 ocxl_link_lpc_map(void *link_handle, struct pci_dev *pdev) > > +u64 ocxl_link_lpc_online(void *link_handle, struct pci_dev *pdev) > > { > > struct ocxl_link *link = (struct ocxl_link *) link_handle; > > > > A bit of a nitpick, but is there any specific reason to rename with > "online" suffix? I'm discovering it myself, but with memory hotplug, > "onlining" seems to refer to the second, a.k.a logical memory > hotplug > phase (as described in Documentation/admin-guide/mm/memory- > hotplug.rst). > We'll need to worry about it, but the function here is really doing > the > first phase, a.k.a physical memory hotplug. > > Fred It's been a while since I wrote that, so I can't remember why, but your reasoning is sound, I'll drop the rename. > > > > @@ -759,7 +759,7 @@ u64 ocxl_link_lpc_map(void *link_handle, struct > > pci_dev *pdev) > > return link->lpc_mem; > > } > > > > -void ocxl_link_lpc_release(void *link_handle, struct pci_dev > > *pdev) > > +void ocxl_link_lpc_offline(void *link_handle, struct pci_dev > > *pdev) > > { > > struct ocxl_link *link = (struct ocxl_link *) link_handle; > > > > diff --git a/drivers/misc/ocxl/ocxl_internal.h > > b/drivers/misc/ocxl/ocxl_internal.h > > index db2647a90fc8..5656a4aab5b7 100644 > > --- a/drivers/misc/ocxl/ocxl_internal.h > > +++ b/drivers/misc/ocxl/ocxl_internal.h > > @@ -52,6 +52,12 @@ struct ocxl_afu { > > void __iomem *global_mmio_ptr; > > u64 pp_mmio_start; > > void *private; > > + u64 lpc_base_addr; /* Covers both LPC & special purpose memory > > */ > > + struct bin_attribute attr_global_mmio; > > + struct bin_attribute attr_lpc_mem; > > + struct resource lpc_res; > > + struct bin_attribute attr_special_purpose_mem; > > + struct resource special_purpose_res; > > }; > > > > enum ocxl_context_status { > > @@ -170,7 +176,7 @@ extern u64 ocxl_link_get_lpc_mem_sz(void > > *link_handle); > > * @link_handle: The OpenCAPI link handle > > * @pdev: A device that is on the link > > */ > > -u64 ocxl_link_lpc_map(void *link_handle, struct pci_dev *pdev); > > +u64 ocxl_link_lpc_online(void *link_handle, struct pci_dev *pdev); > > > > /** > > * Release the LPC memory device for an OpenCAPI device > > @@ -181,6 +187,6 @@ u64 ocxl_link_lpc_map(void *link_handle, struct > > pci_dev *pdev); > > * @link_handle: The OpenCAPI link handle > > * @pdev: A device that is on the link > > */ > > -void ocxl_link_lpc_release(void *link_handle, struct pci_dev > > *pdev); > > +void ocxl_link_lpc_offline(void *link_handle, struct pci_dev > > *pdev); > > > > #endif /* _OCXL_INTERNAL_H_ */ > > diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h > > index 06dd5839e438..a1897737908d 100644 > > --- a/include/misc/ocxl.h > > +++ b/include/misc/ocxl.h > > @@ -212,6 +212,24 @@ int ocxl_irq_set_handler(struct ocxl_context > > *ctx, int irq_id, > > > > // AFU Metadata > > > > +/** > > + * Map the LPC system & special purpose memory for an AFU > > + * > > + * Do not call this during device discovery, as there may me > > multiple > > + * devices on a link, and the memory is mapped for the whole link, > > not > > + * just one device. It should only be called after all devices > > have > > + * registered their memory on the link. > > + * > > + * afu: The AFU that has the LPC memory to map > > + */ > > +extern int ocxl_map_lpc_mem(struct ocxl_afu *afu); > > + > > +/** > > + * Get the physical address range of LPC memory for an AFU > > + * afu: The AFU associated with the LPC memory > > + */ > > +extern struct resource *ocxl_afu_lpc_mem(struct ocxl_afu *afu); > > + > > /** > > * Get a pointer to the config for an AFU > > * > > -- Alastair D'Silva Open Source Developer Linux Technology Centre, IBM Australia mob: 0423 762 819