Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1267192ybl; Fri, 23 Aug 2019 16:33:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzA2XmZ//LGYxSWsNJ1pK9rguYEX6dGmnEPRRgY71uexIFR71mp3ZzsmJEllvGnOUaapPT1 X-Received: by 2002:a17:90a:c08f:: with SMTP id o15mr7932980pjs.31.1566603185544; Fri, 23 Aug 2019 16:33:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566603185; cv=none; d=google.com; s=arc-20160816; b=KfnnEtz3EgZETwqf4+O2DF3eFx+Y5IO3oZDQnHAqvwCYwGxsXQxXKZapdvFlvpU/ln 9ik7vBTIAvpbZOyvTCy/5Qa8zNeY0OGxxP+cMNnnPhOVh4dWsp3sFM/7NpRQdClG/1Kl 3wzICPp0Ob591P1h3h7sbNKbHIGamnDnrPMi/kpNcNgqBcjp3ddbg/h3+1PxypR4hwTo kBdxaWhwTqcjmfOtGUlcCywQ4wrjiNzHakgCvp0r7AxQ2yYGK1Whp8HdoQzMgimejzHk XCXdcFA0nD2f35yc/g7M0ZOs4Kq9PVLL1ZmOGFL/LLKxA46RSNP0Hnpi46gsMV7N5C2J Ar5g== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=1gwOuhs8WafRTJEyf5/cJus7AZ8D+l5Adsg74udviRo=; b=otCnf8nuy4u/91Xe7Tuig9Mklm4fZAclvTOABteTWhljFnwp99I5vY192jnQQNzWSY 1mhl355tWCcHst6DMgttavVDge0m+en0u8HAP9zY+utaU9VAGVBSVKiOzG6TSys95w0B tBiFmh5/r9T2rBNh5wMemmJZ5fGEwBI1UXWdSTc64u2AI5Ytvxq4jGTe+rm1AaY1HSuk R0WOCegfk6D9/2IXSMp/iMDLorZ/VyUy7/GL4rOu9HfitO5796AP0uII6poqcJ5joN+K H+OJtqbJrCk1bDoerZ6EWAl5l6L5E0wkUbDUD7OEW7oPuSzEzbcSIExxyaZzEUUSJ0Pr 4WKQ== 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 k43si3466274pje.59.2019.08.23.16.32.50; Fri, 23 Aug 2019 16:33:05 -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 S2436798AbfHWQg2 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Aug 2019 12:36:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5649 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391229AbfHWQg2 (ORCPT ); Fri, 23 Aug 2019 12:36:28 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6A6D7791BB853EF10449; Sat, 24 Aug 2019 00:36:25 +0800 (CST) Received: from localhost (10.202.226.61) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Sat, 24 Aug 2019 00:36:14 +0800 Date: Fri, 23 Aug 2019 17:36:03 +0100 From: Jonathan Cameron To: zhangfei CC: Greg Kroah-Hartman , Arnd Bergmann , Zaibo Xu , , Zhou Wang , "Kenneth Lee" , Subject: Re: [PATCH 2/2] uacce: add uacce module Message-ID: <20190823173603.00001b3d@huawei.com> In-Reply-To: References: <1565775265-21212-1-git-send-email-zhangfei.gao@linaro.org> <1565775265-21212-3-git-send-email-zhangfei.gao@linaro.org> <20190815175424.00002256@huawei.com> Organization: Huawei X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.226.61] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Aug 2019 17:21:33 +0800 zhangfei wrote: > Hi, Jonathan Hi zhangfei, > > Thanks for your careful review and good suggestion. > Sorry for late response, I am checking one detail. I have reviews on patches from years ago that I still haven't replied to ;) > > On 2019/8/16 上午12:54, Jonathan Cameron wrote: > > On Wed, 14 Aug 2019 17:34:25 +0800 > > Zhangfei Gao wrote: > > > >> From: Kenneth Lee > >> > >> Uacce is the kernel component to support WarpDrive accelerator > >> framework. It provides register/unregister interface for device drivers > >> to expose their hardware resource to the user space. The resource is > >> taken as "queue" in WarpDrive. > > It's a bit confusing to have both the term UACCE and WarpDrive in here. > > I'd just use the uacce name in all comments etc. > Yes, make sense > > > >> Uacce create a chrdev for every registration, the queue is allocated to > >> the process when the chrdev is opened. Then the process can access the > >> hardware resource by interact with the queue file. By mmap the queue > >> file space to user space, the process can directly put requests to the > >> hardware without syscall to the kernel space. > >> > >> Uacce also manages unify addresses between the hardware and user space > >> of the process. So they can share the same virtual address in the > >> communication. > >> > >> Signed-off-by: Kenneth Lee > >> Signed-off-by: Zaibo Xu > >> Signed-off-by: Zhou Wang > >> Signed-off-by: Zhangfei Gao > > I would strip this back to which ever case is of most interest (SVA I guess?) > > and only think about adding support for the others if necessary at a later date. > > (or in later patches). > Do you mean split the patch and send sva part first? Either: 1) SVA only in the first series, second series can do other options. 2) Patch N for SVA only, N+1... for other features. I don't mind which, but I want to be able to see just one case and review that before taking into account the affect of the more complex cases. > >> + > >> +static int uacce_qfr_alloc_pages(struct uacce_qfile_region *qfr) > >> +{ > >> + int gfp_mask = GFP_ATOMIC | __GFP_ZERO; > > More readable to just have this inline. > Yes, all right. > > > >> + int i, j; > >> + ... > >> +static int uacce_set_iommu_domain(struct uacce *uacce) > >> +{ > >> + struct iommu_domain *domain; > >> + struct iommu_group *group; > >> + struct device *dev = uacce->pdev; > >> + bool resv_msi; > >> + phys_addr_t resv_msi_base = 0; > >> + int ret; > >> + > >> + if ((uacce->flags & UACCE_DEV_NOIOMMU) || > >> + (uacce->flags & UACCE_DEV_PASID)) > >> + return 0; > >> + > >> + /* > >> + * We don't support multiple register for the same dev in RFC version , > >> + * will add it in formal version > > So this effectively multiple complete uacce interfaces for one device. > > Is there a known usecase for that? > Here is preventing one device with multiple algorithm and register > multi-times, > and without sva, they can not be distinguished. Isn't that a bug in the device driver? > >> + */ > >> + ret = class_for_each_device(uacce_class, NULL, uacce->pdev, > >> + uacce_dev_match); > >> + if (ret) > >> + return ret; > >> + > >> + /* allocate and attach a unmanged domain */ ...