From patchwork Mon Jan 6 08:22:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3436441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1DA2F9F163 for ; Mon, 6 Jan 2014 08:25:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5150E2016D for ; Mon, 6 Jan 2014 08:25:47 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 61F822016A for ; Mon, 6 Jan 2014 08:25:46 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W05TQ-0006Tz-OZ; Mon, 06 Jan 2014 08:23:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W05T8-0003IU-NJ; Mon, 06 Jan 2014 08:23:30 +0000 Received: from mail-we0-f181.google.com ([74.125.82.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W05SX-0003CS-7G for linux-arm-kernel@lists.infradead.org; Mon, 06 Jan 2014 08:22:54 +0000 Received: by mail-we0-f181.google.com with SMTP id x55so15622670wes.12 for ; Mon, 06 Jan 2014 00:22:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=orbqKVuUHnPHB+tmJfgMD3CUaxN4WtNr+S+sdJlLLnE=; b=Z9qRSbIty0RW9aHtHchoeqGU/R2O+OC6d1w+2Ax4e1Ayu6T5ZdWDtgsTl+tg+h6uzV U1BEc0IZKvya4up2XhXI0FPylKVYinnjOqDzHU5og4/3zxh4LMjuSRYFllnnqWle6t1e XJNI2MRMuicnacwwFw6U32/pCI1GNYlQb3bqcsp0yFvC+BHN7BhrP3TKdIQ47cn98Obq VmfSm33ug7MPQNyzgdCuy+YTsgG2sVN9FBlvMU5+UKr0pz02mo28HUD1ZwMr+GG4TrAv yG9aCr6eFR4vekFXrZqnMG7tTBg2hk32/RiklXhh/1vH2L9MdKRgrgRQl6CKT7RAkoqY 3bUw== X-Gm-Message-State: ALoCoQmpZ3Ytq+kFn5RDVHvrlT+K+c6DedZ5rTpnaPQ0imUvSlTdMRlIWVx4g38EcxvTZd6RLa5R X-Received: by 10.180.21.143 with SMTP id v15mr11178042wie.60.1388996551567; Mon, 06 Jan 2014 00:22:31 -0800 (PST) Received: from ards-mac-mini.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id ci4sm41930498wjc.21.2014.01.06.00.22.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 Jan 2014 00:22:29 -0800 (PST) From: Ard Biesheuvel To: catalin.marinas@arm.com, will.deacon@arm.com, gregkh@linuxfoundation.org, akpm@linux-foundation.org, hpa@zytor.com, ak@linux.intel.com Subject: [PATCH 5/8] arm64: advertise CPU features for modalias matching Date: Mon, 6 Jan 2014 09:22:13 +0100 Message-Id: <1388996536-27014-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1388996536-27014-1-git-send-email-ard.biesheuvel@linaro.org> References: <1388996536-27014-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140106_032253_414331_4CEF09D7 X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -2.6 (--) Cc: Ard Biesheuvel , herbert@gondor.apana.org.au, nico@linaro.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This enables the generic implementation in drivers/base/cpu.c that allows modules to be loaded automatically based on the optional features supported (and advertised over udev) by the CPU. Signed-off-by: Ard Biesheuvel --- arch/arm64/Kconfig | 3 +++ arch/arm64/kernel/setup.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index cb9421b540c8..74650b68d575 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -214,6 +214,9 @@ config ARCH_WANT_HUGE_PMD_SHARE config HAVE_ARCH_TRANSPARENT_HUGEPAGE def_bool y +config ARCH_HAS_CPU_AUTOPROBE + def_bool y + source "mm/Kconfig" config XEN_DOM0 diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index bb33fff09ba2..5ed082bbd61c 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -379,3 +379,23 @@ const struct seq_operations cpuinfo_op = { .stop = c_stop, .show = c_show }; + +ssize_t arch_print_cpu_modalias(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + unsigned long caps; + ssize_t n; + int i; + + /* + * With 64 features maximum (taking 5 bytes each to print), we don't + * need to worry about overrunning the PAGE_SIZE sized buffer. + */ + n = sprintf(buf, "cpu:type:%s:feature:", ELF_PLATFORM); + for (caps = elf_hwcap, i = 0; caps; caps >>= 1, i++) + if (caps & 1) + n += sprintf(&buf[n], ",%04X", i); + buf[n++] = '\n'; + return n; +}