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: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 09/14] i386: define pc guest info
Date: Sun, 28 Jul 2013 02:41:51 +0200	[thread overview]
Message-ID: <51F468CF.3020201@suse.de> (raw)
In-Reply-To: <1374681580-17439-10-git-send-email-mst@redhat.com>

Am 24.07.2013 18:02, schrieb Michael S. Tsirkin:
> This defines a structure that will be used to fill in guest info table.
> This structure will be filled in in follow-up patches, using QOM.  Fill
> in NUMA node info is not available in QOM so it is filled in directly.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  hw/i386/pc.c            | 33 +++++++++++++++++++++++++++++++++
>  include/hw/i386/pc.h    | 31 +++++++++++++++++++++++++++++++
>  include/qemu/typedefs.h |  1 +
>  3 files changed, 65 insertions(+)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index b0b98a8..b9b8f92 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1017,6 +1017,27 @@ static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info)
>      fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info);
>  }
>  
> +static void pc_set_cpu_guest_info(CPUState *cpu, void *arg)
> +{
> +    PcGuestInfo *guest_info = arg;
> +    CPUClass *klass = CPU_GET_CLASS(cpu);
> +    uint64_t apic_id = klass->get_arch_id(cpu);

Please use "cc" to avoid the dreaded "klass".

> +    int j;
> +
> +    assert(apic_id <= MAX_CPUMASK_BITS);
> +    assert(apic_id < guest_info->apic_id_limit);
> +
> +    set_bit(apic_id, guest_info->found_cpus);
> +
> +    for (j = 0; j < guest_info->numa_nodes; j++) {
> +        assert(cpu->cpu_index < max_cpus);
> +        if (test_bit(cpu->cpu_index, node_cpumask[j])) {
> +            guest_info->node_cpu[apic_id] = cpu_to_le64(j);
> +            break;
> +        }
> +    }
> +}
> +
>  typedef struct PcGuestInfoState {
>      PcGuestInfo info;
>      Notifier machine_done;
> @@ -1037,6 +1058,18 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
>      PcGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state);
>      PcGuestInfo *guest_info = &guest_info_state->info;
>  
> +    guest_info->ram_size = below_4g_mem_size + above_4g_mem_size;
> +    guest_info->apic_id_limit = pc_apic_id_limit(max_cpus);
> +    guest_info->apic_xrupt_override = kvm_allows_irq0_override();
> +    guest_info->numa_nodes = nb_numa_nodes;
> +    guest_info->node_mem = g_memdup(node_mem, guest_info->numa_nodes *
> +                                    sizeof *guest_info->node_mem);
> +    guest_info->node_cpu = g_malloc0(guest_info->apic_id_limit *
> +                                     sizeof *guest_info->node_cpu);
> +
> +    memset(&guest_info->found_cpus, 0, sizeof guest_info->found_cpus);
> +    qemu_for_each_cpu(pc_set_cpu_guest_info, guest_info);
> +
>      guest_info->pci_info.w32.end = IO_APIC_DEFAULT_ADDRESS;
>      if (sizeof(hwaddr) == 4) {
>          guest_info->pci_info.w64.begin = 0;
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 7fb97b0..7c0bd50 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -9,6 +9,9 @@
>  #include "hw/i386/ioapic.h"
>  
>  #include "qemu/range.h"
> +#include "qemu/bitmap.h"
> +#include "sysemu/sysemu.h"
> +#include "hw/pci/pci.h"
>  
>  /* PC-style peripherals (also used by other machines).  */
>  
> @@ -17,9 +20,37 @@ typedef struct PcPciInfo {
>      Range w64;
>  } PcPciInfo;
>  
> +/* Matches the value hard-coded in BIOS */
> +#define PC_GUEST_PORT_ACPI_PM_BASE      0xb000
> +
> +struct AcpiPmInfo {
> +    bool s3_disabled;
> +    bool s4_disabled;
> +    uint8_t s4_val;
> +    uint16_t sci_int;
> +    uint8_t acpi_enable_cmd;
> +    uint8_t acpi_disable_cmd;
> +    uint32_t gpe0_blk;
> +    uint32_t gpe0_blk_len;
> +};
> +
>  struct PcGuestInfo {
>      PcPciInfo pci_info;

These capitalizations look weird. Can't we use at least PM rather than Pm?

Andreas

>      bool has_pci_info;
> +    hwaddr ram_size;
> +    unsigned apic_id_limit;
> +    bool apic_xrupt_override;
> +    bool has_hpet;
> +    uint64_t numa_nodes;
> +    uint64_t *node_mem;
> +    uint64_t *node_cpu;
> +    DECLARE_BITMAP(found_cpus, MAX_CPUMASK_BITS + 1);
> +    DECLARE_BITMAP(slot_hotplug_enable, PCI_SLOT_MAX);
> +    AcpiPmInfo pm;
> +    uint64_t mcfg_base;
> +    const unsigned char *dsdt_code;
> +    unsigned dsdt_size;
> +    uint16_t pvpanic_port;
>      FWCfgState *fw_cfg;
>  };
>  
> diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
> index ac9f8d4..cb66e19 100644
> --- a/include/qemu/typedefs.h
> +++ b/include/qemu/typedefs.h
> @@ -65,5 +65,6 @@ typedef struct QEMUSGList QEMUSGList;
>  typedef struct SHPCDevice SHPCDevice;
>  typedef struct FWCfgState FWCfgState;
>  typedef struct PcGuestInfo PcGuestInfo;
> +typedef struct AcpiPmInfo AcpiPmInfo;
>  
>  #endif /* QEMU_TYPEDEFS_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:42 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 [this message]
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
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=51F468CF.3020201@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --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).