From patchwork Sat Nov 10 21:02:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 10677429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 681D015A6 for ; Sat, 10 Nov 2018 21:02:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5883C2C40A for ; Sat, 10 Nov 2018 21:02:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D33C2C410; Sat, 10 Nov 2018 21:02:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB5882C40A for ; Sat, 10 Nov 2018 21:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P3F7o53VsrHD53cQ8FyqnAhHh158NGfvg2+AKATp+HY=; b=SUt4uR7GNkenk/ Oxd8Pxj3vzyCXRvHs3jz3yHrbABTV/pc7UdcXNTJFeC9XNE1iGVEKHNIF+vmbQpG+qaAGeMSGXIKE N364DlCZguMrdMTMaKzsgoFBuGPxi26SwcsUf78K3oFtZulHNPDfr5hPobUULEU6nd5oQP2dJc5B2 yhbfVWtivVkj/7wvOJmRGF2GU4Ibi4mFs5dRkQowvEu66YmmdqN1uMwxABn2Gs5xcVewShnHEvuyh JaM0IYbt4Pq5onOGXD9pnXTjDm4/HIBJ/T4JQWNeH7EGUwWUc6Kq26iONIk8OtHg7UrF/uiKYUSSU 7KUbmWiQziPr9Q3CJOmw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaP0-0003GW-QS; Sat, 10 Nov 2018 21:02:46 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaOs-00038p-MI for linux-arm-kernel@bombadil.infradead.org; Sat, 10 Nov 2018 21:02:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Cc:To:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:From:References:In-Reply-To:Message-Id:Date :Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pJKvd9M1yUqbjOSk+ekZ+TW6FP5/U9i+trGrcdzW6Zw=; b=zc/JTA4FcEsAjUA6uPMgi5M6/7 CzppEpUjMbG8Cv5+TgY7uTygI/tVyX6I6UqsCsLqK9YlkPmRA2fJb7ypcncPU2Yt0lDVzqJLxUTtO ndlNH3FKG8KcHXsudJM12722EoYvlqgJbaBII5xdXNtTQasTw5khCDGM0rQdv0KQgoOqiwKdw72rz LaCxIxxUVKNd8cCg1Fgy+dbq/dfFSuugQLAFIAlyhEf84/HkYQzexENx8QqAaxL4GyKfcbfI5lXbx YzIQ/VT25SLsFy2Mk7YrrQypZwmZ86fXNtl0DxS/O5iPt+etlp+Pip9uPV46Oj3S4hBLcYlUCU2JX BiTZypzQ==; Received: from rere.qmqm.pl ([91.227.64.183]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLaOo-0008Pl-RS for linux-arm-kernel@lists.infradead.org; Sat, 10 Nov 2018 21:02:35 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 42sqFH0pGMzSL; Sat, 10 Nov 2018 22:01:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1541883683; bh=0EVKyGgqyMdhKmcjfkXV4TTARorA61c/lj+NDszHBqc=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=AnhvO/nT9Zkc95KHULdvrHD6ryd4/zPEnJsiSLAIVJhuNCFBtYrgaZJD+LWyYhFeo INeBlPnBpKfIVNi44AuiG+xuek4gWMqy8Lv0AK+t155m2ddg9bdmZEwTor8DsT59oQ hJn3llf9+tRkdSUXX6Dj4YD5jru8VXmdIiwwZ45OsYmrjGd6YC8S6XMRs0011lJKIY 2PbuluPSqh+57BQ/IGXY1qzP+nYc2bAlQZ1XAuAgJhHl7hArAnHADut+xM7fq4owor oXPymteBOzPK5VHI8P6yf5qZ04IHMPR1dIa5Hv5gVEK/NHRAlrNLJ/Q+E2qP0uqjn2 5cnVxmbjvu7qQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.2 at mail Date: Sat, 10 Nov 2018 22:02:22 +0100 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH 1/3] ARM: cache-l2x0: share l2x0_base with PMU code MIME-Version: 1.0 To: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181110_160235_236217_6C467F37 X-CRM114-Status: GOOD ( 15.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, Mark Rutland , Dmitry Osipenko , Russell King Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid l2x0_base duplication with PMU driver by sharing it and using l2x0_name as the 'enabled' flag instead. Since l2x0_name is not used for anything else, mark it as __initdata. This will also be needed for cache maintenance with Trusted Foundations firmware. Signed-off-by: Michał Mirosław --- arch/arm/include/asm/hardware/cache-l2x0.h | 6 ++++-- arch/arm/mm/cache-l2x0-pmu.c | 9 +++------ arch/arm/mm/cache-l2x0.c | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h index 736292b42fca..665eb0758417 100644 --- a/arch/arm/include/asm/hardware/cache-l2x0.h +++ b/arch/arm/include/asm/hardware/cache-l2x0.h @@ -167,11 +167,11 @@ static inline int l2x0_of_init(u32 aux_val, u32 aux_mask) #endif #ifdef CONFIG_CACHE_L2X0_PMU -void l2x0_pmu_register(void __iomem *base, u32 part); +void l2x0_pmu_register(u32 part); void l2x0_pmu_suspend(void); void l2x0_pmu_resume(void); #else -static inline void l2x0_pmu_register(void __iomem *base, u32 part) {} +static inline void l2x0_pmu_register(u32 part) {} static inline void l2x0_pmu_suspend(void) {} static inline void l2x0_pmu_resume(void) {} #endif @@ -193,6 +193,8 @@ struct l2x0_regs { unsigned long aux2_ctrl; }; +extern void __iomem *l2x0_base; +extern u32 l2x0_way_mask; /* Bitmask of active ways */ extern struct l2x0_regs l2x0_saved_regs; #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/mm/cache-l2x0-pmu.c b/arch/arm/mm/cache-l2x0-pmu.c index afe5b4c7b164..6be335ae4e2f 100644 --- a/arch/arm/mm/cache-l2x0-pmu.c +++ b/arch/arm/mm/cache-l2x0-pmu.c @@ -29,11 +29,10 @@ #define PMU_NR_COUNTERS 2 -static void __iomem *l2x0_base; static struct pmu *l2x0_pmu; static cpumask_t pmu_cpu; -static const char *l2x0_name; +static const char *__initdata l2x0_name = NULL; static ktime_t l2x0_pmu_poll_period; static struct hrtimer l2x0_pmu_hrtimer; @@ -491,7 +490,7 @@ void l2x0_pmu_resume(void) l2x0_pmu_enable(l2x0_pmu); } -void __init l2x0_pmu_register(void __iomem *base, u32 part) +void __init l2x0_pmu_register(u32 part) { /* * Determine whether we support the PMU, and choose the name for sysfs. @@ -516,15 +515,13 @@ void __init l2x0_pmu_register(void __iomem *base, u32 part) default: return; } - - l2x0_base = base; } static __init int l2x0_pmu_init(void) { int ret; - if (!l2x0_base) + if (!l2x0_name) return 0; l2x0_pmu = kzalloc(sizeof(*l2x0_pmu), GFP_KERNEL); diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index ea1e70ff4568..2b6a023fea3f 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -48,13 +48,13 @@ struct l2c_init_data { #define CACHE_LINE_SIZE 32 -static void __iomem *l2x0_base; static const struct l2c_init_data *l2x0_data; static DEFINE_RAW_SPINLOCK(l2x0_lock); -static u32 l2x0_way_mask; /* Bitmask of active ways */ static u32 l2x0_size; static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; +void __iomem *l2x0_base; +u32 l2x0_way_mask; /* Bitmask of active ways */ struct l2x0_regs l2x0_saved_regs; static bool l2x0_bresp_disable; @@ -900,7 +900,7 @@ static int __init __l2c_init(const struct l2c_init_data *data, pr_info("%s: CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n", data->type, cache_id, aux); - l2x0_pmu_register(l2x0_base, cache_id); + l2x0_pmu_register(cache_id); return 0; }