qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Efimov Vasily <real@ispras.ru>, qemu-devel@nongnu.org
Cc: John Snow <jsnow@redhat.com>,
	qemu-block@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Kirill Batuzov <batuzovk@ispras.ru>
Subject: Re: [Qemu-devel] [PATCH 05/13] Q35: implement property interfece to several parameters
Date: Fri, 17 Jun 2016 15:20:38 +0200	[thread overview]
Message-ID: <53d7755b-ab44-9460-b7ba-cfd38ba406d1@redhat.com> (raw)
In-Reply-To: <1466169069-29375-6-git-send-email-real@ispras.ru>



On 17/06/2016 15:11, Efimov Vasily wrote:
> During creation of Q35 instance several parameters are set using direct access.
> It violates Qemu device model. Correctly, the parameters should be handled as
> object properties.
> 
> The patch adds four link type properties for fields:
> mch.ram_memory
> mch.pci_address_space
> mch.system_memory
> mch.address_space_io
> And, it adds two size type properties for fields:
> mch.below_4g_mem_size
> mch.above_4g_mem_size
> 
> Signed-off-by: Efimov Vasily <real@ispras.ru>
> ---
>  hw/pci-host/q35.c         | 20 ++++++++++++++++++++
>  include/hw/i386/pc.h      |  2 ++
>  include/hw/pci-host/q35.h |  5 +++++
>  3 files changed, 27 insertions(+)
> 
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 70f897e..ab337b8 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -127,6 +127,10 @@ static Property mch_props[] = {
>      DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, Q35PCIHost,
>                       mch.pci_hole64_size, DEFAULT_PCI_HOLE64_SIZE),
>      DEFINE_PROP_UINT32("short_root_bus", Q35PCIHost, mch.short_root_bus, 0),
> +    DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MEM_SIZE, Q35PCIHost,
> +                     mch.below_4g_mem_size, 0),
> +    DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, Q35PCIHost,
> +                     mch.above_4g_mem_size, 0),
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  
> @@ -177,6 +181,22 @@ static void q35_host_initfn(Object *obj)
>                          q35_host_get_mmcfg_size,
>                          NULL, NULL, NULL, NULL);
>  
> +    object_property_add_link(obj, MCH_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGION,
> +            (Object **) &s->mch.ram_memory, object_property_allow_set_link,
> +            0, NULL);
> +
> +    object_property_add_link(obj, MCH_HOST_PROP_PCI_MEM, TYPE_MEMORY_REGION,
> +            (Object **) &s->mch.pci_address_space,
> +            object_property_allow_set_link, 0, NULL);
> +
> +    object_property_add_link(obj, MCH_HOST_PROP_SYSTEM_MEM, TYPE_MEMORY_REGION,
> +            (Object **) &s->mch.system_memory, object_property_allow_set_link,
> +            0, NULL);
> +
> +    object_property_add_link(obj, MCH_HOST_PROP_IO_MEM, TYPE_MEMORY_REGION,
> +            (Object **) &s->mch.address_space_io,
> +            object_property_allow_set_link, 0, NULL);

This should use qdev_prop_allow_set_link_before_realize.

Paolo

>      /* Leave enough space for the biggest MCFG BAR */
>      /* TODO: this matches current bios behaviour, but
>       * it's not a power of two, which means an MTRR
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index aab3a53..5193ae9 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -238,6 +238,8 @@ void pc_guest_info_init(PCMachineState *pcms);
>  #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
>  #define PCI_HOST_PROP_PCI_HOLE64_END   "pci-hole64-end"
>  #define PCI_HOST_PROP_PCI_HOLE64_SIZE  "pci-hole64-size"
> +#define PCI_HOST_BELOW_4G_MEM_SIZE     "below-4g-mem-size"
> +#define PCI_HOST_ABOVE_4G_MEM_SIZE     "above-4g-mem-size"
>  #define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
>  
>  
> diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
> index c5c073d..8b4bde3 100644
> --- a/include/hw/pci-host/q35.h
> +++ b/include/hw/pci-host/q35.h
> @@ -78,6 +78,11 @@ typedef struct Q35PCIHost {
>   * gmch part
>   */
>  
> +#define MCH_HOST_PROP_RAM_MEM "ram-mem"
> +#define MCH_HOST_PROP_PCI_MEM "pci-mem"
> +#define MCH_HOST_PROP_SYSTEM_MEM "system-mem"
> +#define MCH_HOST_PROP_IO_MEM "io-mem"
> +
>  /* PCI configuration */
>  #define MCH_HOST_BRIDGE                        "MCH"
>  
> 

  reply	other threads:[~2016-06-17 13:20 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 13:10 [Qemu-devel] [PATCH 00/13] Make Q35 devices closer to Qemu object model Efimov Vasily
2016-06-17 13:10 ` [Qemu-devel] [PATCH 01/13] ide: move headers to include folder Efimov Vasily
2016-06-17 13:18   ` Paolo Bonzini
2016-06-17 13:10 ` [Qemu-devel] [PATCH 02/13] pcspk: convert "pit" property type from ptr to link Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:20   ` Paolo Bonzini
2016-06-17 13:10 ` [Qemu-devel] [PATCH 03/13] vmport: identify vmport type by macro TYPE_VMPORT Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 04/13] pflash: make TYPE_CFI_PFLASH0{1, 2} macros public Efimov Vasily
2016-06-17 13:19   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 05/13] Q35: implement property interfece to several parameters Efimov Vasily
2016-06-17 13:20   ` Paolo Bonzini [this message]
2016-06-17 13:11 ` [Qemu-devel] [PATCH 06/13] pc_q35: configure Q35 instance using properties Efimov Vasily
2016-06-17 13:20   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 07/13] pckbd: handle A20 IRQ as GPIO Efimov Vasily
2016-06-17 13:23   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 08/13] port92: " Efimov Vasily
2016-06-17 13:24   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 09/13] ICH9 SMB: make TYPE_ICH9_SMB_DEVICE macro public Efimov Vasily
2016-06-17 13:25   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 10/13] ICH9 LPC: handle PIC and I/O APIC IRQs as qdev GPIO Efimov Vasily
2016-06-17 13:26   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 11/13] ICH9 LPC: move call of isa_bus_irqs to 'realize' method Efimov Vasily
2016-06-17 14:03   ` Paolo Bonzini
2016-06-20 14:40     ` Paolo Bonzini
2016-06-21 13:46       ` Ефимов Василий
2016-06-21 17:08         ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 12/13] MC146818 RTC: add GPIO access to output IRQ Efimov Vasily
2016-06-17 14:08   ` Paolo Bonzini
2016-06-17 13:11 ` [Qemu-devel] [PATCH 13/13] ICH9 LPC: configure PCI IRQs routing internally Efimov Vasily
2016-06-17 14:11   ` Paolo Bonzini

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=53d7755b-ab44-9460-b7ba-cfd38ba406d1@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=batuzovk@ispras.ru \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=real@ispras.ru \
    --cc=rth@twiddle.net \
    /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).