All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: qemu-devel@nongnu.org, seabios@seabios.org
Cc: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Subject: [Qemu-devel] [PATCH v5 7/7] pci: Use paravirt interface for pcimem_start and pcimem64_start
Date: Wed, 26 Jun 2013 17:15:05 +0800	[thread overview]
Message-ID: <1813216d1e7ce7f7c88aa321a64861a1a65bf895.1372237449.git.hutao@cn.fujitsu.com> (raw)
In-Reply-To: <cover.1372237449.git.hutao@cn.fujitsu.com>

From: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>

Initialize the 32-bit and 64-bit pci starting offsets from values passed in by
the qemu paravirt interface QEMU_CFG_PCI_WINDOW. Qemu calculates the starting
offsets based on initial memory and hotplug-able dimms.
It's possible to avoid the new paravirt interface, and calculate pci ranges from
srat entries. But the code changes are ugly, see:
http://lists.gnu.org/archive/html/qemu-devel/2012-09/msg03548.html

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
---
 src/paravirt.c | 7 +++++++
 src/paravirt.h | 1 +
 src/pciinit.c  | 9 +++++++++
 3 files changed, 17 insertions(+)

diff --git a/src/paravirt.c b/src/paravirt.c
index 5925c63..9c1e511 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -134,6 +134,7 @@ qemu_platform_setup(void)
 #define QEMU_CFG_BOOT_MENU              0x0e
 #define QEMU_CFG_MAX_CPUS               0x0f
 #define QEMU_CFG_FILE_DIR               0x19
+#define QEMU_CFG_PCI_WINDOW             0x1a
 #define QEMU_CFG_ARCH_LOCAL             0x8000
 #define QEMU_CFG_ACPI_TABLES            (QEMU_CFG_ARCH_LOCAL + 0)
 #define QEMU_CFG_SMBIOS_ENTRIES         (QEMU_CFG_ARCH_LOCAL + 1)
@@ -339,3 +340,9 @@ void qemu_cfg_init(void)
                          , 0, be32_to_cpu(qfile.size));
     }
 }
+
+void qemu_cfg_get_pci_offsets(u64 *pcimem_start, u64 *pcimem64_start)
+{
+    qemu_cfg_read_entry(pcimem_start, QEMU_CFG_PCI_WINDOW, sizeof(u64));
+    qemu_cfg_read((u8*)(pcimem64_start), sizeof(u64));
+}
diff --git a/src/paravirt.h b/src/paravirt.h
index fce5af9..2c37d0d 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -27,5 +27,6 @@ static inline int runningOnKVM(void) {
 void qemu_preinit(void);
 void qemu_platform_setup(void);
 void qemu_cfg_init(void);
+void qemu_cfg_get_pci_offsets(u64 *pcimem_start, u64 *pcimem64_start);
 
 #endif
diff --git a/src/pciinit.c b/src/pciinit.c
index 8370b96..7e63c5e 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -805,6 +805,7 @@ static void pci_bios_map_devices(struct pci_bus *busses)
 void
 pci_setup(void)
 {
+    u64 pv_pcimem_start, pv_pcimem64_start;
     if (!CONFIG_QEMU)
         return;
 
@@ -837,6 +838,14 @@ pci_setup(void)
 
     pci_bios_init_devices();
 
+    /* if qemu gives us other pci window values, it means there are hotplug-able
+     * dimms. Adjust accordingly */
+    qemu_cfg_get_pci_offsets(&pv_pcimem_start, &pv_pcimem64_start);
+    if (pv_pcimem_start > pcimem_start)
+        pcimem_start = pv_pcimem_start;
+    if (pv_pcimem64_start > pcimem64_start)
+        pcimem64_start = pv_pcimem64_start;
+
     free(busses);
 
     pci_enable_default_vga();
-- 
1.8.3.1

  parent reply	other threads:[~2013-06-26  9:16 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26  9:13 [Qemu-devel] [PATCH v5 00/14] ACPI memory hotplug Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 01/14] qapi: make visit_type_size fallback to v->type_int() Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 02/14] Add SIZE type to qdev properties Hu Tao
2013-07-08  9:37   ` Andreas Färber
2013-07-12  1:27     ` Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 03/14] qemu-option: export parse_option_number Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 04/14] Implement dimm device abstraction Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 05/14] vl: handle "-device dimm" Hu Tao
2013-06-26  9:46   ` Paolo Bonzini
2013-06-27  5:08     ` Wanlong Gao
2013-06-27  6:55       ` Paolo Bonzini
2013-07-09 16:53         ` Igor Mammedov
2013-07-12  2:39           ` Hu Tao
2013-07-14 16:58             ` Paolo Bonzini
2013-07-16  1:26               ` Hu Tao
2013-07-15 17:05         ` Vasilis Liaskovitis
2013-07-15 17:10           ` Paolo Bonzini
2013-07-15 17:20             ` Vasilis Liaskovitis
2013-07-16  1:27             ` Hu Tao
2013-07-16  6:19               ` Paolo Bonzini
2013-07-16  7:27                 ` Hu Tao
2013-07-16 10:22                   ` Igor Mammedov
2013-07-16 10:19                 ` Igor Mammedov
2013-07-16 10:31                   ` Paolo Bonzini
2013-07-16 12:00                     ` Igor Mammedov
2013-07-16 12:17                       ` Paolo Bonzini
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 06/14] acpi_piix4 : Implement memory device hotplug registers Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 07/14] acpi_ich9 " Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 08/14] memory: record below_4g_mem_size, above_4g_mem_size Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 09/14] memory controller: initialize dram controller Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 10/14] pc: Add dimm paravirt SRAT info Hu Tao
2013-07-10 10:10   ` Michael S. Tsirkin
2013-07-11  5:13     ` Igor Mammedov
2013-07-11  8:49       ` Michael S. Tsirkin
2013-07-12  1:33         ` Hu Tao
2013-07-14  5:47           ` Michael S. Tsirkin
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 11/14] Introduce paravirt interface QEMU_CFG_PCI_WINDOW Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 12/14] Implement "info memory" and "query-memory" Hu Tao
2013-06-28 20:27   ` Eric Blake
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 13/14] balloon: update with hotplugged memory Hu Tao
2013-06-26  9:13 ` [Qemu-devel] [PATCH v5 14/14] Implement dimm-info Hu Tao
2013-06-28 20:28   ` Eric Blake
2013-06-26  9:14 ` [Qemu-devel] [PATCH v5 0/7] support for ACPI memory hotplug Hu Tao
2013-06-26  9:14   ` [Qemu-devel] [PATCH v5 1/7] Add ACPI_EXTRACT_DEVICE* macros Hu Tao
2013-06-26  9:15   ` [Qemu-devel] [PATCH v5 2/7] Add SSDT memory device support Hu Tao
2013-06-26  9:15   ` [Qemu-devel] [PATCH v5 3/7] acpi-dsdt: Implement functions for memory hotplug Hu Tao
2013-06-26  9:15   ` [Qemu-devel] [PATCH v5 4/7] set psize to 0 when romfile_loadfile failed Hu Tao
2013-06-26  9:15   ` [Qemu-devel] [PATCH v5 5/7] acpi: generate hotplug memory devices Hu Tao
2013-07-12 10:07     ` Igor Mammedov
2013-06-26  9:15   ` [Qemu-devel] [PATCH v5 6/7] q35: Add memory hotplug handler Hu Tao
2013-06-26  9:15   ` Hu Tao [this message]
2013-07-15 20:11     ` [Qemu-devel] [PATCH v5 7/7] pci: Use paravirt interface for pcimem_start and pcimem64_start Vasilis Liaskovitis
2013-07-07  8:36   ` [Qemu-devel] [PATCH v5 0/7] support for ACPI memory hotplug Michael S. Tsirkin
2013-07-08  9:48 ` [Qemu-devel] [PATCH v5 00/14] " Andreas Färber
2013-07-12  1:30   ` Hu Tao
2013-07-14 16:56   ` 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=1813216d1e7ce7f7c88aa321a64861a1a65bf895.1372237449.git.hutao@cn.fujitsu.com \
    --to=hutao@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=seabios@seabios.org \
    --cc=vasilis.liaskovitis@profitbricks.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.