All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian
@ 2010-11-08  3:57 Alex Williamson
  2010-11-09 10:57 ` [Qemu-devel] " Jes Sorensen
  2010-11-16 22:26 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Williamson @ 2010-11-08  3:57 UTC (permalink / raw)
  To: qemu-devel, blauwirbel; +Cc: jes.sorensen, alex.williamson

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 Compile tested only.  Only current user is kvm, no cross-arch users.

 hw/pc.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 0264e3d..cc8ec14 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -467,19 +467,19 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
 
 int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
 {
-    int index = e820_table.count;
+    int index = le32_to_cpu(e820_table.count);
     struct e820_entry *entry;
 
     if (index >= E820_NR_ENTRIES)
         return -EBUSY;
-    entry = &e820_table.entry[index];
+    entry = &e820_table.entry[index++];
 
-    entry->address = address;
-    entry->length = length;
-    entry->type = type;
+    entry->address = cpu_to_le64(address);
+    entry->length = cpu_to_le64(length);
+    entry->type = cpu_to_le32(type);
 
-    e820_table.count++;
-    return e820_table.count;
+    e820_table.count = cpu_to_le32(index);
+    return index;
 }
 
 static void *bochs_bios_init(void)

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

* [Qemu-devel] Re: [PATCH] pc: Fix e820 fw_cfg for big endian
  2010-11-08  3:57 [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian Alex Williamson
@ 2010-11-09 10:57 ` Jes Sorensen
  2010-11-09 12:42   ` Alexander Graf
  2010-11-16 22:26 ` [Qemu-devel] " Anthony Liguori
  1 sibling, 1 reply; 5+ messages in thread
From: Jes Sorensen @ 2010-11-09 10:57 UTC (permalink / raw)
  To: Alex Williamson; +Cc: blauwirbel, qemu-devel

On 11/08/10 04:57, Alex Williamson wrote:
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  Compile tested only.  Only current user is kvm, no cross-arch users.
> 
>  hw/pc.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)

Patch looks fine to me, but are there any systems out there using e820
on big endian hardware?

Jes

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

* Re: [Qemu-devel] Re: [PATCH] pc: Fix e820 fw_cfg for big endian
  2010-11-09 10:57 ` [Qemu-devel] " Jes Sorensen
@ 2010-11-09 12:42   ` Alexander Graf
  2010-11-09 12:44     ` Jes Sorensen
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2010-11-09 12:42 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: blauwirbel, Alex Williamson, qemu-devel


On 09.11.2010, at 11:57, Jes Sorensen wrote:

> On 11/08/10 04:57, Alex Williamson wrote:
>> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
>> ---
>> 
>> Compile tested only.  Only current user is kvm, no cross-arch users.
>> 
>> hw/pc.c |   14 +++++++-------
>> 1 files changed, 7 insertions(+), 7 deletions(-)
> 
> Patch looks fine to me, but are there any systems out there using e820
> on big endian hardware?

This fixes things when host endianness is big endian.


Alex

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

* Re: [Qemu-devel] Re: [PATCH] pc: Fix e820 fw_cfg for big endian
  2010-11-09 12:42   ` Alexander Graf
@ 2010-11-09 12:44     ` Jes Sorensen
  0 siblings, 0 replies; 5+ messages in thread
From: Jes Sorensen @ 2010-11-09 12:44 UTC (permalink / raw)
  To: Alexander Graf; +Cc: blauwirbel, Alex Williamson, qemu-devel

On 11/09/10 13:42, Alexander Graf wrote:
> 
> On 09.11.2010, at 11:57, Jes Sorensen wrote:
> 
>> On 11/08/10 04:57, Alex Williamson wrote:
>>> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
>>> ---
>>>
>>> Compile tested only.  Only current user is kvm, no cross-arch users.
>>>
>>> hw/pc.c |   14 +++++++-------
>>> 1 files changed, 7 insertions(+), 7 deletions(-)
>>
>> Patch looks fine to me, but are there any systems out there using e820
>> on big endian hardware?
> 
> This fixes things when host endianness is big endian.

Ah right, then it's all fine :)

Cheers,
Jes

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

* Re: [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian
  2010-11-08  3:57 [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian Alex Williamson
  2010-11-09 10:57 ` [Qemu-devel] " Jes Sorensen
@ 2010-11-16 22:26 ` Anthony Liguori
  1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2010-11-16 22:26 UTC (permalink / raw)
  To: Alex Williamson; +Cc: blauwirbel, jes.sorensen, qemu-devel

On 11/07/2010 09:57 PM, Alex Williamson wrote:
> Signed-off-by: Alex Williamson<alex.williamson@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>
>   Compile tested only.  Only current user is kvm, no cross-arch users.
>
>   hw/pc.c |   14 +++++++-------
>   1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 0264e3d..cc8ec14 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -467,19 +467,19 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)
>
>   int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
>   {
> -    int index = e820_table.count;
> +    int index = le32_to_cpu(e820_table.count);
>       struct e820_entry *entry;
>
>       if (index>= E820_NR_ENTRIES)
>           return -EBUSY;
> -    entry =&e820_table.entry[index];
> +    entry =&e820_table.entry[index++];
>
> -    entry->address = address;
> -    entry->length = length;
> -    entry->type = type;
> +    entry->address = cpu_to_le64(address);
> +    entry->length = cpu_to_le64(length);
> +    entry->type = cpu_to_le32(type);
>
> -    e820_table.count++;
> -    return e820_table.count;
> +    e820_table.count = cpu_to_le32(index);
> +    return index;
>   }
>
>   static void *bochs_bios_init(void)
>
>
>
>    

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

end of thread, other threads:[~2010-11-16 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-08  3:57 [Qemu-devel] [PATCH] pc: Fix e820 fw_cfg for big endian Alex Williamson
2010-11-09 10:57 ` [Qemu-devel] " Jes Sorensen
2010-11-09 12:42   ` Alexander Graf
2010-11-09 12:44     ` Jes Sorensen
2010-11-16 22:26 ` [Qemu-devel] " Anthony Liguori

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.