From patchwork Thu Nov 21 15:42:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3219791 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 AC3A09F26C for ; Thu, 21 Nov 2013 15:54:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AA3C20788 for ; Thu, 21 Nov 2013 15:54:50 +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 262332078A for ; Thu, 21 Nov 2013 15:54:44 +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 1VjWQs-0007Oa-5H; Thu, 21 Nov 2013 15:44:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjWPu-0006du-D1; Thu, 21 Nov 2013 15:43:42 +0000 Received: from mail-we0-f170.google.com ([74.125.82.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjWPO-0006Zm-Ka for linux-arm-kernel@lists.infradead.org; Thu, 21 Nov 2013 15:43:12 +0000 Received: by mail-we0-f170.google.com with SMTP id w61so7254018wes.1 for ; Thu, 21 Nov 2013 07:42:49 -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=UVfRS74dQK7dxsHP2461C9wgfHyxUdhQblG9j6YT8Hg=; b=MlHObyXqM9nogZtYP4rQZPKCFHEZLsGTRKot3cNRkMbdjYivDYqDgWQvJB5nvYJCrp sBxpTIBJ2SSyds0Dr1dJ2OYH8V6pUMQPSyuniDRPE8C97yBweE5H/QLR7Tk2o56QnEUE uNZ5dYVgD9b+uzzzaqo1g1YMKpIIRkEKDI27KD/N646u2y1NuTGhj8nc7ATsJf9Vvxx5 J/JQh1rvB/rxZYiaI2/hkuXvEHGSW4gNnoAmUQj6YkRVFuS2evN1TB2iNZwmc8W/etRs AMQKZa0xLOPNUhJhUO+RqCOqgjTBUgpLWARwDYrbl6SNRxf0pcUPrY+PLOAeuV1qJwbK bXwg== X-Gm-Message-State: ALoCoQmcgAIaxtQ5IFE97OiQfPBiDaTN7MBwQSncFyG9F4bDNELvLsjVF4C6Rzif7oHI/fWmtt6Y X-Received: by 10.180.36.80 with SMTP id o16mr6429315wij.1.1385048569154; Thu, 21 Nov 2013 07:42:49 -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 dn2sm6329879wid.1.2013.11.21.07.42.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Nov 2013 07:42:48 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] arm64: advertise CPU features for modalias matching Date: Thu, 21 Nov 2013 16:42:32 +0100 Message-Id: <1385048552-12528-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385048552-12528-1-git-send-email-ard.biesheuvel@linaro.org> References: <1385048552-12528-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131121_104310_858637_1C8358D3 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -2.6 (--) Cc: ak@linux.intel.com, catalin.marinas@arm.com, Ard Biesheuvel , gregkh@linuxfoundation.org, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.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.7 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 055cfb8..775a531 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -366,3 +366,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:%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; +}