qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Filip Navara <filip.navara@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT ee6847d] qdev: rework device properties.
Date: Fri, 17 Jul 2009 13:13:09 +0300	[thread overview]
Message-ID: <f43fc5580907170313ie8eb0b4o121ef24bb22caf3c@mail.gmail.com> (raw)
In-Reply-To: <5b31733c0907170305l50f5f7ecteadf3d4a057e8f95@mail.gmail.com>

On Fri, Jul 17, 2009 at 1:05 PM, Filip Navara<filip.navara@gmail.com> wrote:
> On Fri, Jul 17, 2009 at 11:39 AM, Blue Swirl<blauwirbel@gmail.com> wrote:
>> On Fri, Jul 17, 2009 at 2:12 AM, Anthony Liguori<aliguori@us.ibm.com> wrote:
>>> From: Gerd Hoffmann <kraxel@redhat.com>
>>>
>>> This patch is a major overhaul of the device properties.  The properties
>>> are saved directly in the device state struct now, the linked list of
>>> property values is gone.
>>
>>>     .qdev.name  = "fdc",
>>>     .qdev.size  = sizeof(fdctrl_t),
>>> -    .qdev.props = (DevicePropList[]) {
>>> -        {.name = "io_base", .type = PROP_TYPE_INT},
>>> -        {.name = "strict_io", .type = PROP_TYPE_INT},
>>> -        {.name = "mem_mapped", .type = PROP_TYPE_INT},
>>> -        {.name = "sun4m", .type = PROP_TYPE_INT},
>>> -        {.name = NULL}
>>> +    .qdev.props = (Property[]) {
>>> +        {
>>> +            .name = "io_base",
>>> +            .info = &qdev_prop_uint32,
>>> +            .offset = offsetof(fdctrl_t, io_base),
>>> +        },
>>
>> This is broken, on SS-600MP, SS-10 and SS-20 fdc is located above 4G.
>> The correct type is target_phys_addr_t. I'll fix this.
>>
>>> +typedef struct RamDevice
>>> +{
>>> +    SysBusDevice busdev;
>>> +    uint32_t size;
>>> +} RamDevice;
>>> +
>>>  /* System RAM */
>>>  static void ram_init1(SysBusDevice *dev)
>>>  {
>>>     ram_addr_t RAM_size, ram_offset;
>>> +    RamDevice *d = FROM_SYSBUS(RamDevice, dev);
>>>
>>> -    RAM_size = qdev_get_prop_int(&dev->qdev, "size", 0);
>>> +    RAM_size = d->size;
>>>
>>>     ram_offset = qemu_ram_alloc(RAM_size);
>>>     sysbus_init_mmio(dev, RAM_size, ram_offset);
>>> @@ -496,6 +499,7 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size,
>>>  {
>>>     DeviceState *dev;
>>>     SysBusDevice *s;
>>> +    RamDevice *d;
>>>
>>>     /* allocate RAM */
>>>     if ((uint64_t)RAM_size > max_mem) {
>>> @@ -506,20 +510,26 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size,
>>>         exit(1);
>>>     }
>>>     dev = qdev_create(NULL, "memory");
>>> -    qdev_set_prop_int(dev, "size", RAM_size);
>>>     qdev_init(dev);
>>>     s = sysbus_from_qdev(dev);
>>>
>>> +    d = FROM_SYSBUS(RamDevice, s);
>>> +    d->size = RAM_size;
>>> +
>>>     sysbus_mmio_map(s, 0, addr);
>>>  }
>>
>> This is completely hosed because of the wrong order of setting
>> d->size. Now qemu_ram_alloc gets passed a zero.
>
> Move the qdev_init(dev); call after the setting of d->size.

Thanks, this fixes the zero memory size.

      reply	other threads:[~2009-07-17 10:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200907162312.n6GNCidA022228@d01av03.pok.ibm.com>
2009-07-17  9:39 ` [Qemu-devel] Re: [Qemu-commits] [COMMIT ee6847d] qdev: rework device properties Blue Swirl
2009-07-17 10:05   ` Filip Navara
2009-07-17 10:13     ` Blue Swirl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f43fc5580907170313ie8eb0b4o121ef24bb22caf3c@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=filip.navara@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).