From patchwork Thu Jun 26 15:18:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 32568 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CDC4201EF for ; Thu, 26 Jun 2014 15:21:40 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rd18sf20677398iec.2 for ; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=EHPLCTSiZVClpCnXtwCnKmTuuCdLg63tnifegQ/a5HY=; b=KYBFs1ldRl92AVTR4YOtAkxYgRiaflH3vg4mJTe/t0Y9twveGfT2WQQGFz/LvIed5o w4UfmGY6pm2KmNECDrZ9JtnLlonEJ6yFsjS24C01fVM9ulGJzBKSNiYUj1hOQEaeWaS0 0TnnyCuytDXap0+LIuPTkjTBjLqD2HGtyPamgB9SWjWO8peZx/27XFTHsGKNuo6Nab3Q 7TMn8WOonECRSHb5HTzGxFnkBVOWWwIpoaOWM1vJ6R3GEVwpRxtzwACCzTPkxHO5dc4/ 7MuHWwQbqrb9inR0eLgE+0DQqyYsTIwsdfQifHlaYrFpG9tlqliOUyu9TiaTkiEXk1kZ O36A== X-Gm-Message-State: ALoCoQmIGzpYLO3o8hJXX0xiZIGrYMLgJjUFOQSHnBPbmVUZFE84ZrhCLKIbtcJ3dIcEPlNJkZzx X-Received: by 10.182.166.36 with SMTP id zd4mr8520117obb.43.1403796099894; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.173 with SMTP id 42ls254692qgb.62.gmail; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) X-Received: by 10.52.121.112 with SMTP id lj16mr11813528vdb.29.1403796099679; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id q6si4632613vcm.67.2014.06.26.08.21.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 08:21:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so3709601vcb.19 for ; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) X-Received: by 10.52.253.131 with SMTP id aa3mr7824168vdd.25.1403796099343; Thu, 26 Jun 2014 08:21:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp38107vcb; Thu, 26 Jun 2014 08:21:38 -0700 (PDT) X-Received: by 10.68.225.133 with SMTP id rk5mr22702471pbc.98.1403796098542; Thu, 26 Jun 2014 08:21:38 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kv4si10308787pab.78.2014.06.26.08.21.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 08:21:38 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0BTC-0006kn-5D; Thu, 26 Jun 2014 15:20:14 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0BSt-0005NU-ME for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 15:19:56 +0000 Received: from leverpostej.cambridge.arm.com (leverpostej.cambridge.arm.com [10.1.205.151]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s5QFInwr014784; Thu, 26 Jun 2014 16:19:34 +0100 (BST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Subject: [PATCHv3 3/5] arm64: cpuinfo: print info for all CPUs Date: Thu, 26 Jun 2014 16:18:44 +0100 Message-Id: <1403795926-17139-4-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1403795926-17139-1-git-send-email-mark.rutland@arm.com> References: <1403795926-17139-1-git-send-email-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_081956_150204_C2A6A0E7 X-CRM114-Status: GOOD ( 12.49 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: Mark Rutland , catalin.marinas@arm.com, lorenzo.pieralisi@arm.com, will.deacon@arm.com, ard.biesheuvel@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mark.rutland@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Currently reading /proc/cpuinfo will result in information being read out of the MIDR_EL1 of the current CPU, and the information is not associated with any particular logical CPU number. This is problematic for systems with heterogeneous CPUs (i.e. big.LITTLE) where fields will vary across CPUs, and the output will differ depending on the executing CPU. This patch reorganises the code responsible for /proc/cpuinfo to print information per-cpu. As hwcaps are expected to be identical across all CPUs, this information is printed once. Signed-off-by: Mark Rutland Acked-by: Ard Biesheuvel --- arch/arm64/kernel/setup.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index edb146d..b00b7a3 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -448,20 +448,30 @@ static const char *hwcap_str[] = { static int c_show(struct seq_file *m, void *v) { - int i; + int c, i; - seq_printf(m, "Processor\t: %s rev %d (%s)\n", - cpu_name, read_cpuid_id() & 15, ELF_PLATFORM); + for_each_online_cpu(c) { + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, c); + u32 midr = cpuinfo->reg_midr; - for_each_online_cpu(i) { /* * glibc reads /proc/cpuinfo to determine the number of * online processors, looking for lines beginning with * "processor". Give glibc what it expects. */ #ifdef CONFIG_SMP - seq_printf(m, "processor\t: %d\n", i); + seq_printf(m, "processor\t: %d\n", c); #endif + seq_printf(m, "Type\t\t: %s rev %d (%s)\n", + cpu_name, MIDR_REVISION(midr), ELF_PLATFORM); + seq_printf(m, "CPU implementer\t: 0x%02x\n", + MIDR_IMPLEMENTOR(midr)); + seq_printf(m, "CPU architecture: AArch64\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 revision\t: %d\n", MIDR_REVISION(midr)); + + seq_puts(m, "\n"); } /* dump out the processor features */ @@ -470,17 +480,8 @@ static int c_show(struct seq_file *m, void *v) for (i = 0; hwcap_str[i]; i++) if (elf_hwcap & (1 << i)) seq_printf(m, "%s ", hwcap_str[i]); - - seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); - seq_printf(m, "CPU architecture: AArch64\n"); - seq_printf(m, "CPU variant\t: 0x%x\n", (read_cpuid_id() >> 20) & 15); - seq_printf(m, "CPU part\t: 0x%03x\n", (read_cpuid_id() >> 4) & 0xfff); - seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15); - seq_puts(m, "\n"); - seq_printf(m, "Hardware\t: %s\n", machine_name); - return 0; }