PPC 85xx: Add support for QEMU's ppce500 PV machine
v5 cover PPC 85xx: Add support for QEMU's ppce500 PV machine
In QEMU we implement a PV machine type called "ppce500". That board is able to run any e500+ FSL cores (e500v2, e500mc, e5500, e6500).
It is heavily inspired by the MPC8544DS SoC and board combination, but implements only the bare minimum to make Linux happy enough to drive a virtual machine.
This patch set implements support for this PV machine type in U-Boot, enabling users to run their virtual machines with netboot, u-boot payload binaries or other fun things they come up with.
---
v1 -> v2:
- Write device tree offset directly into global variable
- use r4 rather than r2 for that
- access fdt directly from in-memory copy
- remove unneeded header includes
- clean up pci enumeration
- coding style fixes
- populate and only use fdt_addr_r
- remove unused exported functions
- remove unused TLB0 entries
- make TLB1 I/O maps non-executable
- remove unused defines in board header
- make -kernel boot variables more clear
- remove TLB0 invalidation
- use tlb1.14 for temporary as=1 map
- use CONFIG_SYS_MPC85XX_NO_RESETVEC
- store fdt pointer in gd through cpu_init_early_f()
- replace fixup_tlb1() with dynamic TLB creation hook
- find CCSRBAR from device tree
- find PCI controllers from device tree
- find CPU speed from device tree
v2 -> v3:
- new patch: fdt_support: split fdt_getprop_u32_default
- new patch: fdt_support: Add helper function to read "ranges" property
- new patch: PPC: 85xx: Remove IVOR reset
- removed patch: PPC 85xx: Detect e500v2 / e500mc during runtime
- merge dt patches into machine patch
- Document and rename CONFIG_SYS_USE_DYNAMIC_TLBS
- remove CONFIG_DDR_SPD
- Reduce PCI message to only base address
- Map AS=1 fdt behind CCSRBAR
- Use CONFIG_SYS_CCSR_DO_NOT_RELOCATE
- remove unnecessary ccsr map
- s/cell size/cell count/
- add temporary map define
- use fdt_get_base_address() to find region
- use new APIs
- remove myfdt helpers
v3 -> v4:
- tlb_map_range: return unmapped size
- tlb_map_range: take ram/io parameter as enum rather than bool
- use new tlb map syntax
- check that tlb map mapped everything
- always save/restore r3 for cpu_init_early_f
- remove CONFIG_DYNAMIC_CCSRBAR
- make init_tlbs weak and remove all init_tlbs_dynamic() cruft
- always map fdt to fixed virtual address
- fold together AS=1 fdt map functions
- use tlb_map_range for CCSR map
- search for PCI based on device type rather than compatible
- remove unnecessary cast
- call get_linear_ram_size directly
- override get_tbclk with timebase-frequency fetching code
v4 -> v5:
- rebase to current master
- remove CONFIG_MPC85xx from header file, it's already defined on the cmdline
- use __weak instead of __attribute__((weak))
- use esel parameter in map_fdt_as()
- explicitly define start and end of PCI map range
Alexander Graf (6):
fdt_support: split fdt_getprop_u32_default
fdt_support: Add helper function to read "ranges" property
PPC: 85xx: Remove IVOR reset
PPC: 85xx: Generalize DDR TLB mapping function PPC 85xx: Add ELF entry point
PPC 85xx: Add qemu-ppce500 machine
arch/powerpc/cpu/mpc85xx/Makefile | 2 + arch/powerpc/cpu/mpc85xx/cpu.c | 5 +- arch/powerpc/cpu/mpc85xx/cpu_init.c | 4 - arch/powerpc/cpu/mpc85xx/cpu_init_early.c | 8 +- arch/powerpc/cpu/mpc85xx/fixed_ivor.S | 63 ----- arch/powerpc/cpu/mpc85xx/release.S | 3 - arch/powerpc/cpu/mpc85xx/start.S | 17 +- arch/powerpc/cpu/mpc85xx/tlb.c | 49 ++-- arch/powerpc/cpu/mpc85xx/u-boot.lds | 1 + arch/powerpc/include/asm/config_mpc85xx.h | 4 + arch/powerpc/include/asm/mmu.h | 8 + board/freescale/qemu-ppce500/Makefile | 9 + board/freescale/qemu-ppce500/qemu-ppce500.c | 348 ++++++++++++++++++++++++++ boards.cfg | 1 + common/fdt_support.c | 132 +++++++++- include/configs/qemu-ppce500.h | 206 +++++++++++++++ include/fdt_support.h | 4 + nand_spl/board/freescale/mpc8536ds/Makefile | 6 +- nand_spl/board/freescale/mpc8569mds/Makefile | 6 +- nand_spl/board/freescale/mpc8572ds/Makefile | 5 - nand_spl/board/freescale/p1023rds/Makefile | 6 +- nand_spl/board/freescale/p1_p2_rdb/Makefile | 6 +- 22 files changed, 767 insertions(+), 126 deletions(-) delete mode 100644 arch/powerpc/cpu/mpc85xx/fixed_ivor.S create mode 100644 board/freescale/qemu-ppce500/Makefile create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c create mode 100644 include/configs/qemu-ppce500.h
Signature · 1 line
1.7.10.4
PATCH v5 1/6 fdt_support: split fdt_getprop_u32_default
We already have a nice helper to give us a property cell value with default fall back from a path. Split that into two helpers - one for the old path based lookup and one to give us a value based on a node offset.
--- common/fdt_support.c | 38 ++++++++++++++++++++++++++++++++------ include/fdt_support.h | 2 ++ 2 files changed, 34 insertions(+), 6 deletions(-)
common/fdt_support.c +32 -6
@@ -50,6 +50,37 @@ static void write_cell(u8 *addr, u64 val, int size) }/** +* fdt_getprop_u32_default_node - Return a node's property or a default +* +* @fdt: ptr to device tree +* @off: offset of node +* @cell: cell offset in property +* @prop: property name +* @dflt: default value if the property isn't found +* +* Convenience function to return a node's property or a default value if +* the property doesn't exist. +*/ +u32 fdt_getprop_u32_default_node (const void *fdt,int off,int cell, +const char *prop,const u32 dflt) +{ +const fdt32_t *val; +int len; + + val =fdt_getprop (fdt, off, prop, &len); + +/* Check if property exists */ +if (!val) +return dflt; + +/* Check if property is long enough */ +if (len < ((cell +1 ) *sizeof (uint32_t ))) +return dflt; + +return fdt32_to_cpu (*val); +} + +/** * fdt_getprop_u32_default - Find a node and return it's property or a default * * @fdt: ptr to device tree
@@ -63,18 +94,13 @@ static void write_cell(u8 *addr, u64 val, int size)u32 fdt_getprop_u32_default (const void *fdt,const char *path,const char *prop,const u32 dflt) { -const fdt32_t *val;int off; off =fdt_path_offset (fdt, path);if (off <0 )return dflt; - val =fdt_getprop (fdt, off, prop,NULL ); -if (val) -return fdt32_to_cpu (*val); -else -return dflt; +return fdt_getprop_u32_default_node (fdt, off,0 , prop, dflt); }/**
include/fdt_support.h +2 -0
@@ -12,6 +12,8 @@#include <libfdt.h> +u32 fdt_getprop_u32_default_node (const void *fdt,int off,int cell, +const char *prop,const u32 dflt);u32 fdt_getprop_u32_default (const void *fdt,const char *path,const char *prop,const u32 dflt);int fdt_chosen (void *fdt,int force);
Signature · 1 line
1.7.10.4
PATCH v5 2/6 fdt_support: Add helper function to read "ranges" property
In reply to Alexander GrafThis patch adds a helper function that can be used to interpret most "ranges" properties in the device tree.
It reads the n'th range out of a "ranges" array and returns the node's virtual address of the range, the physical address that range starts at and the size of the range.
--- common/fdt_support.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 2 ++ 2 files changed, 96 insertions(+)
common/fdt_support.c +94 -0
@@ -1435,3 +1435,97 @@ u64 fdt_get_base_address(void *fdt, int node)return prop ?fdt_translate_address (fdt, node, prop + naddr) :0 ; } + +/* +* Read a property of size <prop_len>. Currently only supports 1 or 2 cells. +*/ +static int fdt_read_prop (const fdt32_t *prop,int prop_len,int cell_off, +uint64_t *val,int cells) +{ +const fdt32_t *prop32 = &prop[cell_off]; +const fdt64_t *prop64 = (const fdt64_t *)&prop[cell_off]; + +if ((cell_off + cells) > prop_len) +return -FDT_ERR_NOSPACE ; + +switch (cells) { +case 1 : + *val =fdt32_to_cpu (*prop32); +break ; +case 2 : + *val =fdt64_to_cpu (*prop64); +break ; +default : +return -FDT_ERR_NOSPACE ; + } + +return 0 ; +} + +/** +* fdt_read_range - Read a node's n'th range property +* +* @fdt: ptr to device tree +* @node: offset of node +* @n: range index +* @child_addr: pointer to storage for the "child address" field +* @addr: pointer to storage for the CPU view translated physical start +* @len: pointer to storage for the range length +* +* Convenience function that reads and interprets a specific range out of +* a number of the "ranges" property array. +*/ +int fdt_read_range (void *fdt,int node,int n,uint64_t *child_addr, +uint64_t *addr,uint64_t *len) +{ +int pnode =fdt_parent_offset (fdt, node); +const fdt32_t *ranges; +int pacells; +int acells; +int scells; +int ranges_len; +int cell =0 ; +int r =0 ; + +/* +* The "ranges" property is an array of +* { <child address> <parent address> <size in child address space> } +* +* All 3 elements can span a diffent number of cells. Fetch their size. +*/ + pacells =fdt_getprop_u32_default_node (fdt, pnode,0 ,"#address-cells" ,1 ); + acells =fdt_getprop_u32_default_node (fdt, node,0 ,"#address-cells" ,1 ); + scells =fdt_getprop_u32_default_node (fdt, node,0 ,"#size-cells" ,1 ); + +/* Now try to get the ranges property */ + ranges =fdt_getprop (fdt, node,"ranges" , &ranges_len); +if (!ranges) +return -FDT_ERR_NOTFOUND ; + ranges_len /=sizeof (uint32_t ); + +/* Jump to the n'th entry */ + cell = n * (pacells + acells + scells); + +/* Read <child address> */ +if (child_addr) { + r =fdt_read_prop (ranges, ranges_len, cell, child_addr, + acells); +if (r) +return r; + } + cell += acells; + +/* Read <parent address> */ +if (addr) + *addr =fdt_translate_address (fdt, node, ranges + cell); + cell += pacells; + +/* Read <size in child address space> */ +if (len) { + r =fdt_read_prop (ranges, ranges_len, cell, len, scells); +if (r) +return r; + } + +return 0 ; +}
include/fdt_support.h +2 -0
@@ -87,6 +87,8 @@ int fdt_add_edid(void *blob, const char *compat, unsigned char *buf);int fdt_verify_alias_address (void *fdt,int anode,const char *alias,u64 addr);u64 fdt_get_base_address (void *fdt,int node); +int fdt_read_range (void *fdt,int node,int n,uint64_t *child_addr, +uint64_t *addr,uint64_t *len);enum fdt_status {FDT_STATUS_OKAY ,
Signature · 1 line
1.7.10.4
PATCH v5 3/6 PPC: 85xx: Remove IVOR reset
In reply to Alexander GrafThere is no need to set IVORs to anything but their default values, so let's leave them where they are.
--- arch/powerpc/cpu/mpc85xx/cpu_init.c | 4 -- arch/powerpc/cpu/mpc85xx/fixed_ivor.S | 63 -------------------------- arch/powerpc/cpu/mpc85xx/release.S | 3 -- arch/powerpc/cpu/mpc85xx/start.S | 6 --- nand_spl/board/freescale/mpc8536ds/Makefile | 6 +-- nand_spl/board/freescale/mpc8569mds/Makefile | 6 +-- nand_spl/board/freescale/mpc8572ds/Makefile | 5 -- nand_spl/board/freescale/p1023rds/Makefile | 6 +-- nand_spl/board/freescale/p1_p2_rdb/Makefile | 6 +-- 9 files changed, 4 insertions(+), 101 deletions(-) delete mode 100644 arch/powerpc/cpu/mpc85xx/fixed_ivor.S
arch/powerpc/cpu/mpc85xx/cpu_init.c +0 -4
@@ -767,8 +767,6 @@ skip_l2:return 0 ; } -extern void setup_ivors (void ); -void arch_preboot_os (void ) {u32 msr;
@@ -781,8 +779,6 @@ void arch_preboot_os(void) msr =mfmsr (); msr &= ~(MSR_ME |MSR_CE );mtmsr (msr); - -setup_ivors (); }#if defined(CONFIG_CMD_SATA ) && defined(CONFIG_FSL_SATA )
arch/powerpc/cpu/mpc85xx/fixed_ivor.S deleted +0 -63
63 lines not on this page · raw message
arch/powerpc/cpu/mpc85xx/release.S +0 -3
@@ -405,9 +405,6 @@ __second_half_boot_page: bne 3b isync - /* setup IVORs to match fixed offsets */ -#include "fixed_ivor.S" - /* get the upper bits of the addr */ lwz r11,ENTRY_ADDR_UPPER(r10)
arch/powerpc/cpu/mpc85xx/start.S +0 -6
@@ -1965,10 +1965,4 @@ flush_dcache: isync blr - -.globl setup_ivors -setup_ivors: - -#include "fixed_ivor.S" - blr #endif /* !MINIMAL_SPL */
nand_spl/board/freescale/mpc8536ds/Makefile +1 -5
@@ -78,11 +78,7 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S +$(obj)/start.S: @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@
nand_spl/board/freescale/mpc8569mds/Makefile +1 -5
@@ -78,11 +78,7 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S +$(obj)/start.S: @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@
nand_spl/board/freescale/mpc8572ds/Makefile +0 -5
@@ -78,11 +78,6 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@
nand_spl/board/freescale/p1023rds/Makefile +1 -5
@@ -74,11 +74,7 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/$(CPUDIR)/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S +$(obj)/start.S: @rm -f $@ ln -sf $(srctree)/$(CPUDIR)/start.S $@
nand_spl/board/freescale/p1_p2_rdb/Makefile +1 -5
@@ -78,11 +78,7 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S +$(obj)/start.S: @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@
Signature · 1 line
1.7.10.4
PATCH v5 3/6 PPC: 85xx: Remove IVOR reset
Quoted 6 lines · Alexander Graf
nand_spl/board/freescale/mpc8572ds/Makefile +0
-0@@ -78,11 +78,6 @@ $(obj)/resetvec.S: @rm -f $@
nand_spl/board/freescale/mpc8572ds/Makefile $(obj)/resetvec.S: · line 83
Quoted 10 lines
nand_spl/board/freescale/mpc8572ds/Makefile +0
-5ln -s $(srctree)/$(CPUDIR)/resetvec.S $@ -$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@
You forgot to add back "$(obj)/start.S:". Don't send a new patch. I will fix it when I apply it.
York
PATCH v5 3/6 PPC: 85xx: Remove IVOR reset
Quoted 13 lines
Am 17.04.2014 um 02:46 schrieb York Sun <[email protected]>:
Quoted 9 lines · Alexander Graf
nand_spl/board/freescale/mpc8572ds/Makefile +0
-0@@ -78,11 +78,6 @@ $(obj)/resetvec.S: @rm -f $@ ln -s $(srctree)/$(CPUDIR)/resetvec.S $@
Quoted 10 lines
nand_spl/board/freescale/mpc8572ds/Makefile $(obj)/resetvec.S: · line 82
Quoted 7 lines
nand_spl/board/freescale/mpc8572ds/Makefile +0
-5-$(obj)/fixed_ivor.S: - @rm -f $@ - ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@ - -$(obj)/start.S: $(obj)/fixed_ivor.S @rm -f $@ ln -sf $(srctree)/arch/powerpc/cpu/mpc85xx/start.S $@You forgot to add back "$(obj)/start.S:". Don't send a new patch. I will fix it when I apply it.
Oops :). Thanks a lot!
Alex
PATCH v5 4/6 PPC: 85xx: Generalize DDR TLB mapping function
In reply to Alexander GrafThe DDR mapping function really is just a generic virtual -> physical mapping function. Generalize it so it can support any virtual starting offset and IO maps just the same.
---
v3 -> v4:
- change tlb_map to return unmapped size and get ram/io as enum rather than bool
--- arch/powerpc/cpu/mpc85xx/tlb.c | 47 +++++++++++++++++++++++++++------------- arch/powerpc/include/asm/mmu.h | 8 +++++++ 2 files changed, 40 insertions(+), 15 deletions(-)
arch/powerpc/cpu/mpc85xx/tlb.c +32 -15
@@ -236,20 +236,26 @@ void init_addr_map(void) }#endif -unsigned int -setup_ddr_tlbs_phys (phys_addr_t p_addr,unsigned int memsize_in_meg) +uint64_t tlb_map_range (ulong v_addr,phys_addr_t p_addr,uint64_t size, +enum tlb_map_type map_type) {int i;unsigned int tlb_size; -unsigned int wimge =MAS2_M ; -unsigned int ram_tlb_address = (unsigned int )CONFIG_SYS_DDR_SDRAM_BASE ; +unsigned int wimge; +unsigned int perm;unsigned int max_cam, tsize_mask; -u64 size, memsize = (u64 )memsize_in_meg <<20 ; +if (map_type ==TLB_MAP_RAM ) { + perm =MAS3_SX |MAS3_SW |MAS3_SR ; + wimge =MAS2_M ;#ifdef CONFIG_SYS_PPC_DDR_WIMGE - wimge =CONFIG_SYS_PPC_DDR_WIMGE ; + wimge =CONFIG_SYS_PPC_DDR_WIMGE ;#endif - size =min (memsize,CONFIG_MAX_MEM_MAPPED ); + }else { + perm =MAS3_SW |MAS3_SR ; + wimge =MAS2_I |MAS2_G ; + } +if ((mfspr (SPRN_MMUCFG ) &MMUCFG_MAVN ) ==MMUCFG_MAVN_V1 ) {/* Convert (4^max) kB to (2^max) bytes */ max_cam = ((mfspr (SPRN_TLB1CFG ) >>16 ) &0xf ) *2 +10 ;
@@ -261,11 +267,11 @@ setup_ddr_tlbs_phys(phys_addr_t p_addr, unsigned int memsize_in_meg) }for (i =0 ; size && i <8 ; i++) { -int ram_tlb_index =find_free_tlbcam (); +int tlb_index =find_free_tlbcam ();u32 camsize =__ilog2_u64 (size) & tsize_mask; -u32 align =__ilog2 (ram_tlb_address) & tsize_mask; +u32 align =__ilog2 (v_addr) & tsize_mask; -if (ram_tlb_index ==-1 ) +if (tlb_index ==-1 )break ;if (align ==-2 ) align = max_cam;
@@ -277,18 +283,29 @@ setup_ddr_tlbs_phys(phys_addr_t p_addr, unsigned int memsize_in_meg) tlb_size = camsize -10 ; -set_tlb (1 , ram_tlb_address, p_addr, -MAS3_SX |MAS3_SW |MAS3_SR , wimge, -0 , ram_tlb_index, tlb_size,1 ); +set_tlb (1 , v_addr, p_addr, perm, wimge, +0 , tlb_index, tlb_size,1 ); size -=1ULL << camsize; - memsize -=1ULL << camsize; - ram_tlb_address +=1UL << camsize; + v_addr +=1UL << camsize; p_addr +=1UL << camsize; } +return size; +} + +unsigned int setup_ddr_tlbs_phys (phys_addr_t p_addr, +unsigned int memsize_in_meg) +{ +unsigned int ram_tlb_address = (unsigned int )CONFIG_SYS_DDR_SDRAM_BASE ; +u64 memsize = (u64 )memsize_in_meg <<20 ; + + memsize =min (memsize,CONFIG_MAX_MEM_MAPPED ); + memsize =tlb_map_range (ram_tlb_address, p_addr, memsize,TLB_MAP_RAM ); +if (memsize)print_size (memsize," left unmapped\n" ); +return memsize_in_meg; }
arch/powerpc/include/asm/mmu.h +8 -0
@@ -509,6 +509,14 @@ extern void print_tlbcam(void);extern unsigned int setup_ddr_tlbs (unsigned int memsize_in_meg);extern void clear_ddr_tlbs (unsigned int memsize_in_meg); +enum tlb_map_type { +TLB_MAP_RAM , +TLB_MAP_IO , +}; + +extern uint64_t tlb_map_range (ulong v_addr,phys_addr_t p_addr,uint64_t size, +enum tlb_map_type map_type); +extern void write_tlb (u32 _mas0,u32 _mas1,u32 _mas2,u32 _mas3,u32 _mas7);#define SET_TLB_ENTRY (_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \
Signature · 1 line
1.7.10.4
PATCH v5 5/6 PPC 85xx: Add ELF entry point
In reply to Alexander GrafWe want to be able to directly execute the ELF binary without going through the u-boot.bin one.
To know where we have to start executing this ELF binary we have to tell the linker where our entry point is.
--- arch/powerpc/cpu/mpc85xx/u-boot.lds | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc85xx/u-boot.lds +1 -0
@@ -13,6 +13,7 @@ #endif OUTPUT_ARCH(powerpc) +ENTRY(_start_e500) PHDRS {
Signature · 1 line
1.7.10.4
PATCH v5 6/6 PPC 85xx: Add qemu-ppce500 machine
In reply to Alexander GrafFor KVM we have a special PV machine type called "ppce500". This machine is inspired by the MPC8544DS board, but implements a lot less features than that one.
It also provides more PCI slots and is supposed to be enumerated by device tree only.
This patch adds support for the generic ppce500 machine and tries to rely solely on device tree for device enumeration.
---
v1 -> v2:
- Write device tree offset directly into global variable
- use r4 rather than r2 for that
- access fdt directly from in-memory copy
- remove unneeded header includes
- clean up pci enumeration
- coding style fixes
- populate and only use fdt_addr_r
- remove unused exported functions
- remove unused TLB0 entries
- make TLB1 I/O maps non-executable
- remove unused defines in board header
- make -kernel boot variables more clear
- remove TLB0 invalidation
- use tlb1.14 for temporary as=1 map
- use CONFIG_SYS_MPC85XX_NO_RESETVEC
- store fdt pointer in gd through cpu_init_early_f()
- replace fixup_tlb1() with dynamic TLB creation hook
v2 -> v3:
- merge dt patches into this one
- Document and rename CONFIG_SYS_USE_DYNAMIC_TLBS
- remove CONFIG_DDR_SPD
- Reduce PCI message to only base address
- Map AS=1 fdt behind CCSRBAR
- Use CONFIG_SYS_CCSR_DO_NOT_RELOCATE
- remove unnecessary ccsr map
- s/cell size/cell count/
- add temporary map define
- use fdt_get_base_address() to find region
- use new APIs
- remove myfdt helpers
v3 -> v4:
- use new tlb map syntax
- check that tlb map mapped everything
- always save/restore r3 for cpu_init_early_f
- remove CONFIG_DYNAMIC_CCSRBAR
- make init_tlbs weak and remove all init_tlbs_dynamic() cruft
- always map fdt to fixed virtual address
- fold together AS=1 fdt map functions
- use tlb_map_range for CCSR map
- search for PCI based on device type rather than compatible
- remove unnecessary cast
- call get_linear_ram_size directly
- override get_tbclk with timebase-frequency fetching code
v4 -> v5:
- remove CONFIG_MPC85xx from header file, it's already defined on the cmdline
- use __weak instead of __attribute__((weak))
- use esel parameter in map_fdt_as()
- explicitly define start and end of PCI map range
--- arch/powerpc/cpu/mpc85xx/Makefile | 2 + arch/powerpc/cpu/mpc85xx/cpu.c | 5 +- arch/powerpc/cpu/mpc85xx/cpu_init_early.c | 8 +- arch/powerpc/cpu/mpc85xx/start.S | 11 + arch/powerpc/cpu/mpc85xx/tlb.c | 2 +- arch/powerpc/include/asm/config_mpc85xx.h | 4 + board/freescale/qemu-ppce500/Makefile | 9 + board/freescale/qemu-ppce500/qemu-ppce500.c | 348 +++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/qemu-ppce500.h | 206 ++++++++++++++++ 10 files changed, 592 insertions(+), 4 deletions(-) create mode 100644 board/freescale/qemu-ppce500/Makefile create mode 100644 board/freescale/qemu-ppce500/qemu-ppce500.c create mode 100644 include/configs/qemu-ppce500.h
arch/powerpc/cpu/mpc85xx/Makefile +2 -0
@@ -102,7 +102,9 @@ obj-y += cpu.o obj-y += cpu_init.o obj-y += cpu_init_early.o obj-y += interrupts.o +ifneq ($(CONFIG_QEMU_E500),y) obj-y += speed.o +endif obj-y += tlb.o obj-y += traps.o
arch/powerpc/cpu/mpc85xx/cpu.c +3 -2
@@ -272,7 +272,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifndef CONFIG_SYS_FSL_TBCLK_DIV #define CONFIG_SYS_FSL_TBCLK_DIV 8#endif -unsigned long get_tbclk (void ) +__weak unsigned long get_tbclk (void ) {unsigned long tbclk_div =CONFIG_SYS_FSL_TBCLK_DIV ;
@@ -338,7 +338,8 @@ void mpc85xx_reginfo(void) !defined(CONFIG_SYS_INIT_L2_ADDR)phys_size_t initdram (int board_type) { -#if defined(CONFIG_SPD_EEPROM ) || defined(CONFIG_DDR_SPD ) +#if defined(CONFIG_SPD_EEPROM ) || defined(CONFIG_DDR_SPD ) || \ + defined(CONFIG_QEMU_E500 )return fsl_ddr_sdram_size ();#else return (phys_size_t )CONFIG_SYS_SDRAM_SIZE *1024 *1024 ;
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +7 -1
@@ -79,7 +79,7 @@ void setup_ifc(void)#endif /* We run cpu_init_early_f in AS = 1 */ -void cpu_init_early_f (void ) +void cpu_init_early_f (void *fdt) {u32 mas0, mas1, mas2, mas3, mas7;int i;
@@ -102,6 +102,12 @@ void cpu_init_early_f(void)for (i =0 ; i <sizeof (gd_t); i++) ((char *)gd)[i] =0 ; +/* +* CONFIG_SYS_CCSRBAR_PHYS below may use gd->fdt_blob on ePAPR systems, +* so we need to populate it before it accesses it. +*/ + gd->fdt_blob = fdt; + mas0 =MAS0_TLBSEL (1 ) |MAS0_ESEL (13 ); mas1 =MAS1_VALID |MAS1_TID (0 ) |MAS1_TS |MAS1_TSIZE (BOOKE_PAGESZ_1M ); mas2 =FSL_BOOKE_MAS2 (CONFIG_SYS_CCSRBAR ,MAS2_I |MAS2_G );
arch/powerpc/cpu/mpc85xx/start.S +11 -0
@@ -78,6 +78,13 @@ _start_e500: li r1,MSR_DE mtmsr r1 + /* + * If we got an ePAPR device tree pointer passed in as r3, we need that + * later in cpu_init_early_f(). Save it to a safe register before we + * clobber it so that we can fetch it from there later. + */ + mr r24, r3 + #ifdef CONFIG_SYS_FSL_ERRATUM_A004510 mfspr r3,SPRN_SVR rlwinm r3,r3,0,0xff
@@ -1142,6 +1149,10 @@ _start_cont: mr r1,r3 /* Transfer to SP(r1) */ GET_GOT + + /* Pass our potential ePAPR device tree pointer to cpu_init_early_f */ + mr r3, r24 + bl cpu_init_early_f /* switch back to AS = 0 */
arch/powerpc/cpu/mpc85xx/tlb.c +1 -1
@@ -24,7 +24,7 @@ void invalidate_tlb(u8 tlb)mtspr (MMUCSR0 ,0x2 ); } -void init_tlbs (void ) +__weak void init_tlbs (void ) {int i;
arch/powerpc/include/asm/config_mpc85xx.h +4 -0
@@ -797,6 +797,10 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)#define CONFIG_SYS_CCSRBAR_DEFAULT 0xff700000#define CONFIG_SYS_FSL_ERRATUM_A005125 +#elif defined(CONFIG_QEMU_E500 ) +#define CONFIG_MAX_CPUS 1 +#define CONFIG_SYS_CCSRBAR_DEFAULT 0xe0000000 +#else #error Processor type not defined for this platform#endif
board/freescale/qemu-ppce500/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# +# Copyright 2007 Freescale Semiconductor, Inc. +# (C) Copyright 2001-2006 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += qemu-ppce500.o
board/freescale/qemu-ppce500/qemu-ppce500.c new file +348 -0
348 lines not on this page · raw message
boards.cfg +1 -0
@@ -963,6 +963,7 @@ Active powerpc mpc85xx - freescale t4qds Active powerpc mpc85xx - freescale t4qds T4240QDS_SDCARD T4240QDS:PPC_T4240,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000 - Active powerpc mpc85xx - freescale t4qds T4240QDS_SPIFLASH T4240QDS:PPC_T4240,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000 - Active powerpc mpc85xx - freescale t4qds T4240QDS_SRIO_PCIE_BOOT T4240QDS:PPC_T4240,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000 - +Active powerpc mpc85xx - freescale qemu-ppce500 qemu-ppce500 - Alexander Graf <[email protected]> Active powerpc mpc85xx - gdsys p1022 controlcenterd_36BIT_SDCARD controlcenterd:36BIT,SDCARD Dirk Eibach <[email protected]> Active powerpc mpc85xx - gdsys p1022 controlcenterd_36BIT_SDCARD_DEVELOP controlcenterd:36BIT,SDCARD,DEVELOP Dirk Eibach <[email protected]> Active powerpc mpc85xx - gdsys p1022 controlcenterd_TRAILBLAZER controlcenterd:TRAILBLAZER,SPIFLASH Dirk Eibach <[email protected]>
include/configs/qemu-ppce500.h new file +206 -0
206 lines not on this page · raw message
Signature · 1 line
1.7.10.4
v5 cover PPC 85xx: Add support for QEMU's ppce500 PV machine
In reply to Alexander GrafQuoted 10 lines · Alexander Graf
In QEMU we implement a PV machine type called "ppce500". That board is able to run any e500+ FSL cores (e500v2, e500mc, e5500, e6500).
It is heavily inspired by the MPC8544DS SoC and board combination, but implements only the bare minimum to make Linux happy enough to drive a virtual machine.
This patch set implements support for this PV machine type in U-Boot, enabling users to run their virtual machines with netboot, u-boot payload binaries or other fun things they come up with.
-Scott
v5 cover PPC 85xx: Add support for QEMU's ppce500 PV machine
In reply to Alexander GrafQuoted 12 lines · Alexander Graf
In QEMU we implement a PV machine type called "ppce500". That board is able to run any e500+ FSL cores (e500v2, e500mc, e5500, e6500).
It is heavily inspired by the MPC8544DS SoC and board combination, but implements only the bare minimum to make Linux happy enough to drive a virtual machine.
This patch set implements support for this PV machine type in U-Boot, enabling users to run their virtual machines with netboot, u-boot payload binaries or other fun things they come up with.
Applied to u-boot-mpc85xx/master, thanks.
York