Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp721855rdf; Tue, 21 Nov 2023 14:58:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0Hf/mWiFqv21BpccLtiD8cus6uEhZ7brAU2dyAebLxgEDpmx3SkI9/qOomBJBY1awR9Ar X-Received: by 2002:a05:6a00:21c4:b0:6cb:4d36:5d07 with SMTP id t4-20020a056a0021c400b006cb4d365d07mr729496pfj.10.1700607524566; Tue, 21 Nov 2023 14:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700607524; cv=none; d=google.com; s=arc-20160816; b=kX74qpNpkwJkT2Dr3m2M60469pgxGn1jww1KlbFS39ivu+8nsEyc0KKZkz9IArIErR gFH1UoSsRckfCKTPqfvKGA33zRXF4poWVSbOnh1kDRnUpbJNjF6Zw+ogAD7aPgfjIdAm h15oTZlVATHFqj3+06Opk7YOpSt17om2nfnbxM3VxlVtHQATvb1Fete4hrekanpJSS40 mjnfo1qBvFIWqGt2oT7045mvy+36wj4l6IBrpGS88FMf9ORx3iXOvCgLusWt3GCCHDGm QgNas/KAtgAFrGbs2KL+8vCjlYiwrzI3Za7wctI8MudybfXN69/AzEW6JpiB++Ej2xSk nWSQ== 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:sender :dkim-signature; bh=FdcERJimN0aFkwFBjeCuGYBCdP/KZCZ/nHY+2sAtfHI=; fh=T4qncUS1Tb/KauJyoC7h8o4siNBgnYdUd8AD+jfKdrM=; b=A0wX4Jdluc53MaUgie9qORkPTbVLFYgnYO6K6rg1dcGe35hPCZuVkmIgeM8/6nCYZw HSkGUlY4T5u4XZyfLXZkgOK1lmqflNwi6VVtsa4Dexk9oTUF4MBaav08snE4+/shinld 3pjLuYUW09bmp5oHagldhGvx17mzyxi9NUtqn+rYjEZv8AHDfeAV2D1ZLAc7mjoWi4Qf ZrKsgYqrEhLq3pi5uWnPlomqIfN//4b1kxZEQV7lnKSYO7hNA8TfKeqwgT43X/6PcpSY 8RugRr5hlaKEb8nCtt+Y653UsrYjNh14akHIIny2/fQlnkY6YNorbsd3yFsL87R7hrlD 1QNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VP62qRG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 2-20020a631742000000b00565db2812a0si11410719pgx.60.2023.11.21.14.58.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:58:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="VP62qRG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A494C802988E; Tue, 21 Nov 2023 14:58:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234834AbjKUW5W (ORCPT + 99 others); Tue, 21 Nov 2023 17:57:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbjKUW5P (ORCPT ); Tue, 21 Nov 2023 17:57:15 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D623D54; Tue, 21 Nov 2023 14:57:03 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1cf6a67e290so17791685ad.1; Tue, 21 Nov 2023 14:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700607423; x=1701212223; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=FdcERJimN0aFkwFBjeCuGYBCdP/KZCZ/nHY+2sAtfHI=; b=VP62qRG/cgY5aW7Qfvd61YcYheRlSx1hG8yVBA8EsTqupF6Ee2CpS8o1bA02/w376r 2cEdSIA49SGU1RXNUgHD6BHSnXcnkQwj8/rOOeCxl3k/yIyMqng/ELuVD1x+O/17wik6 IQca4uQjCEihCaYxnV58/f3Ifp0YczUln3NC/gtQ+VVwNJK6uV4AjWme4LLG836kYB2O QPjbUwkcDcEjhzYrYnwd6xmpOUuwv/k9yQZjw6GaaRhfETJsKLU9k0B2X4G1ZlfcdJoF 8kKj60CeTtej/3sYlvmUDT+v7TvMeR4XcrmnSjjlriHHQUwJFtMTfnTctz9n8a1ATDRX wI3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700607423; x=1701212223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FdcERJimN0aFkwFBjeCuGYBCdP/KZCZ/nHY+2sAtfHI=; b=Lwr7M8pm8cFYED7mHMYk+sLrgwTqwREYG3orZBIZLsGmQGvBPxl8J6qVfRUSfDNPmR nNzt6HnZI4vltclFMrt67ImqDatGzvHk69xZCNmbxKGXT47YoNpKMcHPvRJltyC+WkdD 1oj3b6l66hOJ5qv/cTUvB+aqBePicu0TkWLbulkT1Y3lgZ/L6o3gScLTYridsHxF3dR1 NbnZomup6rV02WAumDfFtEGv5WPnC/6bCp3EylewVLmbhLYkBtHN7e8iMVzPno16KNP/ OycF3jVYkkGr/ybcw8hF8K7JenyeS6ur+miTYYzoFGS9KROccAxRXDPuxLf0gfsg0+Ih u5mQ== X-Gm-Message-State: AOJu0YwPPDpUbYEw8z4oa81jKpCnUMDguYNf8UC0XWVjZx9BedAzKrYX QOI83gYToJK+w00DfxItWNY= X-Received: by 2002:a17:902:f811:b0:1cc:6dd4:5955 with SMTP id ix17-20020a170902f81100b001cc6dd45955mr663004plb.19.1700607422906; Tue, 21 Nov 2023 14:57:02 -0800 (PST) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:42e0:7377:923f:1ff3:266d]) by smtp.gmail.com with ESMTPSA id m12-20020a1709026bcc00b001cc47c1c29csm8413189plt.84.2023.11.21.14.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 14:57:02 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/14] tools headers: Update tools's copy of arm64/asm headers Date: Tue, 21 Nov 2023 14:56:44 -0800 Message-ID: <20231121225650.390246-9-namhyung@kernel.org> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog In-Reply-To: <20231121225650.390246-1-namhyung@kernel.org> References: <20231121225650.390246-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 14:58:35 -0800 (PST) tldr; Just FYI, I'm carrying this on the perf tools tree. Full explanation: There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model. The way these headers are used in perf are not restricted to just including them to compile something. There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc. E.g.: $ ls -1 tools/perf/trace/beauty/*.sh | head -5 tools/perf/trace/beauty/arch_errno_names.sh tools/perf/trace/beauty/drm_ioctl.sh tools/perf/trace/beauty/fadvise.sh tools/perf/trace/beauty/fsconfig.sh tools/perf/trace/beauty/fsmount.sh $ $ tools/perf/trace/beauty/fadvise.sh static const char *fadvise_advices[] = { [0] = "NORMAL", [1] = "RANDOM", [2] = "SEQUENTIAL", [3] = "WILLNEED", [4] = "DONTNEED", [5] = "NOREUSE", }; $ The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files. So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Namhyung Kim --- tools/arch/arm64/include/asm/cputype.h | 5 ++- tools/arch/arm64/include/uapi/asm/kvm.h | 32 +++++++++++++++++++ tools/arch/arm64/include/uapi/asm/perf_regs.h | 10 +++--- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/tools/arch/arm64/include/asm/cputype.h b/tools/arch/arm64/include/asm/cputype.h index 5f6f84837a49..7c7493cb571f 100644 --- a/tools/arch/arm64/include/asm/cputype.h +++ b/tools/arch/arm64/include/asm/cputype.h @@ -79,13 +79,15 @@ #define ARM_CPU_PART_CORTEX_A78AE 0xD42 #define ARM_CPU_PART_CORTEX_X1 0xD44 #define ARM_CPU_PART_CORTEX_A510 0xD46 +#define ARM_CPU_PART_CORTEX_A520 0xD80 #define ARM_CPU_PART_CORTEX_A710 0xD47 #define ARM_CPU_PART_CORTEX_A715 0xD4D #define ARM_CPU_PART_CORTEX_X2 0xD48 #define ARM_CPU_PART_NEOVERSE_N2 0xD49 #define ARM_CPU_PART_CORTEX_A78C 0xD4B -#define APM_CPU_PART_POTENZA 0x000 +#define APM_CPU_PART_XGENE 0x000 +#define APM_CPU_VAR_POTENZA 0x00 #define CAVIUM_CPU_PART_THUNDERX 0x0A1 #define CAVIUM_CPU_PART_THUNDERX_81XX 0x0A2 @@ -148,6 +150,7 @@ #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE) #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) +#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2) diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h index f7ddd73a8c0f..89d2fc872d9f 100644 --- a/tools/arch/arm64/include/uapi/asm/kvm.h +++ b/tools/arch/arm64/include/uapi/asm/kvm.h @@ -505,6 +505,38 @@ struct kvm_smccc_filter { #define KVM_HYPERCALL_EXIT_SMC (1U << 0) #define KVM_HYPERCALL_EXIT_16BIT (1U << 1) +/* + * Get feature ID registers userspace writable mask. + * + * From DDI0487J.a, D19.2.66 ("ID_AA64MMFR2_EL1, AArch64 Memory Model + * Feature Register 2"): + * + * "The Feature ID space is defined as the System register space in + * AArch64 with op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, + * op2=={0-7}." + * + * This covers all currently known R/O registers that indicate + * anything useful feature wise, including the ID registers. + * + * If we ever need to introduce a new range, it will be described as + * such in the range field. + */ +#define KVM_ARM_FEATURE_ID_RANGE_IDX(op0, op1, crn, crm, op2) \ + ({ \ + __u64 __op1 = (op1) & 3; \ + __op1 -= (__op1 == 3); \ + (__op1 << 6 | ((crm) & 7) << 3 | (op2)); \ + }) + +#define KVM_ARM_FEATURE_ID_RANGE 0 +#define KVM_ARM_FEATURE_ID_RANGE_SIZE (3 * 8 * 8) + +struct reg_mask_range { + __u64 addr; /* Pointer to mask array */ + __u32 range; /* Requested range */ + __u32 reserved[13]; +}; + #endif #endif /* __ARM_KVM_H__ */ diff --git a/tools/arch/arm64/include/uapi/asm/perf_regs.h b/tools/arch/arm64/include/uapi/asm/perf_regs.h index fd157f46727e..86e556429e0e 100644 --- a/tools/arch/arm64/include/uapi/asm/perf_regs.h +++ b/tools/arch/arm64/include/uapi/asm/perf_regs.h @@ -36,11 +36,13 @@ enum perf_event_arm_regs { PERF_REG_ARM64_LR, PERF_REG_ARM64_SP, PERF_REG_ARM64_PC, + PERF_REG_ARM64_MAX, /* Extended/pseudo registers */ - PERF_REG_ARM64_VG = 46, // SVE Vector Granule - - PERF_REG_ARM64_MAX = PERF_REG_ARM64_PC + 1, - PERF_REG_ARM64_EXTENDED_MAX = PERF_REG_ARM64_VG + 1 + PERF_REG_ARM64_VG = 46, /* SVE Vector Granule */ + PERF_REG_ARM64_EXTENDED_MAX }; + +#define PERF_REG_EXTENDED_MASK (1ULL << PERF_REG_ARM64_VG) + #endif /* _ASM_ARM64_PERF_REGS_H */ -- 2.43.0.rc1.413.gea7ed67945-goog