Re: [Qemu-devel] [PATCH v4 26/39] pcnet: convert to memory API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 09, 2011 at 09:52:17AM +0300, Avi Kivity wrote:
> On 08/09/2011 09:55 AM, Bob Breuer wrote:
> >>   static void lance_cleanup(VLANClientState *nc)
> >>  @@ -117,13 +116,11 @@ static int lance_init(SysBusDevice *dev)
> >>       SysBusPCNetState *d = FROM_SYSBUS(SysBusPCNetState, dev);
> >>       PCNetState *s =&d->state;
> >>
> >>  -    s->mmio_index =
> >>  -        cpu_register_io_memory(lance_mem_read, lance_mem_write, d,
> >>  -                               DEVICE_NATIVE_ENDIAN);
> >>  +    memory_region_init_io(&s->mmio,&lance_mem_ops, s, "lance-mmio", 4);
> >
> >You've switched up d and s here, so anything that tries to talk to the
> >ethernet, such as a sparc32 guest, will now cause Qemu to segfault.
> >
> >
> 
> Good catch; will post a fix.
> 
> Maybe keeping the opaque wasn't such a good idea.

Yes, we typically can get from the mmio to the device state
using container_of.

> -- 
> I have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux