qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 11/12] pc: Support firmware configuration wit


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v4 11/12] pc: Support firmware configuration with -blockdev
Date: Tue, 12 Mar 2019 18:08:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 03/11/19 18:45, Paolo Bonzini wrote:
> On 11/03/19 18:42, Markus Armbruster wrote:
>> Incremental diff since v3:
> 
> Ack, thanks.

I'm OK with this change too (as it doesn't seem to touch parts of the
code that I could comment on ;) )

Thanks
Laszlo

>> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
>> index ccf2221acb..c628540774 100644
>> --- a/hw/i386/pc_sysfw.c
>> +++ b/hw/i386/pc_sysfw.c
>> @@ -82,13 +82,19 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory,
>>      memory_region_set_readonly(isa_bios, true);
>>  }
>>  
>> -static PFlashCFI01 *pc_pflash_create(const char *name)
>> +static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms,
>> +                                     const char *name,
>> +                                     const char *alias_prop_name)
>>  {
>>      DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
>>  
>>      qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE);
>>      qdev_prop_set_uint8(dev, "width", 1);
>>      qdev_prop_set_string(dev, "name", name);
>> +    object_property_add_child(OBJECT(pcms), name, OBJECT(dev),
>> +                              &error_abort);
>> +    object_property_add_alias(OBJECT(pcms), alias_prop_name,
>> +                              OBJECT(dev), "drive", &error_abort);
>>      return PFLASH_CFI01(dev);
>>  }
>>  
>> @@ -97,14 +103,10 @@ void pc_system_flash_create(PCMachineState *pcms)
>>      PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
>>  
>>      if (pcmc->pci_enabled) {
>> -        pcms->flash[0] = pc_pflash_create("system.flash0");
>> -        pcms->flash[1] = pc_pflash_create("system.flash1");
>> -        object_property_add_alias(OBJECT(pcms), "pflash0",
>> -                                  OBJECT(pcms->flash[0]), "drive",
>> -                                  &error_abort);
>> -        object_property_add_alias(OBJECT(pcms), "pflash1",
>> -                                  OBJECT(pcms->flash[1]), "drive",
>> -                                  &error_abort);
>> +        pcms->flash[0] = pc_pflash_create(pcms, "system.flash0",
>> +                                          "pflash0");
>> +        pcms->flash[1] = pc_pflash_create(pcms, "system.flash1",
>> +                                          "pflash1");
>>      }
>>  }
>>  
>> @@ -122,19 +124,7 @@ static void 
>> pc_system_flash_cleanup_unused(PCMachineState *pcms)
>>              prop_name = g_strdup_printf("pflash%d", i);
>>              object_property_del(OBJECT(pcms), prop_name, &error_abort);
>>              g_free(prop_name);
>> -            /*
>> -             * Delete @dev_obj.  Straight object_unref() is wrong,
>> -             * since it leaves dangling references in the parent bus
>> -             * behind.  object_unparent() doesn't work, either: since
>> -             * @dev_obj hasn't been realized, dev_obj->parent is null,
>> -             * and object_unparent() does nothing.  DeviceClass method
>> -             * device_unparent() works, but we have to take a
>> -             * temporary reference, or else device_unparent() commits
>> -             * a use-after-free error.
>> -             */
>> -            object_ref(dev_obj);
>> -            object_get_class(dev_obj)->unparent(dev_obj);
>> -            object_unref(dev_obj);
>> +            object_unparent(dev_obj);
>>              pcms->flash[i] = NULL;
>>          }
>>      }
>>
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]