[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 10/21] pcie: pass pcie window size to pcie_ho
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 10/21] pcie: pass pcie window size to pcie_host_mmcfg_update() |
Date: |
Tue, 09 Oct 2012 09:52:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
Il 09/10/2012 05:30, Jason Baron ha scritto:
> From: Jason Baron <address@hidden>
>
> This allows q35 to pass/set the size of the pcie window in its update routine.
>
> Signed-off-by: Jason Baron <address@hidden>
> ---
> hw/pcie_host.c | 21 ++++++++++++---------
> hw/pcie_host.h | 8 +++++---
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/hw/pcie_host.c b/hw/pcie_host.c
> index 28bbe72..e2fd276 100644
> --- a/hw/pcie_host.c
> +++ b/hw/pcie_host.c
> @@ -107,14 +107,9 @@ static const MemoryRegionOps pcie_mmcfg_ops = {
> /* pcie_host::base_addr == PCIE_BASE_ADDR_UNMAPPED when it isn't mapped. */
> #define PCIE_BASE_ADDR_UNMAPPED ((target_phys_addr_t)-1ULL)
>
> -int pcie_host_init(PCIExpressHost *e, uint32_t size)
> +int pcie_host_init(PCIExpressHost *e)
> {
> - assert(!(size & (size - 1))); /* power of 2 */
> - assert(size >= PCIE_MMCFG_SIZE_MIN);
> - assert(size <= PCIE_MMCFG_SIZE_MAX);
> e->base_addr = PCIE_BASE_ADDR_UNMAPPED;
> - e->size = size;
> - memory_region_init_io(&e->mmio, &pcie_mmcfg_ops, e, "pcie-mmcfg",
> e->size);
>
> return 0;
> }
> @@ -123,22 +118,30 @@ void pcie_host_mmcfg_unmap(PCIExpressHost *e)
> {
> if (e->base_addr != PCIE_BASE_ADDR_UNMAPPED) {
> memory_region_del_subregion(get_system_memory(), &e->mmio);
> + memory_region_destroy(&e->mmio);
> e->base_addr = PCIE_BASE_ADDR_UNMAPPED;
> }
> }
>
> -void pcie_host_mmcfg_map(PCIExpressHost *e, target_phys_addr_t addr)
> +void pcie_host_mmcfg_map(PCIExpressHost *e, target_phys_addr_t addr,
> + uint32_t size)
> {
> + assert(!(size & (size - 1))); /* power of 2 */
> + assert(size >= PCIE_MMCFG_SIZE_MIN);
> + assert(size <= PCIE_MMCFG_SIZE_MAX);
> + e->size = size;
> + memory_region_init_io(&e->mmio, &pcie_mmcfg_ops, e, "pcie-mmcfg",
> e->size);
> e->base_addr = addr;
> memory_region_add_subregion(get_system_memory(), e->base_addr, &e->mmio);
> }
>
> void pcie_host_mmcfg_update(PCIExpressHost *e,
> int enable,
> - target_phys_addr_t addr)
> + target_phys_addr_t addr,
> + uint32_t size)
> {
> pcie_host_mmcfg_unmap(e);
> if (enable) {
> - pcie_host_mmcfg_map(e, addr);
> + pcie_host_mmcfg_map(e, addr, size);
> }
> }
> diff --git a/hw/pcie_host.h b/hw/pcie_host.h
> index 0074508..2faa54e 100644
> --- a/hw/pcie_host.h
> +++ b/hw/pcie_host.h
> @@ -39,11 +39,13 @@ struct PCIExpressHost {
> MemoryRegion mmio;
> };
>
> -int pcie_host_init(PCIExpressHost *e, uint32_t size);
> +int pcie_host_init(PCIExpressHost *e);
> void pcie_host_mmcfg_unmap(PCIExpressHost *e);
> -void pcie_host_mmcfg_map(PCIExpressHost *e, target_phys_addr_t addr);
> +void pcie_host_mmcfg_map(PCIExpressHost *e, target_phys_addr_t addr,
> + uint32_t size);
These two functions perhaps could be made static, but it can be done in
a separate patch.
Reviewed-by: Paolo Bonzini <address@hidden>
> void pcie_host_mmcfg_update(PCIExpressHost *e,
> int enable,
> - target_phys_addr_t addr);
> + target_phys_addr_t addr,
> + uint32_t size);
>
> #endif /* PCIE_HOST_H */
>
- Re: [Qemu-devel] [PATCH v2 04/21] pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle, (continued)
- [Qemu-devel] [PATCH v2 02/21] blockdev: Introduce IF_AHCI, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 06/21] pc: Move ioapic_init() from pc_piix.c to pc.c, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 01/21] blockdev: Introduce a default machine blockdev interface field, QEMUMachine->mach_if, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 09/21] pci: Add class 0xc05 as 'SMBus', Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 10/21] pcie: pass pcie window size to pcie_host_mmcfg_update(), Jason Baron, 2012/10/08
- Re: [Qemu-devel] [PATCH v2 10/21] pcie: pass pcie window size to pcie_host_mmcfg_update(),
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 08/21] pci_ids: add intel 82801BA pci-to-pci bridge id and PCI_CLASS_SERIAL_SMBUS, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 11/21] pcie: Convert PCIExpressHost to use the QOM., Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 07/21] pc/piix_pci: factor out smram/pam logic, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 14/21] q35: Suppress SMM BIOS initialization under KVM, Jason Baron, 2012/10/08
- [Qemu-devel] [PATCH v2 17/21] q35: Add kvmclock support, Jason Baron, 2012/10/08