From patchwork Thu Mar 16 15:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 6765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp564344wrt; Thu, 16 Mar 2023 09:02:43 -0700 (PDT) X-Google-Smtp-Source: AK7set/ozRVHzdJAsJam48SN5JaORvcPXhzxAzEbVsCZBLKohonspR1NuzT5rIphwRjhGpfuuCQZ X-Received: by 2002:a62:587:0:b0:5a8:abd2:2beb with SMTP id 129-20020a620587000000b005a8abd22bebmr3133065pff.30.1678982562709; Thu, 16 Mar 2023 09:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678982562; cv=none; d=google.com; s=arc-20160816; b=Yza4HlwaQDQcDbcm69kNYQdU1mkFHaB1as87iED40lNH4COnDF8V508kysj6og4Mz2 /vwgrp3m4iUL1RMF5rM37GoYXE5gmliZc0bMSUJQGDQcQj+Gztmdp6L6mVeZMet3pMMF KOmDVZGLQ7NSWfK5/Ol2YRv+qSwL8/RcNIisRk5ArEgZi4IH9KAomBHfLygryWv+IhOk 1okXmzuTXHjaEM+C5pHo9H+z0fkiyXDEWa8Yxc6VABLsJ7Q9ZniG8vqI57b0/8CKTqSr DK8v73Wut5nP9oSLLsJalx4D47rJ/jygja65bXT9f1bcoDGACU6ThUf7zWnaAFuGJIIC gviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fxHORfIS5YmPhUirMIfKtjbreAchDtnxZ5mpbj/fjqs=; b=mQkvWTi3AdwKkil1TJ4IOT7TBoJNKG/v3gRspIMdADx6c63aEpyWJIYpcbm/NH1D2P NOEDB+c9T9+0GeYjHppIP9/Bnx03AJkLA9psdD2LnVI+K4Ojn3mUEEgED8PPszqi5RYr NgWauSU/qSQVQ7pYST8uN1vwm8QkcgMubuT4q9VuY7W06kewSefmaJhhYkq3B6JeZcFq aQsqi/TkKJna8hXJTxbiLsVigx0ApuVFDCR/PHKZsItBJhT0dpg9BZB1K/YbVbHHK6xd OY2vPK+zfCbNYzyweO6HKLoJg7D1U0AOp3F1oQXnlb1W4/xNJkfmdNXpxG3sgRJ7GG7V CrsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JIZpZcaO; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q84-20020a632a57000000b0050ac7d1b32asi8694892pgq.603.2023.03.16.09.02.26; Thu, 16 Mar 2023 09:02:42 -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=JIZpZcaO; 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 S231482AbjCPPlK (ORCPT + 99 others); Thu, 16 Mar 2023 11:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjCPPkp (ORCPT ); Thu, 16 Mar 2023 11:40:45 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9CE427D72; Thu, 16 Mar 2023 08:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678981202; x=1710517202; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TUgeqE4ATDv399pdRnSJTG3joPFb41oP5Y0X4tbedDE=; b=JIZpZcaOCnEA0QqUWZmZA+BehONk7ZEuxkvSllH9raleqbyPo1pvVelK Y+Dy+HEWsPHnAVIERH4bKz/lJQmxRGj8yGeHBMYvooEVHIqJWG0LxQe8h idkBmM8snEiMWYQGyVDn9ngzCfD5SWLjFJjCoPSUpSI16iCSAbsLD0k4Z jM8tdMnEz22392k8FsksSuHgdthqS3CCnmdhc4+O49Mtc3nQt2WnvD6Pz f1sL8oKYh3h4c9+k3LpBPxfcY+ZcSwwWjpij3LzQp2z5Qd2wa8ZcpebUB R/vohHm65lZaUtfbr8CGnEHsNBBwJynNeGmYqd3luG1i5gvdoRYsSdkGp w==; X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="339570930" X-IronPort-AV: E=Sophos;i="5.98,265,1673942400"; d="scan'208";a="339570930" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2023 08:38:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="1009266961" X-IronPort-AV: E=Sophos;i="5.98,265,1673942400"; d="scan'208";a="1009266961" Received: from feiwang3-mobl2.ccr.corp.intel.com (HELO rzhang1-DESK.intel.com) ([10.249.170.93]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2023 08:38:48 -0700 From: Zhang Rui To: linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com, daniel.lezcano@linaro.org Cc: linux-kernel@vger.kernel.org, srinivas.pandruvada@intel.com Subject: [PATCH 0/15] powercap/intel_rapl: Introduce RAPL TPMI support Date: Thu, 16 Mar 2023 23:38:26 +0800 Message-Id: <20230316153841.3666-1-rui.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760540819443110854?= X-GMAIL-MSGID: =?utf-8?q?1760540819443110854?= The TPMI (Topology Aware Register and PM Capsule Interface) provides a flexible, extendable and PCIe enumerable MMIO interface for PM features. The TPMI documentation can be downloaded from: https://github.com/intel/tpmi_power_management Intel RAPL (Running Average Power Limit) is one of the features that benefit from this. Using TPMI Interface has advantage over traditional MSR (Model Specific Register) interface, where a thread needs to be scheduled on the target CPU to read or write. Also the RAPL features vary between CPU models, and hence lot of model specific code. Here TPMI provides an architectural interface by providing hierarchical tables and fields, which will not need any model specific implementation. Given that there are some differences between RAPL TPMI Interface and the existing RAPL MSR/MMIO Interface, this patch series improves the RAPL common code to satisfy the new requirements from TPMI interface, and then introduces the RAPL TPMI Interface driver. Patch 1-4 cleanups and preparation work. Patch 5 adds support for per Domain Unit register. Patch 6-10 improves Power Limits handling, and provides support for per Power Limit register, and per Power Limit Lock. Patch 11-12 support rapl_package without online CPUs. So that TPMI rapl_package still works with whole package offlined. Patch 13-15 introduces RAPL Core support for TPMI Interface and the RAPL TPMI Interface driver. This series depends on the TPMI base driver which has been merged in 6.3-rc1. thanks, rui ---------------------------------------------------------------- Zhang Rui (15): powercap/intel_rapl: Remove unused field in struct rapl_if_priv powercap/intel_rapl: Allow probing without CPUID match powercap/intel_rapl: Support per Interface rapl_defaults powercap/intel_rapl: Support per Interface primitive information powercap/intel_rapl: Support per domain energy/power/time unit powercap/intel_rapl: Use index to initialize primitive information powercap/intel_rapl: Change primitive order powercap/intel_rapl: Use bitmap for Power Limits powercap/intel_rapl: Cleanup Power Limits support powercap/intel_rapl: Introduce per Power Limit lock powercap/intel_rapl: Remove redundant cpu parameter powercap/intel_rapl: Make cpu optional for rapl_package powercap/intel_rapl: Introduce RAPL I/F type powercap/intel_rapl: Introduce core support for TPMI interface powercap/intel_rapl_tpmi: Introduce RAPL TPMI interface driver drivers/powercap/Kconfig | 14 + drivers/powercap/Makefile | 1 + drivers/powercap/intel_rapl_common.c | 868 ++++++++++++--------- drivers/powercap/intel_rapl_msr.c | 14 +- drivers/powercap/intel_rapl_tpmi.c | 325 ++++++++ .../intel/int340x_thermal/processor_thermal_rapl.c | 11 +- include/linux/intel_rapl.h | 40 +- 7 files changed, 875 insertions(+), 398 deletions(-) create mode 100644 drivers/powercap/intel_rapl_tpmi.c