Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5552753imm; Wed, 12 Sep 2018 07:40:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbjbyeI0drJgu6K4GZa0JjO/wWwb4k6M9G9Yfhk/o9R6rgnJAyGZnW8Wak+nCy4q0IqFUpX X-Received: by 2002:a63:5845:: with SMTP id i5-v6mr2716089pgm.272.1536763256588; Wed, 12 Sep 2018 07:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536763256; cv=none; d=google.com; s=arc-20160816; b=zeFbinHA5ytj1StaI92rS2QGgK0NxkHPkk21T+mnt+ATi9z+2WBjdm8y60RhqL2+FL EJaUVP9OHP1VSNrWvLJvz7IiSVSn21njtkeH/TUSTawh9xD301AyHRFX92JeyCdtpGQ+ xsNjtBC1B05Hb9AfQoTToyPFsdaShxxZyOhZydjVmZa+ZQmBWyHvPdR/RVolLqbdup6N 64iK0pbD6W+GJDAaOMQTYCH2wpNzbkI0t2nLx/VQpH4hARPQFhj6YtVH3J9rgw85gunk hLDsIT1mpLdpc62dB8KNKLkzhkMy003jFODfgYkQL1Y1cQ/iWAIaP2cgrZcK71QUxbS2 LiMQ== 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=6/ydt6N6S/55utOAFvJcmvh4Eg5M9T60iCGCfN79Lr4=; b=hL2HKUftzT8JquO1RsVPmpJtJFsjTGyhxXW08fqJ0mMhkkcNinu1SbQ0DVnI3XGJ1A S7iQbgq35GW4J9tRO/OWjtXIZKHXqHtnQEJxISchTBJeH5v861TJxg6Hb0wb/Xllz8lI k9mfz4GvwI6D9DzPeA3gYNYgm+AZ8QbaZtLEmZjup87Cbd6m+8673V+ugIaqTIHyGL6J kGatc383+R+c2k8I2qyi71I14LFWNFoQRmpMQZdhNNO3mc9SaHMsUSb5z1qxc0IWJiJ3 ZRYDAJEUsJIRfpfFoMpxidE6b+ChAYMSVAIr9OaIQnR0o98IQAk9eJpxprXKE+5k8JRf JGgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=J9HoMRc1; 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 184-v6si1150717pgj.421.2018.09.12.07.40.32; Wed, 12 Sep 2018 07:40:56 -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=J9HoMRc1; 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 S1728090AbeILTn2 (ORCPT + 99 others); Wed, 12 Sep 2018 15:43:28 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46596 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbeILTn2 (ORCPT ); Wed, 12 Sep 2018 15:43:28 -0400 Received: by mail-pg1-f196.google.com with SMTP id b129-v6so1155509pga.13 for ; Wed, 12 Sep 2018 07:38:40 -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=6/ydt6N6S/55utOAFvJcmvh4Eg5M9T60iCGCfN79Lr4=; b=J9HoMRc1Cw2DWHgjkSmnvF69yzHPXFmKuJQbJiIfK2vbP0DE6gIGMX+pb6B15fR4OQ eO+dqb2Epv0AJtJI3HwryzOwmsopDb2wGrX3d0MOE1JwQs2td4Y+3sbn2Pu1ZqcbcJHJ Ua/q/FRpewipvA0FYWr3b8kh2n7Qo4zxyMgMnp2luzLKVQ8TIKfmm5vq7QTm275RzncO uf6JVBY5ImqUItQEdYxu9xBDCjWfJnuAC7q8Lwn5VEGtWE5ZzYQd+AZeJxOoiYGWvUjl dQGH/GWxtoz099unBQJkAaztK/YW+HyXHov3+BpUzAtLReBFBkLXB88EzVd8lsMrUrh1 czTQ== 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=6/ydt6N6S/55utOAFvJcmvh4Eg5M9T60iCGCfN79Lr4=; b=Ex+5Qh/NZMXCwfI/w6QfuZ8/ZU5KzrzCtON9Pp7HWK5p3+yipEB9v+EfHMaq02Dv97 6+tvjBtvbvr0ra76MA4eRe6fXEmgbKdlWZYx385wDlMeMgwo2XPHsGyolrgCvOKNnp8+ VwbacN9V7vslFKR3TKPkwc6MEV6AUOwbcJlj9hr2Q5nRBtoVJxt1MYyV5N4bcWopEUyF kKS7WG51KHepjqx3MbjIJjR3WyWRMXtYxNd2kQk1lLtF5qqtC8hIhfYysHomNkNEeGbE fj5KGu7L7rZpnMslKnclQ7RvrXc95J4UrxEOU8+6mpym7wIoMJ90E6XeEgKu64z+L2cF ekNA== X-Gm-Message-State: APzg51Chx5pHj2XZsMdtetQf7YROvL5oKtLaJI9gIXDuWQW9ciorcPhA rSRHfQVXgaujD3pnLCmBRu/MYw== X-Received: by 2002:a63:c912:: with SMTP id o18-v6mr2601378pgg.331.1536763120095; Wed, 12 Sep 2018 07:38:40 -0700 (PDT) Received: from anup-ubuntu64.dlink.router ([106.51.30.16]) by smtp.googlemail.com with ESMTPSA id y85-v6sm2416083pfa.170.2018.09.12.07.38.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 07:38:39 -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] RISC-V: Show CPU ID and Hart ID separately in /proc/cpuinfo Date: Wed, 12 Sep 2018 20:08:22 +0530 Message-Id: <20180912143822.21948-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: cpu : 0 hart : 1 isa : rv64imafdcsu mmu : sv48 cpu : 1 hart : 0 isa : rv64imafdcsu mmu : sv48 cpu : 2 hart : 3 isa : rv64imafdcsu mmu : sv48 cpu : 3 hart : 2 isa : rv64imafdcsu mmu : sv48 Signed-off-by: Anup Patel --- arch/riscv/kernel/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index f0f0ec2737b7..7c1342e242e6 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -87,7 +87,8 @@ 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, "cpu\t: %lu\n", cpu_id); + seq_printf(m, "hart\t: %lu\n", cpuid_to_hardid_map(cpu_id)); if (!of_property_read_string(node, "riscv,isa", &isa) && isa[0] == 'r' && isa[1] == 'v') -- 2.17.1