Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp166604pxj; Thu, 20 May 2021 06:52:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUpQ/jU9MtUpYD+8AgTAXOS3hNrfFNwzOt28DdJ1foCwSn2r8GkPj42sWLavSJjDZMnb1C X-Received: by 2002:a17:906:857:: with SMTP id f23mr4788090ejd.64.1621518755266; Thu, 20 May 2021 06:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621518755; cv=none; d=google.com; s=arc-20160816; b=uN+5UZB211XOiiyJKEVeiyoS6SeXyOEn+/2VWRg5jTkdzLg50ZmuqXp1uUwZ5HyKTt nhlEq5N/v4++i5BoqS5ZiW4BlnuNjsFoU+3heL7AuL/Hp4SFv2TM4X40aTpFtheRcIoG W37fBO7n3E7eJJqUkDSdtpoEanlTr9UMz8r20XrYvp7EfmJ2qSFfzm1zbqeH1o9Py2l1 oCuWj5opS1m3p9RkAZ2wNtdNPI+fj/zA/ZhmTOXAX6FM+gDRQkmE6wpcvi10dlHUZl9I fK0H5f+fRPhfHzEpFZfKxCth4ii3Kvjabkox/Bid6Q4o2aqCkCT1H4FJNbm5HrGtCZrB cVag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:message-id; bh=HMIql1AZi39LOeTR42WJ68Mrv9V1SPAyBoj8SJd3RwU=; b=fBNeWMfA1k/+LJ5TzHBLReE5J0ht5W9oooLrdrHuYbA6FNUpQm61omybDzYjev1Xmu fjme4vPwlccUZZpSumnIZ3qVF7JmDCDUhMWvu9h1Ztazeq0Syyv4vu6zObNA81Nnp3YY lW2dbDUAp/w757ZgJrGehzb8pJPzJOyEztdQOSNMXUg4By2jzqAH5vHPmIgTp30sXRBZ 4GtLIteVUSx7uTpeXWSRt+qzbyGvsGIsy2l5A4H9sNbZ0E6XbhmtE6GwcweUBn/dOmKj lJ1rLqvJL7QGJm49XtQBbbXwItxE3X8i2XbbIUmscepEAa0qioQFnjzuGbWCBWkWixUU OSgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm18si2304132edb.378.2021.05.20.06.52.08; Thu, 20 May 2021 06:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240381AbhETNwC (ORCPT + 99 others); Thu, 20 May 2021 09:52:02 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:44979 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232298AbhETNwB (ORCPT ); Thu, 20 May 2021 09:52:01 -0400 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4FmB2k1mcQz9sTJ; Thu, 20 May 2021 15:50:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7fZ3poNK2C58; Thu, 20 May 2021 15:50:38 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4FmB2j5Yqtz9sT8; Thu, 20 May 2021 15:50:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7870F8B813; Thu, 20 May 2021 15:50:37 +0200 (CEST) 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 N-dgg_hcNp0b; Thu, 20 May 2021 15:50:37 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.105]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 271F08B808; Thu, 20 May 2021 15:50:37 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 11DFF64C40; Thu, 20 May 2021 13:50:37 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH v2 00/12] powerpc: Cleanup use of 'struct ppc_inst' To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , naveen.n.rao@linux.vnet.ibm.com, jniethe5@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 20 May 2021 13:50:37 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series is a cleanup of the use of 'struct ppc_inst'. A confusion is made between internal representation of powerpc instructions with 'struct ppc_inst' and in-memory code which is and will always be an array of 'unsigned int'. This series cleans it up. First patch is fixing detection of missing '__user' flag by sparse when using get_user_instr(). Last part of the series does some source code cleanup in optprobes, it is put at the ends of this series because of clashes with the 'struct ppc_inst' cleanups. Changes in v2: - Temporarily don't use get_op() and don't include asm/disassemble.h in asm/inst.h because it exhibits a conflict for function get_ra() with drivers/staging/rtl8723bs/include/wifi.h - Fix a create_branch() in ftrace and take copy_inst_from_kernel_nofault() into account Christophe Leroy (12): powerpc/inst: Fix sparse detection on get_user_instr() powerpc/inst: Reduce casts in get_user_instr() powerpc/inst: Improve readability of get_user_instr() and friends powerpc/inst: Avoid pointer dereferencing in ppc_inst_equal() powerpc: Do not dereference code as 'struct ppc_inst' (uprobe, code-patching, feature-fixups) powerpc/lib/code-patching: Make instr_is_branch_to_addr() static powerpc/lib/code-patching: Don't use struct 'ppc_inst' for runnable code in tests. powerpc: Don't use 'struct ppc_inst' to reference instruction location powerpc/inst: Refactor PPC32 and PPC64 versions powerpc/optprobes: Minimise casts powerpc/optprobes: Compact code source a bit. powerpc/optprobes: use PPC_RAW_ macros arch/powerpc/include/asm/code-patching.h | 23 ++- arch/powerpc/include/asm/inst.h | 92 +++++------- arch/powerpc/include/asm/ppc-opcode.h | 11 +- arch/powerpc/include/asm/uprobes.h | 4 +- arch/powerpc/kernel/crash_dump.c | 4 +- arch/powerpc/kernel/epapr_paravirt.c | 4 +- arch/powerpc/kernel/jump_label.c | 2 +- arch/powerpc/kernel/kgdb.c | 6 +- arch/powerpc/kernel/kprobes.c | 17 ++- arch/powerpc/kernel/mce_power.c | 2 +- arch/powerpc/kernel/optprobes.c | 124 +++++----------- arch/powerpc/kernel/setup_32.c | 2 +- arch/powerpc/kernel/trace/ftrace.c | 33 +++-- arch/powerpc/kernel/uprobes.c | 6 +- arch/powerpc/lib/code-patching.c | 165 ++++++++++++---------- arch/powerpc/lib/feature-fixups.c | 98 ++++++------- arch/powerpc/mm/maccess.c | 4 +- arch/powerpc/perf/core-book3s.c | 4 +- arch/powerpc/platforms/86xx/mpc86xx_smp.c | 2 +- arch/powerpc/platforms/powermac/smp.c | 4 +- arch/powerpc/xmon/xmon.c | 10 +- 21 files changed, 277 insertions(+), 340 deletions(-) -- 2.25.0