Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2188448imu; Sat, 26 Jan 2019 22:41:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN7mm4e6GML4a7Rytw+tHmaYeyjLMazU5fHsFpynSj2DF6VedU2ld67FFvBBvV35vEbKgqpo X-Received: by 2002:a17:902:1122:: with SMTP id d31mr17273161pla.246.1548571294642; Sat, 26 Jan 2019 22:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548571294; cv=none; d=google.com; s=arc-20160816; b=JIR+1GUATcrPdApHydW7i/4H1r6jIpnx8Owa35AvR2HN5vyuzhEFwwR/RpnsMvgant NDbSqih5fXd5MgnI6vd7BnvjbwddaqdAykkiwEC2IO0KdDcMNsQ1kidhTiUKteJK+S+j K8/HoURD7QX/It6pCCJg1iOSvDxOsc6nqLCxqIesN1CAxjICn7Xyz35G9xulrTEmQgac fZB7vZNEfP/NHE2FkYVOGAmYp5BiSEHeaioJ8TXmiaH1Jsny2cZ3xyFkRPZQWevE83wg GTYmQHTWXJj99IBNZs+B2HtTx4lN7PXTYd0wQh6usxEOclzBVm9yp/uk3AtNfPFjS6gA eNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=7xbeiLpLR1vsmqEG9iErhxkOV910auy3DLXNxS8eDiE=; b=g5ZhXPXg0chm/FvM0esQ7KOpR8iSOWunEfymV3uQq0FqWqNhV6uNWhpzPbTI5BgF1n pqimfo9U7Uk6Fqnk/cvp9iPKWfvtmuolT5ZiCrQITT6++P35YKIteFT4op6OnJUYs45t jLOm8+y+yKPMtMGfJZKzgM6A5JPrkougDuyA6K8tD33V15RiDGWHYtsq4CDZaEjPS4D5 ldl4wd71mNQFtyNC62hUCK9eSSZaPqYwJAKRj/veFrMvr3UgE76il/cm4bBnuEMqrQ+l Nd5akHnwWpwow/L4zNcl6w/9MbJvqPaTBrS6t8xw4nS/WmZtSfsNWDfhej8X0QZc1rPp YYnA== 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 h85si30435556pfd.27.2019.01.26.22.40.50; Sat, 26 Jan 2019 22:41:34 -0800 (PST) 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 S1726461AbfA0GjW (ORCPT + 99 others); Sun, 27 Jan 2019 01:39:22 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726113AbfA0GjW (ORCPT ); Sun, 27 Jan 2019 01:39:22 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0R6d1aS129260 for ; Sun, 27 Jan 2019 01:39:21 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q95fcb19h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 27 Jan 2019 01:39:20 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 27 Jan 2019 06:39:19 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 27 Jan 2019 06:39:18 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0R6dHTq31981742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 27 Jan 2019 06:39:17 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4620A4C050; Sun, 27 Jan 2019 06:39:17 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD89E4C044; Sun, 27 Jan 2019 06:39:16 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.103]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 27 Jan 2019 06:39:16 +0000 (GMT) Date: Sun, 27 Jan 2019 08:39:15 +0200 From: Mike Rapoport To: Oded Gabbay Cc: Greg Kroah-Hartman , "Linux-Kernel@Vger. Kernel. Org" Subject: Re: [PATCH 03/15] habanalabs: add basic Goya support References: <20190123000057.31477-1-oded.gabbay@gmail.com> <20190123000057.31477-4-oded.gabbay@gmail.com> <20190123122817.GB4747@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19012706-0028-0000-0000-0000033EA9C9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19012706-0029-0000-0000-000023FBF295 Message-Id: <20190127063914.GA16853@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-27_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1810050000 definitions=main-1901270056 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 25, 2019 at 10:32:55PM +0200, Oded Gabbay wrote: > On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport wrote: > > > > On Wed, Jan 23, 2019 at 02:00:45AM +0200, Oded Gabbay wrote: > > > This patch adds a basic support for the Goya device. The code initializes > > > the device's PCI controller and PCI bars. It also initializes various S/W > > > structures and adds some basic helper functions. > > > > > > Signed-off-by: Oded Gabbay > > > --- > > > drivers/misc/habanalabs/Makefile | 5 +- > > > drivers/misc/habanalabs/device.c | 71 +++ > > > drivers/misc/habanalabs/goya/Makefile | 3 + > > > drivers/misc/habanalabs/goya/goya.c | 633 ++++++++++++++++++++ > > > drivers/misc/habanalabs/goya/goyaP.h | 125 ++++ > > > drivers/misc/habanalabs/habanalabs.h | 131 ++++ > > > drivers/misc/habanalabs/habanalabs_drv.c | 3 + > > > drivers/misc/habanalabs/include/goya/goya.h | 115 ++++ > > > 8 files changed, 1085 insertions(+), 1 deletion(-) > > > create mode 100644 drivers/misc/habanalabs/goya/Makefile > > > create mode 100644 drivers/misc/habanalabs/goya/goya.c > > > create mode 100644 drivers/misc/habanalabs/goya/goyaP.h > > > create mode 100644 drivers/misc/habanalabs/include/goya/goya.h [ ... ] > > > + > > > +/** > > > + * goya_sw_init - Goya software initialization code > > > + * > > > + * @hdev: pointer to hl_device structure > > > + * > > > + */ > > > +static int goya_sw_init(struct hl_device *hdev) > > > +{ > > > + struct goya_device *goya; > > > + int rc; > > > + > > > + /* Allocate device structure */ > > > + goya = kzalloc(sizeof(*goya), GFP_KERNEL); > > > > Consider using devm_k[mz]alloc() for memory allocations throughout the > > driver. I didn't check all the spots where it can be applicable. > I honestly wasn't aware of that. We never used that in AMD drivers > (which where I spent most of my kernel time). > I'll look into that offline but for now I don't really want to change > into it blindly in all locations, unless there is some hard kernel > rule for using that in drivers. AFAIK, there's no such rule. It's just supposed to make driver developer/maintainer life easier ;-) > > > > > + if (!goya) > > > + return -ENOMEM; > > > + > > > + /* according to goya_init_iatu */ > > > + goya->ddr_bar_cur_addr = DRAM_PHYS_BASE; > > > + hdev->asic_specific = goya; > > > + > > > + /* Create DMA pool for small allocations */ > > > + hdev->dma_pool = dma_pool_create(dev_name(hdev->dev), > > > + &hdev->pdev->dev, GOYA_DMA_POOL_BLK_SIZE, 8, 0); > > > + if (!hdev->dma_pool) { > > > + dev_err(hdev->dev, "failed to create DMA pool\n"); > > > + rc = -ENOMEM; > > > + goto free_goya_device; > > > + } > > > + [ ... ] > > > + > > > +static const struct hl_asic_funcs goya_funcs = { > > > + .early_init = goya_early_init, > > > + .early_fini = goya_early_fini, > > > + .sw_init = goya_sw_init, > > > + .sw_fini = goya_sw_fini, > > > + .suspend = goya_suspend, > > > + .resume = goya_resume, > > > + .dma_alloc_coherent = goya_dma_alloc_coherent, > > > + .dma_free_coherent = goya_dma_free_coherent, > > > > Is there any additional functionality that is planned in goya or gaudi in > > these two functions? > > It seems like they are not really needed, at least at the moment and for > > sure that don't need to be part of ASIC ops. > > So this relates to the simulator support, because there the > implementation of these two functions is totally different as I don't > have pci device. Can you please add a comment about it here? -- Sincerely yours, Mike.