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

[IA64] Fix __{in,out}s{w,l} to handle unaligned data

Some ia64 systems produce several repeats of kernel messages like this:

kernel unaligned access to 0xe000000644220466, ip=0xa000000100516fa1

This was tracked to ide code using the __cmd[] field in "struct request"
via the __outsw() function. __cmd[] is a char array, so is not guaranteed
to be properly aligned when accessed as words.

Tested-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>

authored by

James Bottomley and committed by
Tony Luck
8a549f8b 42aca483

+6 -4
+6 -4
arch/ia64/include/asm/io.h
··· 19 19 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com> 20 20 */ 21 21 22 + #include <asm/unaligned.h> 23 + 22 24 /* We don't use IO slowdowns on the ia64, but.. */ 23 25 #define __SLOW_DOWN_IO do { } while (0) 24 26 #define SLOW_DOWN_IO do { } while (0) ··· 243 241 unsigned short *dp = dst; 244 242 245 243 while (count--) 246 - *dp++ = platform_inw(port); 244 + put_unaligned(platform_inw(port), dp++); 247 245 } 248 246 249 247 static inline void ··· 252 250 unsigned int *dp = dst; 253 251 254 252 while (count--) 255 - *dp++ = platform_inl(port); 253 + put_unaligned(platform_inl(port), dp++); 256 254 } 257 255 258 256 static inline void ··· 270 268 const unsigned short *sp = src; 271 269 272 270 while (count--) 273 - platform_outw(*sp++, port); 271 + platform_outw(get_unaligned(sp++), port); 274 272 } 275 273 276 274 static inline void ··· 279 277 const unsigned int *sp = src; 280 278 281 279 while (count--) 282 - platform_outl(*sp++, port); 280 + platform_outl(get_unaligned(sp++), port); 283 281 } 284 282 285 283 /*