Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1847521lqz; Mon, 1 Apr 2024 21:49:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVYAgOtW+EBkuUbl/SiJBMhPCRFnRvzEav9KbybZQHqHz5ZDKNyXxB8J7Wwb6msbWTmJIaVEsoP6aRnlzPOaEanlofRkXiPAyUchqNDA== X-Google-Smtp-Source: AGHT+IHx/oscq9eTrLTFMuH+BITcC8SbgOWXjPMgtcxx8yMhdmtpot4pHpYDdYUOBBqZ51JmILjx X-Received: by 2002:a05:6808:4481:b0:3c3:ac2b:97f0 with SMTP id eq1-20020a056808448100b003c3ac2b97f0mr18368064oib.13.1712033351461; Mon, 01 Apr 2024 21:49:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712033351; cv=pass; d=google.com; s=arc-20160816; b=E5cP/f5eWyW5G/c1JE4KRm74mvlWw0o42EPYjHeKOZVqQ0mXYgQl+1r5t8x7wNNG3+ E3mSR5BoSZRsV35fxaT32UTx1eutc6URZfqcEVI41xjssZY5vlNbCwpdAp8Ju/TOMzsI 3cjmwvdjHayXOXKQMiAk5nKvl5gJpb6t1u4QTO/XYKg9ECTwXlTHEVvD0ht8W9zVksUt 497fazCN15hoRO9t9edQnTSco/iSN3QRK6vEO0VgthlBIXnWCooRy1eK2kwdqZTi9xss tPKDDkVvZo/kX8iRnnkdmj28Zv4LBiAUeXP6057MGdyegaGCiJzlYUe8fnAw7L6Q/Jjs hNlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LnAAcKcmGB/1SU/EUcyr1O2VDX4AF/0LC+OQ9Cfyf14=; fh=BzJif6CLkouceMZlD8DhbLSE180fz1DzYxJeRoBSzUE=; b=Wg8pOrjFTnJNNHG+FaRK0K/g//wCJeeKFht3zj/O5XHCofCcstKqQIr/rfW7ErITvd KJ8nv6yqt758ErahnNDtmc4hd4AZTws1K+jtmC12zsaA337WZuOVR3VJJ8jDtvxf3SoG pAeg8sF6Ms+Z4zz11dGN611Lzvp1Qkroz84HMlhEZ8HoGT4WTL0bhkO8aBU2cvaxftbU hdk9mmi4GiIAcJXjZIHoOp1pmR/ix6MHoDcegVzjPS95ilVOUJJ05povios/XPsDOQ+t +3DZccfmvEQTlOXkNXX2EqrgK1oZe7r0Hz1nB7G5jg+h6zU09aqGu0ErkrllZVTGdS27 TJ/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FQaVlFg0; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n9-20020a654509000000b005ced19e2d21si10366558pgq.676.2024.04.01.21.49.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 21:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FQaVlFg0; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DD5DFB23951 for ; Tue, 2 Apr 2024 04:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01CC217C72; Tue, 2 Apr 2024 04:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FQaVlFg0" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49F3B17BBA; Tue, 2 Apr 2024 04:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712033339; cv=none; b=bhPimYtXDTXR5UWtXwzGDHcBaGLif2fqcJG1xTPy34A9N41iWLKey63hxDvOV6kBSUGYnDx2bawWTCgi9UHg6XlBDiLt8JFClTFZJB3kMQqbuaZk9pFJ8ALLhc/ZfpwB5yJ3iLqEUs8Zj6ISF4QGpTQ1B2Q14iq3dTdcy9s/uBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712033339; c=relaxed/simple; bh=9dnJjfacnC5NIXeRU42Rs8bqYi+ZfEdAnf1tJGX8DCc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Oy2SFSV9vACHj21c8qtKQYufNaUu8b785KjgRX9Et7iWmJnRfPBKCU5Mlz6RNVzAYW46JJvWu5q1VE27X0zilw94yX1dhyBbRhYlua6J6mf0wA7zTKb5220MFgQsZYc0Fsvrf98w/9ZZEkDbN9iMt90dS+2l/bP1hRfwvAjLEac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FQaVlFg0; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712033337; x=1743569337; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=9dnJjfacnC5NIXeRU42Rs8bqYi+ZfEdAnf1tJGX8DCc=; b=FQaVlFg0oLACqi4CtmMTHoHJ0zrqTj50S3M2l695jDqFds6K2B3gX2Bp B86tH0mWyUFbEua76H8zbY5IiCi3v9RCFwMFK5C+uZQk6nO9puCOPmfJW eOpK+YzuuLW+FvPgQi+GevJyE/3V0GNCPbeDvW9F9V9QOIbbei/43wLOX DtXcxUFXP2fZjJ70FtOGfcTj+RorkLSQqw4jFAAFEnFsiLh8r7PbinQyp Wejg99OKpyKwJx5RebCUx5xm8I9Kn1u6nj9uWxa0Ucp9UuOgaG13ye7zr siJR1NOPmzmc8ZzmudP7klHWxCMJKCObnGtyDG6+KVdoTzZgQWbVfaTDh Q==; X-CSE-ConnectionGUID: LkR//19HQR2ci2V1gQmFmw== X-CSE-MsgGUID: 2MvqGf7YQViSQWnT0TamUg== X-IronPort-AV: E=McAfee;i="6600,9927,11031"; a="24639104" X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="24639104" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2024 21:48:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="22601807" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by fmviesa004.fm.intel.com with ESMTP; 01 Apr 2024 21:48:54 -0700 Date: Tue, 2 Apr 2024 12:44:03 +0800 From: Xu Yilun To: matthew.gerlach@linux.intel.com Cc: hao.wu@intel.com, trix@redhat.com, mdf@kernel.org, yilun.xu@intel.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, Tim Whisonant , Ananda Ravuri Subject: Re: [PATCH] fpga: add DFL driver for CXL Cache IP block Message-ID: References: <20240308172327.1970160-1-matthew.gerlach@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Mar 29, 2024 at 08:34:49AM -0700, matthew.gerlach@linux.intel.com wrote: > > > On Tue, 19 Mar 2024, Xu Yilun wrote: > > > On Fri, Mar 08, 2024 at 09:23:27AM -0800, Matthew Gerlach wrote: > > > From: Tim Whisonant > > > > > > Add a Device Feature List (DFL) driver for the > > > Intel CXL Cache IP block. The driver > > > provides a means of accessing the device MMIO and the > > > > Why the device MMIO should be accessed by userspace? > > The definition of the MMIO space is actually dependent on the the custom > logic in the FPGA image. Given the variability of the custom logic > implemented in the FPGA, it seems burdensome to handle the variability in > kernel code. > > > > > > capability to pin buffers and program their physical > > > addresses into the HE-Cache registers. User interface > > > > Are these registers also exposed to userspace? > > These registers are currently exposed to user space as well. It probably > make sense to be consistent and let user space code handle these registers, > like all custom logic registers, in user space. > > > > > And this patch to support a new device/IP, please firstly describe > > what the device/IP is doing. I think not everyone(including me) here > > is familar with CXL standard and how this IP block is implementing CXL > > functionality. Some reference documentation is also helpful. > > This is very good feedback. There are actually multiple IP blocks involved > here. There is a Hard IP block (HIP), and there is a FPGA/soft IP block > interfacing the HIP, and then there is custom logic implementing a desired > application. > > > > > After a quick skim of this patch, I can see user is trying to write a > > set of physical addrs to some register, but have no idea why this > > should be done. i.e. Do not reiterate what the code literally does. > > In this case, the physical addresses are being written to the custom, > application logic in the FPGA and should be moved to user space. > > If all MMIO to the custom logic is moved to user space, then this driver is > not really about CXL and hardware. This driver just provides services of > pinning/unpinning memory with numa node awareness. In this case, the driver > name is wrong because there is nothing related to CXL nor any specific > hardware implementation. If this is not related to any hardware implementation. I'm afraid it is not just the naming. From the limited knowledge I've got, you just want an interface in memory management system, not in FPGA/DFL. You may send a patch to MM people (or VFIO) for review, their opinions are determinative. But my opinion is the patch is far from being ready to send. Some questions I can quickly think of, FYI: 1. A justification why a physical address(CPU's perspective) is needed in userspace? 2. If question #1 is related to device requirement, why a device needs a CPU physical address, rather than IOVA. > > > > > > is exposed via /dev/dfl-cxl-cache.X as described in > > > include/uapi/linux/fpga-dfl.h. > > > > And please split the patch, e.g. first add a skeleton of bus driver, > > then add the skeleton of char interface, then add the functionalities > > one by one. This gives chances to clearly describe each function, and > > why add it, etc. > > If this driver is only implementing a char interface to memory management, > does it make sense to split the code into separate patches? In general, it is alway good to split the whole code into small patches. That makes better understanding. But since it seems to be a different story now, the most important thing is to clearly tell the use case, what's the existing solution kernel have, why they are not fit for you? what are the possible options? why you choose this option? A general word that application logic demands is not helpful. Thanks, Yilun