Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp827358rwi; Wed, 2 Nov 2022 19:35:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Fn1fMtiB6EGMjxHUTFk5+tp2tBYJFJQEfWVn3SsDYOqzP/SYmQsa6F6oQGXaypDjRbrT5 X-Received: by 2002:aa7:d341:0:b0:464:778:c3fe with SMTP id m1-20020aa7d341000000b004640778c3femr5794760edr.251.1667442912522; Wed, 02 Nov 2022 19:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667442912; cv=none; d=google.com; s=arc-20160816; b=mO7HSSo+ZxlHlaSi7/pFuDO8WvRhKxpi+WjfBjyVhkik8m0+Ps9EUi7SKsWUoeQPE9 KF24zKR8YDXBjj3etXwdRj205s7HCOZ3KqymOUqzZoju1SMSmkm0E1hEOGC4JWNe+WlD NYSuynWqmVWq5UqvZOwhVMiYV++PaI5bu+zU0qnFOQmK4zJrftIgq0F4j9zTzHxJ7FdH zH4p66g6bc8yYAGw8Qv/MjrhICH/zvh3Q5hYqTYX7ZgsVAYPYG5q6a/xk/MVxxegTJsC 8wUhHihLExmBDtMczCNfzu4yKRxTIsW1e5mJouk3yH15+5pfm6cB5iyU6j19QXceZ7Lv YWag== 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:dkim-signature; bh=MSzkVnW83enA44VFJUYnsfz6snFyB+av+pXupQxshKk=; b=PnHChHcObz+n+H66aY9G3PY/9F8Yg8SNkF0zHFKg/2MM59FSjoNDieZ73Z2qUeyN7F Q00YD+UOom4itBkUf9udi4SfwsUZ4+xtwmZ7OyfQ31nrjsvKQ6bbFcHX/zbb3wcDcJ83 SjgXP5/qwaycDS0X9jX+/9Eh161QE+wY6u3E/qpiey5XZ5YlEMUaQkN9QxE6lOJMGic7 /eE9QqTbvuJrz3gqbpqxVzjZ+W8Se6QiuBhrMRg4XPp+wdVLhQCmhcGyWt8mtNK+iah0 TpIVsFG5hep7LrPjrzRrpqM5Ni7dWA6jZe/tETliB/5qeBiTH7LpAsrhqbsJ9L3kiXe/ ZYaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SRHQ4S7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a170907948a00b007ac2daa0b49si18227402ejc.367.2022.11.02.19.34.49; Wed, 02 Nov 2022 19:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SRHQ4S7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230341AbiKCBpw (ORCPT + 97 others); Wed, 2 Nov 2022 21:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiKCBpu (ORCPT ); Wed, 2 Nov 2022 21:45:50 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02BC412088; Wed, 2 Nov 2022 18:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667439949; x=1698975949; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Sln4k5J/uP9rg3q9ZfFqzdN1uhd3yeOy4OBz6rjRhlQ=; b=SRHQ4S7lW68nfJ4wGdk+OvnLleJO2qnJHr4PiSfum+y29ABf2MB+7qo2 VvR4XRmpOzNK1M0QMqnoxoTvmgYdEKGcUUD750tV+e76GnuN6DDE/YYhd +jx6nMwxyOmZ/kqnZMz42oAk0cqkvnyq+Or9ys8UvcbJnA9CRgSbnHsIt yVWiIwmYi2FwFxZxu4OyWi82Yx4hPQb8Ja4g2rNCY9WIYHspOPJ89iKm4 F6v09LBzgZLIEjiS063gEZ8uVbkrHXkl38ftvPal6b4VkEYD0HQcpLUN7 p/H3uZII5jV+1QYOxDMAu2v1ckw0C5LD4zrVw9cKy9i3ipcp77DTVTmh6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="307177385" X-IronPort-AV: E=Sophos;i="5.95,235,1661842800"; d="scan'208";a="307177385" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2022 18:45:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="612462262" X-IronPort-AV: E=Sophos;i="5.95,235,1661842800"; d="scan'208";a="612462262" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by orsmga006.jf.intel.com with ESMTP; 02 Nov 2022 18:45:45 -0700 Date: Thu, 3 Nov 2022 09:36:33 +0800 From: Xu Yilun To: matthew.gerlach@linux.intel.com Cc: hao.wu@intel.com, russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.com, trix@redhat.com, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tianfei.zhang@intel.com, corbet@lwn.net, jirislaby@kernel.org, geert+renesas@glider.be, andriy.shevchenko@linux.intel.com, niklas.soderlund+renesas@ragnatech.se, macro@orcam.me.uk, johan@kernel.org, lukas@wunner.de, ilpo.jarvinen@linux.intel.com, marpagan@redhat.com Subject: Re: [PATCH v4 3/4] fpga: dfl: add basic support DFHv1 Message-ID: References: <20221020212610.697729-1-matthew.gerlach@linux.intel.com> <20221020212610.697729-4-matthew.gerlach@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-11-01 at 15:37:19 -0700, matthew.gerlach@linux.intel.com wrote: > > > On Sat, 29 Oct 2022, matthew.gerlach@linux.intel.com wrote: > > > > > > > > > > if (!finfo) > > > > return -ENOMEM; > > > > > > > > + if (dfh_psize > 0) { > > > > + memcpy_fromio(finfo->params, > > > > + binfo->ioaddr + ofst + DFHv1_PARAM_HDR, dfh_psize); > > > > + finfo->param_size = dfh_psize; > > > > + } > > > > + > > > > finfo->fid = fid; > > > > finfo->revision = revision; > > > > - finfo->mmio_res.start = binfo->start + ofst; > > > > - finfo->mmio_res.end = finfo->mmio_res.start + size - 1; > > > > + finfo->dfh_version = dfh_ver; > > > > finfo->mmio_res.flags = IORESOURCE_MEM; > > > > - finfo->irq_base = irq_base; > > > > - finfo->nr_irqs = nr_irqs; > > > > + if (dfh_ver == 1) { > > > > + v = readq(binfo->ioaddr + ofst + DFHv1_CSR_ADDR); > > > > + if (v & DFHv1_CSR_ADDR_REL) > > > > + finfo->mmio_res.start = v & ~DFHv1_CSR_ADDR_REL; > > > > + else > > > > + finfo->mmio_res.start = binfo->start + ofst + > > > > + FIELD_GET(DFHv1_CSR_ADDR_MASK, v); > > > > + > > > > + v = readq(binfo->ioaddr + ofst + DFHv1_CSR_SIZE_GRP); > > > > + finfo->mmio_res.end = finfo->mmio_res.start + > > > > + FIELD_GET(DFHv1_CSR_SIZE_GRP_SIZE, v) - 1; > > > > > > So for dflv1, no feature header resource for dfl_device, is it a problem > > > for dfl_uio? Does userspace driver need the raw feature header? > > These are two very good questions. The dfl_uio driver question is > > particularly relevent because user space is looking at the GUIDs. > > > > In the case of dfl_uio driver, user space will definitely want to look at > the feature header for the GUID and the parameters. Since DFHv1 can have > the DFH header and the feature registers in non-contiguous memory locations, > a resource for the dfl_device will be required. In earlier > revisions of this patch set, a second resource was added called csr_res > pointing to the feature's register while mmio_res pointed at the header. > Do we just need better names or do we need an array of named resources? Either is OK, you could also name a resource element in an array by struct resource:name. But my concern is still no overlapping. Thanks, Yilun