Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3874231imw; Thu, 7 Jul 2022 08:54:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tILQkT6WjvC7L8wk35sfjLx1S4BFeFMARmQHnTxJSU+DZQ7T/YcotIvXQFu4qr5QFlkeoG X-Received: by 2002:a17:902:b712:b0:16b:d667:ab59 with SMTP id d18-20020a170902b71200b0016bd667ab59mr29675107pls.74.1657209250769; Thu, 07 Jul 2022 08:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657209250; cv=none; d=google.com; s=arc-20160816; b=w2MWMZ/zHpV7ZGXDa9ciptoFmM2iPgBwoFutLWUarADNWXoq2d9P+9LdyHAPgwH+3r hSExG4JEpWmftryVgJ1W0SmSzYBWkRDfUe3DcsHcDNizGKOb+Ae0UHDON/EZvI/4dyQq 4pnrU20D/8X6Okh+9nGCxm0S0T6KHpjcAwuhhRRxsChiGnOBkB6ToAFHurxyqT7HKXCt DMe+ri3zV0JMj740nz5tLRMAwnpv+WQEJv9TrmLAZkQix2aKUsRC/Ewz1ILeNPT24atQ zbOjLOX+hr1Qv9I5jwvVKt75L/NKhIzzjqSERIBoh7sPHV40CzAMXUFmk/oXUNF0iX4I Gp6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=H0LQ8L8yHAi55ijnwvCfcNniUwCEi7P0u1uiiAVKUvc=; b=QYWY6merwWDYdXQLriyo38PUVzxrAQZcDAq9S9vSFfTMeYfaGweAOtFL5S2nAxr+o+ pmN6wXGq2P7fZL99oHPHLnl8ZPSbaNpvzUoNvR6HGhrImVTWX1b+7V/P8BXTtaK+7lwF YIVSwNjxeSHGC7+lexijvoVRvyOXJhR4kY0kxwGZrbM8FNLZH6TBHJaCbeSuGkx54Cr2 rGcwVqFjwAnlJqO1GHrCYpPSN+bHDnDkcvWWQn2590kF+QRQ2aE847xGMW5P+ucQNN7a wa+ToKCWXJ7igNT98SjD2GSdlsdYmCULyMft4Ph2FkW5PGEq/34KIaatxl/H9MpgF5WP 354Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i190-20020a6387c7000000b004150f6f4476si1225462pge.292.2022.07.07.08.53.53; Thu, 07 Jul 2022 08:54:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236322AbiGGO5X (ORCPT + 99 others); Thu, 7 Jul 2022 10:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236315AbiGGO5F (ORCPT ); Thu, 7 Jul 2022 10:57:05 -0400 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01C0B5C9E9 for ; Thu, 7 Jul 2022 07:55:40 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Ldzx32njJz9tGf; Thu, 7 Jul 2022 16:55:35 +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 EFHjvXTaKIr1; Thu, 7 Jul 2022 16:55:35 +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 4Ldzx20SpKz9t90; Thu, 7 Jul 2022 16:55:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F33228B7A7; Thu, 7 Jul 2022 16:55:33 +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 CygF_q0_2rOD; Thu, 7 Jul 2022 16:55:33 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.233.174]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B5BFD8B79F; Thu, 7 Jul 2022 16:55:33 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 267EtOed541781 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 7 Jul 2022 16:55:24 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 267EtOfZ541780; Thu, 7 Jul 2022 16:55:24 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/3] powerpc/ppc-opcode: Define and use PPC_RAW_TRAP() and PPC_RAW_TW() Date: Thu, 7 Jul 2022 16:55:15 +0200 Message-Id: <52c7e522e56a38e3ff0363906919445920005a8f.1657205708.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1657205713; l=1963; s=20211009; h=from:subject:message-id; bh=/QUbuNCRaB5mtR9HgvpdBFYMNf4JgF1mD8ce0wgA6TA=; b=22Rcqn2ubuXmhSFVyY8J56mMu5TlQRwmuhWaADoEMrmpa0GMKAcuUX20ePOpE9N+jQeUSzYmFw1k dg61v59eDHMNii27sUtAJnqmCoe3Z7M2i4fV+TqgU8qwTXAvcJuW X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add and use PPC_RAW_TRAP() instead of opencoding. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/include/asm/probes.h | 3 ++- arch/powerpc/xmon/xmon.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 89beabf5325c..5527a955fb4a 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -581,6 +581,8 @@ #define PPC_RAW_BRANCH(offset) (0x48000000 | PPC_LI(offset)) #define PPC_RAW_BL(offset) (0x48000001 | PPC_LI(offset)) +#define PPC_RAW_TW(t0, a, b) (0x7f000008 | ___PPC_RS(t0) | ___PPC_RA(a) | ___PPC_RB(b)) +#define PPC_RAW_TRAP() PPC_RAW_TW(31, 0, 0) /* Deal with instructions that older assemblers aren't aware of */ #define PPC_BCCTR_FLUSH stringify_in_c(.long PPC_INST_BCCTR_FLUSH) diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h index 00634e3145e7..e77a2ed7d938 100644 --- a/arch/powerpc/include/asm/probes.h +++ b/arch/powerpc/include/asm/probes.h @@ -9,8 +9,9 @@ */ #include #include +#include -#define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ +#define BREAKPOINT_INSTRUCTION PPC_RAW_TRAP() /* trap */ /* Trap definitions per ISA */ #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index f80c714f1d49..26ef3388c24c 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c @@ -116,7 +116,7 @@ struct bpt { static struct bpt bpts[NBPTS]; static struct bpt dabr[HBP_NUM_MAX]; static struct bpt *iabr; -static unsigned bpinstr = 0x7fe00008; /* trap */ +static unsigned int bpinstr = PPC_RAW_TRAP(); #define BP_NUM(bp) ((bp) - bpts + 1) -- 2.36.1