All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps
@ 2010-02-11  3:56 Matt Turner
  2010-02-11  4:19 ` Matt Turner
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Turner @ 2010-02-11  3:56 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher, Dave Airlie, Jerome Glisse

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 <mattst88@gmail.com>
CC: Jerome Glisse <jglisse@redhat.com>
CC: Alex Deucher <alexdeucher@gmail.com>
CC: Dave Airlie <airlied@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
--

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps
  2010-02-11  3:56 [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps Matt Turner
@ 2010-02-11  4:19 ` Matt Turner
  2010-02-11  5:50   ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Turner @ 2010-02-11  4:19 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher, Dave Airlie, Jerome Glisse

[-- Attachment #1: Type: text/plain, Size: 1462 bytes --]

Updated patch to use get_unaligned_le32, as suggested by Dave.

On Wed, Feb 10, 2010 at 10:56 PM, Matt Turner <mattst88@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 <mattst88@gmail.com>
> CC: Jerome Glisse <jglisse@redhat.com>
> CC: Alex Deucher <alexdeucher@gmail.com>
> CC: Dave Airlie <airlied@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
>
>

[-- Attachment #2: 0001-drm-radeon-kms-atom-use-get_unaligned_le32-for-ctx-p.patch --]
[-- Type: application/octet-stream, Size: 1309 bytes --]

From 89ccfb52e4ac0f6ab481bd6f3a75b67435f99212 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Wed, 10 Feb 2010 23:22:27 -0500
Subject: [PATCH] drm/radeon/kms/atom: use get_unaligned_le32() for ctx->ps

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 <mattst88@gmail.com>
CC: Jerome Glisse <jglisse@redhat.com>
CC: Alex Deucher <alexdeucher@gmail.com>
CC: Dave Airlie <airlied@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..ee4da4d 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_le32 avoids unaligned accesses from atombios
+		 * tables 21, 24, 42. */
+		val = get_unaligned_le32((u32 *)&ctx->ps[idx]);
 		if (print)
 			DEBUG("PS[0x%02X,0x%04X]", idx, val);
 		break;
-- 
1.6.5.3


[-- Attachment #3: Type: text/plain, Size: 254 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps
  2010-02-11  4:19 ` Matt Turner
@ 2010-02-11  5:50   ` Alex Deucher
  2010-02-14  1:15     ` Matt Turner
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2010-02-11  5:50 UTC (permalink / raw)
  To: Matt Turner; +Cc: Dave Airlie, Jerome Glisse, dri-devel

On Wed, Feb 10, 2010 at 11:19 PM, Matt Turner <mattst88@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 <mattst88@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 <mattst88@gmail.com>
>> CC: Jerome Glisse <jglisse@redhat.com>
>> CC: Alex Deucher <alexdeucher@gmail.com>
>> CC: Dave Airlie <airlied@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
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps
  2010-02-11  5:50   ` Alex Deucher
@ 2010-02-14  1:15     ` Matt Turner
  2010-02-14  5:27       ` Matt Turner
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Turner @ 2010-02-14  1:15 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Dave Airlie, Jerome Glisse, dri-devel

[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]

On Thu, Feb 11, 2010 at 12:50 AM, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Wed, Feb 10, 2010 at 11:19 PM, Matt Turner <mattst88@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 <mattst88@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 <mattst88@gmail.com>
>>> CC: Jerome Glisse <jglisse@redhat.com>
>>> CC: Alex Deucher <alexdeucher@gmail.com>
>>> CC: Dave Airlie <airlied@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

Alright, please check out the attached patch.

Thanks,
Matt

[-- Attachment #2: 0001-drm-radeon-kms-atom-use-get_unaligned_le32-for-ctx-p.patch --]
[-- Type: application/octet-stream, Size: 1319 bytes --]

From cf5a4d8cfd9eb4290e1bc5c8020a074454f5f019 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Sat, 13 Feb 2010 20:20:19 -0500
Subject: [PATCH] drm/radeon/kms/atom: use get_unaligned_le32() for ctx->ps

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 <mattst88@gmail.com>
CC: Jerome Glisse <jglisse@redhat.com>
CC: Alex Deucher <alexdeucher@gmail.com>
CC: Dave Airlie <airlied@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..a742d22 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_le32 avoids unaligned accesses from atombios
+		 * tables, noticed on a DEC Alpha.
+		val = get_unaligned_le32((u32 *)&ctx->ps[idx]);
 		if (print)
 			DEBUG("PS[0x%02X,0x%04X]", idx, val);
 		break;
-- 
1.6.5.3


[-- Attachment #3: Type: text/plain, Size: 254 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps
  2010-02-14  1:15     ` Matt Turner
@ 2010-02-14  5:27       ` Matt Turner
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Turner @ 2010-02-14  5:27 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Dave Airlie, Jerome Glisse, dri-devel

[-- Attachment #1: Type: text/plain, Size: 19 bytes --]

Ugh. I missed a */

[-- Attachment #2: 0001-drm-radeon-kms-atom-use-get_unaligned_le32-for-ctx-p.patch --]
[-- Type: application/octet-stream, Size: 1322 bytes --]

From cf5a4d8cfd9eb4290e1bc5c8020a074454f5f019 Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Sat, 13 Feb 2010 20:20:19 -0500
Subject: [PATCH] drm/radeon/kms/atom: use get_unaligned_le32() for ctx->ps

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 <mattst88@gmail.com>
CC: Jerome Glisse <jglisse@redhat.com>
CC: Alex Deucher <alexdeucher@gmail.com>
CC: Dave Airlie <airlied@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..a742d22 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_le32 avoids unaligned accesses from atombios
+		 * tables, noticed on a DEC Alpha. */
+		val = get_unaligned_le32((u32 *)&ctx->ps[idx]);
 		if (print)
 			DEBUG("PS[0x%02X,0x%04X]", idx, val);
 		break;
-- 
1.6.5.3


[-- Attachment #3: Type: text/plain, Size: 254 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 161 bytes --]

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-14  5:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11  3:56 [PATCH] drm/radeon/kms/atom: use get_unaligned() for ctx->ps Matt Turner
2010-02-11  4:19 ` Matt Turner
2010-02-11  5:50   ` Alex Deucher
2010-02-14  1:15     ` Matt Turner
2010-02-14  5:27       ` Matt Turner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.