ppc patch queue 2013-05-06
Hi Blue / Aurelien,
This is my current patch queue for ppc with last minute changes for 1.5.
Please pull.
Alex
The following changes since commit 8e515b125d5f7849167dbee6cbe6ef61636607d4:
Peter Maydell (1):
configure: Check that "libtool" is not the MacOSX one
are available in the git repository at:
git://github.com/agraf/qemu.git ppc-for-upstream
Alexander Graf (1):
PPC: Add MMU type for 2.06 with AMR but no TB pages
Alexey Kardashevskiy (2):
pseries: Update SLOF firmware image
spapr_llan: fix device reenabling
Anton Blanchard (2):
target-ppc: Fix invalid SPR read/write warnings
target-ppc: Add read and write of PPR SPR
Bharat Bhushan (1):
PPC: e500: initialize GPRs as per epapr
David Gibson (2):
pseries: Factor out check for out-of-bounds LIOBN
pseries: Fix debug message for out-of-bounds address in H_PUT_TCE
Tiejun Chen (1):
PPC: e500: correct params->ram_size with ram_size
hw/net/spapr_llan.c | 2 ++ hw/ppc/e500.c | 31 ++++++++++++++++++++++++++++--- hw/ppc/spapr_iommu.c | 14 +++++++------- pc-bios/README | 4 ++-- pc-bios/slof.bin | Bin 880832 -> 909720 bytes roms/SLOF | 2 +- target-ppc/cpu.h | 3 +++ target-ppc/mmu_helper.c | 4 ++++ target-ppc/translate.c | 32 ++++++++++++++++---------------- target-ppc/translate_init.c | 4 ++++ 10 files changed, 67 insertions(+), 29 deletions(-)
PATCH 1/9 pseries: Factor out check for out-of-bounds LIOBN
From: David Gibson <[email protected]>
PAPR defines LIOBNs (Logical IO Bus Numbers) to be 32-bit, and we check for values that aren't in the code for H_PUT_TCE. This patch factors the check into spapr_tce_find_by_liobn(), which already checks if a 32-bit LIOBN actually exists. This will become more important as future patches add other hypercalls which need to look up a LIOBN.
At the same time we fix the typo in the message.
--- hw/ppc/spapr_iommu.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
hw/ppc/spapr_iommu.c +6 -6
@@ -55,6 +55,12 @@ static sPAPRTCETable *spapr_tce_find_by_liobn(uint32_t liobn) {sPAPRTCETable *tcet; +if (liobn &0xFFFFFFFF00000000ULL ) { +hcall_dprintf ("Request for out-of-bounds LIOBN 0x" TARGET_FMT_lx"\n" , + liobn); +return NULL ; + } + QLIST_FOREACH(tcet, &spapr_tce_tables, list) {if (tcet->liobn == liobn) {return tcet;
@@ -218,12 +224,6 @@ static target_ulong h_put_tce(PowerPCCPU *cpu, sPAPREnvironment *spapr,target_ulong tce = args[2 ];sPAPRTCETable *tcet =spapr_tce_find_by_liobn (liobn); -if (liobn &0xFFFFFFFF00000000ULL ) { -hcall_dprintf ("spapr_vio_put_tce on out-of-boundsw LIOBN " - TARGET_FMT_lx"\n" , liobn); -return H_PARAMETER ; - } - ioba &= ~(SPAPR_TCE_PAGE_SIZE -1 );if (tcet) {
Signature · 1 line
1.6.0.2
PATCH 2/9 pseries: Fix debug message for out-of-bounds address in H_PUT_TCE
In reply to Alexander GrafFrom: David Gibson <[email protected]>
Due to a brain outage, this message says "out-of-boards" instead of "out-of-bounds".
--- hw/ppc/spapr_iommu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/ppc/spapr_iommu.c +1 -1
@@ -205,7 +205,7 @@ static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,sPAPRTCE *tcep;if (ioba >= tcet->window_size) { -hcall_dprintf ("spapr_vio_put_tce on out-of-boards IOBA 0x" +hcall_dprintf ("spapr_vio_put_tce on out-of-bounds IOBA 0x" TARGET_FMT_lx"\n" , ioba);return H_PARAMETER ; }
Signature · 1 line
1.6.0.2
PATCH 3/9 PPC: e500: initialize GPRs as per epapr
In reply to Alexander GrafFrom: Bharat Bhushan <[email protected]>
ePAPR defines the initial values of cpu registers. This patch initialize the GPRs as per ePAPR specification.
This resolves the issue of guest reboot/reset (guest hang on reboot).
--- hw/ppc/e500.c | 30 +++++++++++++++++++++++++++--- 1 files changed, 27 insertions(+), 3 deletions(-)
hw/ppc/e500.c +27 -3
@@ -37,6 +37,7 @@#include "qemu/host-utils.h" #include "hw/pci-host/ppce500.h" +#define EPAPR_MAGIC (0x45504150)#define BINARY_DEVICE_TREE_FILE "mpc8544ds.dtb"#define UIMAGE_LOAD_BASE 0#define DTC_LOAD_PAD 0x1800000
@@ -393,11 +394,10 @@ static inline hwaddr booke206_page_size_to_tlb(uint64_t size)return 63 -clz64 (size >>10 ); } -static void mmubooke_create_initial_mapping (CPUPPCState *env) +static int booke206_initial_map_tsize (CPUPPCState *env) {struct boot_info *bi = env->load_info; -ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,0 ); -hwaddr size, dt_end; +hwaddr dt_end;int ps;/* Our initial TLB entry needs to cover everything from 0 to
@@ -408,6 +408,24 @@ static void mmubooke_create_initial_mapping(CPUPPCState *env)/* e500v2 can only do even TLB size bits */ ps++; } +return ps; +} + +static uint64_t mmubooke_initial_mapsize (CPUPPCState *env) +{ +int tsize; + + tsize =booke206_initial_map_tsize (env); +return (1ULL <<10 << tsize); +} + +static void mmubooke_create_initial_mapping (CPUPPCState *env) +{ +ppcmas_tlb_t *tlb =booke206_get_tlbm (env,1 ,0 ,0 ); +hwaddr size; +int ps; + + ps =booke206_initial_map_tsize (env); size = (ps <<MAS1_TSIZE_SHIFT ); tlb->mas1 =MAS1_VALID | size; tlb->mas2 =0 ;
@@ -444,6 +462,12 @@ static void ppce500_cpu_reset(void *opaque) cs->halted =0 ; env->gpr[1 ] = (16 <<20 ) -8 ; env->gpr[3 ] = bi->dt_base; + env->gpr[4 ] =0 ; + env->gpr[5 ] =0 ; + env->gpr[6 ] =EPAPR_MAGIC ; + env->gpr[7 ] =mmubooke_initial_mapsize (env); + env->gpr[8 ] =0 ; + env->gpr[9 ] =0 ; env->nip = bi->entry;mmubooke_create_initial_mapping (env); }
Signature · 1 line
1.6.0.2
PATCH 4/9 pseries: Update SLOF firmware image
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
Minor SLOF fixes which are required for libvirtd to function properly:
* vio-vscsi: vscsi-report-luns can return 0
* vio-vscsi: added a proper lun parser
* SLOF: vio-vscsi: fixed bug with reported luns
--- pc-bios/README | 4 ++-- pc-bios/slof.bin | Bin 880832 -> 909720 bytes roms/SLOF | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
pc-bios/README +2 -2
@@ -16,8 +16,8 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at - https://github.com/dgibson/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20121018. + https://github.com/aik/SLOF, and the image currently in qemu is + built from git tag qemu-slof-20130430. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit 0ad10f26c94a86a0c9c3970e53f9a9f6a744055d +Subproject commit 8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812
Signature · 1 line
1.6.0.2
PATCH 5/9 PPC: Add MMU type for 2.06 with AMR but no TB pages
In reply to Alexander GrafWhen running -cpu on a POWER7 system with PR KVM, we mask out the 1TB MMU capability from the MMU type mask, but not the AMR bit.
This leads to us having a new MMU type that we don't check for in our MMU management functions.
Add the new type, so that we don't have to worry about breakage there. We're not going to use the TCG MMU management in that case anyway.
The long term fix for this will be to move all these MMU management functions to class callbacks.
--- target-ppc/cpu.h | 3 +++ target-ppc/mmu_helper.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-)
target-ppc/cpu.h +3 -0
@@ -119,6 +119,9 @@ enum powerpc_mmu_t {/* Architecture 2.06 variant */ POWERPC_MMU_2_06 =POWERPC_MMU_64 |POWERPC_MMU_1TSEG |POWERPC_MMU_AMR |0x00000003 , +/* Architecture 2.06 "degraded" (no 1T segments) */ + POWERPC_MMU_2_06a =POWERPC_MMU_64 |POWERPC_MMU_AMR + |0x00000003 ,/* Architecture 2.06 "degraded" (no 1T segments or AMR) */ POWERPC_MMU_2_06d = POWERPC_MMU_64 | 0x00000003, #endif /* defined(TARGET_PPC64) */
target-ppc/mmu_helper.c +4 -0
@@ -1188,6 +1188,7 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)#if defined(TARGET_PPC64 )case POWERPC_MMU_64B :case POWERPC_MMU_2_06 : +case POWERPC_MMU_2_06a:case POWERPC_MMU_2_06d:dump_slb (f, cpu_fprintf, env);break ;
@@ -1324,6 +1325,7 @@ hwaddr cpu_get_phys_page_debug(CPUPPCState *env, target_ulong addr)#if defined(TARGET_PPC64 )case POWERPC_MMU_64B :case POWERPC_MMU_2_06 : +case POWERPC_MMU_2_06a:case POWERPC_MMU_2_06d:return ppc_hash64_get_phys_page_debug (env, addr);#endif
@@ -1815,6 +1817,7 @@ void ppc_tlb_invalidate_all(CPUPPCState *env)#if defined(TARGET_PPC64 )case POWERPC_MMU_64B :case POWERPC_MMU_2_06 : +case POWERPC_MMU_2_06a:case POWERPC_MMU_2_06d:#endif /* defined(TARGET_PPC64) */ tlb_flush (env,1 );
@@ -1884,6 +1887,7 @@ void ppc_tlb_invalidate_one(CPUPPCState *env, target_ulong addr)#if defined(TARGET_PPC64 )case POWERPC_MMU_64B :case POWERPC_MMU_2_06 : +case POWERPC_MMU_2_06a:case POWERPC_MMU_2_06d:/* tlbie invalidate TLBs for all segments */ /* XXX: given the fact that there are too many segments to invalidate,
Signature · 1 line
1.6.0.2
PATCH 6/9 target-ppc: Fix invalid SPR read/write warnings
In reply to Alexander GrafFrom: Anton Blanchard <[email protected]>
Invalid and privileged SPR warnings currently print the wrong address. While fixing that, also make it clear that we are printing both the decimal and hexadecimal SPR number.
Before:
Trying to read invalid spr 896 380 at 0000000000000714
After:
Trying to read invalid spr 896 (0x380) at 0000000000000710
--- target-ppc/translate.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
target-ppc/translate.c +16 -16
@@ -4005,19 +4005,19 @@ static inline void gen_op_mfspr(DisasContext *ctx)* allowing userland application to read the PVR */ if (sprn !=SPR_PVR ) { -qemu_log ("Trying to read privileged spr %d %03x at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip); -printf ("Trying to read privileged spr %d %03x at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip); +qemu_log ("Trying to read privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +printf ("Trying to read privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); }gen_inval_exception (ctx,POWERPC_EXCP_PRIV_REG ); } }else {/* Not defined */ -qemu_log ("Trying to read invalid spr %d %03x at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip); -printf ("Trying to read invalid spr %d %03x at " TARGET_FMT_lx"\n" , - sprn, sprn, ctx->nip); +qemu_log ("Trying to read invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +printf ("Trying to read invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );gen_inval_exception (ctx,POWERPC_EXCP_INVAL_SPR ); } }
@@ -4150,18 +4150,18 @@ static void gen_mtspr(DisasContext *ctx) (*write_cb)(ctx, sprn,rS (ctx->opcode)); }else {/* Privilege exception */ -qemu_log ("Trying to write privileged spr %d %03x at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip); -printf ("Trying to write privileged spr %d %03x at " TARGET_FMT_lx -"\n" , sprn, sprn, ctx->nip); +qemu_log ("Trying to write privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +printf ("Trying to write privileged spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );gen_inval_exception (ctx,POWERPC_EXCP_PRIV_REG ); } }else {/* Not defined */ -qemu_log ("Trying to write invalid spr %d %03x at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip); -printf ("Trying to write invalid spr %d %03x at " TARGET_FMT_lx"\n" , - sprn, sprn, ctx->nip); +qemu_log ("Trying to write invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); +printf ("Trying to write invalid spr %d (0x%03x) at " + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 );gen_inval_exception (ctx,POWERPC_EXCP_INVAL_SPR ); } }
Signature · 1 line
1.6.0.2
PATCH 7/9 target-ppc: Add read and write of PPR SPR
In reply to Alexander GrafFrom: Anton Blanchard <[email protected]>
Recent Linux kernels save and restore the PPR across exceptions so we need to handle it.
--- target-ppc/translate_init.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
target-ppc/translate_init.c +4 -0
@@ -7010,6 +7010,10 @@ static void init_proc_POWER7 (CPUPPCState *env) &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); +spr_register (env,SPR_PPR ,"PPR" , + &spr_read_generic, &spr_write_generic, + &spr_read_generic, &spr_write_generic, +0x00000000 );#if !defined(CONFIG_USER_ONLY ) env->slb_nr =32 ;#endif
Signature · 1 line
1.6.0.2
PATCH 8/9 PPC: e500: correct params->ram_size with ram_size
In reply to Alexander GrafFrom: Tiejun Chen <[email protected]>
We should sync params->ram_size after we fixup memory size on a alignment boundary. Otherwise Guest would exceed the actual memory region.
--- hw/ppc/e500.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
hw/ppc/e500.c +1 -0
@@ -547,6 +547,7 @@ void ppce500_init(PPCE500Params *params)/* Fixup Memory size on a alignment boundary */ ram_size &= ~(RAM_SIZES_ALIGN -1 ); + params->ram_size = ram_size;/* Register Memory */ memory_region_init_ram (ram,"mpc8544ds.ram" , ram_size);
Signature · 1 line
1.6.0.2
PATCH 9/9 spapr_llan: fix device reenabling
In reply to Alexander GrafFrom: Alexey Kardashevskiy <[email protected]>
Normally, the "tap" device is polled by QEMU if a guest NIC can receive packets. If a guest NIC is stopped during transfer (rmmod or ifdown), it may still have packets in a queue which have to be send to the guest before QEMU enables polling of a "tap" interface via tap_update_fd_handler().
However the spapr_llan device was missing the qemu_flush_queued_packets() call so the tap_send_completed() callback was never called and therefore "tap" interface polling was not enabled ever.
The patch fixes this problem.
--- hw/net/spapr_llan.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/net/spapr_llan.c +2 -0
@@ -336,6 +336,8 @@ static target_ulong h_register_logical_lan(PowerPCCPU *cpu,spapr_vio_dma_set (sdev,VLAN_BD_ADDR (rec_queue),0 ,VLAN_BD_LEN (rec_queue)); dev->isopen =1 ; +qemu_flush_queued_packets (qemu_get_queue (dev->nic)); +return H_SUCCESS ; }
Signature · 1 line
1.6.0.2
Quoted 39 lines · Alexander Graf
Hi Blue / Aurelien,
This is my current patch queue for ppc with last minute changes for 1.5.
Please pull.
Alex
The following changes since commit
8e515b125d5f7849167dbee6cbe6ef61636607d4:
Peter Maydell (1):
configure: Check that "libtool" is not the MacOSX oneare available in the git repository at:
git://github.com/agraf/qemu.gitppc-for-upstreamAlexander Graf (1):
PPC: Add MMU type for 2.06 with AMR but no TB pagesAlexey Kardashevskiy (2):
pseries: Update SLOF firmware image
spapr_llan: fix device reenablingAnton Blanchard (2):
target-ppc: Fix invalid SPR read/write warnings
target-ppc: Add read and write of PPR SPRBharat Bhushan (1):
PPC: e500: initialize GPRs as per epaprDavid Gibson (2):
pseries: Factor out check for out-of-bounds LIOBN
pseries: Fix debug message for out-of-bounds address inH_PUT_TCETiejun Chen (1):
PPC: e500: correct params->ram_size with ram_size
Quoted 11 lines
hw/net/spapr_llan.c | 2 ++ hw/ppc/e500.c | 31 ++++++++++++++++++++++++++++--- hw/ppc/spapr_iommu.c | 14 +++++++------- pc-bios/README | 4 ++-- pc-bios/slof.bin | Bin 880832 -> 909720 bytes roms/SLOF | 2 +- target-ppc/cpu.h | 3 +++ target-ppc/mmu_helper.c | 4 ++++ target-ppc/translate.c | 32 ++++++++++++++++---------------- target-ppc/translate_init.c | 4 ++++ 10 files changed, 67 insertions(+), 29 deletions(-)
Thanks, pulled.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net