Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1689961imm; Tue, 2 Oct 2018 12:16:33 -0700 (PDT) X-Google-Smtp-Source: ACcGV639JSxzWT8KE2fgvQ/Qv9rJDOeWmHwVQ6Lff2bY+7IesJSoi0EVSHZ9SB4sVHaAByjcmNyK X-Received: by 2002:a63:fb54:: with SMTP id w20-v6mr15990513pgj.321.1538507793517; Tue, 02 Oct 2018 12:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538507793; cv=none; d=google.com; s=arc-20160816; b=fln0ZUCEwcQipYkLI+eiMZiKZqXR9MRP44s2jRTDo0foYc8ljUeIdNjNQlcXFx5HHF /1YSGISpe+dwvy7Zy7SzDWtTvwXyGak4Qv4GUUgbnvaEMhfjoyrY8LWmAsjGnpU3Z4Vx /Fs35N5Dp43bO7J6p10jBzrKBPROMsLzvbLHr1Y2ihAwZA6iRdfZhkpG8ZPGAAOMQrXm sRAAZoy2O3PxDE/j6UR5Tm6J3nZii1lttIWZ4uCNjyoYTpS43+ZEvi1jUuiiArEjou67 oSvLCXLEMjugOfV6ptJHSEPdN8am1HydZOcNZSyt4JNyjziiuzgHcvHOiuhNA3xOlgk0 ZSDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=8h5YgrtmHiYSuB3a7JjPiQ/SEihczw+zTCcCXYR2Avg=; b=IEtjTh+LqaHBxG3u78er98DlOhkERw3WqylSDOOiBUycw2dCbpTjaOqw+xi7Xq9sl9 tSEaSBsKgFJuiYi0uXmJxjImZlTaTbvjEmmMorYm1W8J2DhVxRfItS/45fj8bvMEXnCu Tb4iuIKtVhcrSfle12DNIpJvZx2+/o7Vv9joBBshvj2Ji8sk4AEY7BRIlie2jUi5whrz BI4CYElrE39doZhe+ncdligfEV659FThy2fl3rzP3K/b+dyM6OFW9UhVBHcsYgQ6KzzS 1UAhhfSM/TLUKFExr/dJ9M5OHQVwP4z8fGCQOZalsozxj4xswKrAcuoYbfn32uzZnZ13 pAfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="ID1pJ2/b"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f91-v6si17108719plf.376.2018.10.02.12.16.18; Tue, 02 Oct 2018 12:16:33 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="ID1pJ2/b"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728302AbeJCCAi (ORCPT + 99 others); Tue, 2 Oct 2018 22:00:38 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:61582 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727755AbeJCCAF (ORCPT ); Tue, 2 Oct 2018 22:00:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1538507713; x=1570043713; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=QoJF+zxi71e6lxam6xbMcJHOAzHqmAmlkJMulFCOr4w=; b=ID1pJ2/b39CibvuouxVToaen7R+9ScjMyMWbs2r++KKzzYxvSJrqpsml eTCU079JCjOGK5GiDVLflTml45zms2bmzST51baXO0QaydcPqWKSh+0md zGHQjkzz/frUoUGamNPghfR90+bJqt3oxpY9kVsFCvXGM1FjHqj2RwSUH /zRY6JVIms24ICwYoHNg+mfMnQZeHE+NhjcJ9N8fLeeNHoUyGW2EBrD5o FONL0rO0LQp80bVVBqb94fyrdttBmfHIkK7kwO3zJkaRg5h0mKOWjmNgy SH225pK370t6Ym8ww89rp3mU1qt/e9HhESczxq2I1KhTCGtOlk3izq68r g==; X-IronPort-AV: E=Sophos;i="5.54,332,1534780800"; d="scan'208";a="91076764" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Oct 2018 03:15:10 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Oct 2018 12:00:51 -0700 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Oct 2018 12:15:11 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org, palmer@sifive.com Cc: anup@brainfault.org, hch@infradead.org, linux-kernel@vger.kernel.org, atish.patra@wdc.com Subject: [PATCH v6 13/14] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Date: Tue, 2 Oct 2018 12:15:06 -0700 Message-Id: <1538507707-22299-14-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538507707-22299-1-git-send-email-atish.patra@wdc.com> References: <1538507707-22299-1-git-send-email-atish.patra@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anup Patel 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 Signed-off-by: Atish Patra --- 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 cccc6f61..3a5a2ee3 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_hartid_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.7.4