From patchwork Tue Feb 23 14:12:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 62695 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1853339lbl; Tue, 23 Feb 2016 06:14:12 -0800 (PST) X-Received: by 10.66.90.226 with SMTP id bz2mr20801304pab.31.1456236852538; Tue, 23 Feb 2016 06:14:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fg8si47584739pad.227.2016.02.23.06.14.12; Tue, 23 Feb 2016 06:14:12 -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 S1753048AbcBWOOJ (ORCPT + 30 others); Tue, 23 Feb 2016 09:14:09 -0500 Received: from mail-bn1on0082.outbound.protection.outlook.com ([157.56.110.82]:60571 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753051AbcBWOOD (ORCPT ); Tue, 23 Feb 2016 09:14:03 -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 BLUPR12MB0436.namprd12.prod.outlook.com (10.162.92.141) with Microsoft SMTP Server (TLS) id 15.1.409.15; Tue, 23 Feb 2016 14:13:52 +0000 From: Suravee Suthikulpanit To: , , , , CC: , , , , , "Suravee Suthikulpanit" , Suravee Suthikulpanit Subject: [PATCH V5 02/10] perf/amd/iommu: Consolidate and move perf_event_amd_iommu header Date: Tue, 23 Feb 2016 08:12:36 -0600 Message-ID: <1456236764-1569-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456236764-1569-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1456236764-1569-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: HKNPR06CA0045.apcprd06.prod.outlook.com (10.141.16.35) To BLUPR12MB0436.namprd12.prod.outlook.com (25.162.92.141) X-MS-Office365-Filtering-Correlation-Id: 33505430-819e-4d25-c1e9-08d33c5b9404 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0436; 2:UhCD0QA6c+dC8ETFMffOYpNbN/36swofHp1HTVP7BNUsNNqVcWUvPCPZVc0GcwShvhk7pwwknfTmDkW1pVQ2HwQtsVypzQeGxlG0qsxklex7Q0RpdgT3rSsaJcsTeJ/6g9dRUPXLi86lIlYKTeA73ozWk89P4GyER6U5Er6gRAgSRxQ8Vgw+vpDKG0kQzYgO; 3:dtazB/71Wdpcgwp9jZquBNMUP6z35HyBiAeBHZJeJsYnyLrLOi6g5caHW2dhFiASWYnC9EIRul65HwP9e2Z/S/bNzFZpJcnPwo/+aTNSHN22drF+gFpN+yK5DiDoAzo7; 25:KbKjXnA90cU+hjy8z8q08tXsdfS8StKlxnDSHdgcuWKSTggBSgUXGNPJNy9NTpHdrvuC0QvDWLqcjucaWaVaoFlGz+FebRuwBfgqdC1Sx2dxY3xG7Ef6g9n3se6KK2VZ+LLlZP6VkN3vGrxied70x6U+Xa7VmDP2VrngUHT2Jpv8hDgf/X0ReOxk0hVBYOEVHxDt0amvzMyj6h1F1SZhW/soeEhkDKclKe8jRGhRKk3bxEY61XH7UT7XUDLLJCfVYBbno2vS/gPis/Xlgmaawfo9DM0YWx5tMS+ewmWIjFseuweCLcKUSN2REq1ePXiUldhoGvTEj8yVsfl8564tMCFss+3FQCiKVkLBWc+I0aM= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0436; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0436; 20:46fVFHWaHoIIAdipweCR/2bCDYQeNEY0EECMcSQGvYINy+fwF4itjHxJRatUHbl+Kp5zyaWyeT2g+z7LlIou5s+az4rUsu23OJfdDWsEzWUH5H3GdfKhPiH2w7goZ6G2aOHjHb4D7K7TJM3Z6zx0w7DrCCbCngt/liR0YRJh3E/Q+aCRcIqAonDOVuPH9JVtzmcVQIecjtnsatfiIhRP+DbZHrKFFqII2GmXwwDpT9ERUdujycroSX56/kiBMxsIKKgrM6MW39+SAFzU+fWkr2IIxhSUJA7XkfqcNUePMUKQ6jW0Fiu02mpq3uAnOwyYINB0HEU3dk+v0+LWza49lojrggQvvR+xxhRQ3jurJ/PlEiAR7Q6uBDu0BpxqionSUFvpfVIe/2C8LqHbo1uW0hOF3lj8mTN1XQR6HNSz0gqfgk90udm6+7osQXuwjJHW4VLrHZLcyb052lyiFqIHcBD3AyPFewAVFwykG3SIkhAZOIOo0LFdp6jOf6R2jubZ; 4:Jme9IsmzaHsq6H/M9Hia/COf6NQkVm4JlHAKiNyf+9UoINB02vXqKJyB2CzwYCn4rQYyxqMYJmawWwan7f8PuJ2z0d0W6FtqM+IpY8lXWeqAEEudOvPhyt0/4n0YFOOyGUHoH7I2MvhciKgVxDncQ0M6XmFnLk3siXO65uaNVFVPg0bmMJmz2i201dT70isGKSXU4fm38g/024tPWneWCEtA50uk18HWqo0R82lxTJJ4FYNHjXUkhBNOdZYElEWX03el3SXEJwnVk45XHb0dkzkwkHDYAwrRqYveSmZuyM6a2WkuY5vm1yCzZLqunb3BjrhptCVSmud7u7gnelH1/bSxhacCVuY+vylmRy7sD+JYSZNZE0LPkWLOm/3n6El3Cujoo+p0/Q+h8SBFB99dgk3NsU6XVanOT7OoWwkRQZE= 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:BLUPR12MB0436; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0436; X-Forefront-PRVS: 08617F610C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(5004730100002)(48376002)(77096005)(4326007)(2950100001)(2906002)(3846002)(6116002)(42186005)(5008740100001)(19580405001)(1096002)(19580395003)(86362001)(575784001)(40100003)(50466002)(586003)(122386002)(36756003)(76176999)(5001960100002)(47776003)(66066001)(50986999)(5001770100001)(189998001)(229853001)(50226001)(87976001)(92566002)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0436; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR12MB0436; 23:2bK0IqEdgcUbhW6eCbH1XLB8GfFFdmJZs/jZCSwcy?= =?us-ascii?Q?J7oMmTeJ5FiJOQ4+Q7XdKHFpa4eSiHvvPPlb6Th15ULiD8wxZ51bJEdywMqr?= =?us-ascii?Q?0h+VPsyA6sKCvC2vlbw9k4/v3mzBcpVG3C3FnForkowJjBJqCH4qQ5r0ev7z?= =?us-ascii?Q?qwuMyKN/FmERchkPQxMUB4Ca8ZPg1btr6gfnt9146tYVrhh3UpSWPs7O7axG?= =?us-ascii?Q?PPyACC7eQhCcPVLJxGErx+k0Ob38qJFrZw8Q/N0VnKoOIecz8SPwvoTXbJFO?= =?us-ascii?Q?VRQenQKC0VTxxWuXwnZbMy15fDHBZHjl5gZ46FABXkwq42a85PAdIu4Y3rq2?= =?us-ascii?Q?XwodBHFWTmUBU4NVCmFLe9NV4TDCSj2Nd/8ziPgu2wKtl3u6X/rLv23BZnUR?= =?us-ascii?Q?5IPXWqeyqIQk66Kirc3RWwH7vlA7Ka1gKnp/htGIDRiIhzxNKTc7UCKQ+4g6?= =?us-ascii?Q?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1PMPp/b4Sg6ffIP0twGWkYgX5Hc8iJHXlIALqELXVTkJSaX+RkMJx6SzgOxGBFKPGFLas8UFoJKB7XxrV08dbLKIwJL5CputK0gg93HevLyj9nx8XeQ7GC4ymjkimOwlnnVbepL865L X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2016 14:13:52.0836 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0436 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 declaration 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 -- 1.9.1 diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c index 9da0d16..fb4aa7b 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