Skip to content

Commit 7bdd8f7

Browse files
djbwjgunthorpe
authored andcommitted
fwctl/cxl: Fix uuid_t usage in uapi
The uuid_t type is kernel internal, and Paul reports the following build error when it is used in a uapi header: usr/include/cxl/features.h:59:9: error: unknown type name ‘uuid_t’ Create a uuid type (__uapi_uuid_t) compatible with the longstanding definition uuid/uuid.h for userspace builds, and use uuid_t directly for kernel builds. Fixes: 9b8e73c ("cxl: Move cxl feature command structs to user header") Link: https://patch.msgid.link/r/174430961702.617339.13963021112051029933.stgit@dwillia2-xfh.jf.intel.com Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Reported-by: Paul E. McKenney <paulmck@kernel.org> Closes: http://lore.kernel.org/f6489337-67c7-48c8-b48a-58603ec15328@paulmck-laptop Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202504050434.Eb4vugh5-lkp@intel.com/ Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Tested-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 0af2f6b commit 7bdd8f7

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

include/uapi/cxl/features.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@
88
#define _UAPI_CXL_FEATURES_H_
99

1010
#include <linux/types.h>
11-
#ifndef __KERNEL__
12-
#include <uuid/uuid.h>
13-
#else
11+
12+
typedef unsigned char __uapi_uuid_t[16];
13+
14+
#ifdef __KERNEL__
1415
#include <linux/uuid.h>
16+
/*
17+
* Note, __uapi_uuid_t is 1-byte aligned on modern compilers and 4-byte
18+
* aligned on others. Ensure that __uapi_uuid_t in a struct is placed at
19+
* a 4-byte aligned offset, or the structure is packed, to ensure
20+
* consistent padding.
21+
*/
22+
static_assert(sizeof(__uapi_uuid_t) == sizeof(uuid_t));
23+
#define __uapi_uuid_t uuid_t
1524
#endif
1625

1726
/*
@@ -60,7 +69,7 @@ struct cxl_mbox_get_sup_feats_in {
6069
* Get Supported Features Supported Feature Entry
6170
*/
6271
struct cxl_feat_entry {
63-
uuid_t uuid;
72+
__uapi_uuid_t uuid;
6473
__le16 id;
6574
__le16 get_feat_size;
6675
__le16 set_feat_size;
@@ -110,7 +119,7 @@ struct cxl_mbox_get_sup_feats_out {
110119
* CXL spec r3.2 section 8.2.9.6.2 Table 8-99
111120
*/
112121
struct cxl_mbox_get_feat_in {
113-
uuid_t uuid;
122+
__uapi_uuid_t uuid;
114123
__le16 offset;
115124
__le16 count;
116125
__u8 selection;
@@ -143,7 +152,7 @@ enum cxl_get_feat_selection {
143152
*/
144153
struct cxl_mbox_set_feat_in {
145154
__struct_group(cxl_mbox_set_feat_hdr, hdr, /* no attrs */,
146-
uuid_t uuid;
155+
__uapi_uuid_t uuid;
147156
__le32 flags;
148157
__le16 offset;
149158
__u8 version;

0 commit comments

Comments
 (0)