mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 14:28:56 +00:00
DM: release mem range allocated in init_pci
Two memory ranges are allocated: - PCI ECFG - PCI hole They should be released when deinit_pci. Old code mark this two ranges not unregistered. Which is wrong for warm reboot case. Make them could be unregistered. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -234,6 +234,34 @@ register_mem_fallback(struct mem_range *memp)
|
||||
return register_mem_int(&mmio_rb_fallback, memp);
|
||||
}
|
||||
|
||||
int
|
||||
unregister_mem_fallback(struct mem_range *memp)
|
||||
{
|
||||
struct mem_range *mr;
|
||||
struct mmio_rb_range *entry = NULL;
|
||||
int err;
|
||||
|
||||
pthread_rwlock_wrlock(&mmio_rwlock);
|
||||
err = mmio_rb_lookup(&mmio_rb_fallback, memp->base, &entry);
|
||||
if (err == 0) {
|
||||
mr = &entry->mr_param;
|
||||
assert(mr->name == memp->name);
|
||||
assert(mr->base == memp->base && mr->size == memp->size);
|
||||
assert((mr->flags & MEM_F_IMMUTABLE) == 0);
|
||||
RB_REMOVE(mmio_rb_tree, &mmio_rb_fallback, entry);
|
||||
|
||||
/* flush Per-VM cache */
|
||||
if (mmio_hint == entry)
|
||||
mmio_hint = NULL;
|
||||
}
|
||||
pthread_rwlock_unlock(&mmio_rwlock);
|
||||
|
||||
if (entry)
|
||||
free(entry);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
unregister_mem(struct mem_range *memp)
|
||||
{
|
||||
|
Reference in New Issue
Block a user