Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1490227lqe; Mon, 8 Apr 2024 10:14:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsEUgQhgHm4lUTqvHAXHOIMT0edyXCSiCg3i1mCr5hmPZZ3RmojK69tJRxjswr3uRvm3om4Q4kuPwPQnGNDjWRxtZQ9enGbouuqZWA6A== X-Google-Smtp-Source: AGHT+IG9i5pZPLRS4ul14zlpFpFwKq2a8MkoFk6H3LSW34tn20mCrYw+YAr7WIyeIgfPr7zE079A X-Received: by 2002:a05:6a00:2283:b0:6ec:f5cf:2bb1 with SMTP id f3-20020a056a00228300b006ecf5cf2bb1mr10248518pfe.6.1712596444739; Mon, 08 Apr 2024 10:14:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712596444; cv=pass; d=google.com; s=arc-20160816; b=LS6H0v/x4qeuE8rIIx8HBahC4HN6JiMflTkncILApXcANxhMBYwZfzHdG+3bF3k2v6 K1vVqiwrmGA0emKjCUtooXfftm84959jpWNQaLn8JQ6nGOvvGCzymQM5xnl5PpKel1jh vKXwMEhyMDe3V/nVPxrsD9s8A44TMGF70OPyOP0vGx3UwY+Mh7CkwZhgsfrSpPjXnTqk UzXvk2oMuXl8mzrJNIiriMI+iCO0gx002gJudl+SbAcA8/zlJ16w8OIINCb4G1VsaP8X jEmqYPu6sX9xyP7jidGRNRFPXHqi527NbmvvHdS4RYzpl76d7jAYsy04p4RZCn5HNE4U yKQw== 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=8j8Qi29N0ZU5cy2+o8r3Z5tqGT82pSoPK2Aglh8Q7rA=; fh=3GUgNX5Y4IZGBhdL6Wgk67bVgDENWiYgvZ13WZtAURA=; b=jc6F7kJ8F7EmDHb/idJM2rMo7T8StCq7zmwjxAysedf/hD1Q3QzEF17lmZX2oY8zNK TR5hvfjwdlqHQ+ztFC114Z2U3N8N+XOK9r4hprzGEPqc1CXcbF9wUFdWnfUjGAHFvBf0 rZ/SQnjlO2HHnj90NpaVFXcGJJWOJ7NJr8POx1kNJ/DsV42FUlp3FuIVYxO5zJz9mZhP 8hUY0fLn2wY4wJSoxiRI9xHHYOyZm4f7wkKHSdnVJQlNdX20jU/RHHKe6WpOknPCqayd drMkDd3UdEKq4S2J2rdK6mN0i6nTi6SIDFQszZ4HbmP6mzJ9tRm8sswkyw2j2dCqICgN JhUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nqxH6EO/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-135734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f9-20020a056a0022c900b006ed21c12b7csi3566304pfj.35.2024.04.08.10.14.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 10:14:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nqxH6EO/"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-135734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135734-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4CE642881B2 for ; Mon, 8 Apr 2024 17:14:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9B3214388F; Mon, 8 Apr 2024 17:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nqxH6EO/" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 A5AEC142906; Mon, 8 Apr 2024 17:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712596438; cv=none; b=bZ9WOT3B59JO/KdcDlRf2YKl+RGcpRXR9nHwAuFTaZcWLWSSRUpZISGTLKcNr4loApG+qouyAZSCu4U78ikPmqYP5l7to+bn9ILo6RhzOiSWVtIK4aHLIv5HcrxvyfD8z7q+VjF9SjA0NwqAwtwdY6/w66f8G7Eu9zwq5FFXve0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712596438; c=relaxed/simple; bh=aHlnDtYgF5sHA2gDq8CnXU8bKMjq82wegMvazgZEzcA=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=LMV5LH79wixvG4ssmdo6A8n4geaL2zrdTLjpsb+mH7LhGKc9Z7KzAyU+HOAoz47Grn9R+8/L0bf1ET44rMw0Q0t0kK5J2AOWPpf2FD8TWqpQuotUEj+NaTBM6Uj4ROUgruwgme57/6H/KjQ1wrYkhziJ5K39f0+uRmaHAE9ulUc= 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=nqxH6EO/; arc=none smtp.client-ip=198.175.65.19 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=1712596437; x=1744132437; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=aHlnDtYgF5sHA2gDq8CnXU8bKMjq82wegMvazgZEzcA=; b=nqxH6EO/IQGroE1oute6a16TDL+muJZ/mw+YwdDhitum4YUPKM938wyy hISeFh248R2lMiirgujedbYetWUzEcMs26t+CfA+dIMCHA7y6rln+cflh vOHjzq97l4jmbHjGmxQx0Ttz97k+uez9DINSNhS7hAbLTrIyHwhOrcu8l tPD25RBCp5xKVltCgV4h1JG2FDD+prvJxjaaav4xpxnlxr8KnibRtxPZR P+N0oRmgwS8tnPEaskeBHdk6oN9bix7NREB2KuLb5qMh2kf/YSvrpZSKO qgPTwA6uQN2jRcvixkh7RCJrCFJqAH8u9z3plNPOPl1X75TDLjL7/m1j0 Q==; X-CSE-ConnectionGUID: gyyuA4WNQOWAl8J0G7EhHQ== X-CSE-MsgGUID: ytWg8u74QDiBPXvlWuhXXg== X-IronPort-AV: E=McAfee;i="6600,9927,11038"; a="7757073" X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="7757073" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 10:13:57 -0700 X-CSE-ConnectionGUID: mz3ABMMCR9eOvJxOt3sZeg== X-CSE-MsgGUID: xOx9u3YGSe6uW+ZzVt3uHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,187,1708416000"; d="scan'208";a="19977335" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.28]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2024 10:13:54 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Mon, 8 Apr 2024 20:13:50 +0300 (EEST) To: "David E. Box" cc: Hans de Goede , platform-driver-x86@vger.kernel.org, LKML , sathyanarayanan.kuppuswamy@linux.intel.com Subject: Re: [PATCH V3 6/9] tools/arch/x86/intel_sdsi: Fix meter_show display In-Reply-To: <20240405032507.2637311-7-david.e.box@linux.intel.com> Message-ID: <567552c0-db6b-21db-aa89-2950f5a802ad@linux.intel.com> References: <20240405032507.2637311-1-david.e.box@linux.intel.com> <20240405032507.2637311-7-david.e.box@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: multipart/mixed; boundary="8323328-1469216011-1712596430=:14302" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1469216011-1712596430=:14302 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 4 Apr 2024, David E. Box wrote: > Fixes sdsi_meter_cert_show() to correctly decode and display the meter > certificate output. Adds and displays a missing version field, displays t= he > ASCII name of the signature, and fixes the print alignment. >=20 > Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading= meter certificates") > Signed-off-by: David E. Box > --- > V3 - Change patch subject and changelog to clarify changes. > - Use new BUNDLE_COUNT #def >=20 > V2 - Split of V1 patch 7 >=20 > tools/arch/x86/intel_sdsi/intel_sdsi.c | 29 +++++++++++++++++--------- > 1 file changed, 19 insertions(+), 10 deletions(-) >=20 > diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/inte= l_sdsi/intel_sdsi.c > index 7eaffcbff788..a0711177e1bb 100644 > --- a/tools/arch/x86/intel_sdsi/intel_sdsi.c > +++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c > @@ -153,11 +153,12 @@ struct bundle_encoding { > }; > =20 > struct meter_certificate { > -=09uint32_t block_signature; > +=09uint32_t signature; > +=09uint32_t version; > +=09uint64_t ppin; > =09uint32_t counter_unit; > -=09uint64_t ppin; > =09uint32_t bundle_length; > -=09uint32_t reserved; > +=09uint64_t reserved; > =09uint32_t mmrc_encoding; > =09uint32_t mmrc_counter; > }; > @@ -338,6 +339,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s) > =09uint32_t count =3D 0; > =09FILE *cert_ptr; > =09int ret, size; > +=09char name[4]; > =20 > =09ret =3D sdsi_update_registers(s); > =09if (ret) > @@ -379,12 +381,19 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s) > =09printf("\n"); > =09printf("Meter certificate for device %s\n", s->dev_name); > =09printf("\n"); > -=09printf("Block Signature: 0x%x\n", mc->block_signature); > -=09printf("Count Unit: %dms\n", mc->counter_unit); > -=09printf("PPIN: 0x%lx\n", mc->ppin); > -=09printf("Feature Bundle Length: %d\n", mc->bundle_length); > -=09printf("MMRC encoding: %d\n", mc->mmrc_encoding); > -=09printf("MMRC counter: %d\n", mc->mmrc_counter); > + > +=09get_feature(mc->signature, name); > +=09printf("Signature: %.4s\n", name); > + > +=09printf("Version: %d\n", mc->version); > +=09printf("Count Unit: %dms\n", mc->counter_unit); > +=09printf("PPIN: 0x%lx\n", mc->ppin); > +=09printf("Feature Bundle Length: %d\n", mc->bundle_length); > + > +=09get_feature(mc->mmrc_encoding, name); > +=09printf("MMRC encoding: %.4s\n", name); > + > +=09printf("MMRC counter: %d\n", mc->mmrc_counter); > =09if (mc->bundle_length % 8) { > =09=09fprintf(stderr, "Invalid bundle length\n"); > =09=09return -1; > @@ -398,7 +407,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s) > =20 > =09bec =3D (void *)(mc) + sizeof(mc); > =20 > -=09printf("Number of Feature Counters: %d\n", mc->bundle_length= / 8); > +=09printf("Number of Feature Counters: %ld\n", BUNDLE_COUNT(mc->bundle= _length)); > =09while (count++ < mc->bundle_length / 8) { > =09=09char feature[5]; Reviewed-by: Ilpo J=E4rvinen --=20 i. --8323328-1469216011-1712596430=:14302--