Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1016274imu; Fri, 9 Nov 2018 09:34:42 -0800 (PST) X-Google-Smtp-Source: AJdET5crWrC1w2Ex77s0pjQWnOVdSracIZs0HI+rxNCeeCV6wwcTBQWAkHIub6YAELRqgEOQtXBA X-Received: by 2002:a63:de04:: with SMTP id f4mr8132852pgg.292.1541784882179; Fri, 09 Nov 2018 09:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541784882; cv=none; d=google.com; s=arc-20160816; b=nkOXLHlA0ZwcSkFAsD5OY5O8UdglVtJSHmyp5X34JFLrgUUYZaQeL9BEfNgZxK+HzN RZDX0jJ+BN5wRhTp16HFiMFDR1iasi9Digu/oOTAJSOf9xOUxlgeh/3mXbvuidNJeXbb ZyTopzhF8NK844RfE5mf7j2GWI4/sG9KLoDP8TUOsn60ZV8ZqJWxS8DOAmHSwv2qcEfE B1Igimc05MHwYH7ieoDHvrPpA9iE5Gua+sxc2GtCZAT82R6RIuECn/v1eLhZMniMort6 d2/b8MhI/abgpPY9MsjnlX2hQ/HFbw2dMg6iLsP/tGBRfy6ZHPePFrB3BQKGr2fmJyOF LMxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=62BNlw/Nj52h96wIe0hWE8VzkP08RfTT8t9kicQZGck=; b=ru3vnCSEcsfmaEdBwNlbgn0c7qoUUeRK/0NuINbtHX23/q8P9iwM4M3mKNc3dxZvC+ 5Ej9oWIeh3TZSO6aDnyAVQM2Uwmp1zgVRcpUKsyP+I5n2PCAoy0ckOFerigA6TpFlUG8 nfbzgj+vVai8oRDplitmj8KtGe3RBW7op6pdEHHbsvG/ZEilHWp9yVwhSJU5jYmsoDiE 0Nf/lMeIqDc+WvwOQS1aXpjiJtHkv9s0KjiHqg0Pum6/WVUbwfXiVQQx9aGyUd7Dzs0j loEbv2hWX0/BVOUzpV86W5nCgBIip6H7YkWSmUhJ/14tmskvkHpuuQgWbyezFWMYzyjK llUg== 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 5-v6si8374794plt.408.2018.11.09.09.34.24; Fri, 09 Nov 2018 09:34:42 -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 S1728856AbeKJDPG (ORCPT + 99 others); Fri, 9 Nov 2018 22:15:06 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:54927 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727995AbeKJDPF (ORCPT ); Fri, 9 Nov 2018 22:15:05 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 42s6gm5Mr7z9v0XS; Fri, 9 Nov 2018 18:33:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id rj0crbc1WPPR; Fri, 9 Nov 2018 18:33:24 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 42s6gm4tl9z9v0XL; Fri, 9 Nov 2018 18:33:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 8387C8B899; Fri, 9 Nov 2018 18:33:30 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id GxAQMdWs63DK; Fri, 9 Nov 2018 18:33:30 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4D46D8B887; Fri, 9 Nov 2018 18:33:30 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2CF4A69A2A; Fri, 9 Nov 2018 17:33:30 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH 8/9] powerpc/44x: use patch_sites for TLB handlers patching To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 9 Nov 2018 17:33:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use patch sites and associated helpers to manage TLB handlers patching instead of hardcoding. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/mmu-44x.h | 3 +++ arch/powerpc/kernel/head_44x.S | 11 +++++------ arch/powerpc/mm/44x_mmu.c | 14 +++----------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/mmu-44x.h b/arch/powerpc/include/asm/mmu-44x.h index 295b3dbb2698..28aa3b339c5e 100644 --- a/arch/powerpc/include/asm/mmu-44x.h +++ b/arch/powerpc/include/asm/mmu-44x.h @@ -111,6 +111,9 @@ typedef struct { unsigned long vdso_base; } mm_context_t; +/* patch sites */ +extern s32 patch__tlb_44x_hwater_D, patch__tlb_44x_hwater_I; + #endif /* !__ASSEMBLY__ */ #ifndef CONFIG_PPC_EARLY_DEBUG_44x diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index 37e4a7cf0065..bf23c19c92d6 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S @@ -40,6 +40,7 @@ #include #include #include +#include #include "head_booke.h" @@ -382,10 +383,9 @@ interrupt_base: /* Increment, rollover, and store TLB index */ addi r13,r13,1 + patch_site 0f, patch__tlb_44x_hwater_D /* Compare with watermark (instruction gets patched) */ - .globl tlb_44x_patch_hwater_D -tlb_44x_patch_hwater_D: - cmpwi 0,r13,1 /* reserve entries */ +0: cmpwi 0,r13,1 /* reserve entries */ ble 5f li r13,0 5: @@ -478,10 +478,9 @@ tlb_44x_patch_hwater_D: /* Increment, rollover, and store TLB index */ addi r13,r13,1 + patch_site 0f, patch__tlb_44x_hwater_I /* Compare with watermark (instruction gets patched) */ - .globl tlb_44x_patch_hwater_I -tlb_44x_patch_hwater_I: - cmpwi 0,r13,1 /* reserve entries */ +0: cmpwi 0,r13,1 /* reserve entries */ ble 5f li r13,0 5: diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c index 12d92518e898..ea2b9af08a48 100644 --- a/arch/powerpc/mm/44x_mmu.c +++ b/arch/powerpc/mm/44x_mmu.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "mmu_decl.h" @@ -43,22 +44,13 @@ unsigned long tlb_47x_boltmap[1024/8]; static void ppc44x_update_tlb_hwater(void) { - extern unsigned int tlb_44x_patch_hwater_D[]; - extern unsigned int tlb_44x_patch_hwater_I[]; - /* The TLB miss handlers hard codes the watermark in a cmpli * instruction to improve performances rather than loading it * from the global variable. Thus, we patch the instructions * in the 2 TLB miss handlers when updating the value */ - tlb_44x_patch_hwater_D[0] = (tlb_44x_patch_hwater_D[0] & 0xffff0000) | - tlb_44x_hwater; - flush_icache_range((unsigned long)&tlb_44x_patch_hwater_D[0], - (unsigned long)&tlb_44x_patch_hwater_D[1]); - tlb_44x_patch_hwater_I[0] = (tlb_44x_patch_hwater_I[0] & 0xffff0000) | - tlb_44x_hwater; - flush_icache_range((unsigned long)&tlb_44x_patch_hwater_I[0], - (unsigned long)&tlb_44x_patch_hwater_I[1]); + modify_instruction_site(&patch__tlb_44x_hwater_D, 0xffff, tlb_44x_hwater); + modify_instruction_site(&patch__tlb_44x_hwater_I, 0xffff, tlb_44x_hwater); } /* -- 2.13.3