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.

Merge tag 'for-linus-fwctl' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

Pull fwctl fixes from Jason Gunthorpe:
"Three small changes from further build testing:

- Don't rely on the userspace uuid.h for the uapi header

- Fix sparse warnings in pds

- Typo in log message"

* tag 'for-linus-fwctl' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
fwctl: Fix repeated device word in log message
pds_fwctl: Fix type and endian complaints
fwctl/cxl: Fix uuid_t usage in uapi

+36 -20
+1 -1
drivers/fwctl/main.c
··· 105 105 if (!test_and_set_bit(0, &fwctl_tainted)) { 106 106 dev_warn( 107 107 &fwctl->dev, 108 - "%s(%d): has requested full access to the physical device device", 108 + "%s(%d): has requested full access to the physical device", 109 109 current->comm, task_pid_nr(current)); 110 110 add_taint(TAINT_FWCTL, LOCKDEP_STILL_OK); 111 111 }
+20 -13
drivers/fwctl/pds/main.c
··· 105 105 static void pdsfc_free_endpoints(struct pdsfc_dev *pdsfc) 106 106 { 107 107 struct device *dev = &pdsfc->fwctl.dev; 108 + u32 num_endpoints; 108 109 int i; 109 110 110 111 if (!pdsfc->endpoints) 111 112 return; 112 113 113 - for (i = 0; pdsfc->endpoint_info && i < pdsfc->endpoints->num_entries; i++) 114 + num_endpoints = le32_to_cpu(pdsfc->endpoints->num_entries); 115 + for (i = 0; pdsfc->endpoint_info && i < num_endpoints; i++) 114 116 mutex_destroy(&pdsfc->endpoint_info[i].lock); 115 117 vfree(pdsfc->endpoint_info); 116 118 pdsfc->endpoint_info = NULL; ··· 201 199 ep_entry = (struct pds_fwctl_query_data_endpoint *)pdsfc->endpoints->entries; 202 200 for (i = 0; i < num_endpoints; i++) { 203 201 mutex_init(&pdsfc->endpoint_info[i].lock); 204 - pdsfc->endpoint_info[i].endpoint = ep_entry[i].id; 202 + pdsfc->endpoint_info[i].endpoint = le32_to_cpu(ep_entry[i].id); 205 203 } 206 204 207 205 return 0; ··· 216 214 struct pds_fwctl_query_data *data; 217 215 union pds_core_adminq_cmd cmd; 218 216 dma_addr_t data_pa; 217 + u32 num_entries; 219 218 int err; 220 219 int i; 221 220 ··· 249 246 *pa = data_pa; 250 247 251 248 entries = (struct pds_fwctl_query_data_operation *)data->entries; 252 - dev_dbg(dev, "num_entries %d\n", data->num_entries); 253 - for (i = 0; i < data->num_entries; i++) { 249 + num_entries = le32_to_cpu(data->num_entries); 250 + dev_dbg(dev, "num_entries %d\n", num_entries); 251 + for (i = 0; i < num_entries; i++) { 254 252 255 253 /* Translate FW command attribute to fwctl scope */ 256 254 switch (entries[i].scope) { ··· 271 267 break; 272 268 } 273 269 dev_dbg(dev, "endpoint %d operation: id %x scope %d\n", 274 - ep, entries[i].id, entries[i].scope); 270 + ep, le32_to_cpu(entries[i].id), entries[i].scope); 275 271 } 276 272 277 273 return data; ··· 284 280 struct pds_fwctl_query_data_operation *op_entry; 285 281 struct pdsfc_rpc_endpoint_info *ep_info = NULL; 286 282 struct device *dev = &pdsfc->fwctl.dev; 283 + u32 num_entries; 287 284 int i; 288 285 289 286 /* validate rpc in_len & out_len based 290 287 * on ident.max_req_sz & max_resp_sz 291 288 */ 292 - if (rpc->in.len > pdsfc->ident.max_req_sz) { 289 + if (rpc->in.len > le32_to_cpu(pdsfc->ident.max_req_sz)) { 293 290 dev_dbg(dev, "Invalid request size %u, max %u\n", 294 - rpc->in.len, pdsfc->ident.max_req_sz); 291 + rpc->in.len, le32_to_cpu(pdsfc->ident.max_req_sz)); 295 292 return -EINVAL; 296 293 } 297 294 298 - if (rpc->out.len > pdsfc->ident.max_resp_sz) { 295 + if (rpc->out.len > le32_to_cpu(pdsfc->ident.max_resp_sz)) { 299 296 dev_dbg(dev, "Invalid response size %u, max %u\n", 300 - rpc->out.len, pdsfc->ident.max_resp_sz); 297 + rpc->out.len, le32_to_cpu(pdsfc->ident.max_resp_sz)); 301 298 return -EINVAL; 302 299 } 303 300 304 - for (i = 0; i < pdsfc->endpoints->num_entries; i++) { 301 + num_entries = le32_to_cpu(pdsfc->endpoints->num_entries); 302 + for (i = 0; i < num_entries; i++) { 305 303 if (pdsfc->endpoint_info[i].endpoint == rpc->in.ep) { 306 304 ep_info = &pdsfc->endpoint_info[i]; 307 305 break; ··· 332 326 333 327 /* reject unsupported and/or out of scope commands */ 334 328 op_entry = (struct pds_fwctl_query_data_operation *)ep_info->operations->entries; 335 - for (i = 0; i < ep_info->operations->num_entries; i++) { 336 - if (PDS_FWCTL_RPC_OPCODE_CMP(rpc->in.op, op_entry[i].id)) { 329 + num_entries = le32_to_cpu(ep_info->operations->num_entries); 330 + for (i = 0; i < num_entries; i++) { 331 + if (PDS_FWCTL_RPC_OPCODE_CMP(rpc->in.op, le32_to_cpu(op_entry[i].id))) { 337 332 if (scope < op_entry[i].scope) 338 333 return -EPERM; 339 334 return 0; ··· 409 402 cmd = (union pds_core_adminq_cmd) { 410 403 .fwctl_rpc = { 411 404 .opcode = PDS_FWCTL_CMD_RPC, 412 - .flags = PDS_FWCTL_RPC_IND_REQ | PDS_FWCTL_RPC_IND_RESP, 405 + .flags = cpu_to_le16(PDS_FWCTL_RPC_IND_REQ | PDS_FWCTL_RPC_IND_RESP), 413 406 .ep = cpu_to_le32(rpc->in.ep), 414 407 .op = cpu_to_le32(rpc->in.op), 415 408 .req_pa = cpu_to_le64(in_payload_dma_addr),
+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;