Trivial PPC cleanups
cover Trivial PPC cleanups
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
- make check
- make check-avocado
Bernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable over qdev_get_machine() hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate place
hw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Signature · 1 line
2.39.0
PATCH 1/6 target/ppc/mmu_common: Log which effective address had no TLB entry found
Let's not leave developers in the dark where this log message comes from.
--- target/ppc/mmu_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/ppc/mmu_common.c +2 -1
@@ -811,7 +811,8 @@ static int mmubooke206_check_tlb(CPUPPCState *env, ppcmas_tlb_t *tlb, } } -qemu_log_mask (CPU_LOG_MMU ,"%s: TLB entry not found\n" , __func__); +qemu_log_mask (CPU_LOG_MMU ,"%s: No TLB entry found for effective address " +"0x" TARGET_FMT_lx"\n" , __func__, address);return -1 ; found_tlb:
Signature · 1 line
2.39.0
Re: [PATCH 1/6] target/ppc/mmu_common: Log which effective address had no TLB entry found
Quoted 7 lines · Bernhard Beschow
Let's not leave developers in the dark where this log message comes from.
Signed-off-by Bernhard Beschow <[email protected]>--- target/ppc/mmu_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH 2/6 target/ppc/mmu_common: Fix table layout of "info tlb" HMP command
In reply to Bernhard BeschowStarting with the URWX columns the columns didn't line up. Before:
QEMU 7.2.50 monitor - type 'help' for more information (qemu) info tlb
TLB0: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x0000000000a80000 0x000000000105d000 4K 117 0 SR--UR-- --M-- U---- 0x0000000000100000 0x000000000114e000 4K 117 0 SR--UR-- --M-- U---- <snip TLB1: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000c0000000 0x0000000000000000 16M 0 0 SR-XU--- --M-- U---- 0x00000000c1000000 0x0000000001000000 16M 0 0 SRW-U--- --M-- U---- <snip> (qemu)
After:
QEMU 7.2.50 monitor - type 'help' for more information (qemu) info tlb
TLB0: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000b7a00000 0x000000000fcf5000 4K 18 0 SR-- UR-- --M-- U---- 0x0000000000800000 0x000000000fd73000 4K 18 0 SR-- UR-X --M-- U---- <snip> TLB1: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000c0000000 0x0000000000000000 16M 0 0 SR-X U--- --M-- U---- 0x00000000c1000000 0x0000000001000000 16M 0 0 SRW- U--- --M-- U---- <snip> (qemu)
--- target/ppc/mmu_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/mmu_common.c +1 -1
@@ -980,7 +980,7 @@ static void mmubooke206_dump_one_tlb(CPUPPCState *env, int tlbn, int offset, pa = entry->mas7_3 & ~(size -1 ); qemu_printf("0x%016" PRIx64 " 0x%016" PRIx64 " %4s %-5u %1u S%c%c%c" - "U%c%c%c %c%c%c%c%c U%c%c%c%c\n", + " U%c%c%c %c%c%c%c%c U%c%c%c%c\n", (uint64_t)ea, (uint64_t)pa, book3e_tsize_to_str[tsize], (entry->mas1 & MAS1_TID_MASK) >> MAS1_TID_SHIFT,
Signature · 1 line
2.39.0
Re: [PATCH 2/6] target/ppc/mmu_common: Fix table layout of "info tlb" HMP command
Quoted 37 lines · Bernhard Beschow
Starting with the URWX columns the columns didn't line up. Before:
QEMU 7.2.50 monitor - type 'help' for more information (qemu) info tlb TLB0: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x0000000000a80000 0x000000000105d000 4K 117 0 SR--UR-- --M-- U---- 0x0000000000100000 0x000000000114e000 4K 117 0 SR--UR-- --M-- U---- <snip TLB1: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000c0000000 0x0000000000000000 16M 0 0 SR-XU--- --M-- U---- 0x00000000c1000000 0x0000000001000000 16M 0 0 SRW-U--- --M-- U---- <snip> (qemu)After:
QEMU 7.2.50 monitor - type 'help' for more information (qemu) info tlb TLB0: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000b7a00000 0x000000000fcf5000 4K 18 0 SR-- UR-- --M-- U---- 0x0000000000800000 0x000000000fd73000 4K 18 0 SR-- UR-X --M-- U---- <snip> TLB1: Effective Physical Size TID TS SRWX URWX WIMGE U0123 0x00000000c0000000 0x0000000000000000 16M 0 0 SR-X U--- --M-- U---- 0x00000000c1000000 0x0000000001000000 16M 0 0 SRW- U--- --M-- U---- <snip> (qemu)
Quoted 4 lines
Signed-off-by Bernhard Beschow <[email protected]>--- target/ppc/mmu_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 3/6 hw/ppc/virtex_ml507: Prefer local over global variable
In reply to Bernhard Beschow--- hw/ppc/virtex_ml507.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/virtex_ml507.c +1 -1
@@ -157,7 +157,7 @@ static int xilinx_load_device_tree(MachineState *machine,int r;const char *dtb_filename; - dtb_filename = current_machine->dtb; + dtb_filename = machine->dtb;if (dtb_filename) { fdt =load_device_tree (dtb_filename, &fdt_size);if (!fdt) {
Signature · 1 line
2.39.0
Re: [PATCH 3/6] hw/ppc/virtex_ml507: Prefer local over global variable
Quoted 1 line · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>
Quoted 20 lines
--- hw/ppc/virtex_ml507.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/virtex_ml507.c +1
-1@@ -157,7 +157,7 @@ static int xilinx_load_device_tree(MachineState *machine,int r;const char *dtb_filename; - dtb_filename = current_machine->dtb; + dtb_filename = machine->dtb;if (dtb_filename) { fdt =load_device_tree (dtb_filename, &fdt_size);if (!fdt) {Signature · 1 line
2.39.0
Re: [PATCH 3/6] hw/ppc/virtex_ml507: Prefer local over global variable
In reply to Bernhard BeschowQuoted 10 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- hw/ppc/virtex_ml507.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/virtex_ml507.c +0
-0
hw/ppc/virtex_ml507.c static int xilinx_load_device_tree(MachineState *machine, · line 160
Quoted 5 lines
hw/ppc/virtex_ml507.c +1
-1@@ -157,7 +157,7 @@ static int xilinx_load_device_tree(MachineState *machine,int r;const char *dtb_filename; - dtb_filename = current_machine->dtb; + dtb_filename = machine->dtb;
https://lore.kernel.org/qemu-devel/[email protected]/
\o/
PATCH 4/6 hw/ppc/e500: Prefer local variable over qdev_get_machine()
In reply to Bernhard Beschow--- hw/ppc/e500.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/e500.c +2 -2
@@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0 , machine->ram); dev =qdev_new ("e500-ccsr" ); -object_property_add_child (qdev_get_machine (),"e500-ccsr" , +object_property_add_child (OBJECT (machine),"e500-ccsr" ,OBJECT (dev));sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); ccsr =CCSR (dev);
@@ -1002,7 +1002,7 @@ void ppce500_init(MachineState *machine)/* PCI */ dev =qdev_new ("e500-pcihost" ); -object_property_add_child (qdev_get_machine (),"pci-host" ,OBJECT (dev)); +object_property_add_child (OBJECT (machine),"pci-host" ,OBJECT (dev));qdev_prop_set_uint32 (dev,"first_slot" , pmc->pci_first_slot);qdev_prop_set_uint32 (dev,"first_pin_irq" , pci_irq_nrs[0 ]); s =SYS_BUS_DEVICE (dev);
Signature · 1 line
2.39.0
Re: [PATCH 4/6] hw/ppc/e500: Prefer local variable over qdev_get_machine()
Quoted 10 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>---
hw/ppc/e500.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)hw/ppc/e500.c +0
-0
hw/ppc/e500.c void ppce500_init(MachineState *machine) · line 963
Quoted 6 lines
hw/ppc/e500.c +1
-1@@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0 , machine->ram); dev =qdev_new ("e500-ccsr" ); -object_property_add_child (qdev_get_machine (),"e500-ccsr" , +object_property_add_child (OBJECT (machine),"e500-ccsr" ,OBJECT (dev));
Cen the line break removed too? Looks like it fit in one line even before this change so not sure why was written in two lines. Maybe had some longer stuff there before qdev_get_machine().
Regards,
BALATON Zoltan
Quoted 12 lines
hw/ppc/e500.c +1
-1sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); ccsr =CCSR (dev);@@ -1002,7 +1002,7 @@ void ppce500_init(MachineState *machine)/* PCI */ dev =qdev_new ("e500-pcihost" ); -object_property_add_child (qdev_get_machine (),"pci-host" ,OBJECT (dev)); +object_property_add_child (OBJECT (machine),"pci-host" ,OBJECT (dev));qdev_prop_set_uint32 (dev,"first_slot" , pmc->pci_first_slot);qdev_prop_set_uint32 (dev,"first_pin_irq" , pci_irq_nrs[0 ]); s =SYS_BUS_DEVICE (dev);
Re: [PATCH 4/6] hw/ppc/e500: Prefer local variable over qdev_get_machine()
In reply to Bernhard Beschowhw/ppc/e500.c void ppce500_init(MachineState *machine) · line 959
Quoted 11 lines · Bernhard Beschow
Signed-off-by Bernhard Beschow <[email protected]>--- hw/ppc/e500.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/ppc/e500.c +0
-0@@ -959,7 +959,7 @@ void ppce500_init(MachineState *machine)memory_region_add_subregion (address_space_mem,0 , machine->ram);
PATCH 5/6 hw/ppc/e500: Resolve variable shadowing
In reply to Bernhard BeschowAssign to the outer variable instead which even saves some code.
--- hw/ppc/e500.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/ppc/e500.c +1 -3
@@ -883,7 +883,7 @@ void ppce500_init(MachineState *machine)bool kernel_as_payload;hwaddr bios_entry =0 ;target_long payload_size; -struct boot_info *boot_info; +struct boot_info *boot_info =NULL ;int dt_size;int i;unsigned int smp_cpus = machine->smp.cpus;
@@ -938,7 +938,6 @@ void ppce500_init(MachineState *machine)/* Register reset handler */ if (!i) {/* Primary CPU */ -struct boot_info *boot_info; boot_info = g_new0(struct boot_info, 1);qemu_register_reset (ppce500_cpu_reset, cpu); env->load_info = boot_info;
@@ -1217,7 +1216,6 @@ void ppce500_init(MachineState *machine) }assert (dt_size <DTB_MAX_SIZE ); - boot_info = env->load_info; boot_info->entry = bios_entry; boot_info->dt_base = dt_base; boot_info->dt_size = dt_size;
Signature · 1 line
2.39.0
PATCH 6/6 hw/ppc/e500: Move comment to more appropriate place
In reply to Bernhard BeschowThe TLB entries are set up in mmubooke_create_initial_mapping(), not in booke206_page_size_to_tlb().
--- hw/ppc/e500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/e500.c +1 -1
@@ -692,7 +692,6 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine, kernel_base, kernel_size, true); } -/* Create -kernel TLB entries for BookE. */ hwaddr booke206_page_size_to_tlb (uint64_t size) {return 63 -clz64 (size / KiB);
@@ -723,6 +722,7 @@ static uint64_t mmubooke_initial_mapsize(CPUPPCState *env)return (1ULL <<10 << tsize); } +/* Create -kernel TLB entries for BookE. */ static void mmubooke_create_initial_mapping (CPUPPCState *env) {ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,0 );
Signature · 1 line
2.39.0
Quoted 1 line · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Nice. Did you simply use the qemu-ppce500_defconfig ? or an u-boot old image ?
We could update the qemu_ppc_e500mc_defconfig in buildroot to generate the uboot.bin if that worked.
Quoted 14 lines
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate place
Quoted 5 lines
hw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Thanks,
C.
Am 16. Dezember 2022 15:32:00 UTC schrieb "Cédric Le Goater" <[email protected]>:
Quoted 4 lines · Bernhard Beschow
Quoted 1 line
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Nice. Did you simply use the qemu-ppce500_defconfig ? or an u-boot old image ?
I used P1020RDB-PC_NAND_defconfig from the u-boot repository plus my branch https://github.com/shentok/qemu/commits/e500-u-boot . I had to comment out the fdt handling in u-boot for now since I didn't figure out yet how to include the dt blob in the elf binary. Anyway, with this I get a u-boot shell!
Quoted 3 lines
We could update the
qemu_ppc_e500mc_defconfigin buildroot to generate the uboot.bin if that worked.
I haven't looked into that yet but this sounds interesting!
Best regards,
Bernhard
Quoted 28 lines
Quoted 16 lines
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placeQuoted 5 lines
hw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)Reviewed-by Cédric Le Goater <[email protected]>Thanks,
C.
Daniel Henrique Barboza
AppliedQueued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Daniel
Quoted 20 lines · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placehw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Am 16. Dezember 2022 17:50:41 UTC schrieb Daniel Henrique Barboza <[email protected]>:
Quoted 1 line
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Thanks Daniel!
Is there a way we could accomodate for Zoltan's comment still? It's just cosmetics, so should be pretty simple.
Best regards,
Bernhard
Quoted 25 lines
Daniel
Quoted 20 lines · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placehw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Am 20. Dezember 2022 22:40:25 UTC schrieb Bernhard Beschow <[email protected]>:
Quoted 8 lines
Am 16. Dezember 2022 17:50:41 UTC schrieb Daniel Henrique Barboza <[email protected]>:
Quoted 1 line
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Thanks Daniel!
Is there a way we could accomodate for Zoltan's comment still? It's just cosmetics, so should be pretty simple.
Yeah, you sent a pull request already! Thanks!
I''ll address Zoltan's comment in a future series since I'm working on e500 anyway.
Best regards,
Bernhard
Quoted 28 lines
Best regards,
BernhardQuoted 25 lines
Daniel
Quoted 20 lines · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placehw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Quoted 8 lines · Bernhard Beschow
Am 20. Dezember 2022 22:40:25 UTC schrieb Bernhard Beschow <[email protected]>:
Quoted 5 lines
Am 16. Dezember 2022 17:50:41 UTC schrieb Daniel Henrique Barboza <[email protected]>:
Quoted 1 line
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Quoted 7 lines
Quoted 3 lines
Thanks Daniel!
Is there a way we could accomodate for Zoltan's comment still? It's just cosmetics, so should be pretty simple.
Yeah, you sent a pull request already! Thanks!
I''ll address Zoltan's comment in a future series since I'm working on e500 anyway.
I'll have to respin the pull request due to a clang error. I'll take the opportunity to amend patch 4 with mister Balaton's suggestion.
Daniel
Quoted 32 lines
Best regards,
BernhardQuoted 28 lines
Best regards,
BernhardQuoted 25 lines
Daniel
Quoted 20 lines · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placehw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)
Am 21. Dezember 2022 10:27:51 UTC schrieb Daniel Henrique Barboza <[email protected]>:
Quoted 13 lines · Bernhard Beschow
Quoted 10 lines
Am 20. Dezember 2022 22:40:25 UTC schrieb Bernhard Beschow <[email protected]>:
Quoted 7 lines
Am 16. Dezember 2022 17:50:41 UTC schrieb Daniel Henrique Barboza <[email protected]>:
Quoted 1 line
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Thanks Daniel!
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Is there a way we could accomodate for Zoltan's comment still? It's just cosmetics, so should be pretty simple.
Yeah, you sent a pull request already! Thanks!
I''ll address Zoltan's comment in a future series since I'm working on e500 anyway.
I'll have to respin the pull request due to a clang error. I'll take the opportunity to amend patch 4 with mister Balaton's suggestion.
Yay!
Best regards,
Bernhard
Quoted 36 lines
Daniel
Quoted 32 lines
Best regards,
BernhardQuoted 28 lines
Best regards,
BernhardQuoted 25 lines
Daniel
Quoted 20 lines · Bernhard Beschow
These are some patches which helped me when getting a u-boot image to run on ppce500 machine.
Testing done:
-make check
-make check-avocadoBernhard Beschow (6):
target/ppc/mmu_common: Log which effective address had no TLB entry
found
target/ppc/mmu_common: Fix table layout of "info tlb" HMP command hw/ppc/virtex_ml507: Prefer local over global variable hw/ppc/e500: Prefer local variable overqdev_get_machine()hw/ppc/e500: Resolve variable shadowing
hw/ppc/e500: Move comment to more appropriate placehw/ppc/e500.c | 10 ++++------ hw/ppc/virtex_ml507.c | 2 +- target/ppc/mmu_common.c | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-)