qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Richard Henderson <rth@twiddle.net>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL 5/7] pc: memhotplug: fix incorrectly set reserved-memory-end
Date: Thu, 10 Sep 2015 12:17:57 +0300	[thread overview]
Message-ID: <1441876643-7467-6-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1441876643-7467-1-git-send-email-mst@redhat.com>

From: Igor Mammedov <imammedo@redhat.com>

reserved-memory-end tells firmware address from which
it could start treating memory as PCI address space
and map PCI BARs after it to avoid collisions with
RAM.
Currently it is incorrectly pointing to address where
hotplugged memory range starts which could redirect
hotplugged RAM accesses to PCI BARs when firmware
maps them over RAM or viceverse.
Fix this by pointing reserved-memory-end to the end
of memory hotplug area.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 9f2924e..354e1b3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1412,7 +1412,9 @@ FWCfgState *pc_memory_init(PCMachineState *pcms,
 
     if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) {
         uint64_t *val = g_malloc(sizeof(*val));
-        *val = cpu_to_le64(ROUND_UP(pcms->hotplug_memory.base, 0x1ULL << 30));
+        uint64_t res_mem_end = pcms->hotplug_memory.base +
+                               memory_region_size(&pcms->hotplug_memory.mr);
+        *val = cpu_to_le64(ROUND_UP(res_mem_end, 0x1ULL << 30));
         fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val));
     }
 
-- 
MST

  parent reply	other threads:[~2015-09-10  9:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10  9:17 [Qemu-devel] [PULL 0/7] virtio,pc,acpi fixes, cleanups Michael S. Tsirkin
2015-09-10  9:17 ` [Qemu-devel] [PULL 1/7] pci: Fix pci_device_iommu_address_space() bus propagation Michael S. Tsirkin
2015-09-10  9:17 ` [Qemu-devel] [PULL 2/7] pc: Remove redundant arguments from xen_hvm_init() Michael S. Tsirkin
2015-09-10  9:17 ` [Qemu-devel] [PULL 3/7] virtio: avoid leading underscores for helpers Michael S. Tsirkin
2015-09-10  9:17 ` [Qemu-devel] [PULL 4/7] acpi: Remove unused definition Michael S. Tsirkin
2015-09-10  9:17 ` Michael S. Tsirkin [this message]
2015-09-10  9:18 ` [Qemu-devel] [PULL 6/7] pc: memhotplug: keep reserved-memory-end broken on 2.4 and earlier machines Michael S. Tsirkin
2015-09-10  9:18 ` [Qemu-devel] [PULL 7/7] hw/pci: fix pci_update_mappings() trace events Michael S. Tsirkin
2015-09-10  9:45   ` Laszlo Ersek
2015-09-10  9:54     ` Michael S. Tsirkin
2015-09-10 10:29       ` Laszlo Ersek
2015-09-10 12:55 ` [Qemu-devel] [PULL 0/7] virtio,pc,acpi fixes, cleanups Peter Maydell

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=1441876643-7467-6-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --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).