Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1555100imm; Sun, 23 Sep 2018 06:38:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63XFQbL/Ea7dBVbE/6jB9i2NkyzEBOXPLl+Jk6RYYoPEpxzBv5BeeEk3+WKTp99gYQlbVNk X-Received: by 2002:a17:902:981:: with SMTP id 1-v6mr6714752pln.60.1537709894027; Sun, 23 Sep 2018 06:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537709893; cv=none; d=google.com; s=arc-20160816; b=BVljzv6zUodwrj7jLL0Odjffbq1RW9nK/FxLq9FcOHn2Z+5rnJRVxdjT6w1bXfbJyH ehUXpqJN670wxZZs2P6J+kSg3kSBeCsLdMHHwlyxM1CPy9jvKa8bf4EzzecOhzb8vk91 1fbkpgvneZvECfnIkBhLusznZHZSwSGbWNxv0L1TocyKOQwCrMtRDab5f/qPpRGAxEMl f8pDZlWbGzFfjFpWhl62XOGIDVSzO3sfTxwA7zOZjJwddzo8KM+H11XUj3HLhtUpQ03g fB1mmXjLjCKLw/J0sxk81MucoE246t1LVhHj1RNdKj05gnV6BJWL21i7CiCIwKRqxlWA ybSQ== 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; bh=Zilsh2tFgZXnd5LLq1Z4euqgXWzST7tVUMLvmFK1/HA=; b=nZK1CGjcWsRqB3+KL0Hzo54TxiVJv2WUFx+PWIXrLxOKq+zRbPIsgZ6iifW7uz0Hqb 9LDnenE2TULiI/cQ8VaJQ67zLmc0Hj/+8kgH/TjpaR3gG5aBodmPk0D4YkiFZBBOK5Vt bi6pX1uNAcfdzmogjSizVbALImTL8MgIcooTPoIZgJnpc7ay3TbFpLE+KyVYhVhswKTb NxjIKAgj7+yV64ylEFSFs52WO2d5eL4f8APm0xJzFgHVBDowyeeKsga9KW8S4HWeHOnJ og3u7o5vldGZg7xBumo7LJWRlUCdbLZbhhVf6Bjg/E4RTgESfenLwPCJgAp/5bmTQFOb jhug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=rsr2M8AC; 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 f16-v6si27680527pgv.75.2018.09.23.06.37.57; Sun, 23 Sep 2018 06:38:13 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=rsr2M8AC; 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 S1726225AbeIWTfX (ORCPT + 99 others); Sun, 23 Sep 2018 15:35:23 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45262 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbeIWTfW (ORCPT ); Sun, 23 Sep 2018 15:35:22 -0400 Received: by mail-pf1-f193.google.com with SMTP id a23-v6so246309pfi.12 for ; Sun, 23 Sep 2018 06:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Zilsh2tFgZXnd5LLq1Z4euqgXWzST7tVUMLvmFK1/HA=; b=rsr2M8ACOw2f6hJrczsl229WsNB8iqcMS0JKuaqTsjC6gdt2SlCg8OYLEQay+wMTXL eRqL4tTx4Plu2tOfOhLJGPuORCA5Zaq4VY/D0Ad69vokTg6mSeY8E56Wn8Xcbuw3Tsrm mC/oFU50nDFRdHOoQCHHrx1lOAeFhhDQwyHHsJfNtES3fnS+K2dSxbo5RmgDp3542SuK 9f13q/WOGOVTdLt5WCVlTFj1u6lHLBSawt5X16uDgTJ/QBB4nfApOTuAwkvx2dJlLsEs DE+jp0cq+Fh63NKshYnAAs1kH/CFkaHCg5v2l4YYrZFC2q9v57wdi8ISPqHdmH3RZUlI 1rfg== 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=Zilsh2tFgZXnd5LLq1Z4euqgXWzST7tVUMLvmFK1/HA=; b=OBiYWgVtrU7vnc+VoG23OMbXgWTWeNznfbFsy+4gpbiqm9T9RcyojQWosJBmO1k7+2 PKWgF6ESJkKZ6GYGRZ4tGwrqSYdTcj98fMGc6BIsNGMvOfpanEAQ8oGba7gowuucm7CE WTz+0wKrO2j+4QoF/NeErSX1mvUdYR+wpm3zYbW5UmtjO1yudopb2Uytg+wqG6Y2qBiL CLpPcdf3HHYkbORCAN5/r2TWmZN3gyhtJy99WSoJJJS8GmCYP65fHm2Yz3gUM+YwrZdx kR5TSxku+66iE0oV2JpxRFonAcaF7OgtitiegmowOcXDUYYM9cU0kNKW4Y5NUXpqQZzd iuUw== X-Gm-Message-State: ABuFfohTwpg2trc8N2+DhhDFfA7iZKV13UjAA2Uue+jgFAVPnxPKaJ80 ZF3vfdzR341RtjX9xvPcUf07CA== X-Received: by 2002:a63:fe02:: with SMTP id p2-v6mr5994391pgh.148.1537709871594; Sun, 23 Sep 2018 06:37:51 -0700 (PDT) Received: from anup-ubuntu64.dlink.router ([106.51.30.16]) by smtp.googlemail.com with ESMTPSA id j16-v6sm62428654pfk.125.2018.09.23.06.37.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Sep 2018 06:37:50 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Albert Ou Cc: Atish Patra , Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v2] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Date: Sun, 23 Sep 2018 19:07:37 +0530 Message-Id: <20180923133737.22693-1-anup@brainfault.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, /proc/cpuinfo show logical CPU ID as Hart ID which is in-correct. This patch shows CPU ID and Hart ID separately in /proc/cpuinfo using cpuid_to_hardid_map(). With this patch, contents of /proc/cpuinfo looks as follows: processor : 0 hart : 1 isa : rv64imafdc mmu : sv48 processor : 1 hart : 0 isa : rv64imafdc mmu : sv48 processor : 2 hart : 2 isa : rv64imafdc mmu : sv48 processor : 3 hart : 3 isa : rv64imafdc mmu : sv48 Signed-off-by: Anup Patel --- Changes since v1: - Show logical CPU ID as "processor" attribute in /proc/cpuinfo arch/riscv/kernel/cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 36b6ddb19b4d..392c7c19c4a3 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -81,7 +81,7 @@ static void print_isa(struct seq_file *f, const char *orig_isa) #endif /* Print the base ISA, as we already know it's legal. */ - seq_puts(f, "isa\t: "); + seq_puts(f, "isa\t\t: "); seq_write(f, isa, 5); isa += 5; @@ -96,6 +96,7 @@ static void print_isa(struct seq_file *f, const char *orig_isa) isa++; } } + seq_puts(f, "\n"); /* * If we were given an unsupported ISA in the device tree then print @@ -116,7 +117,7 @@ static void print_mmu(struct seq_file *f, const char *mmu_type) return; #endif - seq_printf(f, "mmu\t: %s\n", mmu_type+6); + seq_printf(f, "mmu\t\t: %s\n", mmu_type+6); } static void *c_start(struct seq_file *m, loff_t *pos) @@ -144,14 +145,15 @@ static int c_show(struct seq_file *m, void *v) NULL); const char *compat, *isa, *mmu; - seq_printf(m, "hart\t: %lu\n", cpu_id); + seq_printf(m, "processor\t: %lu\n", cpu_id); + seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hardid_map(cpu_id)); if (!of_property_read_string(node, "riscv,isa", &isa)) print_isa(m, isa); if (!of_property_read_string(node, "mmu-type", &mmu)) print_mmu(m, mmu); if (!of_property_read_string(node, "compatible", &compat) && strcmp(compat, "riscv")) - seq_printf(m, "uarch\t: %s\n", compat); + seq_printf(m, "uarch\t\t: %s\n", compat); seq_puts(m, "\n"); return 0; -- 2.17.1