[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 26c0ae: vfio/pci: do not set the PCIDevice 'h

From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 26c0ae: vfio/pci: do not set the PCIDevice 'has_rom' attri...
Date: Thu, 12 Jul 2018 03:54:57 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 26c0ae56386edacc8b0da40264748f59afedb1bb
  Author: Cédric Le Goater <address@hidden>
  Date:   2018-07-11 (Wed, 11 Jul 2018)

  Changed paths:
    M hw/vfio/pci.c

  Log Message:
  vfio/pci: do not set the PCIDevice 'has_rom' attribute

PCI devices needing a ROM allocate an optional MemoryRegion with
pci_add_option_rom(). pci_del_option_rom() does the cleanup when the
device is destroyed. The only action taken by this routine is to call
vmstate_unregister_ram() which clears the id string of the optional
ROM RAMBlock and now, also flags the RAMBlock as non-migratable. This
was recently added by commit b895de502717 ("migration: discard
non-migratable RAMBlocks"), .

VFIO devices do their own loading of the PCI option ROM in
vfio_pci_size_rom(). The memory region is switched to an I/O region
and the PCI attribute 'has_rom' is set but the RAMBlock of the ROM
region is not allocated. When the associated PCI device is deleted,
pci_del_option_rom() calls vmstate_unregister_ram() which tries to
flag a NULL RAMBlock, leading to a SEGV.

It seems that 'has_rom' was set to have memory_region_destroy()
called, but since commit 469b046ead06 ("memory: remove
memory_region_destroy") this is not necessary anymore as the
MemoryRegion is freed automagically.

Remove the PCIDevice 'has_rom' attribute setting in vfio.

Fixes: b895de502717 ("migration: discard non-migratable RAMBlocks")
Signed-off-by: Cédric Le Goater <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Alex Williamson <address@hidden>

  Commit: 87130a0d43158f046873a7de7e1df45c45d6c8a8
  Author: Peter Maydell <address@hidden>
  Date:   2018-07-12 (Thu, 12 Jul 2018)

  Changed paths:
    M hw/vfio/pci.c

  Log Message:
  Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20180711.1' 
into staging

VFIO fixes 2018-07-11

 - Avoid RAMBlock segfault in option ROM teardown for vfio-pci devices
   (Cédric Le Goater)

# gpg: Signature made Wed 11 Jul 2018 20:44:44 BST
# gpg:                using RSA key 239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"
# gpg:                 aka "Alex Williamson <address@hidden>"
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-fixes-20180711.1:
  vfio/pci: do not set the PCIDevice 'has_rom' attribute

Signed-off-by: Peter Maydell <address@hidden>

Compare: https://github.com/qemu/qemu/compare/7411faed38a1...87130a0d4315
      **NOTE:** This service been marked for deprecation: 

      Functionality will be removed from GitHub.com on January 31st, 2019.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]