From patchwork Mon Nov 4 21:06:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 13862121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04C0DD1BDF6 for ; Mon, 4 Nov 2024 21:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Oh0zgB7sLyVYV0helH3ndPFTnKM4MrkIfS9kOuYemTI=; b=YPDJ8RH0w1xITEW5rpqocGIUa2 M1Y8G9k2aeIsD7WVc0vRkeH5OqrI/B+KMte3PqxYawQpJdIOR5ezYZq7IV5Relm7h/lYH3JWXbPah 1MXVN7tapqQrGD33xQ46l6XYjSmB3vH78CRXPSpSgn9aguZH8YjgWElPOS5FSBHNpQ91z6VlHi0Um F65Dq7a3jje6du91oZHhYSdO7wqW6E9rIkvtfu+VxJEZq+dRMgzETFI95A7zZHX4FLPq9+aP6ei2T FGqnd0XxAqhY889cbP9RrqqCNje7H7wa13G0UhCBRHlF3sE+zuSDRo8Eub7jKDkhYWhBh5MWUf3Ga BNlBvG/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t84hh-0000000FBCf-45am; Mon, 04 Nov 2024 21:33:41 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t84II-0000000F5sI-3qNk for linux-arm-kernel@lists.infradead.org; Mon, 04 Nov 2024 21:07:31 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-20cb47387ceso44434465ad.1 for ; Mon, 04 Nov 2024 13:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1730754446; x=1731359246; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Oh0zgB7sLyVYV0helH3ndPFTnKM4MrkIfS9kOuYemTI=; b=OfNMmVTT5+VBbpvqrKpQvC76ltRE02JF1RmzHRfw1s/PR6izAJTc24GRpz/lqAyOtv B9smxsYKv/f/kzfMEnQYWxVx9dqYqBP2kmHIi1Yc1D5NZAKECn9orStNuLV2isF5yr/t L2Gzti4tYwEPpF+wDVySYBEITGQ8U2FDkVdzS0Jm8oEVeHnnaThUwMt06KZ81kFClaE0 feVYmrjvKEr0JiLy7B38oeXObUlCvr5p0wnV6H1CmqnXC9+FcgYEyHWhs6Ej5m4BRNH4 ZnQg9kfPbP0rdohlwMZo25a6WH9/wpQfjB+/Hn11ysdvuus4ImIJpTSXEnfqMSeMgAWN zAEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754446; x=1731359246; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Oh0zgB7sLyVYV0helH3ndPFTnKM4MrkIfS9kOuYemTI=; b=ZOx10aKYU+BsH1AsVe/lmJ3SbgPEIPcIMqhQSt0Om2JvJ+rX9ZZcJ8/Z+uSTArTjMo e+RZPiHFAq+QfUSedXtNdQ3KDbUD+3aMPPyWYqXJ1hEL6y6mfld943bIAgI6uk/bgqdi 5vdjCReRt7p8du7IHBQcyLiwB6aUJ85vpHgDRrEKrJWTfPGczNI06jtgkpsv5aDAWkq9 +S7FAw+GwnxL4E9ukYeRJZeJdtuCeqS2OyMxXoQSIINo4C2sItE4Z4+E3uYveNdTD8iI wqXcyS1mIDXe8Fh9ZJ4EUbPt47TU5w2TwbzQQbI4oKGhlWNDsilkVcNWsoYg8N+suIiA Wx7Q== X-Forwarded-Encrypted: i=1; AJvYcCWy0eiUcm+riDN9hvBrQJ7/Zr7uohF9fWqmWZwKfguerwkDppCI/7DXTwn2aO0VMBBzZUuJsDMEJFEw8/TgT/vA@lists.infradead.org X-Gm-Message-State: AOJu0YxzFzTGzOPz8+N41ZjzAPzNu060Sg82I11F+zD532QSXU5Am/Fe dg7B2jCXGdDFP+eMVZosoEgmiOZSQyEdoZw0m51CfrLoDmphd3UCwXToeNOvbkg= X-Google-Smtp-Source: AGHT+IHaBRmk3UxLy3c5UicvluKFbnEkpJfA4ngNOpqBKAciatcY4LjQasBBZP7W0E26B0O8UkiDSA== X-Received: by 2002:a17:903:228b:b0:20b:fd73:32bb with SMTP id d9443c01a7336-210c6872da0mr454535575ad.2.1730754446060; Mon, 04 Nov 2024 13:07:26 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee490e08f4sm7248293a12.40.2024.11.04.13.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:07:24 -0800 (PST) From: Charlie Jenkins Date: Mon, 04 Nov 2024 13:06:16 -0800 Subject: [PATCH RFT 14/16] perf tools: powerpc: Use generic syscall table scripts MIME-Version: 1.0 Message-Id: <20241104-perf_syscalltbl-v1-14-9adae5c761ef@rivosinc.com> References: <20241104-perf_syscalltbl-v1-0-9adae5c761ef@rivosinc.com> In-Reply-To: <20241104-perf_syscalltbl-v1-0-9adae5c761ef@rivosinc.com> To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , =?utf-8?q?G=C3=BCnt?= =?utf-8?q?her_Noack?= , Christian Brauner , Guo Ren , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Jonathan Corbet , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, linux-csky@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6676; i=charlie@rivosinc.com; h=from:subject:message-id; bh=KeKtFvY7SKL2pD81p/skRGxyJKh4FWPknkDrKqvLM5M=; b=owGbwMvMwCHWx5hUnlvL8Y3xtFoSQ7qmeZz2rPuurp2hPgXxdcotzTm3tM22c29+sz776D/nV bOOH9vdUcrCIMbBICumyMJzrYG59Y5+2VHRsgkwc1iZQIYwcHEKwETWr2Bk6JV8Xb7skcWGDz84 p716arbsqNvxPJcbGUa7lwc5V57RmMfIcLryXNRfh+nxskfWRahvDzxpOKlzg/Hn99/tOzKflL2 dyQUA X-Developer-Key: i=charlie@rivosinc.com; a=openpgp; fpr=7D834FF11B1D8387E61C776FFB10D1F27D6B1354 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241104_130727_097152_3BBF2999 X-CRM114-Status: GOOD ( 18.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the generic scripts to generate headers from the syscall table instead of the custom ones for powerpc. Signed-off-by: Charlie Jenkins --- tools/perf/Makefile.config | 4 +-- tools/perf/Makefile.perf | 2 +- tools/perf/arch/powerpc/Makefile | 25 -------------- tools/perf/arch/powerpc/entry/syscalls/Kbuild | 3 ++ .../arch/powerpc/entry/syscalls/Makefile.syscalls | 6 ++++ .../perf/arch/powerpc/entry/syscalls/mksyscalltbl | 39 ---------------------- tools/perf/arch/powerpc/include/syscall_table.h | 8 +++++ tools/perf/util/syscalltbl.c | 8 ----- 8 files changed, 20 insertions(+), 75 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index ce7e9ae276e8..76dbd368aa9f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -31,12 +31,12 @@ $(call detected_var,SRCARCH) ifneq ($(NO_SYSCALL_TABLE),1) NO_SYSCALL_TABLE := 1 - ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc s390)) + ifeq ($(SRCARCH),s390) NO_SYSCALL_TABLE := 0 endif # architectures that use the generic syscall table scripts - ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips)) + ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips powerpc)) NO_SYSCALL_TABLE := 0 CFLAGS += -DGENERIC_SYSCALL_TABLE CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index c9b78518c9a5..c42cc4901005 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -311,7 +311,7 @@ FEATURE_TESTS := all endif endif # architectures that use the generic syscall table -ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips)) +ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips powerpc)) include $(srctree)/tools/perf/scripts/Makefile.syscalls endif include Makefile.config diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile index bf6d323574f6..42dab7c8f508 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -6,28 +6,3 @@ endif HAVE_KVM_STAT_SUPPORT := 1 PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 - -# -# Syscall table generation for perf -# - -out := $(OUTPUT)arch/powerpc/include/generated/asm -header32 := $(out)/syscalls_32.c -header64 := $(out)/syscalls_64.c -sysprf := $(srctree)/tools/perf/arch/powerpc/entry/syscalls -sysdef := $(sysprf)/syscall.tbl -systbl := $(sysprf)/mksyscalltbl - -# Create output directory if not already present -$(shell [ -d '$(out)' ] || mkdir -p '$(out)') - -$(header64): $(sysdef) $(systbl) - $(Q)$(SHELL) '$(systbl)' '64' $(sysdef) > $@ - -$(header32): $(sysdef) $(systbl) - $(Q)$(SHELL) '$(systbl)' '32' $(sysdef) > $@ - -clean:: - $(call QUIET_CLEAN, powerpc) $(RM) $(header32) $(header64) - -archheaders: $(header32) $(header64) diff --git a/tools/perf/arch/powerpc/entry/syscalls/Kbuild b/tools/perf/arch/powerpc/entry/syscalls/Kbuild new file mode 100644 index 000000000000..84c6599b4ea6 --- /dev/null +++ b/tools/perf/arch/powerpc/entry/syscalls/Kbuild @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +syscall-y += syscalls_32.h +syscall-y += syscalls_64.h diff --git a/tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls b/tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls new file mode 100644 index 000000000000..f7e87a61401c --- /dev/null +++ b/tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +syscall_abis_32 += spu nospu +syscall_abis_64 += spu nospu + +syscalltbl = $(srctree)/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl diff --git a/tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl b/tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl deleted file mode 100755 index 0eb316fe6dd1..000000000000 --- a/tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# -# Generate system call table for perf. Derived from -# s390 script. -# -# Copyright IBM Corp. 2017 -# Author(s): Hendrik Brueckner -# Changed by: Ravi Bangoria - -wordsize=$1 -SYSCALL_TBL=$2 - -if ! test -r $SYSCALL_TBL; then - echo "Could not read input file" >&2 - exit 1 -fi - -create_table() -{ - local wordsize=$1 - local max_nr nr abi sc discard - max_nr=-1 - nr=0 - - echo "static const char *const syscalltbl_powerpc_${wordsize}[] = {" - while read nr abi sc discard; do - if [ "$max_nr" -lt "$nr" ]; then - printf '\t[%d] = "%s",\n' $nr $sc - max_nr=$nr - fi - done - echo '};' - echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr" -} - -grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \ - |sort -k1 -n \ - |create_table ${wordsize} diff --git a/tools/perf/arch/powerpc/include/syscall_table.h b/tools/perf/arch/powerpc/include/syscall_table.h new file mode 100644 index 000000000000..7ff51b783000 --- /dev/null +++ b/tools/perf/arch/powerpc/include/syscall_table.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include + +#if __BITS_PER_LONG == 64 +#include +#else +#include +#endif diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c index 724e1391893f..4320876242ae 100644 --- a/tools/perf/util/syscalltbl.c +++ b/tools/perf/util/syscalltbl.c @@ -17,14 +17,6 @@ #include const int syscalltbl_native_max_id = SYSCALLTBL_S390_64_MAX_ID; static const char *const *syscalltbl_native = syscalltbl_s390_64; -#elif defined(__powerpc64__) -#include -const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_64_MAX_ID; -static const char *const *syscalltbl_native = syscalltbl_powerpc_64; -#elif defined(__powerpc__) -#include -const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_32_MAX_ID; -static const char *const *syscalltbl_native = syscalltbl_powerpc_32; #elif defined(GENERIC_SYSCALL_TABLE) #include const int syscalltbl_native_max_id = SYSCALLTBL_MAX_ID;