[PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx-ps

2010-02-10 Thread Matt Turner
Noticed on a DEC Alpha.

Start up into console mode caused 15 unaligned accesses, and starting X
caused another 48.

Signed-off-by: Matt Turner matts...@gmail.com
CC: Jerome Glisse jgli...@redhat.com
CC: Alex Deucher alexdeuc...@gmail.com
CC: Dave Airlie airl...@redhat.com
---
 drivers/gpu/drm/radeon/atom.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index bd0c843..c1d3c24 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -24,6 +24,7 @@
 
 #include linux/module.h
 #include linux/sched.h
+#include asm/unaligned.h
 
 #define ATOM_DEBUG
 
@@ -212,7 +213,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, 
uint8_t attr,
case ATOM_ARG_PS:
idx = U8(*ptr);
(*ptr)++;
-   val = le32_to_cpu(ctx-ps[idx]);
+   /* get_unaligned avoids unaligned accesses from atombios tables
+* 21, 24, 42. */
+   val = le32_to_cpu(get_unaligned((u32 *)ctx-ps[idx]));
if (print)
DEBUG(PS[0x%02X,0x%04X], idx, val);
break;
-- 
1.6.5.3


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx-ps

2010-02-10 Thread Matt Turner
Updated patch to use get_unaligned_le32, as suggested by Dave.

On Wed, Feb 10, 2010 at 10:56 PM, Matt Turner matts...@gmail.com wrote:
 Noticed on a DEC Alpha.

 Start up into console mode caused 15 unaligned accesses, and starting X
 caused another 48.

 Signed-off-by: Matt Turner matts...@gmail.com
 CC: Jerome Glisse jgli...@redhat.com
 CC: Alex Deucher alexdeuc...@gmail.com
 CC: Dave Airlie airl...@redhat.com
 ---
  drivers/gpu/drm/radeon/atom.c |    5 -
  1 files changed, 4 insertions(+), 1 deletions(-)

 diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
 index bd0c843..c1d3c24 100644
 --- a/drivers/gpu/drm/radeon/atom.c
 +++ b/drivers/gpu/drm/radeon/atom.c
 @@ -24,6 +24,7 @@

  #include linux/module.h
  #include linux/sched.h
 +#include asm/unaligned.h

  #define ATOM_DEBUG

 @@ -212,7 +213,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, 
 uint8_t attr,
        case ATOM_ARG_PS:
                idx = U8(*ptr);
                (*ptr)++;
 -               val = le32_to_cpu(ctx-ps[idx]);
 +               /* get_unaligned avoids unaligned accesses from atombios 
 tables
 +                * 21, 24, 42. */
 +               val = le32_to_cpu(get_unaligned((u32 *)ctx-ps[idx]));
                if (print)
                        DEBUG(PS[0x%02X,0x%04X], idx, val);
                break;
 --
 1.6.5.3




0001-drm-radeon-kms-atom-use-get_unaligned_le32-for-ctx-p.patch
Description: Binary data
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx-ps

2010-02-10 Thread Alex Deucher
On Wed, Feb 10, 2010 at 11:19 PM, Matt Turner matts...@gmail.com wrote:
 Updated patch to use get_unaligned_le32, as suggested by Dave.

 On Wed, Feb 10, 2010 at 10:56 PM, Matt Turner matts...@gmail.com wrote:
 Noticed on a DEC Alpha.

 Start up into console mode caused 15 unaligned accesses, and starting X
 caused another 48.

 Signed-off-by: Matt Turner matts...@gmail.com
 CC: Jerome Glisse jgli...@redhat.com
 CC: Alex Deucher alexdeuc...@gmail.com
 CC: Dave Airlie airl...@redhat.com
 ---
  drivers/gpu/drm/radeon/atom.c |    5 -
  1 files changed, 4 insertions(+), 1 deletions(-)

 diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
 index bd0c843..c1d3c24 100644
 --- a/drivers/gpu/drm/radeon/atom.c
 +++ b/drivers/gpu/drm/radeon/atom.c
 @@ -24,6 +24,7 @@

  #include linux/module.h
  #include linux/sched.h
 +#include asm/unaligned.h

  #define ATOM_DEBUG

 @@ -212,7 +213,9 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, 
 uint8_t attr,
        case ATOM_ARG_PS:
                idx = U8(*ptr);
                (*ptr)++;
 -               val = le32_to_cpu(ctx-ps[idx]);
 +               /* get_unaligned avoids unaligned accesses from atombios 
 tables
 +                * 21, 24, 42. */

Not a big deal, but you might want to mention that this is needed for
alpha in the comment.  Also, the tables with unaligned accesses will
probably vary with the card, so there's not really any need to mention
them here.

Alex

 +               val = le32_to_cpu(get_unaligned((u32 *)ctx-ps[idx]));
                if (print)
                        DEBUG(PS[0x%02X,0x%04X], idx, val);
                break;
 --
 1.6.5.3




--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel