Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1393498pxv; Fri, 16 Jul 2021 08:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Ckcxq1k3COSMy6+coFY46uDT7zQLGcK/VwgVLthkCgCvth4MsHAzL6psGI9pB+7/H433 X-Received: by 2002:a5d:6148:: with SMTP id y8mr13021758wrt.20.1626449003147; Fri, 16 Jul 2021 08:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626449003; cv=none; d=google.com; s=arc-20160816; b=p83alP3dF/JHDdQbcEc04a9sgXiZuERS7+9YkJYw/m36jxvE/F9sEACMCCzylSmcSq zQOP0sHPs+YyZpA5mgqLwo1PqtS4PSlPW7U/O6bVeeOclA8lXjjZtlUkiUtbvbTgtcLf exOzhWf0YDwBdsufLCt6gEP0qj4ptQUifrx0uLjrJZEKSutA8tiPlznmIB8rxgibPkAP euUTbL4JlkP/YNK3nLWkJK5SJgOTnlICwUOeX1yC47L+ZNFr1aLgBCWOuWqgkoImXZR0 vPQURCLYPlCF9142URiG2tebHOmWGpTJGtOyzO8E1or8r8PQpjMUyMXaUDslNNDSic9j 5h5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:to:from:dkim-signature; bh=m6L3I2bbr5p6whUwXOOjcad3gF5kGeLmjCADwSTG91s=; b=utcy72x4ozVbwEOn7nuNe8p3uVwzE/jURR+eKfsbxAN/VmgXCfjKpc6dnmnJh5pnMr pWB6JkKbvh8UsGMT7sr4pM1S6BEg40768Xc4XX1YYo65Fx+Jt870Y3alzMpT6tlUa4oc bMc6W1ekGxLa/K3A8nHbbQY1eVtN2EDHvALPTQ/lMgV5cho+9ASeNfaI5JOxaCJELBqB vtvq5PVptj2Yefe4RxzrtEzzqIu5yupyegUOsZgJ6KsnxSkV46s4xXkBEqACf2Besrxb ALUL62h7Mtvs0J6D6J9IjjkmoE/wrjXDIzC3IIq3mpYXk7xewXLh7zk4q9xoX8ThgT0v 3Kwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=U54EDYKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o8si11460859edw.60.2021.07.16.08.22.59; Fri, 16 Jul 2021 08:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=U54EDYKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240385AbhGPPY4 (ORCPT + 99 others); Fri, 16 Jul 2021 11:24:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48814 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233094AbhGPPYz (ORCPT ); Fri, 16 Jul 2021 11:24:55 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16GFJ4b5005832; Fri, 16 Jul 2021 11:21:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=m6L3I2bbr5p6whUwXOOjcad3gF5kGeLmjCADwSTG91s=; b=U54EDYKnK7Y9oYZSn1bdFyiq7pthErGyiw25xWrdQpPsMDpidHM/nq2UXeHL4aPY4QKu GU3cHcvuJU19wv5FdxIVCLDyqQf4+QawiX6IDbw8qXKICrN38hwqTYaNwopFpMN6vGd6 GCQ4MbiyheL6++9/vti+kRBLWHMkY7qLgEuHdYaxJomHruqceA+7R6y0xxHeq+qPl5A/ g8Iv6rmG3AXLdWXmQg7N1Y7TOUeAmH915GqTZFdCzpE+7aP03CEVprM2fMD0h3U/VSqB MPwb+RoVqFOoVxw2ac5mREIs5uuUQrupaeCFfmUOgpRy1LR9MIT79L5zgrmJqPSLyF+T Eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39tw2uhabp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jul 2021 11:21:41 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16GFJAeO009489; Fri, 16 Jul 2021 11:21:40 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 39tw2uhaat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jul 2021 11:21:40 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16GFIETh029358; Fri, 16 Jul 2021 15:21:38 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma02fra.de.ibm.com with ESMTP id 39s3p78wnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jul 2021 15:21:38 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16GFLZF725297360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Jul 2021 15:21:35 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9D9F11C064; Fri, 16 Jul 2021 15:21:35 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FA4A11C052; Fri, 16 Jul 2021 15:21:34 +0000 (GMT) Received: from pratiks-thinkpad.ibmuc.com (unknown [9.77.199.234]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 16 Jul 2021 15:21:34 +0000 (GMT) From: "Pratik R. Sampat" To: mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, psampat@linux.ibm.com, pratik.r.sampat@gmail.com Subject: [PATCH v4 0/1] Interface to represent PAPR firmware attributes Date: Fri, 16 Jul 2021 20:51:32 +0530 Message-Id: <20210716152133.72455-1-psampat@linux.ibm.com> X-Mailer: git-send-email 2.31.1 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: X8IUKhnqEkWZFD5Kx1u1RxMH-q6ZOEO9 X-Proofpoint-GUID: xP-IlT0J-zUJM2p2yUOrpoe1fgPppRmv Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-16_05:2021-07-16,2021-07-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 spamscore=0 bulkscore=0 clxscore=1015 adultscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107160092 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RFC: https://lkml.org/lkml/2021/6/4/791 PATCH v1: https://lkml.org/lkml/2021/6/16/805 PATCH v2: https://lkml.org/lkml/2021/7/6/138 PATCH v3: https://lkml.org/lkml/2021/7/12/2799 Changelog v3 --> v4 Based on a comment from Fabiano: 1. Resolved typo in documentation 2. Statically allocate "pgattrs" instead of kmalloc as size known at compile time 3. Converted sprintf calls to snprintf as size of buffer is known 4. Changed the implementation of "papr_show_desc" function to make an extra H_CALL as a result of making the scope of esi_hdr and esi_attrs local 5. Removed bailing out on version mismatch as the documentation states that the attribute structure can never change, only the data and that will not break the implementation. Hence just a warning is issued on version mismatch 6. Avoid passing a statically allocated buf to "pgs[idx].pg.name", instead used kasprintf to allocate and pass the data through Also, have implemented a POC using this interface for the powerpc-utils' ppc64_cpu --frequency command-line tool to utilize this information in userspace. The POC for the new interface has been hosted here: https://github.com/pratiksampat/powerpc-utils/tree/H_GET_ENERGY_SCALE_INFO_v2 Sample output from the powerpc-utils tool is as follows: # ppc64_cpu --frequency Power and Performance Mode: XXXX Idle Power Saver Status : XXXX Processor Folding Status : XXXX --> Printed if Idle power save status is supported Platform reported frequencies --> Frequencies reported from the platform's H_CALL i.e PAPR interface min : NNNN GHz max : NNNN GHz static : NNNN GHz Tool Computed frequencies min : NNNN GHz (cpu XX) max : NNNN GHz (cpu XX) avg : NNNN GHz Pratik R. Sampat (1): powerpc/pseries: Interface to represent PAPR firmware attributes .../sysfs-firmware-papr-energy-scale-info | 26 ++ arch/powerpc/include/asm/hvcall.h | 24 +- arch/powerpc/kvm/trace_hv.h | 1 + arch/powerpc/platforms/pseries/Makefile | 3 +- .../pseries/papr_platform_attributes.c | 331 ++++++++++++++++++ 5 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-papr-energy-scale-info create mode 100644 arch/powerpc/platforms/pseries/papr_platform_attributes.c -- 2.31.1