From patchwork Thu Nov 7 17:17:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3153851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DAD0BEEB2 for ; Thu, 7 Nov 2013 17:19:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AFB4204E0 for ; Thu, 7 Nov 2013 17:19:46 +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 DCCEB204DE for ; Thu, 7 Nov 2013 17:19: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 1VeTEB-00026M-S0; Thu, 07 Nov 2013 17:18:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VeTDw-0005hW-JQ; Thu, 07 Nov 2013 17:18:28 +0000 Received: from mail-wg0-f52.google.com ([74.125.82.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VeTDe-0005e9-Bp for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2013 17:18:11 +0000 Received: by mail-wg0-f52.google.com with SMTP id k14so836513wgh.31 for ; Thu, 07 Nov 2013 09:17:48 -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=Ua7JbbSS+QmbS+VGGFU5MIfKA9X+I5aD/RNZbWgm4qM=; b=FmP2ONUIHYcducNiJncv4HHIkfYcMXRkYesGRu8sVVtxKOzUj8/BXUHVlnbhBFH1ea pwdIBQ7ADqHSUuf7lDGhK7ASx723WVAS0qp4Tcen7dH+SgXLr07jaYg75dCwzlemA6LC oyucsecnHUQgHTLHT7IwXmj7F61upEll9TV2rtgxO+i0z443SCyEewgZLaIBbERHfmhx bqZrlobg4UluXbRrZMB7v/7Sb9qQIkdhTgkC4oVHXIikkT0ofvT3TzGhGskPIKQZyXDC 4ITgj5F7NNBx0oLy/RTcUqgYvdviDdAokiDoBrrR/Y/n/ZHRiKiQQGRUD5zuVk/fCBjK 3PZg== X-Gm-Message-State: ALoCoQmr3pzpqCUv3aeJaxdj9avHp1lWe425Os9Xwy1NqQAdmRGMLfHeO/BumX5+ASxOfrVbObY9 X-Received: by 10.194.250.6 with SMTP id yy6mr8418499wjc.13.1383844668616; Thu, 07 Nov 2013 09:17: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 fr4sm36736446wib.0.2013.11.07.09.17.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 09:17:48 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/4] scripts/mod: add generic CPU features as module alias Date: Thu, 7 Nov 2013 18:17:36 +0100 Message-Id: <1383844657-17487-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1383844657-17487-1-git-send-email-ard.biesheuvel@linaro.org> References: <1383844657-17487-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131107_121810_516315_A7BE1A26 X-CRM114-Status: GOOD ( 11.84 ) X-Spam-Score: -2.6 (--) Cc: catalin.marinas@arm.com, Ard Biesheuvel , gregkh@linuxfoundation.org, will.deacon@arm.com, mingo@redhat.com, hpa@zytor.com, steve.capper@linaro.org, tglx@linutronix.de 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 implements the changes needed to turn CPU features declared as being depended upon by modules into module aliases in the .ko metadata. Signed-off-by: Ard Biesheuvel --- include/linux/mod_devicetable.h | 11 +++++++++++ scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 45e9214..e481796 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -564,6 +564,17 @@ struct x86_cpu_id { #define X86_MODEL_ANY 0 #define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ +/* + * Generic table type for tracking CPU features. + * @feature: the bit number of the feature (0 - 31) + * + * How the bit numbers map to actual CPU features is entirely up to the arch + */ + +struct cpu_feature { + __u8 feature; +}; + #define IPACK_ANY_FORMAT 0xff #define IPACK_ANY_ID (~0) struct ipack_device_id { diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index bb5d115..f282516 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -174,6 +174,9 @@ int main(void) DEVID_FIELD(x86_cpu_id, model); DEVID_FIELD(x86_cpu_id, vendor); + DEVID(cpu_feature); + DEVID_FIELD(cpu_feature, feature); + DEVID(mei_cl_device_id); DEVID_FIELD(mei_cl_device_id, name); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 2370863..209cdb2 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1135,6 +1135,16 @@ static int do_x86cpu_entry(const char *filename, void *symval, } ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); +/* LOOKS like cpu:feature:*FEAT* */ +static int do_cpu_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, cpu_feature, feature); + + sprintf(alias, "cpu:feature:*%02X*", feature); + return 1; +} +ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); + /* Looks like: mei:S */ static int do_mei_entry(const char *filename, void *symval, char *alias)