diff mbox

[06/13] pc_q35: configure Q35 instance using properties

Message ID 1466169069-29375-7-git-send-email-real@ispras.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Efimov Vasily June 17, 2016, 1:11 p.m. UTC
Currently, Q35 instance is configured using direct access to structure fields.
The patch uses property interface to set the fields.

Signed-off-by: Efimov Vasily <real@ispras.ru>
---
 hw/i386/pc_q35.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Comments

Paolo Bonzini June 17, 2016, 1:20 p.m. UTC | #1
On 17/06/2016 15:11, Efimov Vasily wrote:
> Currently, Q35 instance is configured using direct access to structure fields.
> The patch uses property interface to set the fields.
> 
> Signed-off-by: Efimov Vasily <real@ispras.ru>
> ---
>  hw/i386/pc_q35.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 04aae89..d7dc23a 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -159,12 +159,18 @@ static void pc_q35_init(MachineState *machine)
>      q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
>  
>      object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
> -    q35_host->mch.ram_memory = ram_memory;
> -    q35_host->mch.pci_address_space = pci_memory;
> -    q35_host->mch.system_memory = get_system_memory();
> -    q35_host->mch.address_space_io = system_io;
> -    q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size;
> -    q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size;
> +    object_property_set_link(OBJECT(q35_host), OBJECT(ram_memory),
> +                             MCH_HOST_PROP_RAM_MEM, NULL);
> +    object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory),
> +                             MCH_HOST_PROP_PCI_MEM, NULL);
> +    object_property_set_link(OBJECT(q35_host), OBJECT(get_system_memory()),
> +                             MCH_HOST_PROP_SYSTEM_MEM, NULL);
> +    object_property_set_link(OBJECT(q35_host), OBJECT(system_io),
> +                             MCH_HOST_PROP_IO_MEM, NULL);
> +    object_property_set_int(OBJECT(q35_host), pcms->below_4g_mem_size,
> +                            PCI_HOST_BELOW_4G_MEM_SIZE, NULL);
> +    object_property_set_int(OBJECT(q35_host), pcms->above_4g_mem_size,
> +                            PCI_HOST_ABOVE_4G_MEM_SIZE, NULL);
>      /* pci */
>      qdev_init_nofail(DEVICE(q35_host));
>      phb = PCI_HOST_BRIDGE(q35_host);
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox

Patch

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 04aae89..d7dc23a 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -159,12 +159,18 @@  static void pc_q35_init(MachineState *machine)
     q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
 
     object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
-    q35_host->mch.ram_memory = ram_memory;
-    q35_host->mch.pci_address_space = pci_memory;
-    q35_host->mch.system_memory = get_system_memory();
-    q35_host->mch.address_space_io = system_io;
-    q35_host->mch.below_4g_mem_size = pcms->below_4g_mem_size;
-    q35_host->mch.above_4g_mem_size = pcms->above_4g_mem_size;
+    object_property_set_link(OBJECT(q35_host), OBJECT(ram_memory),
+                             MCH_HOST_PROP_RAM_MEM, NULL);
+    object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory),
+                             MCH_HOST_PROP_PCI_MEM, NULL);
+    object_property_set_link(OBJECT(q35_host), OBJECT(get_system_memory()),
+                             MCH_HOST_PROP_SYSTEM_MEM, NULL);
+    object_property_set_link(OBJECT(q35_host), OBJECT(system_io),
+                             MCH_HOST_PROP_IO_MEM, NULL);
+    object_property_set_int(OBJECT(q35_host), pcms->below_4g_mem_size,
+                            PCI_HOST_BELOW_4G_MEM_SIZE, NULL);
+    object_property_set_int(OBJECT(q35_host), pcms->above_4g_mem_size,
+                            PCI_HOST_ABOVE_4G_MEM_SIZE, NULL);
     /* pci */
     qdev_init_nofail(DEVICE(q35_host));
     phb = PCI_HOST_BRIDGE(q35_host);