Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4229205yba; Tue, 9 Apr 2019 14:06:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwia1tZDphEKlU/BWgisK62LK+5HD4XTAOHeWLlfXaD1/Mbef1/hIfmS6XaFL0snWoIky4w X-Received: by 2002:a17:902:1e2:: with SMTP id b89mr39921846plb.278.1554844004593; Tue, 09 Apr 2019 14:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554844004; cv=none; d=google.com; s=arc-20160816; b=fhSBjHLP4H7Mht82suLwFZ2By7wpOCzp8V/0Gu0GMTVsRrTorLlpJkBFZU69aRv+rB /WW+gdReZT65nOjtOpisu1FlWCWS+SMvILGEVuEnTQAEkupAQOqKcd8DecTiAk7XDWVD c2EJp0Vz0+heXKSCjNrhoBUts1fLhoSWMUa/OtMSaVX6UDEB3J6RvTdPt7hpsioRTKuo 1vff39kOOOTcYamm8vorjK9BeGF4cvOEC6GhGSXGHkriXPOhz0mIVdqNzIJUriw/LxJK UnzX2F/SKXMMPUiDtGpxhTXlAKsJJ2z6KSJkBq09UAxN8Hv9YP51eBLn8vl48WERItg4 2krg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=MAlH1pQy1/OxZzsSTSfWmZLF9bu8JZCkQ9gtNcA1SA0=; b=0uEqvExqiFA0KGNLZLP7WB6yW6u9dwtxoOw5Go8EEYy9eYDuSvQ6dAS/Rc0AUugjJt sNGlCcLV/vQ/5OwAmXYE32pCKE4qpEEpbOaso6AmVbHEt118u1fbIGMZCgO+KsrV+nGs BzbpLfwq+wef0PEVz7Yqek//2Uqi2XsXoFIrruKT/hgyGFCmFT5hsBeW4m6sW0vNuHKX nL4euIJ6v57OeuJlp23Ju4vZuJTRwJeqd1uFxMyEeE524fe9VfQqKSEC+Z4XnKWIRdCF EahG2JXj6TBk9+HnKDsd6TWAYmwODJftwQeMvu2oix9z/cA7iTZC2yELLq+d22wzmXWK 8vSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PvkwfNVE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si29271266pgu.437.2019.04.09.14.06.26; Tue, 09 Apr 2019 14:06:44 -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; dkim=pass header.i=@kernel.org header.s=default header.b=PvkwfNVE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbfDIVFt (ORCPT + 99 others); Tue, 9 Apr 2019 17:05:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:39582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbfDIVFs (ORCPT ); Tue, 9 Apr 2019 17:05:48 -0400 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EF5CA2082A; Tue, 9 Apr 2019 21:05:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554843947; bh=xnpa7ujTpqe8MwJmLJse6j4GVSpXEGQ+bN23OWVBL04=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PvkwfNVEbwSqg9TTt1ePcOY1xhzVWyFRh/KNzFlCFf5WsbLL9Nk1nQKBr7ZXrplw+ mmFyYfFW+fPqyoN27p274r8vK7f2I5b06aFXlQ8D12WCAG/pgi9UUNPxMXvaibbFjk y4EKwq3s5uMH8TNLcXAMw+Gj6kUu9/neA7hoJdc0= Received: by mail-ed1-f50.google.com with SMTP id s39so105588edb.2; Tue, 09 Apr 2019 14:05:46 -0700 (PDT) X-Gm-Message-State: APjAAAVNH9YPEu+h6Cs3DZzZrp4Y/78+thur55NDcZXN5I4aaO81/+Tp fsMOmHTDF58XYejxh651SZxb21140PY7a5tmyUQ= X-Received: by 2002:a50:b5c3:: with SMTP id a61mr18787964ede.31.1554843945534; Tue, 09 Apr 2019 14:05:45 -0700 (PDT) MIME-Version: 1.0 References: <1553483264-5379-1-git-send-email-hao.wu@intel.com> <1553483264-5379-14-git-send-email-hao.wu@intel.com> In-Reply-To: <1553483264-5379-14-git-send-email-hao.wu@intel.com> From: Alan Tull Date: Tue, 9 Apr 2019 16:05:09 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 13/17] fpga: dfl: fme: add capability sysfs interfaces To: Wu Hao Cc: Moritz Fischer , linux-fpga@vger.kernel.org, linux-kernel , linux-api@vger.kernel.org, Luwei Kang , Xu Yilun Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 24, 2019 at 10:24 PM Wu Hao wrote: Hi Hao, Looks good... > > This patch adds 3 read-only sysfs interfaces for FPGA Management Engine > (FME) block for capabilities including cache_size, fabric_version and > socket_id. > > Signed-off-by: Luwei Kang > Signed-off-by: Xu Yilun > Signed-off-by: Wu Hao Acked-by: Alan Tull Thanks, Alan > --- > Documentation/ABI/testing/sysfs-platform-dfl-fme | 23 ++++++++++++ > drivers/fpga/dfl-fme-main.c | 48 ++++++++++++++++++++++++ > 2 files changed, 71 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-platform-dfl-fme b/Documentation/ABI/testing/sysfs-platform-dfl-fme > index 8fa4feb..b8327e9 100644 > --- a/Documentation/ABI/testing/sysfs-platform-dfl-fme > +++ b/Documentation/ABI/testing/sysfs-platform-dfl-fme > @@ -21,3 +21,26 @@ Contact: Wu Hao > Description: Read-only. It returns Bitstream (static FPGA region) meta > data, which includes the synthesis date, seed and other > information of this static FPGA region. > + > +What: /sys/bus/platform/devices/dfl-fme.0/cache_size > +Date: March 2019 > +KernelVersion: 5.2 > +Contact: Wu Hao > +Description: Read-only. It returns cache size of this FPGA device. > + > +What: /sys/bus/platform/devices/dfl-fme.0/fabric_version > +Date: March 2019 > +KernelVersion: 5.2 > +Contact: Wu Hao > +Description: Read-only. It returns fabric version of this FPGA device. > + Userspace applications need this information to select > + best data channels per different fabric design. > + > +What: /sys/bus/platform/devices/dfl-fme.0/socket_id > +Date: March 2019 > +KernelVersion: 5.2 > +Contact: Wu Hao > +Description: Read-only. It returns socket_id to indicate which socket > + this FPGA belongs to, only valid for integrated solution. > + User only needs this information, in case standard numa node > + can't provide correct information. > diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c > index 38c6342..8339ee8 100644 > --- a/drivers/fpga/dfl-fme-main.c > +++ b/drivers/fpga/dfl-fme-main.c > @@ -75,10 +75,58 @@ static ssize_t bitstream_metadata_show(struct device *dev, > } > static DEVICE_ATTR_RO(bitstream_metadata); > > +static ssize_t cache_size_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + void __iomem *base; > + u64 v; > + > + base = dfl_get_feature_ioaddr_by_id(dev, FME_FEATURE_ID_HEADER); > + > + v = readq(base + FME_HDR_CAP); > + > + return scnprintf(buf, PAGE_SIZE, "%u\n", > + (unsigned int)FIELD_GET(FME_CAP_CACHE_SIZE, v)); > +} > +static DEVICE_ATTR_RO(cache_size); > + > +static ssize_t fabric_version_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + void __iomem *base; > + u64 v; > + > + base = dfl_get_feature_ioaddr_by_id(dev, FME_FEATURE_ID_HEADER); > + > + v = readq(base + FME_HDR_CAP); > + > + return scnprintf(buf, PAGE_SIZE, "%u\n", > + (unsigned int)FIELD_GET(FME_CAP_FABRIC_VERID, v)); > +} > +static DEVICE_ATTR_RO(fabric_version); > + > +static ssize_t socket_id_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + void __iomem *base; > + u64 v; > + > + base = dfl_get_feature_ioaddr_by_id(dev, FME_FEATURE_ID_HEADER); > + > + v = readq(base + FME_HDR_CAP); > + > + return scnprintf(buf, PAGE_SIZE, "%u\n", > + (unsigned int)FIELD_GET(FME_CAP_SOCKET_ID, v)); > +} > +static DEVICE_ATTR_RO(socket_id); > + > static const struct attribute *fme_hdr_attrs[] = { > &dev_attr_ports_num.attr, > &dev_attr_bitstream_id.attr, > &dev_attr_bitstream_metadata.attr, > + &dev_attr_cache_size.attr, > + &dev_attr_fabric_version.attr, > + &dev_attr_socket_id.attr, > NULL, > }; > > -- > 2.7.4 >