From patchwork Sat Aug 29 18:38:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 52855 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 2D7F422A23 for ; Sat, 29 Aug 2015 18:38:56 +0000 (UTC) Received: by labd1 with SMTP id d1sf27774148lab.0 for ; Sat, 29 Aug 2015 11:38:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:subject:date :message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=AUR7DEkyciyq/S53L3+d74+uLo5/2J4Wa/oiTtvvE78=; b=AKCBiiMlPml3EnVgm/eT4KdSfOC6X/4yRRcrsFZa7mxou375MUCk9gkfz2BW7ZHky3 9IdpoiAhH6JAqLVZvoM/Y22QIF7fojZsPT5GEGMay9DGqZWfbArd8DAjgGGCUSf4vAz6 is4zZkqnIjenbAV6DlOzesNWn31QrcB92U0qFJNbHqXFJCqbPS45yQw09ccByo5U+Wxk 0p2P0SaATBgHqK5+x77LWETEU1lU7tUrQJ1TlyfY3Q7UnCwR46DIGfotFmlQH7Ui3UjT sCDGk1IJIzfwwL1C9yaarh/gjnZtoEtjImOyC64NTeqNV40NH4HB0Q8cdUU+7onw3TTp UMHg== X-Gm-Message-State: ALoCoQnUAPkOOtr1ThkqLJf31TV0xwTVoJ/+Ue3EzhSkJtVj1iaFzoCfcUdTiH3HRZ1ltWHIAJTD X-Received: by 10.180.100.71 with SMTP id ew7mr2700836wib.0.1440873535079; Sat, 29 Aug 2015 11:38:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.197 with SMTP id h5ls233236lae.85.gmail; Sat, 29 Aug 2015 11:38:54 -0700 (PDT) X-Received: by 10.112.201.231 with SMTP id kd7mr7122315lbc.52.1440873534756; Sat, 29 Aug 2015 11:38:54 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id ph9si9135263lbb.120.2015.08.29.11.38.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Aug 2015 11:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbcbn3 with SMTP id bn3so44343122lbc.2 for ; Sat, 29 Aug 2015 11:38:54 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr7323532lag.86.1440873534449; Sat, 29 Aug 2015 11:38:54 -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.112.151.194 with SMTP id us2csp657450lbb; Sat, 29 Aug 2015 11:38:53 -0700 (PDT) X-Received: by 10.69.2.227 with SMTP id br3mr25072439pbd.9.1440873533364; Sat, 29 Aug 2015 11:38:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si11715293pbu.88.2015.08.29.11.38.52; Sat, 29 Aug 2015 11:38:53 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbbH2Siu (ORCPT + 28 others); Sat, 29 Aug 2015 14:38:50 -0400 Received: from mail-ig0-f178.google.com ([209.85.213.178]:35254 "EHLO mail-ig0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbbH2Sit (ORCPT ); Sat, 29 Aug 2015 14:38:49 -0400 Received: by igcrd18 with SMTP id rd18so4042476igc.0 for ; Sat, 29 Aug 2015 11:38:48 -0700 (PDT) X-Received: by 10.50.73.168 with SMTP id m8mr7937948igv.25.1440873528866; Sat, 29 Aug 2015 11:38:48 -0700 (PDT) Received: from vmware.wrightpinski.org (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id d8sm6368434igl.13.2015.08.29.11.38.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Aug 2015 11:38:48 -0700 (PDT) Received: from vmware.wrightpinski.org (localhost [127.0.0.1]) by vmware.wrightpinski.org (8.14.4/8.14.4/Debian-4) with ESMTP id t7TIchvs043936; Sun, 30 Aug 2015 02:38:43 +0800 Received: (from pinskia@localhost) by vmware.wrightpinski.org (8.14.4/8.14.4/Submit) id t7TIcgNw043935; Sun, 30 Aug 2015 02:38:42 +0800 From: Andrew Pinski To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pinskia@gmail.com, apinski@cavium.com Subject: [PATCH] ARM64: Add AT_ARM64_MIDR to the aux vector Date: Sun, 30 Aug 2015 02:38:40 +0800 Message-Id: <1440873520-43899-1-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: apinski@cavium.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.217.177 as permitted sender) smtp.mailfrom=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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , It is useful to pass down MIDR register down to userland if all of the online cores are all the same type. This adds AT_ARM64_MIDR aux vector type and passes down the midr system register. This is alternative to MIDR_EL1 part of http://lists.infradead.org/pipermail/linux-arm-kernel/2015-July/358995.html. It allows for faster access to midr_el1 than going through a trap and does not exist if the set of cores are not the same. Signed-off-by: Andrew Pinski --- arch/arm64/include/asm/cpu.h | 1 + arch/arm64/include/asm/elf.h | 6 ++++++ arch/arm64/kernel/cpuinfo.c | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h index 8e797b2..fab0aa1 100644 --- a/arch/arm64/include/asm/cpu.h +++ b/arch/arm64/include/asm/cpu.h @@ -62,5 +62,6 @@ DECLARE_PER_CPU(struct cpuinfo_arm64, cpu_data); void cpuinfo_store_cpu(void); void __init cpuinfo_store_boot_cpu(void); +u32 get_arm64_midr(void); #endif /* __ASM_CPU_H */ diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index faad6df..d3549de 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -17,6 +17,7 @@ #define __ASM_ELF_H #include +#include /* * ELF register definitions.. @@ -138,8 +139,13 @@ typedef struct user_fpsimd_state elf_fpregset_t; #define ARCH_DLINFO \ do { \ + u32 midr; \ + \ NEW_AUX_ENT(AT_SYSINFO_EHDR, \ (elf_addr_t)current->mm->context.vdso); \ + midr = get_arm64_midr(); \ + if (midr != 0) \ + NEW_AUX_ENT(AT_ARM64_MIDR, (elf_addr_t)midr); \ } while (0) #define ARCH_HAS_SETUP_ADDITIONAL_PAGES diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 75d5a86..b14c87d 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -254,3 +254,25 @@ void __init cpuinfo_store_boot_cpu(void) boot_cpu_data = *info; } + +u32 get_arm64_midr(void) +{ + int i; + u32 midr = 0; + + for_each_online_cpu(i) { + struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); + u32 oldmidr = midr; + + midr = cpuinfo->reg_midr; + /* + * If there are cpus which have a different + * midr just return 0. + */ + if (oldmidr && oldmidr != midr) + return 0; + } + + return midr; +} +