From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71B8CC433ED for ; Thu, 20 May 2021 12:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 510C060FDA for ; Thu, 20 May 2021 12:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241045AbhETMKM (ORCPT ); Thu, 20 May 2021 08:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239809AbhETMJ4 (ORCPT ); Thu, 20 May 2021 08:09:56 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BB0C01CEBA; Thu, 20 May 2021 03:44:23 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d16so12036244pfn.12; Thu, 20 May 2021 03:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ln/GNcNq5Ro2OkNEh/LM02ElmNPWJ/3MY9XfiUntdlc=; b=C6COQJUoHVx1FUvpa/Y1+fgwUD5eOuVSngTVZKQOjmbeC5IMKGBGpirqwdq+yh6upP AAaOuC+kLKQtVyi05CWflFO1z5s11+7IHT3F0e0/Vo0zvqZDWUcE7XoXicuK9f+kQXI5 opcyMD5UHfWrvGvjmkB6YUwXTFX5sNPzXPQil7/dwuPVpnLbdAMMDaTw7Z8VdnTP3cnr gPvwGl7MmoMV61feZJCu26gtXthY5ipd/i0Tl3FEle/ftQ+/Fhf5SsUBLwdZTWj+SfDS NcK0JqDQfoe+MGWgaYnFTpZLh2TY87+u5TXIm5qcqaBU76RLN4Pw9IsQd2P7NRzjfZdD NReQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ln/GNcNq5Ro2OkNEh/LM02ElmNPWJ/3MY9XfiUntdlc=; b=t+8fwuE2JOOzIy12DLAYid1D+3vC34CtOQBI2JDrRr5EKiyKPBltwK9cABGZuZF8HS tDNmb7Hl6aBxOxaNEtnD05ppPYhZ0EvuRA+SZWiobTDzDggDuX/wilBM2YH3FLVn8qz5 7pKjAbjYKP5gP2uLeKdWNKemzEUrtrgM05I1OXn1rPqNla9xUjUgDk5NPCacu6qHRPz5 RXIxEuXAB5OM79p24c7wbl45PxnO3g1N/mPTv95sI7Ka+dJo4Ph73HJdk9wMJWy3aqoJ oC2iHbip/dJIXhhIj4/03r4CZg8zcE3kfkSgL/uR0g6mYtEDB/pVw+GpEVXy1aLezXKV qSrw== X-Gm-Message-State: AOAM530NB2+a+oL6rG1YpNvdi9VHZ9P7FAlpIG/4Vcc336gtKrn12tyc 7sdYoBgmE2PJ4HfNjuRESeM= X-Google-Smtp-Source: ABdhPJyPJkh+woUNcvvPhjV9BLZHjDX9cfefs69QBlPovPMsvgSoJkKXNt+FopPHtSuynAjN2RWamA== X-Received: by 2002:a62:2901:0:b029:28e:ef3d:10d2 with SMTP id p1-20020a6229010000b029028eef3d10d2mr3823125pfp.45.1621507463048; Thu, 20 May 2021 03:44:23 -0700 (PDT) Received: from pride.localdomain (c-174-61-140-56.hsd1.wa.comcast.net. [174.61.140.56]) by smtp.gmail.com with ESMTPSA id z12sm1762572pfk.45.2021.05.20.03.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 03:44:22 -0700 (PDT) From: Joe Richey To: trivial@kernel.org Cc: Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Mark Rutland , Lorenzo Pieralisi , Mauro Carvalho Chehab , Zhangfei Gao , Zhou Wang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-accelerators@lists.ozlabs.org Subject: [PATCH 0/6] Don't use BIT() macro in UAPI headers Date: Thu, 20 May 2021 03:43:37 -0700 Message-Id: <20210520104343.317119-1-joerichey94@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Richey The BIT(n) macro is used in the kernel as an alias for (1 << n). However, it is not defined in the UAPI headers, which means that any UAPI header files must be careful not to use it, or else the user will get a linker error. For example, compiling the following program: #include #include // Detect if FSGSBASE instructions are enabled int main() { unsigned long val = getauxval(AT_HWCAP2); return !(val & HWCAP2_FSGSBASE); } Results in the following likner error: /usr/bin/ld: /tmp/cceFpAdR.o: in function `main': gs.c:(.text+0x21): undefined reference to `BIT' This patch series changes all UAPI uses of BIT() to just be open-coded. However, there really should be a check for this in checkpatch.pl Currently, the script actually _encourages_ users to use the BIT macro even if adding things to UAPI. Running `rg "BIT\(" **/uapi/**` shows no more usage of BIT() in any UAPI headers. Tested by building a basic kernel. Changes are trivial. Joe Richey (6): x86/elf: Don't use BIT() macro in UAPI headers KVM: X86: Don't use BIT() macro in UAPI headers drivers: firmware: psci: Don't use BIT() macro in UAPI headers uacce: Don't use BIT() macro in UAPI headers media: vicodec: Don't use BIT() macro in UAPI headers tools headers UAPI: Sync pkt_sched.h with the kernel sources arch/x86/include/uapi/asm/hwcap2.h | 2 +- include/uapi/linux/kvm.h | 4 +- include/uapi/linux/psci.h | 2 +- include/uapi/linux/v4l2-controls.h | 22 ++--- include/uapi/misc/uacce/uacce.h | 2 +- tools/include/uapi/linux/kvm.h | 4 +- tools/include/uapi/linux/pkt_sched.h | 122 ++++++++++++++++++++++++--- 7 files changed, 130 insertions(+), 28 deletions(-) -- 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDBBDC433ED for ; Thu, 20 May 2021 10:46:10 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82DCF60FDC for ; Thu, 20 May 2021 10:46:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82DCF60FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=cQ6sV5IxgsxrunLmAwBwVvwTLNCam70PgjvP5lUtzPw=; b=e7MJxqwjWgj1Z+O54ZEA/Xb7PX RjI3g6phziwFycdn/xFUVX4haRTUXB71dTBcve3BLklZhGW4LcyUULCdM1uMH/X5ac7/YNzq23+Zn qnEmQN0wMnx7wXZRCMmnX5AkRNg0qpV7ffeD1ct2wCF9WLvYJr6jhNNPRyOcR4ey9ozPG/kUJWMcE I28uVNsqh/U9s8JA9QNGa6x2b/z1RJfIWwd+KAHjZ2U+EYsye+ePqCVTUt85l2o3lRGxWlbIG62nS n4YIGoxQlIfyVpbPMO8DQyZMbqMz+QTnqNAh+3zCg8vE3VOrNSvFrGTL/2vwAD1PYrQ3em2RoGQky sdbnq5hQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljgAH-000CnO-Nw; Thu, 20 May 2021 10:44:29 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljgAF-000Cn7-9b for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 10:44:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=Ln/GNcNq5Ro2OkNEh/LM02ElmNPWJ/3MY9XfiUntdlc=; b=ik0QX4AF0iBAj04RCgtVysfALs NmVqXQ+aIqUYVPzVc7J808vd4hXwLLGHbYgCKQ737Nu8L7HrveU49tAmnbBuckv1iBWysyVZaHH8Q 6/KyrVT0juKEXYv0JXcYFGoGI75mquFGRhSskU0DkhKhSs5zlx2xjT8mhYQ6vrs/dy7BL4JdCkLbE NnjxRYWZzMJAEuIR3py2jEspmKneAIjS+nC+5KK1gT8NOm76O2vIR1RYKb7TjFEuA9apX0CC6m/GV Vds936e57ZNufA7a6nKe2s+xBr5b7gdrHca+eYiwaUYT99iaAcNXbdwWHhkehZ5ZQNxuyCjPpp5G6 WmDnQAxQ==; Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljgAC-00GBlu-QG for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 10:44:26 +0000 Received: by mail-pf1-x42a.google.com with SMTP id c17so12054684pfn.6 for ; Thu, 20 May 2021 03:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ln/GNcNq5Ro2OkNEh/LM02ElmNPWJ/3MY9XfiUntdlc=; b=C6COQJUoHVx1FUvpa/Y1+fgwUD5eOuVSngTVZKQOjmbeC5IMKGBGpirqwdq+yh6upP AAaOuC+kLKQtVyi05CWflFO1z5s11+7IHT3F0e0/Vo0zvqZDWUcE7XoXicuK9f+kQXI5 opcyMD5UHfWrvGvjmkB6YUwXTFX5sNPzXPQil7/dwuPVpnLbdAMMDaTw7Z8VdnTP3cnr gPvwGl7MmoMV61feZJCu26gtXthY5ipd/i0Tl3FEle/ftQ+/Fhf5SsUBLwdZTWj+SfDS NcK0JqDQfoe+MGWgaYnFTpZLh2TY87+u5TXIm5qcqaBU76RLN4Pw9IsQd2P7NRzjfZdD NReQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ln/GNcNq5Ro2OkNEh/LM02ElmNPWJ/3MY9XfiUntdlc=; b=Jgm8SMfmW50Po6kJkbUnNoICEV2U77+0Y16MzYv6Ytxkk39q/XpndcV/zKlwIu2OOn UaRBAERGbdcQCJioPNLY0r/swx5LX71Okq6/2q3nHbxdmb2PIF0A/+n6rkb767X9s22e DTwFdDu8fAt1WxzGEASNv5BXzI2BE+H1I0qxRsEKx8+8RtTCFAUMCamzFyrcylg/bqsW X8szXo5nSAp5OS+XW4OQ1qbBQWamypc9w21XPS0f1zjok7Ki6VrptS64OUjWO0nWsxDW aOKj8Xciym9G0s9PPzNdbRhHE+C0bpF7xaC+ECK8OT4oNMmoXdXPiYKGwITch9SRLYIN +xzw== X-Gm-Message-State: AOAM530Ibd6aEYz32+wvRhkBOy/zJAjIFoLqF06SfLO6qP7T47HwiFe1 kV6/mcngjJTLPrKNyP3dOmQ= X-Google-Smtp-Source: ABdhPJyPJkh+woUNcvvPhjV9BLZHjDX9cfefs69QBlPovPMsvgSoJkKXNt+FopPHtSuynAjN2RWamA== X-Received: by 2002:a62:2901:0:b029:28e:ef3d:10d2 with SMTP id p1-20020a6229010000b029028eef3d10d2mr3823125pfp.45.1621507463048; Thu, 20 May 2021 03:44:23 -0700 (PDT) Received: from pride.localdomain (c-174-61-140-56.hsd1.wa.comcast.net. [174.61.140.56]) by smtp.gmail.com with ESMTPSA id z12sm1762572pfk.45.2021.05.20.03.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 03:44:22 -0700 (PDT) From: Joe Richey To: trivial@kernel.org Cc: Joe Richey , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Paolo Bonzini , Mark Rutland , Lorenzo Pieralisi , Mauro Carvalho Chehab , Zhangfei Gao , Zhou Wang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-accelerators@lists.ozlabs.org Subject: [PATCH 0/6] Don't use BIT() macro in UAPI headers Date: Thu, 20 May 2021 03:43:37 -0700 Message-Id: <20210520104343.317119-1-joerichey94@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_034424_876961_C7BEF07E X-CRM114-Status: GOOD ( 14.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Joe Richey The BIT(n) macro is used in the kernel as an alias for (1 << n). However, it is not defined in the UAPI headers, which means that any UAPI header files must be careful not to use it, or else the user will get a linker error. For example, compiling the following program: #include #include // Detect if FSGSBASE instructions are enabled int main() { unsigned long val = getauxval(AT_HWCAP2); return !(val & HWCAP2_FSGSBASE); } Results in the following likner error: /usr/bin/ld: /tmp/cceFpAdR.o: in function `main': gs.c:(.text+0x21): undefined reference to `BIT' This patch series changes all UAPI uses of BIT() to just be open-coded. However, there really should be a check for this in checkpatch.pl Currently, the script actually _encourages_ users to use the BIT macro even if adding things to UAPI. Running `rg "BIT\(" **/uapi/**` shows no more usage of BIT() in any UAPI headers. Tested by building a basic kernel. Changes are trivial. Joe Richey (6): x86/elf: Don't use BIT() macro in UAPI headers KVM: X86: Don't use BIT() macro in UAPI headers drivers: firmware: psci: Don't use BIT() macro in UAPI headers uacce: Don't use BIT() macro in UAPI headers media: vicodec: Don't use BIT() macro in UAPI headers tools headers UAPI: Sync pkt_sched.h with the kernel sources arch/x86/include/uapi/asm/hwcap2.h | 2 +- include/uapi/linux/kvm.h | 4 +- include/uapi/linux/psci.h | 2 +- include/uapi/linux/v4l2-controls.h | 22 ++--- include/uapi/misc/uacce/uacce.h | 2 +- tools/include/uapi/linux/kvm.h | 4 +- tools/include/uapi/linux/pkt_sched.h | 122 ++++++++++++++++++++++++--- 7 files changed, 130 insertions(+), 28 deletions(-) -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel