Message ID | 20201224031750.52146-5-jiaxun.yang@flygoat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/mips/fuloong2e fixes | expand |
On 12/24/20 4:17 AM, Jiaxun Yang wrote: > The original mapping had wrong base address. TBO this rational is a bit scarce ;) I sent a patch implementing the REMAP register: https://www.mail-archive.com/qemu-devel@nongnu.org/msg769751.html If this isn't enough with a Linux kernel because it expects the the Bonito being configured by the bootloader, then we need to do the mapping in write_bootloader(). > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > hw/pci-host/bonito.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c > index 3fad470fc6..737ee131e1 100644 > --- a/hw/pci-host/bonito.c > +++ b/hw/pci-host/bonito.c > @@ -85,9 +85,8 @@ > #define BONITO_PCILO_BASE_VA 0xb0000000 > #define BONITO_PCILO_SIZE 0x0c000000 > #define BONITO_PCILO_TOP (BONITO_PCILO_BASE + BONITO_PCILO_SIZE - 1) > -#define BONITO_PCILO0_BASE 0x10000000 > -#define BONITO_PCILO1_BASE 0x14000000 > -#define BONITO_PCILO2_BASE 0x18000000 > +#define BONITO_PCILOx_BASE(x) (BONITO_PCILO_BASE + BONITO_PCILOx_SIZE * x) > +#define BONITO_PCILOx_SIZE 0x04000000 > #define BONITO_PCIHI_BASE 0x20000000 > #define BONITO_PCIHI_SIZE 0x60000000 > #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1) > @@ -610,7 +609,7 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) > { > PCIHostState *phb = PCI_HOST_BRIDGE(dev); > BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev); > - MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3); > + MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 1); > > memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE); > phb->bus = pci_register_root_bus(dev, "pci", > @@ -622,9 +621,10 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) > 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); > + &bs->pci_mem, BONITO_PCILOx_BASE(i), > + BONITO_PCILOx_SIZE); > memory_region_add_subregion(get_system_memory(), > - BONITO_PCILO_BASE + i * 64 * MiB, > + BONITO_PCILOx_BASE(i), > &pcimem_lo_alias[i]); > g_free(name); > } >
在 2021/1/1 下午7:07, Philippe Mathieu-Daudé 写道: > On 12/24/20 4:17 AM, Jiaxun Yang wrote: >> The original mapping had wrong base address. > TBO this rational is a bit scarce ;) Yes. I was just trying to get Linux work as I was programing facing the kernel, not the hardware ;-( I asked Loongson guys for a copy of Bonito 2E manual and they promised me they'll give it to me after the holiday. Thanks. - Jiaxun > > I sent a patch implementing the REMAP register: > https://www.mail-archive.com/qemu-devel@nongnu.org/msg769751.html > > If this isn't enough with a Linux kernel because it expects > the the Bonito being configured by the bootloader, then we > need to do the mapping in write_bootloader(). > >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >> --- >> hw/pci-host/bonito.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c >> index 3fad470fc6..737ee131e1 100644 >> --- a/hw/pci-host/bonito.c >> +++ b/hw/pci-host/bonito.c >> @@ -85,9 +85,8 @@ >> #define BONITO_PCILO_BASE_VA 0xb0000000 >> #define BONITO_PCILO_SIZE 0x0c000000 >> #define BONITO_PCILO_TOP (BONITO_PCILO_BASE + BONITO_PCILO_SIZE - 1) >> -#define BONITO_PCILO0_BASE 0x10000000 >> -#define BONITO_PCILO1_BASE 0x14000000 >> -#define BONITO_PCILO2_BASE 0x18000000 >> +#define BONITO_PCILOx_BASE(x) (BONITO_PCILO_BASE + BONITO_PCILOx_SIZE * x) >> +#define BONITO_PCILOx_SIZE 0x04000000 >> #define BONITO_PCIHI_BASE 0x20000000 >> #define BONITO_PCIHI_SIZE 0x60000000 >> #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1) >> @@ -610,7 +609,7 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) >> { >> PCIHostState *phb = PCI_HOST_BRIDGE(dev); >> BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev); >> - MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3); >> + MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 1); >> >> memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE); >> phb->bus = pci_register_root_bus(dev, "pci", >> @@ -622,9 +621,10 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) >> 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); >> + &bs->pci_mem, BONITO_PCILOx_BASE(i), >> + BONITO_PCILOx_SIZE); >> memory_region_add_subregion(get_system_memory(), >> - BONITO_PCILO_BASE + i * 64 * MiB, >> + BONITO_PCILOx_BASE(i), >> &pcimem_lo_alias[i]); >> g_free(name); >> } >>
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 3fad470fc6..737ee131e1 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -85,9 +85,8 @@ #define BONITO_PCILO_BASE_VA 0xb0000000 #define BONITO_PCILO_SIZE 0x0c000000 #define BONITO_PCILO_TOP (BONITO_PCILO_BASE + BONITO_PCILO_SIZE - 1) -#define BONITO_PCILO0_BASE 0x10000000 -#define BONITO_PCILO1_BASE 0x14000000 -#define BONITO_PCILO2_BASE 0x18000000 +#define BONITO_PCILOx_BASE(x) (BONITO_PCILO_BASE + BONITO_PCILOx_SIZE * x) +#define BONITO_PCILOx_SIZE 0x04000000 #define BONITO_PCIHI_BASE 0x20000000 #define BONITO_PCIHI_SIZE 0x60000000 #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE + BONITO_PCIHI_SIZE - 1) @@ -610,7 +609,7 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) { PCIHostState *phb = PCI_HOST_BRIDGE(dev); BonitoState *bs = BONITO_PCI_HOST_BRIDGE(dev); - MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 3); + MemoryRegion *pcimem_lo_alias = g_new(MemoryRegion, 1); memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_SIZE); phb->bus = pci_register_root_bus(dev, "pci", @@ -622,9 +621,10 @@ static void bonito_pcihost_realize(DeviceState *dev, Error **errp) 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); + &bs->pci_mem, BONITO_PCILOx_BASE(i), + BONITO_PCILOx_SIZE); memory_region_add_subregion(get_system_memory(), - BONITO_PCILO_BASE + i * 64 * MiB, + BONITO_PCILOx_BASE(i), &pcimem_lo_alias[i]); g_free(name); }
The original mapping had wrong base address. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- hw/pci-host/bonito.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)