Tartarus changed the topic of #u-boot to: SOURCE MOVED TO https://source.denx.de/u-boot/u-boot.git / U-Boot v2022.07 is OUT / Merge Window is OPEN, -next is CLOSED / Release v2022.10 is scheduled for 3 October 2022 / http://www.denx.de/wiki/U-Boot / Channel archives at https://libera.irclog.whitequark.org/u-boot
persmule has quit [Ping timeout: 258 seconds]
persmule has joined #u-boot
hanetzer has joined #u-boot
mmu_man has quit [Ping timeout: 264 seconds]
hanetzer has quit [Ping timeout: 246 seconds]
qschulz has quit [Remote host closed the connection]
hanetzer has joined #u-boot
qschulz has joined #u-boot
mmu_man has joined #u-boot
vagrantc has quit [Quit: leaving]
thopiekar_ has joined #u-boot
thopiekar has quit [Ping timeout: 268 seconds]
umbramalison has quit [Quit: %So long and thanks for all the fish%]
umbramalison has joined #u-boot
LeSpocky has quit [Ping timeout: 252 seconds]
LeSpocky has joined #u-boot
thopiekar has joined #u-boot
thopiekar_ has quit [Ping timeout: 264 seconds]
camus has joined #u-boot
persmule has quit [Remote host closed the connection]
Forty-Bot has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
persmule has joined #u-boot
mmu_man has quit [Ping timeout: 252 seconds]
persmule has quit [Remote host closed the connection]
persmule has joined #u-boot
zkrx has quit [Read error: Connection reset by peer]
zkrx has joined #u-boot
zkrx has quit []
zkrx has joined #u-boot
zkrx has quit [Client Quit]
zkrx has joined #u-boot
zkrx has quit []
zkrx has joined #u-boot
rvalue has quit [Ping timeout: 265 seconds]
rvalue has joined #u-boot
rvalue has quit [Ping timeout: 265 seconds]
rvalue has joined #u-boot
zkrx has quit []
zkrx has joined #u-boot
camus has quit [Quit: camus]
<hramrach> there is a patchwork \o/
sukbeom has joined #u-boot
camus has joined #u-boot
sam_sepi0l has quit [Ping timeout: 260 seconds]
hanetzer has quit [Quit: WeeChat 3.6]
hanetzer has joined #u-boot
naoki has quit [Quit: naoki]
Forty-Bot has joined #u-boot
sbach has quit [Read error: Connection reset by peer]
sbach has joined #u-boot
clever has joined #u-boot
vitali64 has joined #u-boot
<clever> me and vitali64 are trying to bring uboot up on a "new" board, and its not printing a single byte to the PL011 uart, i notice that the load addr in the u-boot elf file is 0x8000, but its being loaded to 0 before exeucution
<clever> is the u-boot.bin fully PIC?
<vitali64> The "new" board is actually a RaspberryPi2 running a custom firmware.
<vitali64> When powering it on, I can see this stuff being printed on the screen:
persmule has quit [Remote host closed the connection]
<vitali64> KKKK4444____333322KKK444___333222
<vitali64> But it's not printing anything else.
<vitali64> C0: 0xa580fc53, C1: 0x100, ERRHALT: 0x20
<clever> the C0 line came from the firmware
<vitali64> This line (which comes from the firmware) seems to say that u-boot crashed.
umbramalison has quit [Ping timeout: 246 seconds]
umbramalison has joined #u-boot
vagrantc has joined #u-boot
<hramrach> clever: some copypasta: nm u-boot | grep \\\<_start should give you the place to load and execute u-boot.bin
<hramrach> what does load it, though?
<clever> hramrach: objdump -d says that the load-addr is 0x8000, nothing happens if i run it from 0
<clever> eafffffe b 8000 <*ABS*0x8000>
<clever> hramrach: we tried stuffing this 32bit opcode at 0, and then loading u-boot.bin to 0x8000, but same, no output
<hramrach> and what is the address of _Start?
<clever> 00008000 <__image_copy_start>:
<clever> i dont see a simply _start
<hramrach> I only see it with nm, not objdump, and it seem sto be the same, at least here
<clever> 00008000 T _start
<hramrach> so if you load at that address it should work as far as my expertise on u-boot loading goes
<clever> ah yep, i do see it in nm
<clever> *((uint32_t*)dest) = 0xeafffffe;
<clever> dest += 0x8000;
<clever> the problem, is that this cpu starts with PC=0, and i dont know how to tell u-boot to put _start at 0
<clever> i tried using this bit of code, to inject a `b 0x8000` at 0, and then change the load-addr for u-boot.bin, but it didnt work
<clever> still no output from the uart
<clever> do you know how to change the _start?
<hramrach> so you really want to load at 0?
<clever> yeah
<hramrach> there should be a config option for that
<clever> ahh, the help text on POSITION_INDEPENDENT answers a previous question
<clever> hramrach: i see SYS_TEXT_BASE for some arcm/arm/mach-* folders, but nof for the rpi
<clever> not*
WoC has quit [Remote host closed the connection]
<clever> oh, there it is, boot/Kconfig
<clever> yeah, so it should be as simple as just SYS_TEXT_BASE=0
<clever> the stuff i saw in arch/arm/mach-* was probably board specific defaults
<hramrach> yes, I would bet on that option as well CONFIG_SYS_TEXT_BASE
<marex> CONFIG_SYS_TEXT_BASE=0x0 CONFIG_POSITION_INDEPENDENT=y
<marex> that's how you make u-boot fully PIE
<marex> works at least on aarch64
<clever> currently testing on armv7
<hramrach> does PIE mean it can actually be loaded anywhere?
<clever> are there any downsides to POSITION_INDEPENDENT, if you know that the SYS_TEXT_BASE is going to be correct?
WoC has joined #u-boot
<clever> could i just CONFIG_SYS_TEXT_BASE=0x0 only?
<marex> hramrach: yeah, that was the goal on rcar3
<clever> hramrach: this implies it can run from any 4k aligned addr, but its not entirely clear how it learns what top-of-ram is
<marex> load u-boot.bin at random address and jump to it, useful during development, since the ARM Trusted Firmware takes effing forever to start there
<clever> i assume its just using the mmu to map itself to the right addr?
<marex> clever: what are you trying to do ?
<clever> marex: run uboot on an rpi2, with the open source firmware
<marex> clever: that's the firmware which runs on the GPU or whatever vector processor they have in there ?
<marex> or does this already run on the ARM core ?
<clever> it runs on the VPU
<clever> in the current configuration, its copying u-boot.bin to arm physical 0, and turning the arm core on
<clever> so byte-0 of u-boot.bin is the very first thing the arm runs out of reset
<clever> and all 4 arm cores run that in parallel
<hramrach> that will likely not work well
<marex> what happens if you compile assembler code which does basically '1: mov r0, #address_of_txfifo \n mov r1, #0x30 \n str r1, [r0] \n b 1b' ?
<clever> oh!, KKKK4444____333322KKK444___333222, thats why each chat is repeated 4 times
<hramrach> can you enable only 1?
<marex> oh, heh
<clever> so if we then dedup that, we get K4_32K4, still a bit scrambled, possibly because it wasnt a PIE build
<clever> so its off by 0x8000
<clever> hramrach: not really, some asm would have to be dropped at 0 that only forwards 1 core on
<clever> and i was working under the assumption that uboot already handled that
<vitali64> Thanks!
<hramrach> you can handle it in u-boot if you put the assembler there
<vitali64> I did get 'K4_32'.
<clever> yeah, i could also modify the platform code
<vitali64> Show up on the screen.
<vitali64> Sometimes.
<clever> vitali64: and the reason you sometimes got KKKK, is because uboot is running on all 4 arm cores at once
<clever> and they are all saving the same thing
<vitali64> K4_32 8.989064 [ARM:bridgeStart]: bridge init done, PM_PROC is now: 0x107F!
<clever> then its just rng, how well they stay in sync
<vitali64> K4_32 8.989064 [ARM:bridgeStart]: bridge init done, PM_PROC is now: 0x107F!
<vitali64> ^^^^^ There
<vitali64> clever: That makes sense!
<clever> vitali64: the official firmware puts one of these arm stubs at 0, it parks 3 of the cores, and then jumps to the 0x8000
<vitali64> clever: I guess we could run u-boot from linux-bootloader.
<clever> that could also be done, but then the SMP problem is back again
<vitali64> Yep.
<clever> another is to just use the official arm stubs
<clever> vitali64: we can look into these ideas tomorrow, now that we have some idea of what is wrong
<vitali64> Yeah.
<vitali64> We could try running u-boot on only one core.
<clever> CONFIG_SYS_TEXT_BASE=0x0 would work on the pi1 then, if you use the pi1 defconfig
<vitali64> clever: I don't.
<vitali64> Wait
<vitali64> The Pi1 has only one core.
<clever> yep, so the smp problem doesnt exist
<vitali64> And we could try running u-boot there first!
<clever> yep
<hramrach> do you expect to use ATF on arm64?
<clever> hramrach: i'm guessing save_boot_params might be a good place for a uboot platform to yoink 3 cores and park them?
<clever> hramrach: i plan to support both with and without
<hramrach> no idea about the early platform code
<clever> save_boot_params is basically the very first thing uboot runs
<hramrach> then you probably want support for loading at non-zero address to make room for ATF, eventually
<clever> so the platform can save things like r0/r1/r2 before uboot starts clobbering things
<clever> board/raspberrypi/rpi/lowlevel_init.S already has a save_boot_params, to save the DTB the firmware loaded
<clever> and when its done, it jumps to save_boot_params_ret
<marex> clever: enable ARM PSCI support like iMX7D or STM32MP15xx does in U-Boot and then let Linux un-park those extra cores via PSCI ?
<marex> until then, just let them spin a WFI loop or so
<clever> marex: is that u-boot emulating psci, or u-boot+linux relying on a 3rd binary to provide psci?
<marex> it's U-Boot providing PSCI
<hramrach> it varies per platform
WoC has quit [Remote host closed the connection]
<marex> hramrach: on the two platforms above, it is U-Boot that is the PSCI provider
<clever> marex: ah, that makes things simpler
<marex> hramrach: not ATF BL31 if that is what you had in mind
<marex> i.e. no external binaries or other crud
<clever> nice
<hramrach> yes, varies per platform
<clever> do you know which file in the source is doing that?
<marex> arch/arm/mach-stm32mp/psci.c
<marex> arch/arm/mach-imx/mx7/psci-mx7.c
<clever> yep, i see
<clever> definitely something i should keep in mind
redbrain has quit [Read error: Connection reset by peer]
<clever> though for stm32mp, it looks like the hardware is co-operating, and you can use registers to wake the core and direct it somewhere
<clever> the rpi entirely lacks that, all 4 cores just start at PC=0 in either EL3 or SMC mode
<clever> and whatever code is at 0, is responsible for parking them until they are ready
<clever> and if you want to forcibly reclaim a lost core, then EL3/SMC would have to be setup, to be able to interrupt them in a sane way
WoC has joined #u-boot
<hramrach> technically if you add code to park the extra cores in u-boot it will be noop on firmware that only runs one core
<clever> yeah
<clever> hramrach: i do have this example that i'm familiar with, if built with SMP support, it will check the core#, and jump off to arm_secondary_setup, which blocks until core-0 has brought the mmu online, then steals its paging tables, and jumps to arm_secondary_entry() (a c function)
<clever> at which point, all cores are running C from virtual addresses
redbrain has joined #u-boot
<marex> clever: these systems generally do have registers where you write the jump address and then reset the core, and it jumps to that address
<clever> marex: i have not seen any sign of one on the rpi soc
<clever> at least for the arm cores
<marex> but like hramrach said, you can also just have a trampoline code, have the core spin in a loop and upon some condition, jump to an address written in DRAM or so
<clever> the VPU does have such a reg however
<clever> yep, thats how the official firmware does it
<clever> this code sets up things like the generic timer freq, and drops out of SMC mode, and parks 3 cores in a spintable
<clever> it also deals with setting r2 to point to the dtb, and jumping to the kernel load addr
<clever> all of that is pre-configured at the atags: and kernel: symbols, before the arm even comes out of reset
<marex> clever: seems like mips and rv behave similar
<clever> the main benefit i can see to having proper registers for per-core reset, is for power savings, to turn a core off entirely
<clever> and since the rpi appears to lack that, the best you can do is just wfi/wfe
<clever> marex: another fun feature of the rpi, the mmio doesnt have to be at the "fixed address" the docs claim
<clever> so i can violate every assumption u-boot has about where to find the uart :P
<clever> it could even differ on every boot!
<hramrach> does arm see the registers that set this, or only vpu does?
<clever> hramrach: only the VPU can write to the registers, and they appear to be write-only
<hramrach> what a great interface
<clever> i suspect it was created back when arm trusted mode was still new
<clever> and rather then trust that new thing, they just distrust the whole damn arm :P
<clever> it can be configure so the arm only has say 32mb of ram, and zero peripherals
<clever> then its only capable of compute tasks, and cant talk to any hardware
<hramrach> it'ss more like thinking that arm is just a peripherial core that you can reconfigure and restart if it happens to crash
<clever> perfect little sandbox to throw untrusted code into
<clever> yep, that too
<clever> because the VPU was originally the master, and ran the entire os and all apps
<clever> on every model, the VPU is a dual-core cpu, with 32 registers of 32bits each, and like arm, some of those registers have a special purpose like status/pc/lr/stack
<clever> unlike arm, any of those 32bit regs can be interpreted as either a 32bit float, or a 32bit int
<marex> clever: btw WFI on stm32mp15xx does force the core into low-power state, disables core clock and all that
<marex> it does save a lot of power
<clever> so you dont have special float registers, only float opcodes
<marex> maybe they do the same
<clever> marex: i have read the arm docs, and there is a signal coming out of the arm cluster, to say when every core is in wfe/wfi state
<clever> which you can then use to shutdown the clocks
<clever> or reduce voltages
<clever> i didnt see a per-core one, but maybe i just missed it
<clever> and yeah, its then up to the silicon designer/implementor, to wire that into something
alpernebbi has quit [Ping timeout: 246 seconds]
alpernebbi has joined #u-boot
<marex> clever: you can put one core into WFI and see whether the consumption goes down
<marex> maybe they have something in the clock block which allows you to turn off core clock manually from core0
<marex> *measure the consumption using e.g. USB power meter, that should be precise enough
<clever> marex: from how the hardware is setup, PLLB takes the 19.2mhz crystal multiplies it up to some clock (identical register layout for every PLL), and then the PLLB_ARM tap divides it back down
<clever> each PLL has up to 4 taps, and there are holes in the register layout when it has fewer
<clever> very much a copy&paste hw block, and they just assign names based on where it was routed
<clever> from what i can see, there is only a single arm clock, but there could be unknowns like you describe, between that divider and each core
<clever> and this has the full clock tree and all of the clock muxes
<clever> each peripheral, such as the PL011 uart, has an 8 clock mux and divider, so you can pick one of those 8 sources, and divide it down further
<clever> in the case of the PL011, 0=gnd (no clock), 1=crystal, 2=TD0, 3=TD1 (test/debug clocks), 4=PLLA_PER, 5=PLLC_PER, 6=PLLD_PER, and 7=PLLH_PER
<clever> the mux isnt listed, but my code is configuring the arm to source 4
vitali64 has quit [Quit: Lost terminal]
lucascastro has joined #u-boot
naoki has joined #u-boot
prabhakarlad has quit [Quit: Client closed]
prabhakarlad has joined #u-boot
lucascastro has quit [Quit: Leaving]
<clever> marex: ah, i was going to complain about how each platform seems to be re-implementing psci, but upon closer inspection, they are all sharing code in arch/arm/cpu/armv7/psci.S
<clever> so my only real complaint, is that psci_features isnt dynamically checking the _psci_table, but thats fairly minor
<clever> so that just means that i need to ensure psci.S is linked into my u-boot, and lands at a reserved addr in ram
<clever> ah, and that then involves CONFIG_ARMV7_SECURE_BASE
<clever> and similarly, i can use that secure/reserved region to protect the spintables and parking code, though the hw lacks actual secure arm memory
WoC has quit [Remote host closed the connection]
urja has quit [Quit: WeeChat 3.6]
urja has joined #u-boot
lucascastro has joined #u-boot
lucascastro has quit [Remote host closed the connection]