qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters
@ 2011-11-23 21:20 Stefan Weil
  2011-11-23 22:26 ` Michael S. Tsirkin
  2011-11-28 22:36 ` Anthony Liguori
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Weil @ 2011-11-23 21:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori, Michael S. Tsirkin

According to Intel's Open Source Software Developer Manual,
the dump counters address must be Dword aligned.

The new code enforces this alignment, so s->statsaddr may now
be used with stw_le_pci_dma() and stl_le_pci_dma().

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/eepro100.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/hw/eepro100.c b/hw/eepro100.c
index 7d59e71..29ec5b4 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
     case CU_STATSADDR:
         /* Load dump counters address. */
         s->statsaddr = e100_read_reg4(s, SCBPointer);
-        TRACE(OTHER, logout("val=0x%02x (status address)\n", val));
+        TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val));
+        if (s->statsaddr & 3) {
+            /* Memory must be Dword aligned. */
+            logout("unaligned dump counters address\n");
+            /* Handling of misaligned addresses is undefined.
+             * Here we align the address by ignoring the lower bits. */
+            /* TODO: Test unaligned dump counter address on real hardware. */
+            s->statsaddr &= ~3;
+        }
         break;
     case CU_SHOWSTATS:
         /* Dump statistical counters. */
-- 
1.7.2.5

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

* Re: [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters
  2011-11-23 21:20 [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters Stefan Weil
@ 2011-11-23 22:26 ` Michael S. Tsirkin
  2011-11-23 23:27   ` Anthony Liguori
  2011-11-28 22:36 ` Anthony Liguori
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2011-11-23 22:26 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Anthony Liguori, qemu-devel

On Wed, Nov 23, 2011 at 10:20:30PM +0100, Stefan Weil wrote:
> According to Intel's Open Source Software Developer Manual,
> the dump counters address must be Dword aligned.
> 
> The new code enforces this alignment, so s->statsaddr may now
> be used with stw_le_pci_dma() and stl_le_pci_dma().
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Anthiny, coul you apply pls?

> ---
>  hw/eepro100.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/eepro100.c b/hw/eepro100.c
> index 7d59e71..29ec5b4 100644
> --- a/hw/eepro100.c
> +++ b/hw/eepro100.c
> @@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
>      case CU_STATSADDR:
>          /* Load dump counters address. */
>          s->statsaddr = e100_read_reg4(s, SCBPointer);
> -        TRACE(OTHER, logout("val=0x%02x (status address)\n", val));
> +        TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val));
> +        if (s->statsaddr & 3) {
> +            /* Memory must be Dword aligned. */
> +            logout("unaligned dump counters address\n");
> +            /* Handling of misaligned addresses is undefined.
> +             * Here we align the address by ignoring the lower bits. */
> +            /* TODO: Test unaligned dump counter address on real hardware. */
> +            s->statsaddr &= ~3;
> +        }
>          break;
>      case CU_SHOWSTATS:
>          /* Dump statistical counters. */
> -- 
> 1.7.2.5

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

* Re: [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters
  2011-11-23 22:26 ` Michael S. Tsirkin
@ 2011-11-23 23:27   ` Anthony Liguori
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2011-11-23 23:27 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Stefan Weil, qemu-devel

On 11/23/2011 04:26 PM, Michael S. Tsirkin wrote:
> On Wed, Nov 23, 2011 at 10:20:30PM +0100, Stefan Weil wrote:
>> According to Intel's Open Source Software Developer Manual,
>> the dump counters address must be Dword aligned.
>>
>> The new code enforces this alignment, so s->statsaddr may now
>> be used with stw_le_pci_dma() and stl_le_pci_dma().
>>
>> Signed-off-by: Stefan Weil<sw@weilnetz.de>
>
> Anthiny, coul you apply pls?

Yup.

Regards,

Anthony Liguori

>
>> ---
>>   hw/eepro100.c |   10 +++++++++-
>>   1 files changed, 9 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/eepro100.c b/hw/eepro100.c
>> index 7d59e71..29ec5b4 100644
>> --- a/hw/eepro100.c
>> +++ b/hw/eepro100.c
>> @@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
>>       case CU_STATSADDR:
>>           /* Load dump counters address. */
>>           s->statsaddr = e100_read_reg4(s, SCBPointer);
>> -        TRACE(OTHER, logout("val=0x%02x (status address)\n", val));
>> +        TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val));
>> +        if (s->statsaddr&  3) {
>> +            /* Memory must be Dword aligned. */
>> +            logout("unaligned dump counters address\n");
>> +            /* Handling of misaligned addresses is undefined.
>> +             * Here we align the address by ignoring the lower bits. */
>> +            /* TODO: Test unaligned dump counter address on real hardware. */
>> +            s->statsaddr&= ~3;
>> +        }
>>           break;
>>       case CU_SHOWSTATS:
>>           /* Dump statistical counters. */
>> --
>> 1.7.2.5
>
>

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

* Re: [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters
  2011-11-23 21:20 [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters Stefan Weil
  2011-11-23 22:26 ` Michael S. Tsirkin
@ 2011-11-28 22:36 ` Anthony Liguori
  1 sibling, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2011-11-28 22:36 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel, Michael S. Tsirkin

On 11/23/2011 03:20 PM, Stefan Weil wrote:
> According to Intel's Open Source Software Developer Manual,
> the dump counters address must be Dword aligned.
>
> The new code enforces this alignment, so s->statsaddr may now
> be used with stw_le_pci_dma() and stl_le_pci_dma().
>
> Signed-off-by: Stefan Weil<sw@weilnetz.de>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   hw/eepro100.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/hw/eepro100.c b/hw/eepro100.c
> index 7d59e71..29ec5b4 100644
> --- a/hw/eepro100.c
> +++ b/hw/eepro100.c
> @@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val)
>       case CU_STATSADDR:
>           /* Load dump counters address. */
>           s->statsaddr = e100_read_reg4(s, SCBPointer);
> -        TRACE(OTHER, logout("val=0x%02x (status address)\n", val));
> +        TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val));
> +        if (s->statsaddr&  3) {
> +            /* Memory must be Dword aligned. */
> +            logout("unaligned dump counters address\n");
> +            /* Handling of misaligned addresses is undefined.
> +             * Here we align the address by ignoring the lower bits. */
> +            /* TODO: Test unaligned dump counter address on real hardware. */
> +            s->statsaddr&= ~3;
> +        }
>           break;
>       case CU_SHOWSTATS:
>           /* Dump statistical counters. */

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

end of thread, other threads:[~2011-11-28 22:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23 21:20 [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters Stefan Weil
2011-11-23 22:26 ` Michael S. Tsirkin
2011-11-23 23:27   ` Anthony Liguori
2011-11-28 22:36 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).