qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 10/14] ich9: APIs for pc guest info
Date: Sun, 28 Jul 2013 02:37:59 +0200	[thread overview]
Message-ID: <51F467E7.1010605@suse.de> (raw)
In-Reply-To: <1374681580-17439-11-git-send-email-mst@redhat.com>

Am 24.07.2013 18:02, schrieb Michael S. Tsirkin:
> This adds APIs that will be used to fill in
> guest info table, implemented using QOM,
> to various ich9 components.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/acpi/ich9.c            |  6 ++++++
>  hw/isa/lpc_ich9.c         | 19 +++++++++++++++++++
>  hw/pci-host/q35.c         | 10 ++++++++++
>  include/hw/acpi/ich9.h    |  2 ++
>  include/hw/i386/ich9.h    |  3 +++
>  include/hw/pci-host/q35.h |  2 ++
>  6 files changed, 42 insertions(+)
> 
> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
> index 3fb443d..7ea55e1 100644
> --- a/hw/acpi/ich9.c
> +++ b/hw/acpi/ich9.c
> @@ -228,3 +228,9 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
>      pm->powerdown_notifier.notify = pm_powerdown_req;
>      qemu_register_powerdown_notifier(&pm->powerdown_notifier);
>  }
> +
> +void ich9_pm_get_acpi_pm_info(ICH9LPCPMRegs *pm, AcpiPmInfo *info)
> +{
> +    info->gpe0_blk = PC_GUEST_PORT_ACPI_PM_BASE + ICH9_PMIO_GPE0_STS;
> +    info->gpe0_blk_len = ICH9_PMIO_GPE0_LEN;
> +}
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index d1921aa..12d4a23 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -562,6 +562,25 @@ static bool ich9_rst_cnt_needed(void *opaque)
>      return (lpc->rst_cnt != 0);
>  }
>  
> +ICH9LPCState *ich9_lpc_find(void)
> +{
> +    bool ambig;
> +    Object *o = object_resolve_path_type("", TYPE_ICH9_LPC_DEVICE, &ambig);
> +
> +    if (ambig) {
> +        return NULL;
> +    }
> +    return ICH9_LPC_DEVICE(o);
> +}
> +
> +void ich9_lpc_get_acpi_pm_info(ICH9LPCState *lpc, AcpiPmInfo *info)
> +{
> +    info->sci_int = 9;

Magic value.

> +    info->acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
> +    info->acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
> +    ich9_pm_get_acpi_pm_info(&lpc->pm, info);
> +}
> +
>  static const VMStateDescription vmstate_ich9_rst_cnt = {
>      .name = "ICH9LPC/rst_cnt",
>      .version_id = 1,
> diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
> index 6b1b3b7..ca6f495 100644
> --- a/hw/pci-host/q35.c
> +++ b/hw/pci-host/q35.c
> @@ -298,6 +298,16 @@ static int mch_init(PCIDevice *d)
>      return 0;
>  }
>  
> +uint64_t mch_mcfg_base(void)
> +{
> +    bool ambiguous;
> +    Object *o = object_resolve_path_type("", TYPE_MCH_PCI_DEVICE, &ambiguous);

If you take the minute to add in q35 machine init
object_property_add_child(qdev_get_machine(), "q35", foo, NULL);
then not only can you use object_resolve_path("/machine/q35/mch") to
access it but everyone including qtest can.

> +    if (!o) {
> +        return 0;
> +    }
> +    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;

Another value constant for the device. Taking a wild guess: Is this an
offset of a memory subregion where long-term Anthony's proposed
MemoryRegion QOM'ification would allow us to get rid of this helper?

Anyway, I would like it much better as:

uint64_t mch_mcfg_base()
{
    return MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT;
}

with the path resolution stuff, i.e. check for necessity, happening in
ACPI code, if we don't get around these helpers for now.

Andreas

> +}
> +
>  static void mch_class_init(ObjectClass *klass, void *data)
>  {
>      PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
> index b1fe71f..f5e8a88 100644
> --- a/include/hw/acpi/ich9.h
> +++ b/include/hw/acpi/ich9.h
> @@ -49,4 +49,6 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
>  void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
>  extern const VMStateDescription vmstate_ich9_pm;
>  
> +void ich9_pm_get_acpi_pm_info(ICH9LPCPMRegs *, AcpiPmInfo *);
> +
>  #endif /* HW_ACPI_ICH9_H */
> diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
> index c5f637b..6528dc0 100644
> --- a/include/hw/i386/ich9.h
> +++ b/include/hw/i386/ich9.h
> @@ -66,6 +66,9 @@ typedef struct ICH9LPCState {
>      qemu_irq *ioapic;
>  } ICH9LPCState;
>  
> +ICH9LPCState *ich9_lpc_find(void);
> +void ich9_lpc_get_acpi_pm_info(ICH9LPCState *, AcpiPmInfo *);
> +
>  #define Q35_MASK(bit, ms_bit, ls_bit) \
>  ((uint##bit##_t)(((1ULL << ((ms_bit) + 1)) - 1) & ~((1ULL << ls_bit) - 1)))
>  
> diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
> index 3cb631e..6337dcf 100644
> --- a/include/hw/pci-host/q35.h
> +++ b/include/hw/pci-host/q35.h
> @@ -154,4 +154,6 @@ typedef struct Q35PCIHost {
>  #define MCH_PCIE_DEV                           1
>  #define MCH_PCIE_FUNC                          0
>  
> +uint64_t mch_mcfg_base(void);
> +
>  #endif /* HW_Q35_H */
> 


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

  parent reply	other threads:[~2013-07-28  0:38 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 16:01 [Qemu-devel] [PATCH v3 00/14] qemu: generate acpi tables for the guest Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 01/14] hw/i386/pc.c: move IO_APIC_DEFAULT_ADDRESS to include/hw/i386/apic.h Michael S. Tsirkin
2013-07-25 12:05   ` Gerd Hoffmann
2013-07-28  0:44   ` Andreas Färber
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 02/14] i386: add ACPI table files from seabios Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 03/14] acpi: add rules to compile ASL source Michael S. Tsirkin
2013-07-25 12:09   ` Gerd Hoffmann
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 04/14] acpi: pre-compiled ASL files Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 05/14] loader: use file path size from fw_cfg.h Michael S. Tsirkin
2013-07-24 23:42   ` Andreas Färber
2013-07-25 12:10   ` Gerd Hoffmann
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 06/14] i386: add bios linker/loader Michael S. Tsirkin
2013-07-25 12:11   ` Gerd Hoffmann
2013-07-26  9:42   ` Gerd Hoffmann
2013-07-28  8:08     ` Michael S. Tsirkin
2013-07-24 16:01 ` [Qemu-devel] [PATCH v3 07/14] loader: support for unmapped ROM blobs Michael S. Tsirkin
2013-07-25 12:14   ` Gerd Hoffmann
2013-07-25 12:28     ` Michael S. Tsirkin
2013-07-25 12:43       ` Gerd Hoffmann
2013-07-25 13:03         ` Michael S. Tsirkin
2013-07-25 19:57         ` Michael S. Tsirkin
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 08/14] loader: allow adding ROMs in done callbacks Michael S. Tsirkin
2013-07-25 12:15   ` Gerd Hoffmann
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 09/14] i386: define pc guest info Michael S. Tsirkin
2013-07-25 12:31   ` Gerd Hoffmann
2013-07-28  0:41   ` Andreas Färber
2013-07-28  7:36     ` Michael S. Tsirkin
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 10/14] ich9: APIs for " Michael S. Tsirkin
2013-07-25 12:33   ` Gerd Hoffmann
2013-07-28  0:37   ` Andreas Färber [this message]
2013-07-28  7:35     ` Michael S. Tsirkin
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 11/14] piix: " Michael S. Tsirkin
2013-07-25  9:32   ` Michael S. Tsirkin
2013-07-28  0:12     ` Andreas Färber
2013-07-28  7:30       ` Michael S. Tsirkin
2013-07-28  9:38         ` Andreas Färber
2013-07-28 10:14           ` Michael S. Tsirkin
2013-07-28 10:31             ` Andreas Färber
2013-07-28 11:08               ` Andreas Färber
2013-07-28 12:19                 ` Michael S. Tsirkin
2013-07-25 12:34   ` Gerd Hoffmann
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 12/14] pvpanic: add API to access io port Michael S. Tsirkin
2013-07-25 10:29   ` Gerd Hoffmann
2013-07-25 10:55     ` Michael S. Tsirkin
2013-07-25 10:58       ` Michael S. Tsirkin
2013-07-25 11:05       ` Gerd Hoffmann
2013-07-25 11:22         ` Michael S. Tsirkin
2013-07-25 12:03           ` Gerd Hoffmann
2013-07-25 12:23             ` Michael S. Tsirkin
2013-07-27 23:58               ` Andreas Färber
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 13/14] hpet: add API to find it Michael S. Tsirkin
2013-07-25 12:36   ` Gerd Hoffmann
2013-07-27 23:38   ` Andreas Färber
2013-07-24 16:02 ` [Qemu-devel] [PATCH v3 14/14] i386: ACPI table generation code from seabios Michael S. Tsirkin
2013-07-25 13:06   ` Gerd Hoffmann
2013-07-25 13:23     ` Michael S. Tsirkin
2013-07-25 14:58       ` Gerd Hoffmann
2013-07-25 15:14         ` Michael S. Tsirkin
2013-07-26  9:06           ` Gerd Hoffmann
2013-07-26 15:30             ` Gerd Hoffmann
2013-07-28  7:00               ` Michael S. Tsirkin
2013-07-25 15:50 ` [Qemu-devel] [PATCH v3 00/14] qemu: generate acpi tables for the guest Andreas Färber
2013-07-25 16:19   ` Michael S. Tsirkin
2013-07-26 12:19     ` Andreas Färber
2013-07-27 23:22       ` Andreas Färber
2013-09-11  9:57         ` Michael S. Tsirkin
2013-07-25 17:18   ` Michael S. Tsirkin
2013-07-26 12:25     ` Andreas Färber
2013-07-29 15:27 ` Anthony Liguori

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=51F467E7.1010605@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=kraxel@redhat.com \
    --cc=mst@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).