From patchwork Fri Jan 1 18:13:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 59103 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp4081659lbb; Fri, 1 Jan 2016 10:26:26 -0800 (PST) X-Received: by 10.66.55.39 with SMTP id o7mr107526527pap.13.1451672785923; Fri, 01 Jan 2016 10:26:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tz9si27836527pac.197.2016.01.01.10.26.25; Fri, 01 Jan 2016 10:26:25 -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 S1752586AbcAAS0U (ORCPT + 29 others); Fri, 1 Jan 2016 13:26:20 -0500 Received: from mail-by2on0075.outbound.protection.outlook.com ([207.46.100.75]:54991 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752278AbcAASYc (ORCPT ); Fri, 1 Jan 2016 13:24:32 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from ssuthiku-cz-dev.amd.com (165.204.77.1) by SN1PR12MB0446.namprd12.prod.outlook.com (10.162.105.14) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 1 Jan 2016 18:24:28 +0000 From: Suravee Suthikulpanit To: , , , , CC: , , Suravee Suthikulpanit Subject: [PATCH v2 1/6] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header Date: Fri, 1 Jan 2016 12:13:35 -0600 Message-ID: <1451672020-2150-2-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451672020-2150-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1451672020-2150-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR01CA041.prod.exchangelabs.com (25.160.23.31) To SN1PR12MB0446.namprd12.prod.outlook.com (25.162.105.14) X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 2:dgQd2bbptp/JO3kjhbKCDgI0a2prrLPuIDA0r0LfNgV1aUc2gQm72dc1he0r9FgOihh7icd2dXD0i1ISIptRC7qIe+HdTVE1zaYxI2JtQtXBKJElwGKqSQZJrendfxtcIxIidMEtnnrHhKoeYk72gg==; 3:frnHiMK3yooFRgxqbZR6Nlbcu3CQviHoFBcwe4k7CIPpWNF6ItvEABcgoezZ39+z18xqn4UYTbNV7hUVR8wOSiHMg5Urbm7epsk9j4jvsKM6/PJpyEq8QGwk12z/vshu; 25:e3NT19SLRZipkUBbKLeALKe8lzDKyHi8F3TjMpcaPRhZooLsXTDTa9e0lyLGryHSU4enCtKnPuAUU1Qhlf4KrfdIPnGO46OGETge0F6mq16iGLNlw9AHShjXqIbKnOxhIlf32ejrCREv9awAKMO7QqRoLGZ7emfAX9pfFgBYipaWG7ewEqPpKQCYY2pStMZLRf1ChJTxfUgS/jhZNXorUHKf1cXDTPz9g9rwPl4RDsaftHAA2b27pAcAf4gsWmrE2Fyp8LbTRfdqT1ROmnbc9Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0446; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 20:5e5qfA8/g+vkIIbVi+A5PUcltGBUJ8Rze3HEtodH87/DyLdCGk7661U2ABOY1KzCfQPgFVSjHyPd/oSy5a5VdQTJFbcK8ASG6jVQIm4710Wr9+uwKHNCvrCkKF4whJdgfgl1EwhxgKNagdu//FU1LkgAG5WHZIkDww7X0BUfzr2WgcXGkN0cxRvX+Jgc6hS4lLaz6BJ7SuimiS7SbFkzf/iXL7hFJ/5XQbrXuAzjk05DegMumAYIg3cPTsUmW90B7ic/X82hWTBuYWi2l6TTWG0fDmPIbfjKaRWoL08CyiRfXfqLxyIRb5hIsbMYBTZfiA+nXnwdXDf65hM2E0PpsjEXujEtklqjqJIPpA9FIqem0Vzx+PnczbwrP+HXTj6L11PHwyVpXqfYKake0PIZPiLGxbVbopR8NZXsIytvHcLKnos6oooeC3Rt0UvF/vC6/SMIsm3NT+B4+IgsKXrLfhql6V5arsubA6M2iyhdKKwgrLOVlTw6i4DMVkMEjB2e; 4:JsmmF26h8bQESWrVuSPceOCjuMiFCr9yxY5/N9rVBNaNnSoZdScMLylhXsDSgf16DDtPn8JK2ndX9FmSi4SJa10pgk9TOEui7waOSve80oaVwsSIXu0ZPBUKvTTRYSQ6oM2WSuq4UiYiXLnbbcR0DvgmDPpe1wIyIGV7TM4GCzGNjP/vExjeoIzfGg0oF3bCXUexXGqotLq17XwTmw6+osnIKSIhv5DiM++1udAekIrYkIGhB713zp6YPWTesbLeQTO9bMg2MThIMz4NHrjvl1Zg63I017gcfYVsMpLMO8MxcuTk2HrfkxFc6zgaSy1WPvMMinUCyGb9r17vy53LnHiSXcUmV+i3zqUCOjbXAW00uXHKEmGxJlbEDhAYjGGNypDejLi5SEY9q8kyyjJbE5+5m1V/4uHvTf0VXHzncEk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:SN1PR12MB0446; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0446; X-Forefront-PRVS: 0808323E97 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(189002)(199003)(5008740100001)(19580405001)(97736004)(36756003)(66066001)(50986999)(3846002)(50466002)(586003)(6116002)(40100003)(19580395003)(229853001)(1096002)(122386002)(189998001)(47776003)(2201001)(77096005)(2950100001)(50226001)(76176999)(92566002)(86362001)(5001770100001)(42186005)(48376002)(53416004)(106356001)(101416001)(4326007)(105586002)(5003940100001)(87976001)(5004730100002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0446; H:ssuthiku-cz-dev.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0446; 23:eacK6dP5rFQX4Fw1Yb5y2FzE96n6zE2oHb1QjVvm4?= =?us-ascii?Q?NCEQ6hq58KJxzOaB+GEs6k/+jIVdGxYUc9XazCUiMxmTxWY4vhsOfBxj63HC?= =?us-ascii?Q?1HFW5ScROpmyewPW/YOoF7DKyQilipL0oDX3v7aR9Vb7BHQ8OhjfHf+pxoCV?= =?us-ascii?Q?nUiwoUpnED0nH1fAsP0KbTDHA6gaSfc0qoNdkPAWM7HfnldHoWbKX61uhwbw?= =?us-ascii?Q?gK/5Lfr3CIv6iXQkNmWVbqpLl7PQvFbiFdA1+8gocgJrZF8sTEeE+KKVasK4?= =?us-ascii?Q?/8YM5RbYx/0VhN7yVTXZU+QMEHR+tkqYp7eSbLDDKctSK0SSg6WhlqaHCwTN?= =?us-ascii?Q?BP3JQO0wWcByhOeyDo803Ic5pFNXT3oW0Iu79fZgI5a2dRA5iuD01R5FPcA1?= =?us-ascii?Q?AbEjaRwcYnH9c11BxTowjEnOZWaqvw3B57kMutWnFVvAOe8i89NuULb94qFI?= =?us-ascii?Q?GiySVQUirjjrcHbAbOVxXMUIEtVyLN22fYqbCTNzYwTE7UBT7BHNx3v4cmsj?= =?us-ascii?Q?BQ4Dxvtn6OmPQq2TCfQ+TKg7OSqSygEBzf8cVDCrO4muOHSHHctmH3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bsI1LU+YZ8t39OWfa5YngBWjJ9uW1KJ/7Dt3JJce5Nm1aOWPwFjMNMiGZWEcsvBV4jQ9ro+Pb1Nac X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jan 2016 18:24:28.8618 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0446 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch consolidates "arch/x86/kernel/cpu/perf_event_amd_iommu.h" and "drivers/iommu/amd_iommu_proto.h", which contain duplicate function declarations, into "include/linux/perf/perf_event_amd_iommu.h" Signed-off-by: Suravee Suthikulpanit --- arch/x86/kernel/cpu/perf_event_amd_iommu.c | 2 +- arch/x86/kernel/cpu/perf_event_amd_iommu.h | 40 ------------------------------ drivers/iommu/amd_iommu_init.c | 2 ++ drivers/iommu/amd_iommu_proto.h | 7 ------ include/linux/perf/perf_event_amd_iommu.h | 40 ++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 48 deletions(-) delete mode 100644 arch/x86/kernel/cpu/perf_event_amd_iommu.h create mode 100644 include/linux/perf/perf_event_amd_iommu.h -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c b/arch/x86/kernel/cpu/perf_event_amd_iommu.c index 86f8259..1192f1d 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c +++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c @@ -12,12 +12,12 @@ */ #include +#include #include #include #include #include "perf_event.h" -#include "perf_event_amd_iommu.h" #define COUNTER_SHIFT 16 diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.h b/arch/x86/kernel/cpu/perf_event_amd_iommu.h deleted file mode 100644 index 845d173..0000000 --- a/arch/x86/kernel/cpu/perf_event_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/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 013bdff..b6d684c 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 diff --git a/include/linux/perf/perf_event_amd_iommu.h b/include/linux/perf/perf_event_amd_iommu.h new file mode 100644 index 0000000..845d173 --- /dev/null +++ b/include/linux/perf/perf_event_amd_iommu.h @@ -0,0 +1,40 @@ +/* + * 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_*/