From patchwork Thu Feb 11 09:15:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 61710 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp78938lbl; Thu, 11 Feb 2016 01:19:31 -0800 (PST) X-Received: by 10.66.62.162 with SMTP id z2mr2465793par.128.1455182371188; Thu, 11 Feb 2016 01:19:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w83si11444980pfa.51.2016.02.11.01.19.30; Thu, 11 Feb 2016 01:19:31 -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 S1753255AbcBKJT0 (ORCPT + 30 others); Thu, 11 Feb 2016 04:19:26 -0500 Received: from mail-by2on0072.outbound.protection.outlook.com ([207.46.100.72]:12056 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751496AbcBKJQM (ORCPT ); Thu, 11 Feb 2016 04:16:12 -0500 Authentication-Results: 8bytes.org; dkim=none (message not signed) header.d=none; 8bytes.org; dmarc=none action=none header.from=amd.com; Received: from localhost.localdomain (124.121.8.20) by BLUPR12MB0435.namprd12.prod.outlook.com (10.162.92.140) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 09:16:00 +0000 From: Suravee Suthikulpanit To: , , , , CC: , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PATCH V4 1/6] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header Date: Thu, 11 Feb 2016 16:15:22 +0700 Message-ID: <1455182127-17551-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455182127-17551-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1455182127-17551-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: SINPR01CA0021.apcprd01.prod.exchangelabs.com (10.141.109.21) To BLUPR12MB0435.namprd12.prod.outlook.com (25.162.92.140) X-MS-Office365-Filtering-Correlation-Id: 29e9c46d-1c91-49c5-d8df-08d332c3f9fe X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0435; 2:NsvzZkC6ViBcTSyqRSZ/BnuKS0af2AnEyeJJdOV21RlwCnO0tPXG9/acBhwssfUOXoxh+UiWdRf2yrTD+FrVilVEopWrduHlOjNy13EOfBr2X5vNCUjG8Skkpk0sfPeWwJLHAnFp3V55F0XJ1/saqDtMwFqqhaPJabZnN5o06Jpa2xFpVfDtOAw+sYPYT10O; 3:ANlYVoqJzEhXPTNC1lh4fO9L4OCWKCGu3l/IYzQ5R92UQbHKJ9/qK21a9ROE7si/zr8KkH1G9HLH+l6LAblPFe2E7N/7eERH5BF6pXBK7ojYVLamw1tPPCPQbKcI7gSU; 25:le/3Y7GJ3uGW4BLUljUCJk3FpjP7em/E4TL0Ylourp0640qRDum1kgODhaqRQkllPFTmKgIeixDP34QiLYzVaWxXBKaqZfoO00u1QnmnX6Mc1n6LT/qSQBYSoKb8DgsHtlZqqV3fP6pJEAOBx9LjOmdxnrqBr8n6u0d1TxdnrpsXGvoV0qB6tMf0sbj8HsZOBv3JixZMqJYRZS6cTFSgUebcyk/qZEu8SACk5pZ2dIAxoae+pVzRQ6AfMFDgkpOC62g8fid8ak4G1OnJOqCrecP1NVRBpz8X6cAXj82ELYtFeFw+sH9rbeBjedukwTZj X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0435; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0435; 20:LeI6FYMf9qZS8y7/gWB4kgfYWpre/IuwYxRJ5N7OBaxik6KAQ6QUrv4FVDCmo107W0tQsK+sno7CyOIO94814izAG9t1UkQD7czNiN/lLdzmCOVoQcJ2jZTH29OWDiUfkp8KIPkM5Hdvkwo0WeMysFs0XUBgMNYJgGXZu9wsJlF3NpwLMA+v2wJM9JSA8V0bD1wBQPOlOh6l6Z8CQLL/FmFZI2Nr6PVeBHH9LQjDnzTXSZDDWz/ufi7GYSb3Dw14tm2O3CAxjG1pEEATuPY5v+znSFHQqH1dC02ZJk84XxSkKgreG9v+UBmcc+ZTc9VSrNrX4hic/MOa9sxvAQCCwRgkUnWBFadVnYYaUwvlzDV9DYQ/CLxrCfSsSW8qmOrH4j/IF/eWSjUByt3lPsDXImjZJZRV0SFoVsjnm2Da0H1KHlImAxItkOpWXF2/XcgaUPDMoV4vum7O1ALkLGtclc0yNjyiz1D5ceSo6N4ehoGsNKWD6KnD68uFMEjlzoXQ; 4:d828LiHu8dLCqkv9i7OKtWEs/7XwGJbHVXNQQtFA2loU5o0qpD1lNSBGdE2AWhwqcfBR1JuvFWf/8Svdgl3vEvFkt9gNrcAbd4XGIOcpeXb90umjUiKlgcIlFoaVQoJHB+qd4lwSPZmCmxRD5uoalk/0KJSM4b2kP4Qr+dzo/PejCPPXo9afzRHddt3Vxtw/jLlKfBgX7WaCt4/pKV54eRRndylhe7vZJU/TvcFBR2nI6iLK42IOgn6ty1qo282jZYSHHliMXzKWpXtzCVZ5BtdeoMHpGoxkVpTUtjcpu7QdTU4kkVNBPmYmZ94cIz5Bu78CINAweHemWyLhk9jCp6qe2VZ9k9MadkSXEPWmoZNSsRejM999IiJ86QfZS4qGbPwcQEwBlAV4AeZhlnf+SA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:BLUPR12MB0435; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0435; X-Forefront-PRVS: 08497C3D99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(50986999)(42186005)(5004730100002)(122386002)(2950100001)(19580395003)(77096005)(2906002)(87976001)(40100003)(229853001)(50466002)(2201001)(36756003)(19580405001)(5008740100001)(92566002)(50226001)(47776003)(6116002)(86362001)(66066001)(4326007)(189998001)(3846002)(5001960100002)(76176999)(48376002)(5001770100001)(586003)(1096002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0435; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0435; 23:t04JaYx6rd0SWVarik2qNAoHPLPUiGjApDIbhBnNdaoGfnWJYfLIOvd5NP9cLiVmJiA0nko5mKGfOM5ZcdKClyavUtbUcwM1woiyNaIivJ3AmfvkjjMy3i5xG5NHn0lV4/pfx1NCwiCM+Pcaw4VjfzIJ348EDt8rIhbzBDSZ4c/Dbum81DeODug/hjesGAoEcEd2Uc2mbuHgjyXQ0Si4YoMXZ1YOAdJ/SFB/pNJeLyRS/9FZKPR/4nvRZWE2V0qv4tZhtGhZCZa4sXH1yJN4ioqnVnZg2tb6E0V0vFjtEn5HMW6RxBNaMfPjxDfkRfUxEFYEmk9OwXzv6SPfn/7x9l1SR0w9oa4UJOIVDErIHk17PNjd3+C8cOniVzLX64zyOOTg2AJtI9zhRqflaoxpCjZD+tOoARVUjGLGFbkK1oNrHlN0jtZMknToUS+xL9b9NKkuEn526vRq2nRCSSyPdLMWBC0Y+9tAFq/cULpI9ZpbDSOD1l5M3O7kgwWNcqHCPxYY0aCdclT7a3+y0Gf8htDnCmobksS118sPF6ER9lOCTFv+Q3jg7OxooQye+7g7gC9YDGugRw8MvKdw3oj1uQEZGfwDlhY32Ibh+QIc/6F/92CUpv7QVHf2Pzv9rDZAgAiVYAJCPJYXMF9j73maSNbF+DCFLwrayYJUQau5R6zYzcaCF1zodHMK6GNkGM4ocMoGDufH5hj8ju4o70wwbEpnt4u/qJ3DbQCLjm12YdFhj40SZEmB1Ks1m0jPgpWNanokE/SCboylj5P/3vIGurK7pSSjlIRgPZJUFgQ37fP4nQYRu5iQMnUiARPHZqCBz26K8mpMWfuj2Hkncw0ASPSZgIP3px+hHOJbdGmns9jBKCoIE7Pvgm1yVRmLJZ9GQ9kduOvXIkV+xK3R0KWL7w== X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0435; 5:tN3cPaDbbxriuS7R98XB7m1e1AgqET3VoP6Cv6NrZX2IYt1hn6bIyqCzWniYErhpUyqvR2Gb4nLIrQ75AjHCEXJGJSciuluZlXZYMtlcyWQA/o3y+sFEc1WfL43pVM0J3uP2nylud1ZygEd3dP+xJw==; 24:U+pW0CARVfKlb3CBE7eVWw7OFSsgbj27WM+0OtPLFqvp6B2ayFagDzLKAlkB09431fy6ZlAhwZFoECrHPkGl/fdlwfY37OTBRuVHAMAwDf8=; 20:hvGclaRJKC4uD6N5yX8k3ixfOkWnMymw5tcYhEi7Y3C+iTWtmpn9jDDQZ6Bfe3za5ak0wypEF+1ZjJd+ZMUkfVc9KDYS8ZAizL+KjeG3mNKl3S000G0xaKYc1lXV79iJgQiCm8AVkd4JTt09LRpGyr9Lc0HNpG+Zv61x5nRbvuSB44SAjBUFrOBsH0HxpB3gPNmYUoLFpnvATjfA864nk+gbiUU+kqV36gN718QeongEk1B0UiLfNHTho3Nq02Sf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 09:16:00.0015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0435 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit First, this patch move arch/x86/events/amd/iommu.h to arch/x86/include/asm/perf/amd/iommu.h so that we easily include it in both perf-amd-iommu and amd-iommu drivers. Then, we consolidate declarion of AMD IOMMU performance counter APIs into one file. Reviewed-by: Joerg Roedel Signed-off-by: Suravee Suthikulpanit --- arch/x86/events/amd/iommu.c | 2 +- arch/x86/events/amd/iommu.h | 40 --------------------------------- arch/x86/include/asm/perf/amd/iommu.h | 42 +++++++++++++++++++++++++++++++++++ drivers/iommu/amd_iommu_init.c | 2 ++ drivers/iommu/amd_iommu_proto.h | 7 ------ 5 files changed, 45 insertions(+), 48 deletions(-) delete mode 100644 arch/x86/events/amd/iommu.h create mode 100644 arch/x86/include/asm/perf/amd/iommu.h -- 2.5.0 diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c index 629bc70..2f96072 100644 --- a/arch/x86/events/amd/iommu.c +++ b/arch/x86/events/amd/iommu.c @@ -15,9 +15,9 @@ #include #include #include +#include #include "../../kernel/cpu/perf_event.h" -#include "iommu.h" #define COUNTER_SHIFT 16 diff --git a/arch/x86/events/amd/iommu.h b/arch/x86/events/amd/iommu.h deleted file mode 100644 index 845d173..0000000 --- a/arch/x86/events/amd/iommu.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013 Advanced Micro Devices, Inc. - * - * Author: Steven Kinney - * Author: Suravee Suthikulpanit - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _PERF_EVENT_AMD_IOMMU_H_ -#define _PERF_EVENT_AMD_IOMMU_H_ - -/* iommu pc mmio region register indexes */ -#define IOMMU_PC_COUNTER_REG 0x00 -#define IOMMU_PC_COUNTER_SRC_REG 0x08 -#define IOMMU_PC_PASID_MATCH_REG 0x10 -#define IOMMU_PC_DOMID_MATCH_REG 0x18 -#define IOMMU_PC_DEVID_MATCH_REG 0x20 -#define IOMMU_PC_COUNTER_REPORT_REG 0x28 - -/* maximun specified bank/counters */ -#define PC_MAX_SPEC_BNKS 64 -#define PC_MAX_SPEC_CNTRS 16 - -/* iommu pc reg masks*/ -#define IOMMU_BASE_DEVID 0x0000 - -/* amd_iommu_init.c external support functions */ -extern bool amd_iommu_pc_supported(void); - -extern u8 amd_iommu_pc_get_max_banks(u16 devid); - -extern u8 amd_iommu_pc_get_max_counters(u16 devid); - -extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, - u8 fxn, u64 *value, bool is_write); - -#endif /*_PERF_EVENT_AMD_IOMMU_H_*/ diff --git a/arch/x86/include/asm/perf/amd/iommu.h b/arch/x86/include/asm/perf/amd/iommu.h new file mode 100644 index 0000000..72f64b7 --- /dev/null +++ b/arch/x86/include/asm/perf/amd/iommu.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 Advanced Micro Devices, Inc. + * + * Author: Steven Kinney + * Author: Suravee Suthikulpanit + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _PERF_EVENT_AMD_IOMMU_H_ +#define _PERF_EVENT_AMD_IOMMU_H_ + +/* iommu pc mmio region register indexes */ +#define IOMMU_PC_COUNTER_REG 0x00 +#define IOMMU_PC_COUNTER_SRC_REG 0x08 +#define IOMMU_PC_PASID_MATCH_REG 0x10 +#define IOMMU_PC_DOMID_MATCH_REG 0x18 +#define IOMMU_PC_DEVID_MATCH_REG 0x20 +#define IOMMU_PC_COUNTER_REPORT_REG 0x28 + +/* maximum specified bank/counters */ +#define PC_MAX_SPEC_BNKS 64 +#define PC_MAX_SPEC_CNTRS 16 + +/* iommu pc reg masks*/ +#define IOMMU_BASE_DEVID 0x0000 + +/* amd_iommu_init.c external support functions */ +bool amd_iommu_pc_supported(void); + +u8 amd_iommu_pc_get_max_banks(u16 devid); + +u8 amd_iommu_pc_get_max_counters(u16 devid); + +int amd_iommu_pc_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, u64 *value); + +int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, + u64 *value, bool is_write); + +#endif /*_PERF_EVENT_AMD_IOMMU_H_*/ diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 013bdff..d30f4b2 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -27,6 +27,8 @@ #include #include #include +#include + #include #include #include diff --git a/drivers/iommu/amd_iommu_proto.h b/drivers/iommu/amd_iommu_proto.h index 0bd9eb3..ac2da91 100644 --- a/drivers/iommu/amd_iommu_proto.h +++ b/drivers/iommu/amd_iommu_proto.h @@ -55,13 +55,6 @@ extern int amd_iommu_domain_set_gcr3(struct iommu_domain *dom, int pasid, extern int amd_iommu_domain_clear_gcr3(struct iommu_domain *dom, int pasid); extern struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev); -/* IOMMU Performance Counter functions */ -extern bool amd_iommu_pc_supported(void); -extern u8 amd_iommu_pc_get_max_banks(u16 devid); -extern u8 amd_iommu_pc_get_max_counters(u16 devid); -extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr, u8 fxn, - u64 *value, bool is_write); - #ifdef CONFIG_IRQ_REMAP extern int amd_iommu_create_irq_domain(struct amd_iommu *iommu); #else