Addresses the following kernel logs seen during boot: Kernel unaligned access at TPC[100ee150] mlx4_QUERY_HCA+0x80/0x248 [mlx4_core] Kernel unaligned access at TPC[100f071c] mlx4_QUERY_ADAPTER+0x100/0x12c [mlx4_core] Kernel unaligned access at TPC[100f071c] mlx4_QUERY_ADAPTER+0x100/0x12c [mlx4_core] Kernel unaligned access at TPC[100f071c] mlx4_QUERY_ADAPTER+0x100/0x12c [mlx4_core] Kernel unaligned access at TPC[100f071c] mlx4_QUERY_ADAPTER+0x100/0x12c [mlx4_core]
Unified · Split
| @@ -56,11 +56,13 @@ MODULE_PARM_DESC(enable_qos, "Enable Enhanced QoS support (default: on)"); · 55 unmodified lines | ||
| 56 | 56 | #define MLX4_GET(dest, source, offset) \ |
| 57 | 57 | do { \ |
| 58 | 58 | void *__p = (char *) (source) + (offset); \ |
| 59 | + u64 val; \ | |
| 59 | 60 | switch (sizeof (dest)) { \ |
| 60 | 61 | case 1: (dest) = *(u8 *) __p; break; \ |
| 61 | 62 | case 2: (dest) = be16_to_cpup(__p); break; \ |
| 62 | 63 | case 4: (dest) = be32_to_cpup(__p); break; \ |
| 63 | − case 8: (dest) = be64_to_cpup(__p); break; \ | |
| 64 | + case 8: val = get_unaligned((u64 *)__p); \ | |
| 65 | + (dest) = be64_to_cpu(val); break; \ | |
| 64 | 66 | default: __buggy_use_of_MLX4_GET(); \ |
| 65 | 67 | } \ |
| 66 | 68 | } while (0) |
| @@ -1605,9 +1607,17 @@ static void get_board_id(void *vsd, char *board_id) · 1538 unmodified lines | ||
| 1605 | 1607 | * swaps each 4-byte word before passing it back to |
| 1606 | 1608 | * us. Therefore we need to swab it before printing. |
| 1607 | 1609 | */ |
| 1608 | − for (i = 0; i < 4; ++i) | |
| 1609 | − ((u32 *) board_id)[i] = | |
| 1610 | − swab32(*(u32 *) (vsd + VSD_OFFSET_MLX_BOARD_ID + i * 4)); | |
| 1610 | + u32 *bid_u32 = (u32 *)board_id; | |
| 1611 | + | |
| 1612 | + for (i = 0; i < 4; ++i) { | |
| 1613 | + u32 *addr; | |
| 1614 | + u32 val; | |
| 1615 | + | |
| 1616 | + addr = (u32 *) (vsd + VSD_OFFSET_MLX_BOARD_ID + i * 4); | |
| 1617 | + val = get_unaligned(addr); | |
| 1618 | + val = swab32(val); | |
| 1619 | + put_unaligned(val, &bid_u32[i]); | |
| 1620 | + } | |
| 1611 | 1621 | } |
| 1612 | 1622 | } |
| 1613 | 1623 | |