[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 15/16] pci: Free the space allocated for the opti
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PATCH v2 15/16] pci: Free the space allocated for the option rom on removal |
Date: |
Fri, 25 Jun 2010 11:10:19 -0600 |
User-agent: |
StGIT/0.14.3 |
Signed-off-by: Alex Williamson <address@hidden>
---
hw/pci.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index fe7c5c3..a7ff566 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -76,6 +76,7 @@ static struct BusInfo pci_bus_info = {
static void pci_update_mappings(PCIDevice *d);
static void pci_set_irq(void *opaque, int irq_num, int level);
static int pci_add_option_rom(PCIDevice *pdev);
+static void pci_del_option_rom(PCIDevice *pdev);
static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET;
static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU;
@@ -709,6 +710,7 @@ static int pci_unregister_device(DeviceState *dev)
return ret;
pci_unregister_io_regions(pci_dev);
+ pci_del_option_rom(pci_dev);
do_pci_unregister_device(pci_dev);
return 0;
}
@@ -1765,6 +1767,15 @@ static int pci_add_option_rom(PCIDevice *pdev)
return 0;
}
+static void pci_del_option_rom(PCIDevice *pdev)
+{
+ if (!pdev->rom_offset)
+ return;
+
+ qemu_ram_free(pdev->rom_offset);
+ pdev->rom_offset = 0;
+}
+
/* Reserve space and add capability to the linked list in pci config space */
int pci_add_capability_at_offset(PCIDevice *pdev, uint8_t cap_id,
uint8_t offset, uint8_t size)
- [Qemu-devel] [PATCH 13/15] qemu_ram_free: Implement it, (continued)
- [Qemu-devel] [PATCH v2 00/16] Make migration work with hotplug, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 16/16] ramblocks: No more being lazy about duplicate names, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 14/16] qemu_ram_free: Implement it, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 15/16] pci: Free the space allocated for the option rom on removal,
Alex Williamson <=
- [Qemu-devel] [PATCH v2 13/16] savevm: Create a new continue flag to avoid resending block name, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 12/16] savevm: Use RAM blocks for basis of migration, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 10/16] ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 11/16] savevm: Migrate RAM based on name/offset, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 07/16] eepro100: Add a dev field to eeprom new/free functions, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 08/16] virtio-net: Incorporate a DeviceState pointer and let savevm track instances, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 09/16] qemu_ram_alloc: Add DeviceState and name parameters, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 06/16] savevm: Make use of DeviceState, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 04/16] pci: Implement BusInfo.get_dev_path(), Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 02/16] pc: Allocate all ram in a single qemu_ram_alloc(), Alex Williamson, 2010/06/25