Marcin,<div><br></div><div>I had the same messages on NV17, which worked extremely well (OpenGL games worked fine). The kernel will properly emulate the unaligned access, it just causes a trap which is slow. If the unaligned access caused an error, the NV17 card would have been unable to function given the number of erroneous accesses.</div>
<div><br></div><div>Using __get_unaligned_le would probably remove one byteswap though.</div><div><br></div><div>Patrick<br><br><div class="gmail_quote">On Wed, Mar 13, 2013 at 4:29 PM, Marcin Slusarz <span dir="ltr"><<a href="mailto:marcin.slusarz@gmail.com" target="_blank">marcin.slusarz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Mar 12, 2013 at 10:18:41PM -0500, Patrick Baggett wrote:<br>
>    The nouveau driver makes a number of unaligned accesses via the<br>
>    ROM16(), ROM32() and ROM64() macros which fault on SPARC (but would be<br>
>    transparently handled by x86 hardware). Making use of get_unaligned()<br>
>    macro fixes the problem for me.<br>
><br>
>    diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h<br>
>    b/drivers/gpu/drm/nouveau/nouveau_bios.h<br>
>    index 7ccd28f..92031f6 100644<br>
>    --- a/drivers/gpu/drm/nouveau/nouveau_bios.h<br>
>    +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h<br>
>    @@ -26,6 +26,8 @@<br>
>     #include "nvreg.h"<br>
>    +#include <asm/unaligned.h><br>
>    +<br>
>     #define DCB_MAX_NUM_ENTRIES 16<br>
>     #define DCB_MAX_NUM_I2C_ENTRIES 16<br>
>     #define DCB_MAX_NUM_GPIO_ENTRIES 32<br>
>    @@ -33,10 +35,10 @@<br>
>     #define DCB_LOC_ON_CHIP 0<br>
>    -#define ROM16(x) le16_to_cpu(*(u16 *)&(x))<br>
>    -#define ROM32(x) le32_to_cpu(*(u32 *)&(x))<br>
>    +#define ROM16(x) le16_to_cpu(get_unaligned((u16 *)&(x)))<br>
>    +#define ROM32(x) le32_to_cpu(get_unaligned((u32 *)&(x)))<br>
>     #define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 |<br>
>    ROM32(p[0]); })<br>
>    -#define ROM64(x) le64_to_cpu(*(u64 *)&(x))<br>
>    +#define ROM64(x) le64_to_cpu(get_unaligned((u64 *)&(x)))<br>
>     #define ROMPTR(d,x) ({            \<br>
>            struct nouveau_drm *drm = nouveau_drm((d)); \<br>
>            ROM16(x) ? &drm->vbios.data[ROM16(x)] : NULL; \<br>
<br>
</div></div>Please take a look at Documentation/SubmittingPatches and resubmit after<br>
adapting.<br>
<br>
IMHO, I think you should submit this patch only once you figure out how to<br>
correctly boot and use at least basic accelerated operations, because I'm not<br>
100% sure this is correct - 1. you have other severe issues with nouveau which<br>
may or may not be connected to this code, 2. sparc defines get_unaligned to<br>
__get_unaligned_be, so maybe you need to use _le variant? or maybe use<br>
get_unaligned_le* without le*_to_cpu?.<br>
<span class="HOEnZb"><font color="#888888"><br>
Marcin<br>
</font></span></blockquote></div><br></div>