From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Igor Mammedov <imammedo@redhat.com>,
Peng Hao <peng.hao2@zte.com.cn>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PULL 09/10] pc: make 'pc.rom' readonly when machine has PCI enabled
Date: Wed, 2 Aug 2017 00:37:58 +0300 [thread overview]
Message-ID: <1501623438-31419-10-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1501623438-31419-1-git-send-email-mst@redhat.com>
From: Igor Mammedov <imammedo@redhat.com>
looking at bios ROM mapping in QEMU it seems that only isapc
(i.e. not PCI enabled machine) requires ROM being mapped as
RW in other cases BIOS is mapped as RO. Do the same for option
ROM 'pc.rom' when machine has PCI enabled.
As useful side-effect pc.rom MemoryRegion stops being
put in vhost memory map (filtered out by vhost_section()),
which reduces number of entries by 1.
Coincidentally it fixes migration failure reported in
"[PATCH V2] vhost: fix a migration failed because of vhost region merge"
where following destination CLI with /sys/module/vhost/parameters/max_mem_regions = 8
export DIMMSCOUNT=6
QEMU -enable-kvm \
-netdev type=tap,id=guest0,vhost=on,script=no,vhostforce \
-device virtio-net-pci,netdev=guest0 \
-m 256,slots=256,maxmem=2G \
`i=0; while [ $i -lt $DIMMSCOUNT ]; do echo \
"-object memory-backend-ram,id=m$i,size=128M \
-device pc-dimm,id=d$i,memdev=m$i"; i=$(($i + 1)); \
done`
will fail to startup with error:
"-device pc-dimm,id=d5,memdev=m5: a used vhost backend has no free memory slots left"
while it's possible to add the 6th DIMM during hotplug
on source.
Issue is caused by the fact that number of entries in vhost map
is bigger on 1 entry, when -device is processed, than
after guest boots up, and that offending entry belongs to
'pc.rom', it's not like vhost intends to do IO in ROM range
so making it RO hides region from vhost and makes number
of entries in vhost memory map at -device/machine_done time
match number of entries after guest boots.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reported-by: Peng Hao <peng.hao2@zte.com.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/pc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 22e1603..5943539 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1443,6 +1443,9 @@ void pc_memory_init(PCMachineState *pcms,
option_rom_mr = g_malloc(sizeof(*option_rom_mr));
memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
&error_fatal);
+ if (pcmc->pci_enabled) {
+ memory_region_set_readonly(option_rom_mr, true);
+ }
memory_region_add_subregion_overlap(rom_memory,
PC_ROM_MIN_VGA,
option_rom_mr,
--
MST
next prev parent reply other threads:[~2017-08-01 21:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 21:37 [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1 Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 01/10] tests: switch pxe and vm gen id tests to use kvm Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 02/10] vhost: fix a memory leak Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 03/10] vhost-user: fix legacy cross-endian configurations Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 04/10] intel_iommu: fix iova for pt Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 05/10] intel_iommu: use access_flags for iotlb Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 06/10] accel: cleanup error output Michael S. Tsirkin
2017-08-01 21:42 ` Eric Blake
2017-08-01 21:37 ` [Qemu-devel] [PULL 07/10] tests/bios-tables-test: Compiler warning fix Michael S. Tsirkin
2017-08-01 21:37 ` [Qemu-devel] [PULL 08/10] vhost-user: fix watcher need be removed when vhost-user hotplug Michael S. Tsirkin
2017-08-01 21:37 ` Michael S. Tsirkin [this message]
2017-08-01 21:37 ` [Qemu-devel] [PULL 10/10] pc: acpi: force FADT rev1 for 440fx based machine types Michael S. Tsirkin
2017-08-02 10:09 ` [Qemu-devel] [PULL 00/10] pc, acpi, virtio: fixes, test speedup for rc1 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=1501623438-31419-10-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peng.hao2@zte.com.cn \
--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).