Message ID | 20231207001142.3617856-1-dionnaglaze@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4460559vqy; Wed, 6 Dec 2023 16:12:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFllC6lWRndDzCupn8a6/Qb/pIRDkwBbLK6Ki/QgKi7UNgFqFicQEyA5NWdNKBmKbpHCdq2 X-Received: by 2002:a05:6870:2c87:b0:1fa:1db4:5923 with SMTP id oh7-20020a0568702c8700b001fa1db45923mr2108905oab.43.1701907935000; Wed, 06 Dec 2023 16:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907934; cv=none; d=google.com; s=arc-20160816; b=z7l1rhd/dDS4Wabcle1s5oTh+qUjR+XF2Kg2CtdfCiv1xWV6CHbq5SKR0D314fLYLP 3IRSZapRhpoyoaSbVbKX+Brv/qCf1Lp/mjvoNFvtB6g6aSLQh1gRTn4wl+g9QnKkKL+E Z7wwq05tVu+5bzsrXWfKuWfipLeNvQoAgfNUb6gGr6XXh3nFnqOtla9R0V6In7YDUp7D 78LfV6NMcT8rs1pMpTznBYcEiYdqQp5gy+0/2AFVSyCRuX3YuE33ciIyPN7jOMbnXVg9 Jnwt/qznu+yOcZM8VfmLhEw9Q0/iOvzk0/SQSWSOnue80DCWR+HTV0wGVEAXKN22rGzN DE0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=r3cjh/OicCbB8QyzwRWb0eXa967TdIfrySjWwl2ZooY=; fh=g+5CCgtn0fUhIWHoOW41KVZ3BgoXBXezea5CXx67b5M=; b=nFrM0fohOp8p6x4mdSXdUnOZaDiBcPmQ+HPBLLQyT+yE9sBoo0r9gzlDki7gd3RAHa JGsj27CCdMdeJhYhIhkoo0EIDhxuhjYg6shvhq36gxEgpnXdOmDWMMyUvxJobVzOwJHx 1i0YnDSui1dCASe8C6IF36b5F6aPOZh2AmSECIpHgWClunYArOy2VtiSKqZiwpCIWwfh ApsOr3jVntGG/Vw3c6YySt1q7ztmfwwjvAUNoqJSL+xqLda3YCLkQmAiZEen1oWdJ3zd topRd9LYessJ4IyvIesk62KtPtkCdr0sOJgTcak6t0Xay8r9f6Ej3nRz3yEWJwqJUrib 0YQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AcJEwKRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a13-20020a056a001d0d00b006ce97669ffdsi153524pfx.358.2023.12.06.16.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:12:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=AcJEwKRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0F9CC8020916; Wed, 6 Dec 2023 16:12:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441805AbjLGAMA (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 6 Dec 2023 19:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235178AbjLGAL5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 6 Dec 2023 19:11:57 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42F2BD59 for <linux-kernel@vger.kernel.org>; Wed, 6 Dec 2023 16:12:02 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1d053953954so2333355ad.2 for <linux-kernel@vger.kernel.org>; Wed, 06 Dec 2023 16:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701907922; x=1702512722; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=r3cjh/OicCbB8QyzwRWb0eXa967TdIfrySjWwl2ZooY=; b=AcJEwKRtnRhFdf9yERxlg2/bQjSarjJHqoSk7XjiA86DOSwJW98aocwUPyK6j++Q5i ERvBtbKngbATkTO1344e1Lgg9JwwXqRP/dBrrssHpca3FhfcHu1nFkBTTN8wnVPcx1xE /LspOhEOkrMYh9nxjdzeTX15c5FXINmIMT7x2Pa30q9spgOkeNf2YLAksyO0FNz0cCfh Xi8H409VKeXRyuJBf7EgiiJWK5CVbzrXhicH9nm8GDUrEGbL1dM8tGlkcIWf6tt7Ycd2 jnuyySK0iCM7eR5q3KPz+QRUIK0qNsQL7gOfScEgKWonXlglCE1hAnOPilGWz6ICwLF5 K3qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701907922; x=1702512722; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=r3cjh/OicCbB8QyzwRWb0eXa967TdIfrySjWwl2ZooY=; b=VfSYc1rPT6roi0Sl6eATBdL3vYJlsC3KRfNLFTQ7sMNLuD8jUUJNzwmiT8XRjHMKy4 AXXrXrD8ERPT+5+eUjuwXp48ODLeELtTEUInf3ivpKlZJcRBuUfduKumcYU1wbLmskKM r2wj6twO0y3mhVIDT/UQAhA6sdHD5w4+D9tmDtxBZO7hO8kzPXqwz1LVS9Pgd2Sz2ScW KBJdKM+TqBddGZ3mD5y8PziKixZFNl942zOh7id/9CUEKsKCc/NA92PuVbbOAdkdb32V lq1N5R62pOSSNwtnNdVYtLqLziW8p+zBKqtIusEiBu7rK62mB06JbjRBc9OIiHUpibtk GWGw== X-Gm-Message-State: AOJu0YwzrpDXAHjYIUlJUxtBmfrSnbZk3fijEpRIiDVzHID2N+6y1vBV KyhdIAu9uAiF4bSYRQ35zxvcg6Dr1b3FLmD0yA== X-Received: from dionnaglaze.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2ee6]) (user=dionnaglaze job=sendgmr) by 2002:a17:902:eccd:b0:1d0:96b7:7f4 with SMTP id a13-20020a170902eccd00b001d096b707f4mr24174plh.12.1701907921779; Wed, 06 Dec 2023 16:12:01 -0800 (PST) Date: Thu, 7 Dec 2023 00:11:32 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Message-ID: <20231207001142.3617856-1-dionnaglaze@google.com> Subject: [PATCH] kvm: x86: use a uapi-friendly macro for BIT From: Dionna Glaze <dionnaglaze@google.com> To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, seanjc@google.com, pbonzini@redhat.com Cc: Dionna Glaze <dionnaglaze@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:12:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579814570172646 X-GMAIL-MSGID: 1784579814570172646 |
Series |
kvm: x86: use a uapi-friendly macro for BIT
|
|
Commit Message
Dionna Amalie Glaze
Dec. 7, 2023, 12:11 a.m. UTC
Change uapi header uses of BIT to instead use the uapi/linux/const.h bit
macros, since BIT is not defined in uapi headers.
The PMU mask uses _BITUL since it targets a 32 bit flag field, whereas
the longmode definition is meant for a 64 bit flag field.
Cc: Sean Christophersen <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
---
arch/x86/include/uapi/asm/kvm.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Thu, Dec 07, 2023, Dionna Glaze wrote: > Change uapi header uses of BIT to instead use the uapi/linux/const.h bit > macros, since BIT is not defined in uapi headers. > > The PMU mask uses _BITUL since it targets a 32 bit flag field, whereas > the longmode definition is meant for a 64 bit flag field. > > Cc: Sean Christophersen <seanjc@google.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > > Signed-off-by: Dionna Glaze <dionnaglaze@google.com> > --- > arch/x86/include/uapi/asm/kvm.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h > index 1a6a1f987949..a8955efeef09 100644 > --- a/arch/x86/include/uapi/asm/kvm.h > +++ b/arch/x86/include/uapi/asm/kvm.h > @@ -7,6 +7,7 @@ > * > */ > > +#include <linux/const.h> > #include <linux/types.h> > #include <linux/ioctl.h> > #include <linux/stddef.h> > @@ -526,7 +527,7 @@ struct kvm_pmu_event_filter { > #define KVM_PMU_EVENT_ALLOW 0 > #define KVM_PMU_EVENT_DENY 1 > > -#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS BIT(0) > +#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS _BITUL(0) It's not just BIT(), won't BIT_ULL() and GENMASK_ULL() also be problematic? And sadly, I don't see an existing equivalent for GENMASK_ULL().
On 12/12/23 16:27, Sean Christopherson wrote: >> -#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS BIT(0) >> +#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS _BITUL(0) > It's not just BIT(), won't BIT_ULL() and GENMASK_ULL() also be problematic? And > sadly, I don't see an existing equivalent for GENMASK_ULL(). BIT_ULL() is easy enough, as you point out: @@ -550,7 +550,7 @@ struct kvm_pmu_event_filter { (GENMASK_ULL(7, 0) | GENMASK_ULL(35, 32)) #define KVM_PMU_MASKED_ENTRY_UMASK_MASK (GENMASK_ULL(63, 56)) #define KVM_PMU_MASKED_ENTRY_UMASK_MATCH (GENMASK_ULL(15, 8)) -#define KVM_PMU_MASKED_ENTRY_EXCLUDE (BIT_ULL(55)) +#define KVM_PMU_MASKED_ENTRY_EXCLUDE (_BITULL(55)) #define KVM_PMU_MASKED_ENTRY_UMASK_MASK_SHIFT (56) /* for KVM_{GET,SET,HAS}_DEVICE_ATTR */ And I'll squash it into Dionna's patch since she has already a conversion for KVM_EXIT_HYPERCALL_LONG_MODE. For the others, I'll send a patch. Paolo
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index 1a6a1f987949..a8955efeef09 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -7,6 +7,7 @@ * */ +#include <linux/const.h> #include <linux/types.h> #include <linux/ioctl.h> #include <linux/stddef.h> @@ -526,7 +527,7 @@ struct kvm_pmu_event_filter { #define KVM_PMU_EVENT_ALLOW 0 #define KVM_PMU_EVENT_DENY 1 -#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS BIT(0) +#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS _BITUL(0) #define KVM_PMU_EVENT_FLAGS_VALID_MASK (KVM_PMU_EVENT_FLAG_MASKED_EVENTS) /* @@ -560,6 +561,6 @@ struct kvm_pmu_event_filter { #define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */ /* x86-specific KVM_EXIT_HYPERCALL flags. */ -#define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0) +#define KVM_EXIT_HYPERCALL_LONG_MODE _BITULL(0) #endif /* _ASM_X86_KVM_H */