Am 29.07.2013 16:47, schrieb Igor Mammedov:
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index b0b98a8..a2b9d88 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
[...]
> @@ -1003,15 +1004,27 @@ typedef struct PcRomPciInfo {
>  static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info)
>  {
>      PcRomPciInfo *info;
> +    Object *pci_info;
> +    bool ambiguous = false;
> +
>      if (!guest_info->has_pci_info || !guest_info->fw_cfg) {
>          return;
>      }
> +    pci_info = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, 
> &ambiguous);
> +    g_assert(!ambiguous);
> +    if (!pci_info) {
> +        return;
> +    }
>  
>      info = g_malloc(sizeof *info);
> -    info->w32_min = cpu_to_le64(guest_info->pci_info.w32.begin);
> -    info->w32_max = cpu_to_le64(guest_info->pci_info.w32.end);
> -    info->w64_min = cpu_to_le64(guest_info->pci_info.w64.begin);
> -    info->w64_max = cpu_to_le64(guest_info->pci_info.w64.end);
> +    info->w32_min = cpu_to_le64(object_property_get_int(pci_info,
> +                                PCI_HOST_PROP_PCI_HOLE_START, NULL));
> +    info->w32_max = cpu_to_le64(object_property_get_int(pci_info,
> +                                PCI_HOST_PROP_PCI_HOLE_END, NULL));
> +    info->w64_min = cpu_to_le64(object_property_get_int(pci_info,
> +                                PCI_HOST_PROP_PCI_HOLE64_START, NULL));
> +    info->w64_max = cpu_to_le64(object_property_get_int(pci_info,
> +                                PCI_HOST_PROP_PCI_HOLE64_END, NULL));
>      /* Pass PCI hole info to guest via a side channel.
>       * Required so guest PCI enumeration does the right thing. */
>      fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info);

I wonder, if we're passing PcRomInfo out to SeaBIOS via fw_cfg,
shouldn't it be QEMU_PACKED just in case?

Not strictly related to this patch, obviously.

Regards,
Andreas

/* pci-info ROM file. Little endian format */
typedef struct PcRomPciInfo {
    uint64_t w32_min;
    uint64_t w32_max;
    uint64_t w64_min;
    uint64_t w64_max;
} PcRomPciInfo;

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Reply via email to