Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp610816lqb; Wed, 17 Apr 2024 06:19:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtrEqf7f6Oxyaxx3Wmvnbk7XbM9rY+5jO1uZEDB4E9fcy6TeKY2EnugIoE9cRa4bmLJ7sEunRTkJ8td/yFlE9580+Oz3Rns6kVhbF4xA== X-Google-Smtp-Source: AGHT+IEGcvr/GVPc77du9DoJLeryKbdklDAZVpy/fWML2W1H2ZJSUvlAvTh5igmZ8BxxC4lN2wsq X-Received: by 2002:a50:d55e:0:b0:570:2418:3607 with SMTP id f30-20020a50d55e000000b0057024183607mr8550746edj.36.1713359966733; Wed, 17 Apr 2024 06:19:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713359966; cv=pass; d=google.com; s=arc-20160816; b=oVeJ+UiQP81ryxCjeouLnToJrF1uGVJQwGd/AOyS0BoInSUheKLJHw4AnB9invAYcF RowBmJzewIhGFlIY0HV7AjRvlmGPkfBjJ8GsHbd2LfvdXJvQDrOvQeRnjpwjEACNEwKc zs0IMiWmZhd6lA1B+qqUF4TaML1nanV1BusAgTS/WqPDF7FMFG16RPMHc+wFdLXzDJAH H+CcYhRML79akewhffiC4Q/KMj+UD9CczLybwULnMaIjCNzuwQKE5T5kyxdUiPkRJend SHPAPkMMJAJVJrHMT/zYGXx1sPgx1GtekR1X0T74WT3WZsapg9YkceXqbzcwqlLJsRTv DMRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=11c2HmwQ4ig0RjBvMgWJ0Rko6Y/CHWNxF45HgRU0E00=; fh=BTsw9WG0vtWmuISkaGJqYL0fUol4Z58eXxJg58i3Knw=; b=pGJqWTEeL36Bvyf5d54TBEruyTtdzrKXRpts2yPZhua804RLHQlEzZmaROHvEDcabM hoF5gi8k1Ve65a5C4QV6xYOEDCeRwdx+qQ7MhDBLWyQcWgyWnP3cDnQxRCSfNJsYkj1G 48O52UTZZHyP8eAK8mSP50jq2N1Fj2NnYiN7O8BcMfY4RI1cembDOAxJk5mBz873lsLj pW53Y5Fv18/bRGMGxkOXsLEwqRkvsLWgXiljmAhLJ4dCjmOa4ocdGv67mXEObhnPrz54 BsCQYvmyirMcZYVvUWKa06UpzNB3PRcWtLvVJWkU69T9qKLBqSlIiZtV0NujkgEUjgsj EuzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z3MjoS6v; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-148539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fe10-20020a056402390a00b0056e2060a0a5si6855708edb.406.2024.04.17.06.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:19:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z3MjoS6v; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-148539-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148539-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 744ED1F21216 for ; Wed, 17 Apr 2024 13:19:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B949813F444; Wed, 17 Apr 2024 13:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Z3MjoS6v" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 A632713D8B4; Wed, 17 Apr 2024 13:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713359927; cv=none; b=Dgnu129MuB4wDwVLHVRW+9r8SH+MJVVFB8zHHyJKL5Un9IEeNg22ZWpsEOlcJgS9emiA43cSqNlZBrzAHOjS53F8RXXm/cLtLIoCZmkbzYO5QVSOF8GEEXzKV+h+eybcpMPb4Wb00fSOBTYRmi5UjDTwHFoVRWe+GA7oKLg9ILo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713359927; c=relaxed/simple; bh=RuHzYN0ZhBqkJDC8Ui0Nm3edOOTTp2WF+RIcT7keQlQ=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=gWT4X/GeaRpwHdRTTaZ1KdpL3y4y1lSidFQKcc7IJATTpFPsdlJezY8T2mfnxJg3uLDwd/7vmSPrUDdV/HKX34NyZYRLEe9y7gUHpasNUROBSB1mdBeaxK/JiJ54NL2zjFDWCVIlCKbh682DoL80cYtfFfYRrR5ssxgfr3F13R8= 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=Z3MjoS6v; arc=none smtp.client-ip=192.198.163.15 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=1713359925; x=1744895925; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=RuHzYN0ZhBqkJDC8Ui0Nm3edOOTTp2WF+RIcT7keQlQ=; b=Z3MjoS6vLhbve00pn1jDDBm7HFc2hDU1ueBEYggr1dl40gb0FVbSGQNq 527vgUnegtKGMHQE3ZdNaSBTVsHDnysFd1u4BSIjIhZ3erhDQCXsxWK4h bPrdECyLiAi83ipfRR/z85C9kKKrCqU0QsOOkZJpFtpLE5Y78jmftwpfo 4nzLi2z+PWYymcUHTrAEevS45zmyF+y4dqKzKxJuObZyhv5H4d0VBhSAR tpZKudrHh9ZRPWBJDgoNmBK8rIgA/RhydoASDq7UEllnDd/HIXJP/m3TC Qsr+X76Ztf+nLvAWc7OFDnsA/usvcKpHoiQRz8hOmJ7WGxtNcHGG3GPOw Q==; X-CSE-ConnectionGUID: /GM8inDWTMuHvj7DRy79ng== X-CSE-MsgGUID: DaTE+ZnUSsO//O4LdEDRjA== X-IronPort-AV: E=McAfee;i="6600,9927,11046"; a="9018534" X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="9018534" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 06:18:44 -0700 X-CSE-ConnectionGUID: sMzf6z22SD618eNgS1KsNw== X-CSE-MsgGUID: FJFoLFuUSRyFr4MWccoxdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,209,1708416000"; d="scan'208";a="23211608" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.35]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2024 06:18:41 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Wed, 17 Apr 2024 16:18:37 +0300 (EEST) To: Shravan Kumar Ramani cc: Hans de Goede , Vadim Pasternak , David Thompson , platform-driver-x86@vger.kernel.org, LKML Subject: Re: [PATCH v1 2/3] platform/mellanox: mlxbf-pmc: Add support for 64-bit counters and cycle count In-Reply-To: Message-ID: References: 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 On Wed, 17 Apr 2024, Shravan Kumar Ramani wrote: > Add support for programming any counter to monitor the cycle count. > Since counting of cycles using 32-bit ocunters would result in frequent > wraparounds, add the ability to combine 2 adjacent 32-bit counters to > form 1 64-bit counter. > Both these features are supported by BlueField-3 PMC hardware, hence > the required bit-fields are exposed by the driver via sysfs to allow > the user to configure as needed. > > Signed-off-by: Shravan Kumar Ramani > Reviewed-by: David Thompson > Reviewed-by: Vadim Pasternak > --- > @@ -1799,6 +1902,37 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, unsigned int blk_ > attr = NULL; > } > > + if (pmc->block[blk_num].type == MLXBF_PMC_TYPE_CRSPACE) { > + /* > + * Couple adjacent odd and even 32-bit counters to form 64-bit counters > + * using "use_odd_counter" sysfs which has one bit per even counter. > + */ > + attr = &pmc->block[blk_num].attr_use_odd_counter; > + attr->dev_attr.attr.mode = 0644; > + attr->dev_attr.show = mlxbf_pmc_use_odd_counter_show; > + attr->dev_attr.store = mlxbf_pmc_use_odd_counter_store; > + attr->nr = blk_num; > + attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, > + "use_odd_counter"); > + if (!attr->dev_attr.attr.name) > + return -ENOMEM; > + pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; > + attr = NULL; > + > + /* Program crspace counters to count clock cycles using "count_clock" sysfs */ > + attr = &pmc->block[blk_num].attr_count_clock; > + attr->dev_attr.attr.mode = 0644; > + attr->dev_attr.show = mlxbf_pmc_count_clock_show; > + attr->dev_attr.store = mlxbf_pmc_count_clock_store; > + attr->nr = blk_num; > + attr->dev_attr.attr.name = devm_kasprintf(dev, GFP_KERNEL, > + "count_clock"); > + if (!attr->dev_attr.attr.name) > + return -ENOMEM; > + pmc->block[blk_num].block_attr[++i] = &attr->dev_attr.attr; > + attr = NULL; > + } Hi, What was the reason why this driver could not use .dev_groups to setup sysfs (filtering can be done with .is_visible)? -- i.