diff mbox

[10/18] kvm: qemu: device-assignment: fix ROM writing

Message ID 1232027262-21487-10-git-send-email-markmc@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Mark McLoughlin Jan. 15, 2009, 1:47 p.m. UTC
Use write() instead of write_rom() to write the device number.

Cast the struct option_rom_header* to uint8_t* for write_rom().

Fixes:

  qemu/hw/device-assignment.c: In function ‘scan_option_rom’:
  qemu/hw/device-assignment.c:766: warning: passing argument 2 of ‘cpu_physical_memory_write_rom’ from incompatible pointer type

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 qemu/hw/device-assignment.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Avi Kivity Jan. 15, 2009, 1:54 p.m. UTC | #1
Mark McLoughlin wrote:
> Use write() instead of write_rom() to write the device number.
>
> Cast the struct option_rom_header* to uint8_t* for write_rom().
>
> Fixes:
>
>   qemu/hw/device-assignment.c: In function ‘scan_option_rom’:
>   qemu/hw/device-assignment.c:766: warning: passing argument 2 of ‘cpu_physical_memory_write_rom’ from incompatible pointer type
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> ---
>  qemu/hw/device-assignment.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
> index f8faf5b..e0c01ce 100644
> --- a/qemu/hw/device-assignment.c
> +++ b/qemu/hw/device-assignment.c
> @@ -760,8 +760,8 @@ static int scan_option_rom(uint8_t devfn, void *roms, ram_addr_t offset)
>      cpu_register_physical_memory(0xd0000 + offset, total_size, addr | IO_MEM_ROM);
>  
>      /* Write ROM data and devfn to phys_addr */
> -    cpu_physical_memory_write_rom(0xd0000 + offset, rom, size);
> -    cpu_physical_memory_write_rom(0xd0000 + offset + size, &devfn, 1);
> +    cpu_physical_memory_write_rom(0xd0000 + offset, (uint8_t *)rom, size);
> +    cpu_physical_memory_write(0xd0000 + offset + size, &devfn, 1);
>  
>      return total_size;
>   

Why drop _rom?  The memory region is registered as a rom, a few lines 
earlier?
Mark McLoughlin Jan. 15, 2009, 2:24 p.m. UTC | #2
On Thu, 2009-01-15 at 15:54 +0200, Avi Kivity wrote:
> Mark McLoughlin wrote:
> > Use write() instead of write_rom() to write the device number.
> >
> > Cast the struct option_rom_header* to uint8_t* for write_rom().
> >
> > Fixes:
> >
> >   qemu/hw/device-assignment.c: In function ‘scan_option_rom’:
> >   qemu/hw/device-assignment.c:766: warning: passing argument 2 of ‘cpu_physical_memory_write_rom’ from incompatible pointer type
> >
> > Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> > ---
> >  qemu/hw/device-assignment.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
> > index f8faf5b..e0c01ce 100644
> > --- a/qemu/hw/device-assignment.c
> > +++ b/qemu/hw/device-assignment.c
> > @@ -760,8 +760,8 @@ static int scan_option_rom(uint8_t devfn, void *roms, ram_addr_t offset)
> >      cpu_register_physical_memory(0xd0000 + offset, total_size, addr | IO_MEM_ROM);
> >  
> >      /* Write ROM data and devfn to phys_addr */
> > -    cpu_physical_memory_write_rom(0xd0000 + offset, rom, size);
> > -    cpu_physical_memory_write_rom(0xd0000 + offset + size, &devfn, 1);
> > +    cpu_physical_memory_write_rom(0xd0000 + offset, (uint8_t *)rom, size);
> > +    cpu_physical_memory_write(0xd0000 + offset + size, &devfn, 1);
> >  
> >      return total_size;
> >   
> 
> Why drop _rom?  The memory region is registered as a rom, a few lines 
> earlier?

My mistake, can you just apply the change to the first line?

Thanks,
Mark.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Jan. 15, 2009, 2:35 p.m. UTC | #3
Mark McLoughlin wrote:

  

>> Why drop _rom?  The memory region is registered as a rom, a few lines 
>> earlier?
>>     
>
> My mistake, can you just apply the change to the first line?
>
>   

Sure, applied with _rom.
diff mbox

Patch

diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
index f8faf5b..e0c01ce 100644
--- a/qemu/hw/device-assignment.c
+++ b/qemu/hw/device-assignment.c
@@ -760,8 +760,8 @@  static int scan_option_rom(uint8_t devfn, void *roms, ram_addr_t offset)
     cpu_register_physical_memory(0xd0000 + offset, total_size, addr | IO_MEM_ROM);
 
     /* Write ROM data and devfn to phys_addr */
-    cpu_physical_memory_write_rom(0xd0000 + offset, rom, size);
-    cpu_physical_memory_write_rom(0xd0000 + offset + size, &devfn, 1);
+    cpu_physical_memory_write_rom(0xd0000 + offset, (uint8_t *)rom, size);
+    cpu_physical_memory_write(0xd0000 + offset + size, &devfn, 1);
 
     return total_size;
 }