From 6a76a8be1cd3eebf8a95cc6d9bdd2ef0a335b36f Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Fri, 23 Jul 2010 16:07:46 -0300 Subject: [PATCH 4/4] Do not try loading option ROM for hotplug PCI device in pc-0.11 compat mode RH-Author: Jes Sorensen Message-id: <1279901266-8687-2-git-send-email-Jes.Sorensen@redhat.com> Patchwork-id: 10950 O-Subject: [RHEL6 qemu-kvm PATCH 1/1] Do not try loading option ROM for hotplug PCI device in pc-0.11 compat mode Bugzilla: 612696 RH-Acked-by: Markus Armbruster RH-Acked-by: Don Dutile RH-Acked-by: Alex Williamson From: Jes Sorensen pc-0.11 and older uses fw_cfg to provide option ROMs. As fw_cfg is setup at init time, it is not possible to load an option ROM for a hotplug device when running in compat mode. v2: Alex Williamson pointed out that one can get to qdev directly from pci_dev, so no need to pass it down. Signed-off-by: Jes Sorensen --- hw/pci.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Signed-off-by: Eduardo Habkost --- hw/pci.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 816844c..6d0649f 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1625,11 +1625,15 @@ static int pci_add_option_rom(PCIDevice *pdev) return 0; if (!pdev->rom_bar) { + int class; /* * Load rom via fw_cfg instead of creating a rom bar, - * for 0.11 compatibility. + * for 0.11 compatibility. fw_cfg is initialized at boot, so + * we cannot do hotplug load of option roms. */ - int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE); + if (pdev->qdev.hotplugged) + return 0; + class = pci_get_word(pdev->config + PCI_CLASS_DEVICE); if (class == 0x0300) { rom_add_vga(pdev->romfile); } else { -- 1.7.0.3