From patchwork Wed Jan 29 16:50:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 23886 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B4CA20300 for ; Wed, 29 Jan 2014 16:52:00 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tp5sf6754071ieb.11 for ; Wed, 29 Jan 2014 08:51:59 -0800 (PST) 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:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=ZfjnkwSPPCYy95HTcQFtXp5Z1k/z56tOZ9I2kuBQkvk=; b=cFBQ7ibE7qlCFwPt0LHBVqi6Yc4EkHk3EOfURK4M4TzhJOiRiVfFy4jIN1tnglQZCO KpR44S5VYyrw0S0sgEnCWD/mK/AQh6Zo0uDwVZXMzC3zjisVZFrh8mJPaY4vubr86iuN 3V1BOrGUxRfdrThCNTocP5D/S3GgZPYoLozW+xZyXEWtgUBxRrif2MZULvNsSUWH37Ik LOguhdCkbhJL37ICTtaJQ9bLX2a83v1obgq9wBmZ3SPCLFmRaRLigb+5HCrQBHx8I471 dJznAuqgVyMuM8Ln0dJm8kSllNa+4XW+94nOk31EkuAabCSamounMsEru59z7idOmhzo mvsw== X-Gm-Message-State: ALoCoQmDeBo4amGtOQ1R8RRTWGKzU49MMOJarouI84P7wgjV+Jh1givaWx9NBYmCUQAGb1IGCrTb X-Received: by 10.50.124.9 with SMTP id me9mr12440663igb.4.1391014319495; Wed, 29 Jan 2014 08:51:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.145 with SMTP id v17ls182793qgd.82.gmail; Wed, 29 Jan 2014 08:51:59 -0800 (PST) X-Received: by 10.58.200.168 with SMTP id jt8mr1319569vec.30.1391014319327; Wed, 29 Jan 2014 08:51:59 -0800 (PST) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id w5si967528vcl.66.2014.01.29.08.51.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 08:51:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id p14so1281463vbm.39 for ; Wed, 29 Jan 2014 08:51:59 -0800 (PST) X-Received: by 10.58.201.169 with SMTP id kb9mr190537vec.42.1391014319210; Wed, 29 Jan 2014 08:51:59 -0800 (PST) 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.220.174.196 with SMTP id u4csp128189vcz; Wed, 29 Jan 2014 08:51:58 -0800 (PST) X-Received: by 10.66.186.174 with SMTP id fl14mr9116489pac.108.1391014317675; Wed, 29 Jan 2014 08:51:57 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si3228343pbf.274.2014.01.29.08.51.56; Wed, 29 Jan 2014 08:51:56 -0800 (PST) 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 S1753223AbaA2Qvn (ORCPT + 27 others); Wed, 29 Jan 2014 11:51:43 -0500 Received: from mail-ea0-f174.google.com ([209.85.215.174]:41637 "EHLO mail-ea0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752634AbaA2Qvk (ORCPT ); Wed, 29 Jan 2014 11:51:40 -0500 Received: by mail-ea0-f174.google.com with SMTP id b10so1048616eae.19 for ; Wed, 29 Jan 2014 08:51:39 -0800 (PST) X-Received: by 10.14.8.131 with SMTP id 3mr1185402eer.111.1391014299111; Wed, 29 Jan 2014 08:51:39 -0800 (PST) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id m1sm10892118een.7.2014.01.29.08.51.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 08:51:38 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, will.deacon@arm.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, arnd@arndb.de, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 4/5] arm64: enable generic CPU feature modalias matching for this arch Date: Wed, 29 Jan 2014 17:50:45 +0100 Message-Id: <1391014246-9715-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391014246-9715-1-git-send-email-ard.biesheuvel@linaro.org> References: <1391014246-9715-1-git-send-email-ard.biesheuvel@linaro.org> 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: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This enables support for the generic CPU feature modalias implementation that wires up optional CPU features to udev based module autoprobing. A file is provided that maps CPU feature numbers to elf_hwcap bits, which is the standard way on arm64 to advertise optional CPU features both internally and to user space. Signed-off-by: Ard Biesheuvel --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/cpufeature.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 arch/arm64/include/asm/cpufeature.h diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index dd4327f09ba4..e339099b6fbd 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -16,6 +16,7 @@ config ARM64 select DCACHE_WORD_ACCESS select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS_BROADCAST if SMP + select GENERIC_CPU_AUTOPROBE select GENERIC_IOMAP select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h new file mode 100644 index 000000000000..1d902efa201d --- /dev/null +++ b/arch/arm64/include/asm/cpufeature.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2014 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __ASM_CPUFEATURE_H +#define __ASM_CPUFEATURE_H + +#include +#include + +/* + * In the arm64 world (as in the ARM world), elf_hwcap is used both internally + * in the kernel and for user space to keep track of which optional features + * are supported by the current system. So let's map feature 'x' to HWCAP_x. + * Note that HWCAP_x constants are bit fields so we need to take the log. + */ + +#define MAX_CPU_FEATURES sizeof(elf_hwcap) +#define cpu_feature(x) ((unsigned int)ilog2(HWCAP_ ## x)) + +static inline bool cpu_have_feature(unsigned int num) +{ + return !!(elf_hwcap & (1 << num)); +} + +#endif