|
|
383d26 |
From 3483f36dbf965a4ca01c4a2d3bce1132340596d1 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: "plai@redhat.com" <plai@redhat.com>
|
|
|
383d26 |
Date: Fri, 31 Aug 2018 16:25:52 +0200
|
|
|
383d26 |
Subject: [PATCH 10/29] vfio/pci: do not set the PCIDevice 'has_rom' attribute
|
|
|
383d26 |
MIME-Version: 1.0
|
|
|
383d26 |
Content-Type: text/plain; charset=UTF-8
|
|
|
383d26 |
Content-Transfer-Encoding: 8bit
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: plai@redhat.com
|
|
|
383d26 |
Message-id: <1535732759-22481-3-git-send-email-plai@redhat.com>
|
|
|
383d26 |
Patchwork-id: 82004
|
|
|
383d26 |
O-Subject: [RHEL7.6 PATCH BZ 1539280 2/9] vfio/pci: do not set the PCIDevice 'has_rom' attribute
|
|
|
383d26 |
Bugzilla: 1539280
|
|
|
383d26 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
From: Cédric Le Goater <clg@kaod.org>
|
|
|
383d26 |
|
|
|
383d26 |
PCI devices needing a ROM allocate an optional MemoryRegion with
|
|
|
383d26 |
pci_add_option_rom(). pci_del_option_rom() does the cleanup when the
|
|
|
383d26 |
device is destroyed. The only action taken by this routine is to call
|
|
|
383d26 |
vmstate_unregister_ram() which clears the id string of the optional
|
|
|
383d26 |
ROM RAMBlock and now, also flags the RAMBlock as non-migratable. This
|
|
|
383d26 |
was recently added by commit b895de502717 ("migration: discard
|
|
|
383d26 |
non-migratable RAMBlocks"), .
|
|
|
383d26 |
|
|
|
383d26 |
VFIO devices do their own loading of the PCI option ROM in
|
|
|
383d26 |
vfio_pci_size_rom(). The memory region is switched to an I/O region
|
|
|
383d26 |
and the PCI attribute 'has_rom' is set but the RAMBlock of the ROM
|
|
|
383d26 |
region is not allocated. When the associated PCI device is deleted,
|
|
|
383d26 |
pci_del_option_rom() calls vmstate_unregister_ram() which tries to
|
|
|
383d26 |
flag a NULL RAMBlock, leading to a SEGV.
|
|
|
383d26 |
|
|
|
383d26 |
It seems that 'has_rom' was set to have memory_region_destroy()
|
|
|
383d26 |
called, but since commit 469b046ead06 ("memory: remove
|
|
|
383d26 |
memory_region_destroy") this is not necessary anymore as the
|
|
|
383d26 |
MemoryRegion is freed automagically.
|
|
|
383d26 |
|
|
|
383d26 |
Remove the PCIDevice 'has_rom' attribute setting in vfio.
|
|
|
383d26 |
|
|
|
383d26 |
Fixes: b895de502717 ("migration: discard non-migratable RAMBlocks")
|
|
|
383d26 |
Signed-off-by: Cédric Le Goater <clg@kaod.org>
|
|
|
383d26 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
383d26 |
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 26c0ae56386edacc8b0da40264748f59afedb1bb)
|
|
|
383d26 |
Signed-off-by: Paul Lai <plai@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
hw/vfio/pci.c | 1 -
|
|
|
383d26 |
1 file changed, 1 deletion(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
|
|
383d26 |
index 4683eb4..c00b91c 100644
|
|
|
383d26 |
--- a/hw/vfio/pci.c
|
|
|
383d26 |
+++ b/hw/vfio/pci.c
|
|
|
383d26 |
@@ -990,7 +990,6 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
|
|
|
383d26 |
pci_register_bar(&vdev->pdev, PCI_ROM_SLOT,
|
|
|
383d26 |
PCI_BASE_ADDRESS_SPACE_MEMORY, &vdev->pdev.rom);
|
|
|
383d26 |
|
|
|
383d26 |
- vdev->pdev.has_rom = true;
|
|
|
383d26 |
vdev->rom_read_failed = false;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|