Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1425718pxb; Sun, 17 Jan 2021 08:26:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7gBblNu7M/5PHXX24oU3h6P3OcJ/W9zEDd9oltd+BXmSsPSqy4Gh7HtzOK7KCw6RF3wfy X-Received: by 2002:a05:6402:4389:: with SMTP id o9mr15710841edc.164.1610900791635; Sun, 17 Jan 2021 08:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610900791; cv=none; d=google.com; s=arc-20160816; b=c2NSN1JNxyljKqyg7y9vJjdX5cViPt/lzG5UG5p+hd+kHDnkvusTHWKRT7vXUNkVDs /YW5mxb8vj80fSx7FULkmV35MBd02HTtNAaoqy9D+OTwNaNdv+uV2KByrYOCHEdhTQKL J0SjRwkvEB+xSx0AIcFkc/knlc5cZZllV80YmHgpVS6lAi8Wr94nF6Wz1irG8ZQ2ugbq rKw5RscdM9BcTdGCN8Q9pVI/shla2vfepC/Lar0H2Cp7zC9w3/h9dQcb45TaBXU3oxMz VNYaQ1FMKxzHn0vLkcGrUvcpkhMImO8P+hGZnhnCJfCJxAu8tXcEbnYVtvpMTZInY/OI WbVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=VvDskUcTMKO/Knbyega3fwW2CY3W1m4PF63C8ZG/0S4=; b=YCh4CBkWivWbc4Q4TgKTPUKs5LOUcsmWn5+IxLjb7EetA8OO3cOUeJZ05Ta4eIqY/v U4C0beHDmuZ/ZGYdUVf8tQYu9LCmW8M7teFClaPbNp3hRAVuGh69/f4LpJ2MprsKmErS mo1ABAi2bkbBBHOmMYRykmwyalVhBVQVlCRAJLHef422JrW71fLgbB8nB7BoRCqPICc/ ZjBMzt55BhrRXyEk23GX69HKC22SBaHVVgTNQWYZbGTrZ/OaOaDvoiPO9Pr5zQEyBWCu PJ8Ik90Z8l3Metplav657tZQmNdrjm6QOBcXil7xfhWDPR9jqvouCKq6r2iGQj5TXeHp 38tA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr2si5437090ejc.663.2021.01.17.08.26.08; Sun, 17 Jan 2021 08:26:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729437AbhAQQXW (ORCPT + 99 others); Sun, 17 Jan 2021 11:23:22 -0500 Received: from mail-pl1-f176.google.com ([209.85.214.176]:46940 "EHLO mail-pl1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729824AbhAQQXV (ORCPT ); Sun, 17 Jan 2021 11:23:21 -0500 Received: by mail-pl1-f176.google.com with SMTP id u11so2990873plg.13; Sun, 17 Jan 2021 08:23:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VvDskUcTMKO/Knbyega3fwW2CY3W1m4PF63C8ZG/0S4=; b=ZZxC3bW8Ce24IHmxgjFgux53r7w+C1Tnay8DnfKifqH87+DiVWmfsO6BbMyjo6fuJ5 F/4MZ3cpVx8xrS1/LIydSM5JRNx0FUIb4akpxhd9zP/6p7+/WmS7Vx8/g5SiHYylHs72 Rr1EQgt355ftXTO0YCVNk1gFfuwAdTuCs/BgeP3ABNuB2YYJtsx/xVuHM/BTtZzNQvIU 6VXygFBihSwy3DM93USe4t4P3asLH0V5LokbMN07K2NRKuOQYNAIhqCPUTleGYRFPOR8 Za7lRk/FzLh/Mea7PYUYqR2ttxe3cYd9SQIK3eJ6YktU0Ml/kvw+JIBveK0fUAFPPYnQ 4Pzw== X-Gm-Message-State: AOAM532qwaywavzMJeciStnq2vsO2mr9/IKhAaDvXR7ybPqSkpT0Yr+b Vo7ZDaA1gxFymYOxd4gyV/A= X-Received: by 2002:a17:90a:d494:: with SMTP id s20mr22023049pju.178.1610900558700; Sun, 17 Jan 2021 08:22:38 -0800 (PST) Received: from localhost ([2601:647:5b00:1161:a4cc:eef9:fbc0:2781]) by smtp.gmail.com with ESMTPSA id 73sm13988656pga.26.2021.01.17.08.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 08:22:37 -0800 (PST) Date: Sun, 17 Jan 2021 08:22:36 -0800 From: Moritz Fischer To: Greg KH Cc: Xu Yilun , mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, trix@redhat.com, lgoncalv@redhat.com, hao.wu@intel.com Subject: Re: [PATCH v6 1/2] fpga: dfl: add the userspace I/O device support for DFL devices Message-ID: References: <1610502848-30345-1-git-send-email-yilun.xu@intel.com> <1610502848-30345-2-git-send-email-yilun.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Greg, On Sun, Jan 17, 2021 at 04:45:04PM +0100, Greg KH wrote: > On Wed, Jan 13, 2021 at 09:54:07AM +0800, Xu Yilun wrote: > > This patch supports the DFL drivers be written in userspace. This is > > realized by exposing the userspace I/O device interfaces. > > > > The driver leverages the uio_pdrv_genirq, it adds the uio_pdrv_genirq > > platform device with the DFL device's resources, and let the generic UIO > > platform device driver provide support to userspace access to kernel > > interrupts and memory locations. > > Why doesn't the existing uio driver work for this, why do you need a new > one? > > > --- > > drivers/fpga/Kconfig | 10 +++++ > > drivers/fpga/Makefile | 1 + > > drivers/fpga/dfl-uio-pdev.c | 93 +++++++++++++++++++++++++++++++++++++++++++++ > > uio drivers traditionally go in drivers/uio/ and start with "uio", so > shouldn't this be drivers/uio/uio_dfl_pdev.c to match the same naming > scheme? I had considered suggesting that, but ultimately this driver only creates a 'uio_pdrv_genirq' platform device, so it didn't seem like a good fit. > > But again, you need to explain in detail, why the existing uio driver > doesn't work properly, or why you can't just add a few lines to an > existing one. Ultimately there are three options I see: 1) Do what Xu does, which is re-use the 'uio_pdrv_genirq' uio driver by creating a platform device for it as sub-device of the dfl device that we bind to uio_pdrv_genirq 2) Add a module_dfl_driver part to drivers/uio/uio_pdrv_genirq.c and corresponding id table 3) Create a new uio_dfl_genirq kind of driver that uses the dfl bus and that would make sense to then put into drivers/uio. (This would duplicate code in uio_pdrv_genirq to some extend) Overall I think in terms of code re-use I think Xu's choice might be less new code as it simply wraps the uio platform device driver, and allows for defining the resources passed to the UIO driver to be defined by hardware through a DFL. I've seen the pattern that Xu proposed used in other places like the macb network driver where you'd have macb_main (the platform driver) and macb_pci that wraps it for a pci usage. - Moritz