Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1043534imm; Sat, 14 Jul 2018 20:54:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBHCTqT/fYinCaP4lPdyki13MfM8rs73RqMdm+VZjfVqVyORbBGXCHKT0IKld2K9OSJGVU X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr3965858plb.80.1531626887716; Sat, 14 Jul 2018 20:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531626887; cv=none; d=google.com; s=arc-20160816; b=J1FaIiuAWaKnVEwJ8VInjUxc1r6v6Ozab645Pj+zpI8dnXZVcPSzONEfDzbXLefxo9 i1GrE5eAygo9yExPlwfl8DCUPKbsPcbe/Y46rm0AjpR9sAgAFl9Y9UBroNvzj2b/1RPv 5IXnInjAibwja9ulOsUEQXiewlR8dakwiIyM4Pkhe3Vt6aEG6PzqeuS99LzJG0DmuBUt goUxwEvShVTjYiYKtaauiMOC+F3zZR88MbDL4zfdo/wHikn+YPuNzMv4XENOAkKsw0ug q5KdLuxtsmT/sr3eeO65jvmu3YVmjTzlBJQdcWoZz3jl8IJ4OBPcsgnw1ysOn3Bwo2dR 02gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=9KKAyAbYBhWEcPGx2FCv9KHmTdztaCSUXU5/poEkbwU=; b=J64hPoVReBExl//hBGOX4Ib25g4vTp1QeYxSlE3Qm7UF7D1SKgfJqi3nff+E6Sovbo poJGhsvNF1qVeixVFIU0r2AVGs478GCaZwvzByVc6QzhxRCQ/rteOW5G04ym7w760o0y o5yykevsfaoIeqXd6ECLFzpjTXAuMTn2qHiUZ3zbeKfj/XXF2wcTTMN8VQtLHoP8SEUu +WkzhF/7BguqTJ/3sqLEBICzoHJ+szfe05fq7o31Uhuklujj8d2t6zWajky6cNnDish/ 6BoU2KuzEV1m+q4enk2/kWIY4hdnqG6HjkgrDZp7YfCSXSODcfrbA6iNoazOLVWrHBqQ vXSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=B7DT6OTk; 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 97-v6si27463486pld.345.2018.07.14.20.54.31; Sat, 14 Jul 2018 20:54:47 -0700 (PDT) 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; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=B7DT6OTk; 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 S1726042AbeGOEPV (ORCPT + 99 others); Sun, 15 Jul 2018 00:15:21 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:41836 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbeGOEPV (ORCPT ); Sun, 15 Jul 2018 00:15:21 -0400 Received: by mail-yw0-f195.google.com with SMTP id q129-v6so10330294ywg.8 for ; Sat, 14 Jul 2018 20:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=9KKAyAbYBhWEcPGx2FCv9KHmTdztaCSUXU5/poEkbwU=; b=B7DT6OTkIbL5xJcUeOLR7O1920YS7jIYo30XSaKBbyhlC1w4ZybSeuduEOSmAoiPic Y/jf4T60ugZKjZfipYO4s+bLtYXwz6TKdXY6+V6mdH/9rgJec2dyinFAVG0WYP+sC95Y JYB10jFjy0WDB7WXoi9E2a906hV1hU4lLlIrMgsnxhxVaHzvH9aYkZTTtNTw6xUl72YZ Chee1zQPqM3jN0BBcqdLO5tmKzyOYWxLll5Q5hPmljXmO4wrasOs7sI/UuvSqbbWiRSn SB5xeLFCwj7yQzJBcSpnj7O1MKFwqMs2LBIckkOv84lwHPtuQjJINs1jmW0x/eWE8uoI qjxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9KKAyAbYBhWEcPGx2FCv9KHmTdztaCSUXU5/poEkbwU=; b=YRf4XW+fhmRubmPVmBgIwElMmblVsCtbmInM3J0Iuds2sqoL97GPJh6klhiN23EQN/ 4CycpWnHlEh83WOHf+sL7WPGepvCDG0Myd24TTHvVC49NRCO3zWr089IlBT2zkJ5mght hPdVA8Nyd2vksAJhRPMaOvYA3CcES4A35PqaqXmiYLhIPolXjFyufFcGqJrRVSGETzVa i4f3tcMzV3/rTbfpLIm0/virjTqXcTzlkGdRbrqx7sNteY3nnfwJC4syqoUSGd4ZFeva gHN9tdthDkiCvYVZMaCaj7ibeD6W0PMyQLaETs9WBc1yjsbsWcR70n3KO4SC6K/wP4fb Jbug== X-Gm-Message-State: AOUpUlGok4C+sRUBTluFYPm+yUR8cSDwSOt8zO5slsTE+StmepgDq8z2 tZ8Psj2ghhWNaiv6WUTZfpD84Q== X-Received: by 2002:a81:2202:: with SMTP id i2-v6mr5834904ywi.167.1531626834822; Sat, 14 Jul 2018 20:53:54 -0700 (PDT) Received: from brutus.lixom.net (99-152-116-91.lightspeed.sntcca.sbcglobal.net. [99.152.116.91]) by smtp.gmail.com with ESMTPSA id w143-v6sm3039782yww.49.2018.07.14.20.53.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jul 2018 20:53:53 -0700 (PDT) From: Olof Johansson To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Olof Johansson Subject: [PATCH] arm64: cpuinfo: Include cleartext implementer and part strings Date: Sat, 14 Jul 2018 20:53:42 -0700 Message-Id: <20180715035342.11371-1-olof@lixom.net> X-Mailer: git-send-email 2.8.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's some use in printing out what the implementer and part numbers decode to for cases where they're known. I filled in the table based on public information; mostly from ARM TRMs and other tools (and some of the SSBD tables in the kernel, etc). Apple IDs came from https://github.com/apple/darwin-xnu/blob/master/osfmk/arm/cpuid.h Signed-off-by: Olof Johansson --- arch/arm64/kernel/cpuinfo.c | 79 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index e9ab7b3..9a7c25d 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -121,6 +121,67 @@ static const char *const compat_hwcap2_str[] = { }; #endif /* CONFIG_COMPAT */ +struct midr_info { + unsigned int mask; + unsigned int val; + char *id; +}; + +static const struct midr_info midr_part[] = { + // ARM + { .mask = 0xff00fff0, .val = 0x4100d030, .id = "Cortex-A53" }, + { .mask = 0xff00fff0, .val = 0x4100d040, .id = "Cortex-A35" }, + { .mask = 0xff00fff0, .val = 0x4100d070, .id = "Cortex-A57" }, + { .mask = 0xff00fff0, .val = 0x4100d080, .id = "Cortex-A72" }, + { .mask = 0xff00fff0, .val = 0x4100d090, .id = "Cortex-A73" }, + { .mask = 0xff00fff0, .val = 0x4100d0a0, .id = "Cortex-A75" }, + { .mask = 0xff00fff0, .val = 0x4100d0f0, .id = "Cortex-A55" }, + // Broadcom + { .mask = 0xff00fff0, .val = 0x42001000, .id = "Brahma-B53" }, + { .mask = 0xff00fff0, .val = 0x42005160, .id = "ThunderX2" }, + // Cavium + { .mask = 0xff00fff0, .val = 0x43000a00, .id = "ThunderX" }, + { .mask = 0xff00fff0, .val = 0x43000a10, .id = "ThunderX 88xx" }, + { .mask = 0xff00fff0, .val = 0x43000a20, .id = "ThunderX 81xx" }, + { .mask = 0xff00fff0, .val = 0x43000a30, .id = "ThunderX 83xx" }, + { .mask = 0xff00fff0, .val = 0x43000af0, .id = "ThunderX2 99xx" }, + // Nvidia + { .mask = 0xff00fff0, .val = 0x4e000000, .id = "Denver" }, + { .mask = 0xff00fff0, .val = 0x4e000030, .id = "Denver 2" }, + // Applied Micro + { .mask = 0xff00fff0, .val = 0x50000000, .id = "X-Gene" }, + // Qualcomm + { .mask = 0xff00fff0, .val = 0x51002010, .id = "Kryo" }, + { .mask = 0xff00fff0, .val = 0x51002050, .id = "Kryo" }, + { .mask = 0xff00fff0, .val = 0x51002110, .id = "Kryo" }, + { .mask = 0xff00fff0, .val = 0x51008000, .id = "Falkor V1/Kryo" }, + { .mask = 0xff00fff0, .val = 0x51008010, .id = "Kryo V2" }, + { .mask = 0xff00fff0, .val = 0x5100c000, .id = "Falkor" }, + { .mask = 0xff00fff0, .val = 0x5100c010, .id = "Saphira" }, + // Samsung + { .mask = 0xff00fff0, .val = 0x53000010, .id = "M1" }, + // Apple + { .mask = 0xff00fff0, .val = 0x61000010, .id = "Cyclone" }, + { .mask = 0xff00fff0, .val = 0x61000020, .id = "Typhoon" }, + { .mask = 0xff00fff0, .val = 0x61000030, .id = "Typhoon/Capri" }, + { .mask = 0xff00fff0, .val = 0x61000040, .id = "Twister" }, + { .mask = 0xff00fff0, .val = 0x61000050, .id = "Twister/Elba/Malta" }, + { .mask = 0xff00fff0, .val = 0x61000060, .id = "Hurricane" }, + { .mask = 0xff00fff0, .val = 0x61000070, .id = "Hurricane/Myst" }, +}; + +static const struct midr_info midr_impl[] = { + { .mask = 0xff000000, .val = 0x41000000, .id = "ARM" }, + { .mask = 0xff000000, .val = 0x42000000, .id = "Broadcom" }, + { .mask = 0xff000000, .val = 0x43000000, .id = "Cavium" }, + { .mask = 0xff000000, .val = 0x4d000000, .id = "Motorola" }, + { .mask = 0xff000000, .val = 0x4e000000, .id = "Nvidia" }, + { .mask = 0xff000000, .val = 0x50000000, .id = "Applied Micro" }, + { .mask = 0xff000000, .val = 0x51000000, .id = "Qualcomm" }, + { .mask = 0xff000000, .val = 0x53000000, .id = "Samsung" }, + { .mask = 0xff000000, .val = 0x61000000, .id = "Apple" }, +}; + static int c_show(struct seq_file *m, void *v) { int i, j; @@ -129,6 +190,16 @@ static int c_show(struct seq_file *m, void *v) for_each_online_cpu(i) { struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); u32 midr = cpuinfo->reg_midr; + char *impl = NULL; + char *part = NULL; + + for (j = 0; !impl && j < ARRAY_SIZE(midr_impl); j++) + if ((midr & midr_impl[j].mask) == midr_impl[j].val) + impl = midr_impl[j].id; + + for (j = 0; !part && j < ARRAY_SIZE(midr_part); j++) + if ((midr & midr_part[j].mask) == midr_part[j].val) + part = midr_part[j].id; /* * glibc reads /proc/cpuinfo to determine the number of @@ -168,11 +239,12 @@ static int c_show(struct seq_file *m, void *v) } seq_puts(m, "\n"); - seq_printf(m, "CPU implementer\t: 0x%02x\n", - MIDR_IMPLEMENTOR(midr)); + seq_printf(m, "CPU implementer\t: 0x%02x (%s)\n", + MIDR_IMPLEMENTOR(midr), impl ? : "unknown"); seq_printf(m, "CPU architecture: 8\n"); seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr)); - seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr)); + seq_printf(m, "CPU part\t: 0x%03x (%s)\n", MIDR_PARTNUM(midr), + part ? : "unknown"); seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr)); } @@ -300,6 +372,7 @@ static int __init cpuinfo_regs_init(void) } return 0; } + static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info) { unsigned int cpu = smp_processor_id(); -- 2.8.6