Received: by 10.213.65.68 with SMTP id h4csp4251663imn; Tue, 10 Apr 2018 11:42:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/r0medNEx9e0vcmGgtiBMK8Nfe+AgJ2xRE+j9jDWGElYn0DDLo3bqd5q3qFvmQPSJ6z1gZ X-Received: by 2002:a17:902:407:: with SMTP id 7-v6mr1574557ple.47.1523385743335; Tue, 10 Apr 2018 11:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523385743; cv=none; d=google.com; s=arc-20160816; b=IUIZi6Eu53Yq75EriPnmP4J2rDXvGisNDQSg4954KiyejwCXDL9HBC77X+U8Ei4FPw rRy3Awq34EFi40NnAf5eePZB+v4dk2FT2rCLwzOFB8yFGw7gD1BcucWSIaIOvexgKL8w QUYUNR9FOHJVirW4L2v/wtAJG8IcUlMO6fGw7KaubjHAId0foU2optJHaoQ6LCPpEtcl 705scKSRwfb6iqM64R1g/Ry6WAXUvl99MfaqoU4hPvKL8i0MfMRjmpV5kCdDaqXal7u0 QS+KAdE7C+/Gq3N/j2dmSTNcVV1qGTMtB4DpPfeL93yVRKsJCYI6Xe1m7geSEiSZ5Bk5 TMRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vqeBPi7dogQUkn5SYwoBUUXC9dUqElb3WLjdzCwEJE8=; b=YlJCqqFqc1RTw3DuCfkeVO+MIORbb5VLSzdxfminNVWvtrR3nA42jzpLLdLEolxVXn 0aSUV3pVNGEe+cyT/tSyyEigIMSjJ92g0T6/i8mMoUE2E6v01Yk1P7iZXizYJk/wV+As UlFgxqEI5Sad7R67MLnvF+kWaQ5u85uNEaZUQ3PX2ksRZx/SESZFxoinc/11g2L/B3qp RrTF/3Lt1DAevJHdi70/XpzXHLSXcBXeb8dBCdseP4YM2WHv9T+6iTkhRPngEgNyx6ov OjZsq2rU3amdxH0lH6F1eGjhrPC4+vZgZWWWX17Y2WFL60Q+e6XDhMZEr33nmVtYV3NC 7ZjA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi12-v6si3084667plb.333.2018.04.10.11.41.46; Tue, 10 Apr 2018 11:42:23 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752134AbeDJScs (ORCPT + 99 others); Tue, 10 Apr 2018 14:32:48 -0400 Received: from mga06.intel.com ([134.134.136.31]:23451 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbeDJSco (ORCPT ); Tue, 10 Apr 2018 14:32:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2018 11:32:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,433,1517904000"; d="scan'208";a="219323698" Received: from maru.jf.intel.com ([10.54.51.80]) by fmsmga006.fm.intel.com with ESMTP; 10 Apr 2018 11:32:42 -0700 From: Jae Hyun Yoo To: Alan Cox , Andrew Jeffery , Andrew Lunn , Andy Shevchenko , Arnd Bergmann , Benjamin Herrenschmidt , Fengguang Wu , Greg KH , Guenter Roeck , Haiyue Wang , James Feist , Jason M Biils , Jean Delvare , Joel Stanley , Julia Cartwright , Miguel Ojeda , Milton Miller II , Pavel Machek , Randy Dunlap , Stef van Os , Sumeet R Pawnikar , Vernon Mauery Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, openbmc@lists.ozlabs.org, Jae Hyun Yoo Subject: [PATCH v3 00/10] PECI device driver introduction Date: Tue, 10 Apr 2018 11:32:02 -0700 Message-Id: <20180410183212.16787-1-jae.hyun.yoo@linux.intel.com> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduction of the Platform Environment Control Interface (PECI) bus device driver. PECI is a one-wire bus interface that provides a communication channel between an Intel processor and chipset components to external monitoring or control devices. PECI is designed to support the following sideband functions: * Processor and DRAM thermal management - Processor fan speed control is managed by comparing Digital Thermal Sensor (DTS) thermal readings acquired via PECI against the processor-specific fan speed control reference point, or TCONTROL. Both TCONTROL and DTS thermal readings are accessible via the processor PECI client. These variables are referenced to a common temperature, the TCC activation point, and are both defined as negative offsets from that reference. - PECI based access to the processor package configuration space provides a means for Baseboard Management Controllers (BMC) or other platform management devices to actively manage the processor and memory power and thermal features. * Platform Manageability - Platform manageability functions including thermal, power, and error monitoring. Note that platform 'power' management includes monitoring and control for both the processor and DRAM subsystem to assist with data center power limiting. - PECI allows read access to certain error registers in the processor MSR space and status monitoring registers in the PCI configuration space within the processor and downstream devices. - PECI permits writes to certain registers in the processor PCI configuration space. * Processor Interface Tuning and Diagnostics - Processor interface tuning and diagnostics capabilities (Intel Interconnect BIST). The processors Intel Interconnect Built In Self Test (Intel IBIST) allows for infield diagnostic capabilities in the Intel UPI and memory controller interfaces. PECI provides a port to execute these diagnostics via its PCI Configuration read and write capabilities. * Failure Analysis - Output the state of the processor after a failure for analysis via Crashdump. PECI uses a single wire for self-clocking and data transfer. The bus requires no additional control lines. The physical layer is a self-clocked one-wire bus that begins each bit with a driven, rising edge from an idle level near zero volts. The duration of the signal driven high depends on whether the bit value is a logic '0' or logic '1'. PECI also includes variable data transfer rate established with every message. In this way, it is highly flexible even though underlying logic is simple. The interface design was optimized for interfacing between an Intel processor and chipset components in both single processor and multiple processor environments. The single wire interface provides low board routing overhead for the multiple load connections in the congested routing area near the processor and chipset components. Bus speed, error checking, and low protocol overhead provides adequate link bandwidth and reliability to transfer critical device operating conditions and configuration information. This implementation provides the basic framework to add PECI extensions to the Linux bus and device models. A hardware specific 'Adapter' driver can be attached to the PECI bus to provide sideband functions described above. It is also possible to access all devices on an adapter from userspace through the /dev interface. A device specific 'Client' driver also can be attached to the PECI bus so each processor client's features can be supported by the 'Client' driver through an adapter connection in the bus. This patch set includes Aspeed 24xx/25xx PECI driver and PECI cputemp/dimmtemp drivers as the first implementation for both adapter and client drivers on the PECI bus framework. Please review. Thanks, -Jae Changes from v2: * Divided peci-hwmon driver into two drivers, peci-cputemp and peci-dimmtemp. * Added generic dt binding documents for PECI bus, adapter and client. * Removed in_atomic() call from the PECI core driver. * Improved PECI commands masking logic. * Added permission check logic for PECI ioctls. * Removed unnecessary type casts. * Fixed some invalid error return codes. * Added the mark_updated() function to improve update interval checking logic. * Fixed a bug in populated DIMM checking function. * Fixed some typo, grammar and style issues in documents. * Rewrote hwmon drivers to use devm_hwmon_device_register_with_info API. * Made peci_match_id() function as a static. * Replaced a deprecated create_singlethread_workqueue() call with an alloc_ordered_workqueue() call. * Reordered local variable definitions in reversed xmas tree notation. * Listed up client CPUs that can be supported by peci-cputemp and peci-dimmtemp hwmon drivers. * Added CPU generation detection logic which checks CPUID signature through PECI connection. * Improved interrupt handling logic in the Aspeed PECI adapter driver. * Fixed SPDX license identifier style in header files. * Changed some macros in peci.h to static inline functions. * Dropped sleepable context checking code in peci-core. * Adjusted rt_mutex protection scope in peci-core. * Moved adapter->xfer() checking code into peci_register_adapter(). * Improved PECI command retry checking logic. * Changed ioctl base from 'P' to 0xb6 to avoid confiliction and updated ioctl-number.txt to reflect the ioctl number of PECI subsystem. * Added a comment to describe PECI retry action. * Simplified return code handling of peci_ioctl_ping(). * Changed type of peci_ioctl_fn[] to static const. * Fixed range checking code for valid PECI commands. * Fixed the error return code on invalid PECI commands. * Fixed incorrect definitions of PECI ioctl and its handling logic. Changes from v1: * Additionally implemented a core driver to support PECI linux bus driver model. * Modified Aspeed PECI driver to make that to be an adapter driver in PECI bus. * Modified PECI hwmon driver to make that to be a client driver in PECI bus. * Simplified hwmon driver attribute labels and removed redundant strings. * Removed core_nums from device tree setting of hwmon driver and modified core number detection logic to check the resolved_core register in client CPU's local PCI configuration area. * Removed dimm_nums from device tree setting of hwmon driver and added populated DIMM detection logic to support dynamic creation. * Removed indexing gap on core temperature and DIMM temperature attributes. * Improved hwmon registration and dynamic attribute creation logic. * Fixed structure definitions in PECI uapi header to make that use __u8, __u16 and etc. * Modified wait_for_completion_interruptible_timeout error handling logic in Aspeed PECI driver to deliver errors correctly. * Removed low-level xfer command from ioctl and kept only high-level PECI command suite as ioctls. * Fixed I/O timeout logic in Aspeed PECI driver using ktime. * Added a function into hwmon driver to simplify update delay checking. * Added a function into hwmon driver to convert 10.6 to millidegree. * Dropped non-standard attributes in hwmon driver. * Fixed OF table for hwmon to make it indicate as a PECI client of Intel CPU target. * Added a maintainer of PECI subsystem into MAINTAINERS document. Fengguang Wu (1): drivers/peci: Add support for PECI bus driver core Jae Hyun Yoo (10): Documentations: dt-bindings: Add documents of generic PECI bus, adapter and client drivers Documentations: ioctl: Add ioctl numbers for PECI subsystem drivers/peci: Add support for PECI bus driver core Documentations: dt-bindings: Add a document of PECI adapter driver for Aspeed AST24xx/25xx SoCs ARM: dts: aspeed: peci: Add PECI node drivers/peci: Add a PECI adapter driver for Aspeed AST24xx/AST25xx Documentation: dt-bindings: Add documents for PECI hwmon client drivers Documentation: hwmon: Add documents for PECI hwmon client drivers drivers/hwmon: Add PECI hwmon client drivers Add a maintainer for the PECI subsystem .../devicetree/bindings/hwmon/peci-cputemp.txt | 24 + .../devicetree/bindings/hwmon/peci-dimmtemp.txt | 25 + .../devicetree/bindings/peci/peci-adapter.txt | 23 + .../devicetree/bindings/peci/peci-aspeed.txt | 60 + .../devicetree/bindings/peci/peci-bus.txt | 15 + .../devicetree/bindings/peci/peci-client.txt | 25 + Documentation/hwmon/peci-cputemp | 88 ++ Documentation/hwmon/peci-dimmtemp | 50 + Documentation/ioctl/ioctl-number.txt | 2 + MAINTAINERS | 10 + arch/arm/boot/dts/aspeed-g4.dtsi | 25 + arch/arm/boot/dts/aspeed-g5.dtsi | 25 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/hwmon/Kconfig | 28 + drivers/hwmon/Makefile | 2 + drivers/hwmon/peci-cputemp.c | 783 ++++++++++++ drivers/hwmon/peci-dimmtemp.c | 432 +++++++ drivers/peci/Kconfig | 45 + drivers/peci/Makefile | 9 + drivers/peci/peci-aspeed.c | 504 ++++++++ drivers/peci/peci-core.c | 1291 ++++++++++++++++++++ include/linux/peci.h | 107 ++ include/uapi/linux/peci-ioctl.h | 200 +++ 24 files changed, 3776 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwmon/peci-cputemp.txt create mode 100644 Documentation/devicetree/bindings/hwmon/peci-dimmtemp.txt create mode 100644 Documentation/devicetree/bindings/peci/peci-adapter.txt create mode 100644 Documentation/devicetree/bindings/peci/peci-aspeed.txt create mode 100644 Documentation/devicetree/bindings/peci/peci-bus.txt create mode 100644 Documentation/devicetree/bindings/peci/peci-client.txt create mode 100644 Documentation/hwmon/peci-cputemp create mode 100644 Documentation/hwmon/peci-dimmtemp create mode 100644 drivers/hwmon/peci-cputemp.c create mode 100644 drivers/hwmon/peci-dimmtemp.c create mode 100644 drivers/peci/Kconfig create mode 100644 drivers/peci/Makefile create mode 100644 drivers/peci/peci-aspeed.c create mode 100644 drivers/peci/peci-core.c create mode 100644 include/linux/peci.h create mode 100644 include/uapi/linux/peci-ioctl.h -- 2.16.2