Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 9b8e73cdb141 ("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>

authored by

Dan Williams and committed by
Jason Gunthorpe
7bdd8f75 0af2f6be

+15 -6
+15 -6
include/uapi/cxl/features.h
··· 8 8 #define _UAPI_CXL_FEATURES_H_ 9 9 10 10 #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__ 14 15 #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 15 24 #endif 16 25 17 26 /* ··· 69 60 * Get Supported Features Supported Feature Entry 70 61 */ 71 62 struct cxl_feat_entry { 72 - uuid_t uuid; 63 + __uapi_uuid_t uuid; 73 64 __le16 id; 74 65 __le16 get_feat_size; 75 66 __le16 set_feat_size; ··· 119 110 * CXL spec r3.2 section 8.2.9.6.2 Table 8-99 120 111 */ 121 112 struct cxl_mbox_get_feat_in { 122 - uuid_t uuid; 113 + __uapi_uuid_t uuid; 123 114 __le16 offset; 124 115 __le16 count; 125 116 __u8 selection; ··· 152 143 */ 153 144 struct cxl_mbox_set_feat_in { 154 145 __struct_group(cxl_mbox_set_feat_hdr, hdr, /* no attrs */, 155 - uuid_t uuid; 146 + __uapi_uuid_t uuid; 156 147 __le32 flags; 157 148 __le16 offset; 158 149 __u8 version;