Received: by 10.223.164.202 with SMTP id h10csp1587192wrb; Thu, 23 Nov 2017 21:30:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMbC++kkpQmEXnArAZvwcPdRGu2NpahvjD7zmZ54BiNxoeWyQHWlTBOMIDB9UayOo11W9WxA X-Received: by 10.84.214.2 with SMTP id h2mr17726477pli.142.1511501414449; Thu, 23 Nov 2017 21:30:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511501414; cv=none; d=google.com; s=arc-20160816; b=tNCdomsOmiyw0AVTu3qOo394vGK2PTLzNknySaCNu3Oi8WzIPKPcEsa+oSGT3ykwdJ sXhwIIFLP7fnfXWR5MGfR+iyihUm97zWg9y6aPBA+k2HVQXZVTKnh8ZPts18oIgKgfbv rrTEhLoQ8E7/3+PqR7LW5m6pnLkbxbdMlWU7KuSugxIuXSAsEbzF25AeqfVBEClDQoru WOXMe/GMwUI7h0gqYhCUwi7x/0CO/o7tAntOCB6iSxbmdfP2erkcAqK5MDvVsmHRDxiK KSnA8CiFX1uKCND5lGw/yZaYcdGQ/4+0OffSPDlUpY6w7sRe/6MQqHjearswNiRdL+x6 KWEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=m/SS9Rjd6FYimAqWOaqOdpixaoFpggTQtk6GDDQY1C4=; b=T86dkoLJdB7YyTjps9qbV0RmTTwzx9c7vW8wfgXk8QjPuWJkR2S7GP0zXaPCyHVad0 nrE9vT58nBaORnHvaLRqIQ/GqQrJigGmE3q1KjIH2ueJLUhB7oysYUT7r+85AxSqSp/c nYx4+QRbn/8l1xAIMcSVhmJ2kw6wKfS0XKpP1YNkXnwVqHfBt3kpJZopZF/HWNgIxROq cyNBt03E9URnrjP8DB/ptkjz4acOkJcgPgDwzO03kgnT6d6+VzgOlOt2l2W8KrhxM3+y JLZyOU7UWErLghMgKH7Sameo6hP8lSCbFQkWticgKT8jaIVXQm6hOJAx52mzaRrpwAhw hBrw== 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 j1si17622731pgc.771.2017.11.23.21.30.03; Thu, 23 Nov 2017 21:30:14 -0800 (PST) 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 S1753145AbdKXF3I (ORCPT + 76 others); Fri, 24 Nov 2017 00:29:08 -0500 Received: from mga04.intel.com ([192.55.52.120]:18383 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750992AbdKXF2d (ORCPT ); Fri, 24 Nov 2017 00:28:33 -0500 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2017 21:28:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,444,1505804400"; d="scan'208";a="177169594" Received: from skchakra-desk-3.iind.intel.com ([10.66.254.101]) by orsmga005.jf.intel.com with ESMTP; 23 Nov 2017 21:28:31 -0800 From: Souvik Kumar Chakravarty To: platform-driver-x86@vger.kernel.org Cc: dvhart@infradead.org, andy@infradead.org, linux-kernel@vger.kernel.org, rajneesh.bhardwaj@intel.com, Souvik Kumar Chakravarty Subject: [PATCH v1 1/4] platform/x86: intel_pmc_ipc: Add read64 API Date: Fri, 24 Nov 2017 19:04:41 +0530 Message-Id: <1511530484-29845-2-git-send-email-souvik.k.chakravarty@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511530484-29845-1-git-send-email-souvik.k.chakravarty@intel.com> References: <1511530484-29845-1-git-send-email-souvik.k.chakravarty@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add intel_pmc_gcr_read64() API for reading from 64-bit GCR registers. This API will be called from intel_telemetry. Update description of intel_pmc_gcr_read(). Signed-off-by: Souvik Kumar Chakravarty --- arch/x86/include/asm/intel_pmc_ipc.h | 6 ++++++ drivers/platform/x86/intel_pmc_ipc.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/intel_pmc_ipc.h b/arch/x86/include/asm/intel_pmc_ipc.h index fac89eb..19c9369 100644 --- a/arch/x86/include/asm/intel_pmc_ipc.h +++ b/arch/x86/include/asm/intel_pmc_ipc.h @@ -37,6 +37,7 @@ int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, u32 outlen); int intel_pmc_s0ix_counter_read(u64 *data); int intel_pmc_gcr_read(u32 offset, u32 *data); +int intel_pmc_gcr_read64(u32 offset, u64 *data); int intel_pmc_gcr_write(u32 offset, u32 data); int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val); @@ -69,6 +70,11 @@ static inline int intel_pmc_gcr_read(u32 offset, u32 *data) return -EINVAL; } +static inline int intel_pmc_gcr_read64(u32 offset, u64 *data) +{ + return -EINVAL; +} + static inline int intel_pmc_gcr_write(u32 offset, u32 data) { return -EINVAL; diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c index e03fa314..e7edc8c 100644 --- a/drivers/platform/x86/intel_pmc_ipc.c +++ b/drivers/platform/x86/intel_pmc_ipc.c @@ -215,11 +215,11 @@ static inline int is_gcr_valid(u32 offset) } /** - * intel_pmc_gcr_read() - Read PMC GCR register + * intel_pmc_gcr_read() - Read a 32-bit PMC GCR register * @offset: offset of GCR register from GCR address base * @data: data pointer for storing the register output * - * Reads the PMC GCR register of given offset. + * Reads the 32-bit PMC GCR register at given offset. * * Return: negative value on error or 0 on success. */ @@ -244,6 +244,35 @@ int intel_pmc_gcr_read(u32 offset, u32 *data) EXPORT_SYMBOL_GPL(intel_pmc_gcr_read); /** + * intel_pmc_gcr_read64() - Read a 64-bit PMC GCR register + * @offset: offset of GCR register from GCR address base + * @data: data pointer for storing the register output + * + * Reads the 64-bit PMC GCR register at given offset. + * + * Return: negative value on error or 0 on success. + */ +int intel_pmc_gcr_read64(u32 offset, u64 *data) +{ + int ret; + + spin_lock(&ipcdev.gcr_lock); + + ret = is_gcr_valid(offset); + if (ret < 0) { + spin_unlock(&ipcdev.gcr_lock); + return ret; + } + + *data = readq(ipcdev.gcr_mem_base + offset); + + spin_unlock(&ipcdev.gcr_lock); + + return 0; +} +EXPORT_SYMBOL_GPL(intel_pmc_gcr_read64); + +/** * intel_pmc_gcr_write() - Write PMC GCR register * @offset: offset of GCR register from GCR address base * @data: register update value -- 2.7.4 From 1584968802801678342@xxx Fri Nov 24 17:20:39 +0000 2017 X-GM-THRID: 1584938332377754035 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread