[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more
From: |
Aleksandar Markovic |
Subject: |
Re: [PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more detailled |
Date: |
Mon, 11 May 2020 08:12:39 +0200 |
нед, 10. мај 2020. у 23:01 Philippe Mathieu-Daudé <address@hidden> је
написао/ла:
>
> Better describe the Bonito64 MEM HI/LO and I/O PCI ranges,
> add more PCI regions as unimplemented.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/pci-host/bonito.c | 30 ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
> index 9761780f44..90a6c52a38 100644
> --- a/hw/pci-host/bonito.c
> +++ b/hw/pci-host/bonito.c
> @@ -39,6 +39,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qemu/units.h"
> #include "qemu/error-report.h"
> #include "hw/pci/pci.h"
> #include "hw/irq.h"
> @@ -82,7 +83,7 @@
> #define BONITO_PCILO1_BASE 0x14000000
> #define BONITO_PCILO2_BASE 0x18000000
> #define BONITO_PCIHI_BASE 0x20000000
> -#define BONITO_PCIHI_SIZE 0x20000000
> +#define BONITO_PCIHI_SIZE 0x60000000
> #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1)
> #define BONITO_PCIIO_BASE 0x1fd00000
> #define BONITO_PCIIO_BASE_VA 0xbfd00000
> @@ -606,13 +607,25 @@ static void bonito_pcihost_realize(DeviceState *dev,
> Error **errp)
> PCIHostState *phb = PCI_HOST_BRIDGE(dev);
> BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev);
>
> - memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem",
> BONITO_PCILO_SIZE);
> + memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem",
> BONITO_PCIHI_SIZE);
> phb->bus = pci_register_root_bus(DEVICE(dev), "pci",
> pci_bonito_set_irq, pci_bonito_map_irq,
> dev, &bs->pci_mem, get_system_io(),
> 0x28, 32, TYPE_PCI_BUS);
> - memory_region_add_subregion(get_system_memory(), BONITO_PCILO_BASE,
> - &bs->pci_mem);
> +
> + MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3);
> + for (size_t i = 0; i < 3; i++) {
> + char *name = g_strdup_printf("pci.lomem%zu", i);
> +
> + memory_region_init_alias(&pcimem_lo_alias[i], NULL, name,
> + &bs->pci_mem, i * 64 * MiB, 64 * MiB);
> + memory_region_add_subregion(get_system_memory(),
> + BONITO_PCILO_BASE + i * 64 * MiB,
> + &pcimem_lo_alias[i]);
> + g_free(name);
> + }
> +
> + create_unimplemented_device("pci.io", 0x1fd00000, 1 * MiB);
Hi, Philippe.
I am delighted with the whole series, finally cleaning Bonito code feels good.
I just want to ask you if it possible to get rid of constants like
0x1fd00000 (generally in this code, not limited to this patch), and
give the some nice "#define" names?
Yours,
Aleksandar
> }
>
> static void bonito_realize(PCIDevice *dev, Error **errp)
> @@ -620,6 +633,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
> PCIBonitoState *s = PCI_BONITO(dev);
> SysBusDevice *sysbus = SYS_BUS_DEVICE(s->pcihost);
> PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);
> + BonitoState *bs = BONITO_PCI_HOST_BRIDGE(s->pcihost);
>
> /*
> * Bonito North Bridge, built on FPGA,
> @@ -652,6 +666,7 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
> sysbus_init_mmio(sysbus, &s->iomem_ldma);
> sysbus_mmio_map(sysbus, 3, 0x1fe00200);
>
> + /* PCI copier */
> memory_region_init_io(&s->iomem_cop, OBJECT(s), &bonito_cop_ops, s,
> "cop", 0x100);
> sysbus_init_mmio(sysbus, &s->iomem_cop);
> @@ -669,6 +684,13 @@ static void bonito_realize(PCIDevice *dev, Error **errp)
> sysbus_init_mmio(sysbus, &s->bonito_localio);
> sysbus_mmio_map(sysbus, 6, BONITO_DEV_BASE);
>
> + MemoryRegion *pcimem_alias = g_new(MemoryRegion, 1);
> + memory_region_init_alias(pcimem_alias, NULL, "pci.mem.alias",
> + &bs->pci_mem, 0, BONITO_PCIHI_SIZE);
> + memory_region_add_subregion(get_system_memory(),
> + 0x20000000ul, pcimem_alias);
> + create_unimplemented_device("PCI_2", 0x80000000ul, 2 * GiB); /* pci_hi */
> +
> /* set the default value of north bridge pci config */
> pci_set_word(dev->config + PCI_COMMAND, 0x0000);
> pci_set_word(dev->config + PCI_STATUS, 0x0000);
> --
> 2.21.3
>
- Re: [PATCH 04/12] hw/mips/fuloong2e: Fix typo in Fuloong machine name, (continued)
[PATCH 06/12] hw/pci-host/bonito: Fix DPRINTF() format strings, Philippe Mathieu-Daudé, 2020/05/10
[PATCH 08/12] hw/pci-host/bonito: Map all the Bonito64 I/O range, Philippe Mathieu-Daudé, 2020/05/10
[PATCH 07/12] hw/pci-host/bonito: Map peripheral using physical address, Philippe Mathieu-Daudé, 2020/05/10
[PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more detailled, Philippe Mathieu-Daudé, 2020/05/10
- Re: [PATCH 09/12] hw/pci-host/bonito: Map the different PCI ranges more detailled,
Aleksandar Markovic <=
[PATCH 10/12] hw/pci-host/bonito: Better describe the I/O CS regions, Philippe Mathieu-Daudé, 2020/05/10
[PATCH 11/12] hw/pci-host/bonito: Set the Config register reset value with FIELD_DP32, Philippe Mathieu-Daudé, 2020/05/10
[NOTFORMERGE PATCH 12/12] POC hw/pci-host/bonito: Fix BONGENCFG value after a warm-reset, Philippe Mathieu-Daudé, 2020/05/10
Re: [PATCH 00/12] hw/mips/fuloong2e: PoC to fix hang after reboot, Aleksandar Markovic, 2020/05/11
Re: [PATCH 00/12] hw/mips/fuloong2e: PoC to fix hang after reboot, Philippe Mathieu-Daudé, 2020/05/26