From patchwork Mon Nov 11 10:19:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3166971 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 CD5F29F3AE for ; Mon, 11 Nov 2013 10:22:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42EBD20171 for ; Mon, 11 Nov 2013 10:22:11 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1B8720166 for ; Mon, 11 Nov 2013 10:22:09 +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 1Vfoc6-00038L-1O; Mon, 11 Nov 2013 10:20:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfobn-0002tR-F8; Mon, 11 Nov 2013 10:20:39 +0000 Received: from mail-we0-f172.google.com ([74.125.82.172]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VfobL-0002oP-OK for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2013 10:20:12 +0000 Received: by mail-we0-f172.google.com with SMTP id q58so4438037wes.3 for ; Mon, 11 Nov 2013 02:19:50 -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=E7HSJhevQB8o64V7Z1CRfuIn9uB0XkOWrQ8r0ySseM8=; b=W71slLy0/XlzSVYaRW0AKxW9RxXLvUKq4wQN7VIF/+R8Kywr6gwrqGbIQMYiyKBaA5 GR1S8niN8vRNKH/78Uf71RSuEvI3Qpmi3redBfTkMqSvq4M8q5mwtE7rHVWFPBRgX6Lw mAnfmuG0NZoteD6wY0ZJOob1+gRPGh2UneNDMqv5TQ47fn4hyitnwvm2pQQgOTpnowB9 vE4JYBd3/csSBd+ZbGgfZi4gFRklVQQ4rkr8rUiU3T9z0xWKmr6TNwuDJG3X63pvc0S1 iPWwPcmYvV3+6/iCRrqCfYj+F7SEutpRrknJZcHsiszdIZaOQhPl5ikHn/8c+Fw1K0We XD1g== X-Gm-Message-State: ALoCoQmW9CxkUZG6v0Pv/niOrUtkimFTRv/HoRJypnJ448HqUV26NtQakfi/UICL2GVcV9TYJEDY X-Received: by 10.180.189.49 with SMTP id gf17mr11608550wic.23.1384165188673; Mon, 11 Nov 2013 02:19:48 -0800 (PST) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id gg20sm33709571wic.1.2013.11.11.02.19.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Nov 2013 02:19:48 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] arm64: advertise CPU features for modalias matching Date: Mon, 11 Nov 2013 11:19:35 +0100 Message-Id: <1384165175-16134-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1384165175-16134-1-git-send-email-ard.biesheuvel@linaro.org> References: <1384165175-16134-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131111_052011_963656_0F8FD89A X-CRM114-Status: GOOD ( 11.60 ) X-Spam-Score: -2.6 (--) Cc: ak@linux.intel.com, steve.capper@linaro.org, Ard Biesheuvel , gregkh@linuxfoundation.org, hpa@zytor.com, catalin.marinas@arm.com, dave.martin@arm.com 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.2 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 c044548..50cd97f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -202,6 +202,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 780a7aa..4774304 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -403,3 +403,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 int caps; + ssize_t n; + int i; + + /* + * With 32 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:arm64:feature:"); + for (caps = elf_hwcap, i = 0; caps; caps >>= 1, i++) + if (caps & 1) + n += sprintf(&buf[n], ",%04X", i); + buf[n++] = '\n'; + return n; +}