ppc-for-2.7 queue 20160623
The following changes since commit 6f1d2d1c5ad20d464705b17318cb7ca495f8078a:
Merge remote-tracking branch 'remotes/stsquad/tags/pull-travis-20160621-1' into staging (2016-06-21 15:19:58 +0100)
are available in the git repository at:
git://github.com/dgibson/qemu.git tags/ppc-for-2.7-20160623
for you to fetch changes up to 86b50f2e1befc33407bdfeb6f45f7b0d2439a740:
ppc: Disable huge page support if it is not available for main RAM (2016-06-23 12:53:42 +1000)
----------------------------------------------------------------
ppc patch queue for 2016-06-23
Currently outstanding patches for spapr, target-ppc and related devices. This batch has:
* Significant new progress towards full support for hypervisor mode
* Assorted bugfixes
* Some preliminary patches towards dynamic DMA window support
The last involves a change to memory.c, which Paolo has said I can take through this tree.
----------------------------------------------------------------
Alexey Kardashevskiy (1):
memory: Add reporting of supported page sizes
Aneesh Kumar K.V (1):
powerpc/mm: Update the WIMG check during H_ENTER
Benjamin Herrenschmidt (11):
ppc: Improve emulation of THRM registers
ppc: Fix rfi/rfid/hrfi/... emulation
ppc: define a default LPCR value
ppc: fix exception model for HV mode
ppc: Fix POWER7 and POWER8 exception definitions
ppc: Fix generation if ISI/DSI vs. HV mode
ppc: Rework generation of priv and inval interrupts
ppc: Add real mode CI load/store instructions for P7 and P8
ppc: Turn a bunch of booleans from int to bool
ppc: Move exception generation code out of line
ppc: Add P7/P8 Power Management instructions
Laurent Vivier (1):
ppc64: disable gen_pause() for linux-user mode
Richard Henderson (1):
target-ppc: Fix rlwimi, rlwinm, rlwnm again
Thomas Huth (2):
tests: Use '+=' to add additional tests, not '='
ppc: Disable huge page support if it is not available for main RAM
hw/ppc/spapr_hcall.c | 6 +- hw/ppc/spapr_iommu.c | 8 + hw/vfio/common.c | 9 +- include/exec/memory.h | 19 +- linux-user/main.c | 1 + memory.c | 16 +- target-ppc/cpu-qom.h | 9 + target-ppc/cpu.h | 32 +- target-ppc/excp_helper.c | 263 +++++++------ target-ppc/helper.h | 2 + target-ppc/kvm.c | 17 +- target-ppc/misc_helper.c | 41 +++ target-ppc/mmu-hash64.c | 69 +++- target-ppc/translate.c | 870 ++++++++++++++++++++++---------------------- target-ppc/translate_init.c | 154 +++++++- tests/Makefile.include | 8 +- 16 files changed, 912 insertions(+), 612 deletions(-)
[Qemu-devel] [PULL 02/17] tests: Use '+=' to add additional tests, not '='
From: Thomas Huth <[email protected]>
The recent commit that added the prom-env-test accidentially overwrote the check-qtest-ppc-y, check-qtest-ppc64-y and check-qtest-sparc-y variables instead of extending them.
--- tests/Makefile.include | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/Makefile.include +4 -4
@@ -259,11 +259,11 @@ check-qtest-ppc-y += tests/boot-order-test$(EXESUF) check-qtest-ppc64-y += tests/boot-order-test$(EXESUF) check-qtest-ppc64-y += tests/spapr-phb-test$(EXESUF) gcov-files-ppc64-y += ppc64-softmmu/hw/ppc/spapr_pci.c -check-qtest-ppc-y = tests/prom-env-test$(EXESUF) -check-qtest-ppc64-y = tests/prom-env-test$(EXESUF) -check-qtest-sparc-y = tests/prom-env-test$(EXESUF) +check-qtest-ppc-y += tests/prom-env-test$(EXESUF) +check-qtest-ppc64-y += tests/prom-env-test$(EXESUF) +check-qtest-sparc-y += tests/prom-env-test$(EXESUF) #Disabled for now, triggers a TCG bug on 32-bit hosts -#check-qtest-sparc64-y = tests/prom-env-test$(EXESUF) +#check-qtest-sparc64-y += tests/prom-env-test$(EXESUF) check-qtest-microblazeel-y = $(check-qtest-microblaze-y) check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 01/17] powerpc/mm: Update the WIMG check during H_ENTER
In reply to David GibsonFrom: "Aneesh Kumar K.V" <[email protected]>
Support for 0 value for memeory coherence is optional and with ppc64 we can always enable memory coherence. Linux kernel did that during the development of 4.7 kernel. But that resulted in failure in Qemu in H_ENTER hcall due to below check. The mentioned change was reverted in the kernel and kernel right now enable memory coherence only if cache inhibited is not set. Nevertheless update qemu WIMG flag check to cover the case where we enable memory coherence along with cache inhibited flag.
In order to handle older and newer kernel version consider both Cache inhibitted and (cache inhibitted | memory conference) as valid values for wimg flags.
--- hw/ppc/spapr_hcall.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
hw/ppc/spapr_hcall.c +5 -1
@@ -102,11 +102,15 @@ static target_ulong h_enter(PowerPCCPU *cpu, sPAPRMachineState *spapr,return H_PARAMETER ; } }else { +target_ulong wimg_flags;/* Looks like an IO address */ /* FIXME: What WIMG combinations could be sensible for IO? * For now we allow WIMG=010x, but are there others? */ /* FIXME: Should we check against registered IO addresses? */ -if ((ptel & (HPTE64_R_W |HPTE64_R_I |HPTE64_R_M )) !=HPTE64_R_I ) { + wimg_flags = (ptel & (HPTE64_R_W |HPTE64_R_I |HPTE64_R_M )); + +if (wimg_flags !=HPTE64_R_I && + wimg_flags != (HPTE64_R_I |HPTE64_R_M )) {return H_PARAMETER ; } }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 06/17] memory: Add reporting of supported page sizes
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
Every IOMMU has some granularity which MemoryRegionIOMMUOps::translate uses when translating, however this information is not available outside the translate context for various checks.
This adds a get_min_page_size callback to MemoryRegionIOMMUOps and a wrapper for it so IOMMU users (such as VFIO) can know the minimum actual page size supported by an IOMMU.
As IOMMU MR represents a guest IOMMU, this uses TARGET_PAGE_SIZE as fallback.
This removes vfio_container_granularity() and uses new helper in memory_region_iommu_replay() when replaying IOMMU mappings on added IOMMU memory region.
--- hw/ppc/spapr_iommu.c | 8 ++++++++ hw/vfio/common.c | 9 +-------- include/exec/memory.h | 19 +++++++++++++++---- memory.c | 16 +++++++++++++--- 4 files changed, 37 insertions(+), 15 deletions(-)
hw/ppc/spapr_iommu.c +8 -0
@@ -149,6 +149,13 @@ static void spapr_tce_table_pre_save(void *opaque) tcet->bus_offset, tcet->page_shift); } +static uint64_t spapr_tce_get_min_page_size (MemoryRegion *iommu) +{ +sPAPRTCETable *tcet =container_of (iommu, sPAPRTCETable, iommu); + +return 1ULL << tcet->page_shift; +} +static int spapr_tce_table_post_load (void *opaque,int version_id) {sPAPRTCETable *tcet =SPAPR_TCE_TABLE (opaque);
@@ -228,6 +235,7 @@ static const VMStateDescription vmstate_spapr_tce_table = {static MemoryRegionIOMMUOps spapr_iommu_ops = { .translate = spapr_tce_translate_iommu, + .get_min_page_size = spapr_tce_get_min_page_size, };static int spapr_tce_table_realize (DeviceState *dev)
hw/vfio/common.c +1 -8
@@ -321,11 +321,6 @@ out:rcu_read_unlock (); } -static hwaddr vfio_container_granularity (VFIOContainer *container) -{ -return (hwaddr )1 <<ctz64 (container->iova_pgsizes); -} -static void vfio_listener_region_add (MemoryListener *listener,MemoryRegionSection *section) {
@@ -392,9 +387,7 @@ static void vfio_listener_region_add(MemoryListener *listener,QLIST_INSERT_HEAD (&container->giommu_list, giommu, giommu_next);memory_region_register_iommu_notifier (giommu->iommu, &giommu->n); -memory_region_iommu_replay (giommu->iommu, &giommu->n, -vfio_container_granularity (container), - false); +memory_region_iommu_replay (giommu->iommu, &giommu->n, false);return ; }
include/exec/memory.h +15 -4
@@ -151,6 +151,8 @@ typedef struct MemoryRegionIOMMUOps MemoryRegionIOMMUOps;struct MemoryRegionIOMMUOps {/* Return a TLB entry that contains a given address. */ IOMMUTLBEntry (*translate)(MemoryRegion *iommu,hwaddr addr,bool is_write); +/* Returns minimum supported page size */ +uint64_t (*get_min_page_size)(MemoryRegion *iommu); };typedef struct CoalescedMemoryRange CoalescedMemoryRange ;
@@ -573,6 +575,16 @@ static inline bool memory_region_is_iommu(MemoryRegion *mr)/** +* memory_region_iommu_get_min_page_size: get minimum supported page size +* for an iommu +* +* Returns minimum supported page size for an iommu. +* +* @mr: the memory region being queried +*/ +uint64_t memory_region_iommu_get_min_page_size (MemoryRegion *mr); + +/** * memory_region_notify_iommu: notify a change in an IOMMU translation entry. * * @mr: the memory region that was changed
@@ -596,16 +608,15 @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n);/** * memory_region_iommu_replay: replay existing IOMMU translations to -* a notifier +* a notifier with the minimum page granularity returned by +* mr->iommu_ops->get_page_size(). * * @mr: the memory region to observe * @n: the notifier to which to replay iommu mappings -* @granularity: Minimum page granularity to replay notifications for * @is_write: Whether to treat the replay as a translate "write" * through the iommu */ -void memory_region_iommu_replay (MemoryRegion *mr,Notifier *n, -hwaddr granularity,bool is_write); +void memory_region_iommu_replay (MemoryRegion *mr,Notifier *n,bool is_write);/** * memory_region_unregister_iommu_notifier: unregister a notifier for
memory.c +13 -3
@@ -1502,12 +1502,22 @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n)notifier_list_add (&mr->iommu_notify, n); } -void memory_region_iommu_replay (MemoryRegion *mr,Notifier *n, -hwaddr granularity,bool is_write) +uint64_t memory_region_iommu_get_min_page_size (MemoryRegion *mr) { -hwaddr addr; +assert (memory_region_is_iommu (mr)); +if (mr->iommu_ops && mr->iommu_ops->get_min_page_size) { +return mr->iommu_ops->get_min_page_size (mr); + } +return TARGET_PAGE_SIZE ; +} + +void memory_region_iommu_replay (MemoryRegion *mr,Notifier *n,bool is_write) +{ +hwaddr addr, granularity;IOMMUTLBEntry iotlb; + granularity =memory_region_iommu_get_min_page_size (mr); +for (addr =0 ; addr <memory_region_size (mr); addr += granularity) { iotlb = mr->iommu_ops->translate (mr, addr, is_write);if (iotlb.perm !=IOMMU_NONE ) {
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 17/17] ppc: Disable huge page support if it is not available for main RAM
In reply to David GibsonFrom: Thomas Huth <[email protected]>
On powerpc, we must only signal huge page support to the guest if all memory areas are capable of supporting huge pages. The commit 2d103aae8765 ("fix hugepage support when using memory-backend-file") already fixed the case when the user specified the mem-path property for NUMA memory nodes instead of using the global "-mem-path" option. However, there is one more case where it currently can go wrong. When specifying additional memory DIMMs without using NUMA, e.g.
qemu-system-ppc64 -enable-kvm ... -m 1G,slots=2,maxmem=2G \
-device pc-dimm,id=dimm-mem1,memdev=mem1 -object \
memory-backend-file,policy=default,mem-path=/...,size=1G,id=mem1the code in getrampagesize() currently assumes that huge pages are possible since they are enabled for the mem1 object. But since the main RAM is not backed by a huge page filesystem, the guest Linux kernel then crashes very quickly after being started. So in case the we've got "normal" memory without NUMA and without the global "-mem-path" option, we must not announce huge pages to the guest. Since this is likely a mis-configuration by the user, also spill out a message in this case.
--- target-ppc/kvm.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
target-ppc/kvm.c +16 -1
@@ -27,6 +27,7 @@#include "qemu/timer.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" +#include "sysemu/numa.h" #include "kvm_ppc.h" #include "sysemu/cpus.h" #include "sysemu/device_tree.h"
@@ -388,7 +389,21 @@ static long getrampagesize(void)object_child_foreach (memdev_root, find_max_supported_pagesize, &hpsize); -return (hpsize ==LONG_MAX ) ?getpagesize () : hpsize; +if (hpsize ==LONG_MAX ) { +return getpagesize (); + } + +if (nb_numa_nodes ==0 && hpsize >getpagesize ()) { +/* No NUMA nodes and normal RAM without -mem-path ==> no huge pages! */ +static bool warned; +if (!warned) { +error_report ("Huge page support disabled (n/a for main memory)." ); + warned = true; + } +return getpagesize (); + } + +return hpsize; }static bool kvm_valid_page_size (uint32_t flags,long rampgsize,uint32_t shift)
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 03/17] ppc64: disable gen_pause() for linux-user mode
In reply to David GibsonFrom: Laurent Vivier <[email protected]>
While trying to install a fedora container with "lxc-create -t fedora -- -I qemu-ppc64" the installation abort with the following error:
qemu: fatal: Unknown exception 0x65537. Aborting
NIP 0000004000927924 LR 00000040009e325c CTR 0000004000927480 XER 0000000000000000 CPU#0
MSR 9000000102806000 HID0 0000000000000000 HF 9000000002806000 iidx 3 didx 3 TB 00248932 1069155773327487
GPR00 00000040009e325c 00000040007ff800 0000004000aba098 0000000000000000 GPR04 00000040007ff878 0000004000dcb588 0000004000dcb830 0000004000a7a098 GPR08 0000000000000000 0000000000000000 00000040007ff878 0000004000927960 GPR12 0000000022022448 0000004000e2aef0 0000000000000000 0000000000000000 GPR16 0000000000000000 0000000000000000 0000000000000002 0000000000000001 GPR20 0000000000000000 0000000000000000 0000000000000000 0000004000800699 GPR24 0000004000e13320 0000000000000000 0000004000ac9ad8 0000004000ac9ae0 GPR28 0000000000000001 00000000100210a0 0000000000000000 0000000000000038
CR 22022442 [ E E - E E G G E ] RES ffffffffffffffff
FPR00 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR04 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR08 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR12 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR16 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR20 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR24 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPR28 0000000000000000 0000000000000000 0000000000000000 0000000000000000 FPSCR 0000000000000000/usr/share/lxc/templates/lxc-fedora: line 487: 26661 Aborted (core dumped) chroot . yum -y --nogpgcheck --installroot /run/install install python rpm yum
I've bisected until the commit:
commit b68e60e6f0d2865e961a800fb8db96a7fc6494c4
Author: Benjamin Herrenschmidt <[email protected]>
Date: Tue May 3 18:03:33 2016 +0200
ppc: Get out of emulation on SMT "OR" ops
Otherwise tight loops at smt_low for example, which OPAL does, eat so much CPU that we can't boot a kernel anymore. With that, I can boot 8 CPUs just fine with powernv.
We can fix that by preventing to send EXCP_HLT in the case of linux-user mode, as the main loop doesn't know how to manage it.
--- target-ppc/translate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target-ppc/translate.c +3 -1
@@ -1394,7 +1394,7 @@ GEN_LOGICAL2(nand, tcg_gen_nand_tl, 0x0E, PPC_INTEGER);/* nor & nor. */ GEN_LOGICAL2 (nor, tcg_gen_nor_tl,0x03 ,PPC_INTEGER ); -#if defined(TARGET_PPC64 ) +#if defined(TARGET_PPC64 ) && !defined(CONFIG_USER_ONLY )static void gen_pause (DisasContext *ctx) {TCGv_i32 t0 =tcg_const_i32 (0 );
@@ -1482,7 +1482,9 @@ static void gen_or(DisasContext *ctx)/* Pause us out of TCG otherwise spin loops with smt_low * eat too much CPU and the kernel hangs */ +#if !defined(CONFIG_USER_ONLY )gen_pause (ctx); +#endif }#endif }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 07/17] ppc: Fix rfi/rfid/hrfi/... emulation
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
This reworks emulation of the various "rfi" variants. I removed some masking bits that I couldn't make sense of, the only bit that I am aware we should mask here is POW, the CPU's MSR mask should take care of the rest.
This also fixes some problems when running 32-bit userspace under a 64-bit kernel.
This patch broke 32bit OpenBIOS when run under a 970 cpu. A fix was proposed here :
https://www.coreboot.org/pipermail/openbios/2016-June/009452.html
[dwg: Remove hunk which disabled rfi on 64-bit CPUS. The change was
correct, but we need to fix OpenBIOS before applying it]
--- target-ppc/excp_helper.c | 51 +++++++++++++++++++----------------------------- target-ppc/translate.c | 4 ++++ 2 files changed, 24 insertions(+), 31 deletions(-)
target-ppc/excp_helper.c +20 -31
@@ -922,25 +922,20 @@ void helper_store_msr(CPUPPCState *env, target_ulong val) } } -static inline void do_rfi (CPUPPCState *env,target_ulong nip,target_ulong msr, -target_ulong msrm,int keep_msrh) +static inline void do_rfi (CPUPPCState *env,target_ulong nip,target_ulong msr) {CPUState *cs =CPU (ppc_env_get_cpu (env)); +/* MSR:POW cannot be set by any form of rfi */ + msr &= ~(1ULL <<MSR_POW ); +#if defined(TARGET_PPC64 ) -if (msr_is_64bit (env, msr)) { - nip = (uint64_t )nip; - msr &= (uint64_t )msrm; - }else { +/* Switching to 32-bit ? Crop the nip */ +if (!msr_is_64bit (env, msr)) { nip = (uint32_t )nip; - msr = (uint32_t )(msr & msrm); -if (keep_msrh) { - msr |= env->msr & ~((uint64_t )0xFFFFFFFF ); - } }#else nip = (uint32_t )nip; - msr &= (uint32_t )msrm;#endif /* XXX: beware: this is false if VLE is supported */ env->nip = nip & ~((target_ulong )0x00000003 );
@@ -959,26 +954,24 @@ static inline void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr,void helper_rfi (CPUPPCState *env) { -if (env->excp_model ==POWERPC_EXCP_BOOKE ) { -do_rfi (env, env->spr[SPR_SRR0 ], env->spr[SPR_SRR1 ], - ~((target_ulong )0 ),0 ); - }else { -do_rfi (env, env->spr[SPR_SRR0 ], env->spr[SPR_SRR1 ], - ~((target_ulong )0x783F0000 ),1 ); - } +do_rfi (env, env->spr[SPR_SRR0 ], env->spr[SPR_SRR1 ] &0xfffffffful ); } +#define MSR_BOOK3S_MASK #if defined(TARGET_PPC64 )void helper_rfid (CPUPPCState *env) { -do_rfi (env, env->spr[SPR_SRR0 ], env->spr[SPR_SRR1 ], - ~((target_ulong )0x783F0000 ),0 ); +/* The architeture defines a number of rules for which bits +* can change but in practice, we handle this in hreg_store_msr() +* which will be called by do_rfi(), so there is no need to filter +* here +*/ +do_rfi (env, env->spr[SPR_SRR0 ], env->spr[SPR_SRR1 ]); }void helper_hrfid (CPUPPCState *env) { -do_rfi (env, env->spr[SPR_HSRR0 ], env->spr[SPR_HSRR1 ], - ~((target_ulong )0x783F0000 ),0 ); +do_rfi (env, env->spr[SPR_HSRR0 ], env->spr[SPR_HSRR1 ]); }#endif
@@ -986,28 +979,24 @@ void helper_hrfid(CPUPPCState *env)/* Embedded PowerPC specific helpers */ void helper_40x_rfci (CPUPPCState *env) { -do_rfi (env, env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3], - ~((target_ulong )0xFFFF0000 ),0 ); +do_rfi (env, env->spr[SPR_40x_SRR2], env->spr[SPR_40x_SRR3]); }void helper_rfci (CPUPPCState *env) { -do_rfi (env, env->spr[SPR_BOOKE_CSRR0 ], env->spr[SPR_BOOKE_CSRR1 ], - ~((target_ulong )0 ),0 ); +do_rfi (env, env->spr[SPR_BOOKE_CSRR0 ], env->spr[SPR_BOOKE_CSRR1 ]); }void helper_rfdi (CPUPPCState *env) {/* FIXME: choose CSRR1 or DSRR1 based on cpu type */ -do_rfi (env, env->spr[SPR_BOOKE_DSRR0 ], env->spr[SPR_BOOKE_DSRR1 ], - ~((target_ulong )0 ),0 ); +do_rfi (env, env->spr[SPR_BOOKE_DSRR0 ], env->spr[SPR_BOOKE_DSRR1 ]); }void helper_rfmci (CPUPPCState *env) {/* FIXME: choose CSRR1 or MCSRR1 based on cpu type */ -do_rfi (env, env->spr[SPR_BOOKE_MCSRR0 ], env->spr[SPR_BOOKE_MCSRR1 ], - ~((target_ulong )0 ),0 ); +do_rfi (env, env->spr[SPR_BOOKE_MCSRR0 ], env->spr[SPR_BOOKE_MCSRR1 ]); }#endif
@@ -1045,7 +1034,7 @@ void helper_td(CPUPPCState *env, target_ulong arg1, target_ulong arg2,void helper_rfsvc (CPUPPCState *env) { -do_rfi (env, env->lr, env->ctr,0x0000FFFF ,0 ); +do_rfi (env, env->lr, env->ctr &0x0000FFFF ); }/* Embedded.Processor Control */
target-ppc/translate.c +4 -0
@@ -4119,6 +4119,10 @@ static void gen_rfi(DisasContext *ctx)#if defined(CONFIG_USER_ONLY )gen_inval_exception (ctx,POWERPC_EXCP_PRIV_OPC );#else +/* FIXME: This instruction doesn't exist anymore on 64-bit server +* processors compliant with arch 2.x, we should remove it there, +* but we need to fix OpenBIOS not to use it on 970 first +*/ /* Restore CPU state */ if (unlikely (ctx->pr)) {gen_inval_exception (ctx,POWERPC_EXCP_PRIV_OPC );
Signature · 1 line
2.5.5
Re: [Qemu-devel] [PULL 07/17] ppc: Fix rfi/rfid/hrfi/... emulation
Quoted 6 lines · David Gibson
From: Benjamin Herrenschmidt <[email protected]>
This reworks emulation of the various "rfi" variants. I removed some masking bits that I couldn't make sense of, the only bit that I am aware we should mask here is POW, the CPU's MSR mask should take care of the rest.
See I'd rather we didn't boot at all.
I just spent hours trying to figure out why my kernel wouldn't boot in qemu on a mac99 model with 970, weird weird things happening inside the device-tree parsing...
Until I figured we were losing the 64-bit mode in the MSR. Why ?
Because OpenBIOS isn't bolting the hash entries or SLBs for the entire kernel ! So we are taking some exceptions right during the early assembly, precisely between enable_64b_mode and __mmu_off.
Now this is really fishy to begin with, there is code in there that will use SRR0/SRR1 and won't expect a fault of any sort... such as __mmu_off itself.
The problem in our case was that OpenBIOS using rfi, it only restores 32-bits of the MSR, so we lose the 64-bit flag.
Typically that was happening on the call to __cpu_preinit_ppc970 which happens to reside far enough away that it needs a new translation.
I wonder if prom_init should "touch" the entire kernel for safety, but in any case, OpenBIOS need that fix urgently.
Cheers,
Ben.
Re: [Qemu-devel] [PULL 07/17] ppc: Fix rfi/rfid/hrfi/... emulation
Quoted 24 lines · Benjamin Herrenschmidt
Quoted 6 lines · David Gibson
From: Benjamin Herrenschmidt <[email protected]>
This reworks emulation of the various "rfi" variants. I removed some masking bits that I couldn't make sense of, the only bit that I am aware we should mask here is POW, the CPU's MSR mask should take care of the rest.
See I'd rather we didn't boot at all.
I just spent hours trying to figure out why my kernel wouldn't boot in qemu on a mac99 model with 970, weird weird things happening inside the device-tree parsing...
Until I figured we were losing the 64-bit mode in the MSR. Why ?
Because OpenBIOS isn't bolting the hash entries or SLBs for the entire kernel ! So we are taking some exceptions right during the early assembly, precisely between
enable_64b_modeand__mmu_off.Now this is really fishy to begin with, there is code in there that will use SRR0/SRR1 and won't expect a fault of any sort... such as
__mmu_offitself.
Quoted 8 lines
The problem in our case was that OpenBIOS using rfi, it only restores 32-bits of the MSR, so we lose the 64-bit flag.
Typically that was happening on the call to
__cpu_preinit_ppc970which happens to reside far enough away that it needs a new translation.I wonder if
prom_initshould "touch" the entire kernel for safety, but in any case, OpenBIOS need that fix urgently.
I know, and I do apologies as the OpenBIOS repository has been in freeze for a month now trying to transition over to git. I'll send a follow-up email ASAP.
ATB,
Mark.
Re: [Qemu-devel] [PULL 07/17] ppc: Fix rfi/rfid/hrfi/... emulation
In reply to Benjamin HerrenschmidtQuoted 24 lines · Benjamin Herrenschmidt
Quoted 6 lines · David Gibson
From: Benjamin Herrenschmidt <[email protected]>
This reworks emulation of the various "rfi" variants. I removed some masking bits that I couldn't make sense of, the only bit that I am aware we should mask here is POW, the CPU's MSR mask should take care of the rest.
See I'd rather we didn't boot at all.
I just spent hours trying to figure out why my kernel wouldn't boot in qemu on a mac99 model with 970, weird weird things happening inside the device-tree parsing...
Until I figured we were losing the 64-bit mode in the MSR. Why ?
Because OpenBIOS isn't bolting the hash entries or SLBs for the entire kernel ! So we are taking some exceptions right during the early assembly, precisely between
enable_64b_modeand__mmu_off.Now this is really fishy to begin with, there is code in there that will use SRR0/SRR1 and won't expect a fault of any sort... such as
__mmu_offitself.
Quoted 8 lines
The problem in our case was that OpenBIOS using rfi, it only restores 32-bits of the MSR, so we lose the 64-bit flag.
Typically that was happening on the call to __cpu_preinit_ppc970 which happens to reside far enough away that it needs a new translation.
I wonder if
prom_initshould "touch" the entire kernel for safety, but in any case, OpenBIOS need that fix urgently.
Ah, ok, I hadn't realized that OpenBIOS still failed to boot, just later in the process with this hunk left out.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PULL 07/17] ppc: Fix rfi/rfid/hrfi/... emulation
Quoted 5 lines · David Gibson
Quoted 2 lines
I wonder if
prom_initshould "touch" the entire kernel for safety, but in any case, OpenBIOS need that fix urgently.Ah, ok, I hadn't realized that OpenBIOS still failed to boot, just later in the process with this hunk left out.
OpenBIOS itself works, but the kernel then fails in odd ways :-)
Cheers,
Ben.
[Qemu-devel] [PULL 09/17] ppc: fix exception model for HV mode
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
This properly implements LPES0 handling for HV vs. !HV mode and removes the unsupported LPES1. This has been removed from the specs since ISA v2.07.
[clg: AIL implementation was fixed in commit 5c94b2a5e5ef. This patch
only contains the bits of the original patch related to LPES0 handling, adapted commit log.
fixed checkpatch.pl errors. ]
--- target-ppc/excp_helper.c | 134 ++++++++++++++++------------------------------- 1 file changed, 45 insertions(+), 89 deletions(-)
target-ppc/excp_helper.c +45 -89
@@ -77,18 +77,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)CPUState *cs =CPU (cpu);CPUPPCState *env = &cpu->env;target_ulong msr, new_msr, vector; -int srr0, srr1, asrr0, asrr1; -int lpes0, lpes1, lev, ail; - -if (0 ) { -/* XXX: find a suitable condition to enable the hypervisor mode */ - lpes0 = (env->spr[SPR_LPCR ] >>1 ) &1 ; - lpes1 = (env->spr[SPR_LPCR ] >>2 ) &1 ; - }else { -/* Those values ensure we won't enter the hypervisor mode */ - lpes0 =0 ; - lpes1 =1 ; - } +int srr0, srr1, asrr0, asrr1, lev, ail; +bool lpes0;qemu_log_mask (CPU_LOG_INT ,"Raise exception at " TARGET_FMT_lx" => %08x (%02x)\n" , env->nip, excp, env->error_code);
@@ -100,8 +90,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) msr = env->msr & ~0x783f0000ULL ; } -/* new interrupt handler msr */ - new_msr = env->msr & ((target_ulong )1 <<MSR_ME ); +/* new interrupt handler msr preserves existing HV and ME unless +* explicitly overriden +*/ + new_msr = env->msr & (((target_ulong )1 <<MSR_ME ) |MSR_HVB );/* target registers */ srr0 =SPR_SRR0 ;
@@ -111,12 +103,19 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)/* Exception targetting modifiers * +* LPES0 is supported on POWER7/8 +* LPES1 is not supported (old iSeries mode) +* +* On anything else, we behave as if LPES0 is 1 +* (externals don't alter MSR:HV) +* * AIL is initialized here but can be cleared by * selected exceptions */ #if defined(TARGET_PPC64 )if (excp_model ==POWERPC_EXCP_POWER7 || excp_model ==POWERPC_EXCP_POWER8 ) { + lpes0 = !!(env->spr[SPR_LPCR ] &LPCR_LPES0 );if (excp_model ==POWERPC_EXCP_POWER8 ) { ail = (env->spr[SPR_LPCR ] &LPCR_AIL ) >>LPCR_AIL_SHIFT ; }else {
@@ -125,6 +124,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) } else#endif /* defined(TARGET_PPC64) */ { + lpes0 = true; ail =0 ; }
@@ -162,10 +162,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) cs->halted =1 ; cs->interrupt_request |=CPU_INTERRUPT_EXITTB ; } -if (0 ) { -/* XXX: find a suitable condition to enable the hypervisor mode */ - new_msr |= (target_ulong )MSR_HVB ; - } + new_msr |= (target_ulong )MSR_HVB ; ail =0 ;/* machine check exceptions don't have ME set */
@@ -191,23 +188,20 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)case POWERPC_EXCP_DSI :/* Data storage exception */ LOG_EXCP ("DSI exception: DSISR=" TARGET_FMT_lx" DAR=" TARGET_FMT_lx"\n" , env->spr[SPR_DSISR ], env->spr[SPR_DAR ]); -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_next;case POWERPC_EXCP_ISI :/* Instruction storage exception */ LOG_EXCP ("ISI exception: msr=" TARGET_FMT_lx", nip=" TARGET_FMT_lx"\n" , msr, env->nip); -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } msr |= env->error_code; goto store_next;case POWERPC_EXCP_EXTERNAL :/* External input */ cs =CPU (cpu); -if (lpes0 ==1 ) { +if (!lpes0) { new_msr |= (target_ulong )MSR_HVB ; + new_msr |= env->msr & ((target_ulong )1 <<MSR_RI ); + srr0 =SPR_HSRR0 ; + srr1 =SPR_HSRR1 ; }if (env->mpic_proxy) {/* IACK the IRQ on delivery */
@@ -215,9 +209,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) } goto store_next;case POWERPC_EXCP_ALIGN :/* Alignment exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - }/* XXX: this is false */ /* Get rS/rD and rA from faulting opcode */ env->spr[SPR_DSISR] |= (cpu_ldl_code(env, (env->nip - 4))
@@ -232,9 +223,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) env->error_code =0 ;return ; } -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } msr |=0x00100000 ;if (msr_fe0 == msr_fe1) { goto store_next;
@@ -243,23 +231,14 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)break ;case POWERPC_EXCP_INVAL :LOG_EXCP ("Invalid instruction at " TARGET_FMT_lx"\n" , env->nip); -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } msr |=0x00080000 ; env->spr[SPR_BOOKE_ESR ] =ESR_PIL ;break ;case POWERPC_EXCP_PRIV : -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } msr |=0x00040000 ; env->spr[SPR_BOOKE_ESR ] =ESR_PPR ;break ;case POWERPC_EXCP_TRAP : -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } msr |=0x00020000 ; env->spr[SPR_BOOKE_ESR ] =ESR_PTR ;break ;
@@ -271,27 +250,23 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) } goto store_current;case POWERPC_EXCP_FPU :/* Floating-point unavailable exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_current;case POWERPC_EXCP_SYSCALL :/* System call exception */ dump_syscall (env); lev = env->error_code; + +/* "PAPR mode" built-in hypercall emulation */ if ((lev ==1 ) && cpu_ppc_hypercall) {cpu_ppc_hypercall (cpu);return ; } -if (lev ==1 || (lpes0 ==0 && lpes1 ==0 )) { +if (lev ==1 ) { new_msr |= (target_ulong )MSR_HVB ; } goto store_next;case POWERPC_EXCP_APU :/* Auxiliary processor unavailable */ goto store_current;case POWERPC_EXCP_DECR :/* Decrementer exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_next;case POWERPC_EXCP_FIT :/* Fixed-interval timer interrupt */ /* FIT on 4xx */
@@ -361,21 +336,12 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) new_msr &= ~((target_ulong )1 <<MSR_ME ); } -if (0 ) { -/* XXX: find a suitable condition to enable the hypervisor mode */ - new_msr |= (target_ulong )MSR_HVB ; - } + new_msr |= (target_ulong )MSR_HVB ; ail =0 ; goto store_next;case POWERPC_EXCP_DSEG :/* Data segment exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_next;case POWERPC_EXCP_ISEG :/* Instruction segment exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_next;case POWERPC_EXCP_HDECR :/* Hypervisor decrementer exception */ srr0 =SPR_HSRR0 ;
@@ -384,9 +350,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) new_msr |= env->msr & ((target_ulong )1 <<MSR_RI ); goto store_next;case POWERPC_EXCP_TRACE :/* Trace exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_next;case POWERPC_EXCP_HDSI :/* Hypervisor data storage exception */ srr0 =SPR_HSRR0 ;
@@ -413,19 +376,10 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) new_msr |= env->msr & ((target_ulong )1 <<MSR_RI ); goto store_next;case POWERPC_EXCP_VPU :/* Vector unavailable exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_current;case POWERPC_EXCP_VSXU :/* VSX unavailable exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_current;case POWERPC_EXCP_FU :/* Facility unavailable exception */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - } goto store_current;case POWERPC_EXCP_PIT :/* Programmable interval timer interrupt */ LOG_EXCP ("PIT exception\n" );
@@ -444,9 +398,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) "is not implemented yet !\n"); goto store_next;case POWERPC_EXCP_IFTLB :/* Instruction fetch TLB error */ -if (lpes1 ==0 ) {/* XXX: check this */ - new_msr |= (target_ulong )MSR_HVB ; - }switch (excp_model) {case POWERPC_EXCP_602 :case POWERPC_EXCP_603 :
@@ -463,9 +414,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) }break ;case POWERPC_EXCP_DLTLB :/* Data load TLB miss */ -if (lpes1 ==0 ) {/* XXX: check this */ - new_msr |= (target_ulong )MSR_HVB ; - }switch (excp_model) {case POWERPC_EXCP_602 :case POWERPC_EXCP_603 :
@@ -482,9 +430,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) }break ;case POWERPC_EXCP_DSTLB :/* Data store TLB miss */ -if (lpes1 ==0 ) {/* XXX: check this */ - new_msr |= (target_ulong )MSR_HVB ; - }switch (excp_model) {case POWERPC_EXCP_602 :case POWERPC_EXCP_603 :
@@ -590,9 +535,6 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) "is not implemented yet !\n"); goto store_next;case POWERPC_EXCP_PERFM :/* Embedded performance monitor interrupt */ -if (lpes1 ==0 ) { - new_msr |= (target_ulong )MSR_HVB ; - }/* XXX: TODO */ cpu_abort (cs,"Performance counter exception is not implemented yet !\n" );
@@ -636,6 +578,13 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) }/* Save MSR */ env->spr[srr1] = msr; + +/* Sanity check */ +if (!(env->msr_mask &MSR_HVB ) && (srr0 ==SPR_HSRR0 )) { +cpu_abort (cs,"Trying to deliver HV exception %d with " +"no HV support\n" , excp); + } +/* If any alternate SRR register are defined, duplicate saved values */ if (asrr0 !=-1 ) { env->spr[asrr0] = env->spr[srr0];
@@ -644,14 +593,20 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) env->spr[asrr1] = env->spr[srr1]; } -if (env->spr[SPR_LPCR ] &LPCR_AIL ) { - new_msr |= (1 <<MSR_IR ) | (1 <<MSR_DR ); - } - +/* Sort out endianness of interrupt, this differs depending on the +* CPU, the HV mode, etc... +*/ #ifdef TARGET_PPC64 -if (excp_model ==POWERPC_EXCP_POWER7 || - excp_model ==POWERPC_EXCP_POWER8 ) { -if (env->spr[SPR_LPCR ] &LPCR_ILE ) { + if (excp_model == POWERPC_EXCP_POWER7) { + if (!(new_msr & MSR_HVB) && (env->spr[SPR_LPCR] & LPCR_ILE)) { + new_msr |= (target_ulong)1 << MSR_LE; + } + } else if (excp_model == POWERPC_EXCP_POWER8) { + if (new_msr & MSR_HVB) { + if (env->spr[SPR_HID0] & HID0_HILE) { + new_msr |= (target_ulong)1 << MSR_LE; + } + } else if (env->spr[SPR_LPCR] & LPCR_ILE) { new_msr |= (target_ulong)1 << MSR_LE; } } else if (msr_ile) {
@@ -674,7 +629,8 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)/* AIL only works if there is no HV transition and we are running with * translations enabled */ -if (!((msr >>MSR_IR ) &1 ) || !((msr >>MSR_DR ) &1 )) { +if (!((msr >>MSR_IR ) &1 ) || !((msr >>MSR_DR ) &1 ) || + ((new_msr &MSR_HVB ) && !(msr &MSR_HVB ))) { ail =0 ; }/* Handle AIL */
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 11/17] ppc: Fix generation if ISI/DSI vs. HV mode
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
Under some circumstances, we need to direct ISI and DSI interrupts at the hypervisor, turning them into HISI/HDSI, and using different SPRs (HDSISR and HDAR) depending on the combination of MSR_DR and the corresponding VPM bits in LPCR.
This moves part of the code into helpers that are fixed to select the right exception type and registers. On pre-P7 processors, LPCR is 0 which provides the old behaviour of directing the interrupts at the supervisor.
Thanks to Andrei Warkentin for finding a bug when HV=1
[clg: Merged a fix on POWERPC_EXCP_HDSI fixing the condition on
msr_hv, from Andrei Warkentin <[email protected]> ]
--- target-ppc/mmu-hash64.c | 69 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-)
target-ppc/mmu-hash64.c +50 -19
@@ -613,6 +613,47 @@ unsigned ppc_hash64_hpte_page_shift_noslb(PowerPCCPU *cpu,return 0 ; } +static void ppc_hash64_set_isi (CPUState *cs,CPUPPCState *env, +uint64_t error_code) +{ +bool vpm; + +if (msr_ir) { + vpm = !!(env->spr[SPR_LPCR ] &LPCR_VPM1 ); + }else { + vpm = !!(env->spr[SPR_LPCR ] &LPCR_VPM0 ); + } +if (vpm && !msr_hv) { + cs->exception_index =POWERPC_EXCP_HISI ; + }else { + cs->exception_index =POWERPC_EXCP_ISI ; + } + env->error_code = error_code; +} + +static void ppc_hash64_set_dsi (CPUState *cs,CPUPPCState *env,uint64_t dar, +uint64_t dsisr) +{ +bool vpm; + +if (msr_dr) { + vpm = !!(env->spr[SPR_LPCR ] &LPCR_VPM1 ); + }else { + vpm = !!(env->spr[SPR_LPCR ] &LPCR_VPM0 ); + } +if (vpm && !msr_hv) { + cs->exception_index =POWERPC_EXCP_HDSI ; + env->spr[SPR_HDAR ] = dar; + env->spr[SPR_HDSISR ] = dsisr; + }else { + cs->exception_index =POWERPC_EXCP_DSI ; + env->spr[SPR_DAR ] = dar; + env->spr[SPR_DSISR ] = dsisr; + } + env->error_code =0 ; +} + +int ppc_hash64_handle_mmu_fault (PowerPCCPU *cpu,vaddr eaddr,int rwx,int mmu_idx) {
@@ -623,7 +664,7 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,hwaddr pte_offset;ppc_hash_pte64_t pte;int pp_prot, amr_prot, prot; -uint64_t new_pte1; +uint64_t new_pte1, dsisr;const int need_prot[] = {PAGE_READ ,PAGE_WRITE ,PAGE_EXEC };hwaddr raddr;
@@ -657,26 +698,21 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,/* 3. Check for segment level no-execute violation */ if ((rwx ==2 ) && (slb->vsid &SLB_VSID_N )) { - cs->exception_index =POWERPC_EXCP_ISI ; - env->error_code =0x10000000 ; +ppc_hash64_set_isi (cs, env,0x10000000 );return 1 ; }/* 4. Locate the PTE in the hash table */ pte_offset =ppc_hash64_htab_lookup (cpu, slb, eaddr, &pte);if (pte_offset ==-1 ) { + dsisr =0x40000000 ;if (rwx ==2 ) { - cs->exception_index =POWERPC_EXCP_ISI ; - env->error_code =0x40000000 ; +ppc_hash64_set_isi (cs, env, dsisr); }else { - cs->exception_index =POWERPC_EXCP_DSI ; - env->error_code =0 ; - env->spr[SPR_DAR ] = eaddr;if (rwx ==1 ) { - env->spr[SPR_DSISR ] =0x42000000 ; - }else { - env->spr[SPR_DSISR ] =0x40000000 ; + dsisr |=0x02000000 ; } +ppc_hash64_set_dsi (cs, env, eaddr, dsisr); }return 1 ; }
@@ -705,14 +741,9 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,/* Access right violation */ qemu_log_mask (CPU_LOG_MMU ,"PTE access rejected\n" );if (rwx ==2 ) { - cs->exception_index =POWERPC_EXCP_ISI ; - env->error_code =0x08000000 ; +ppc_hash64_set_isi (cs, env,0x08000000 ); }else { -target_ulong dsisr =0 ; - - cs->exception_index =POWERPC_EXCP_DSI ; - env->error_code =0 ; - env->spr[SPR_DAR ] = eaddr; + dsisr =0 ;if (need_prot[rwx] & ~pp_prot) { dsisr |=0x08000000 ; }
@@ -722,7 +753,7 @@ int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,if (need_prot[rwx] & ~amr_prot) { dsisr |=0x00200000 ; } - env->spr[SPR_DSISR ] = dsisr; +ppc_hash64_set_dsi (cs, env, eaddr, dsisr); }return 1 ; }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 13/17] ppc: Add real mode CI load/store instructions for P7 and P8
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
Those instructions are only available in hypervisor real mode and allow cache inhibited garded access to devices in that mode.
--- target-ppc/cpu.h | 4 ++- target-ppc/translate.c | 59 ++++++++++++++++++++++++++++++++++++--------- target-ppc/translate_init.c | 6 +++-- 3 files changed, 55 insertions(+), 14 deletions(-)
target-ppc/cpu.h +3 -1
@@ -1912,6 +1912,8 @@ enum {PPC_POPCNTB =0x0000000000001000ULL ,/* string load / store */ PPC_STRING =0x0000000000002000ULL , +/* real mode cache inhibited load / store */ + PPC_CILDST = 0x0000000000004000ULL,/* Floating-point unit extensions */ /* Optional floating point instructions */
@@ -2026,7 +2028,7 @@ enum { | PPC_MFAPIDI | PPC_TLBIVA | PPC_TLBIVAX \ | PPC_4xx_COMMON | PPC_40x_ICBT |PPC_RFMCI \ |PPC_RFDI |PPC_DCR |PPC_DCRX |PPC_DCRUX \ - | PPC_POPCNTWD) + | PPC_POPCNTWD | PPC_CILDST)/* extended type values */
target-ppc/translate.c +48 -11
162 lines not on this page · raw message
target-ppc/translate_init.c +4 -2
@@ -8404,7 +8404,8 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)PPC_MEM_TLBIE |PPC_MEM_TLBSYNC |PPC_64B |PPC_64H |PPC_64BX |PPC_ALTIVEC |PPC_SEGMENT_64B |PPC_SLBI | -PPC_POPCNTB |PPC_POPCNTWD ; +PPC_POPCNTB |PPC_POPCNTWD | +PPC_CILDST ; pcc->insns_flags2 =PPC2_VSX |PPC2_DFP |PPC2_DBRX |PPC2_ISA205 |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
@@ -8485,7 +8486,8 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)PPC_MEM_TLBIE |PPC_MEM_TLBSYNC |PPC_64B |PPC_64H |PPC_64BX |PPC_ALTIVEC |PPC_SEGMENT_64B |PPC_SLBI | -PPC_POPCNTB |PPC_POPCNTWD ; +PPC_POPCNTB |PPC_POPCNTWD | +PPC_CILDST ; pcc->insns_flags2 =PPC2_VSX |PPC2_VSX207 |PPC2_DFP |PPC2_DBRX |PPC2_PERM_ISA206 |PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 16/17] ppc: Add P7/P8 Power Management instructions
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
This adds the ISA 2.06 and later power management instructions (doze, nap, sleep and rvwinkle) and associated wakeup cause testing in LPCR
--- target-ppc/cpu-qom.h | 9 +++++ target-ppc/cpu.h | 17 ++++++++- target-ppc/excp_helper.c | 59 +++++++++++++++++++++++++++++ target-ppc/helper.h | 1 + target-ppc/translate.c | 66 ++++++++++++++++++++++++++++++++ target-ppc/translate_init.c | 92 ++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 241 insertions(+), 3 deletions(-)
target-ppc/cpu-qom.h +9 -0
@@ -126,6 +126,15 @@ enum powerpc_excp_t { };/*****************************************************************************/ +/* PM instructions */ +typedef enum { +PPC_PM_DOZE , +PPC_PM_NAP , +PPC_PM_SLEEP , +PPC_PM_RVWINKLE , +}powerpc_pm_insn_t ; + +/*****************************************************************************/ /* Input pins model */ typedef enum powerpc_input_t powerpc_input_t ;enum powerpc_input_t {
target-ppc/cpu.h +16 -1
@@ -383,6 +383,14 @@ struct ppc_slb_t {#define LPCR_LPES1 (1ull << (63 - 61))#define LPCR_AIL_SHIFT (63 - 40)/* Alternate interrupt location */ #define LPCR_AIL (3ull << LPCR_AIL_SHIFT) +#define LPCR_P7_PECE0 (1ull << (63 - 49)) +#define LPCR_P7_PECE1 (1ull << (63 - 50)) +#define LPCR_P7_PECE2 (1ull << (63 - 51)) +#define LPCR_P8_PECE0 (1ull << (63 - 47)) +#define LPCR_P8_PECE1 (1ull << (63 - 48)) +#define LPCR_P8_PECE2 (1ull << (63 - 49)) +#define LPCR_P8_PECE3 (1ull << (63 - 50)) +#define LPCR_P8_PECE4 (1ull << (63 - 51))#define msr_sf ((env->msr >> MSR_SF) & 1)#define msr_isf ((env->msr >> MSR_ISF) & 1)
@@ -1059,6 +1067,11 @@ struct CPUPPCState {* instructions and SPRs are diallowed if MSR:HV is 0 */ bool has_hv_mode; +/* On P7/P8, set when in PM state, we need to handle resume +* in a special way (such as routing some resume causes to +* 0x100), so flag this here. +*/ +bool in_pm_state;#endif /* Those resources are used only during code translation */
@@ -2068,6 +2081,8 @@ enum {PPC2_FP_CVT_S64 =0x0000000000010000ULL ,/* Transactional Memory (ISA 2.07, Book II) */ PPC2_TM =0x0000000000020000ULL , +/* Server PM instructgions (ISA 2.06, Book III) */ +PPC2_PM_ISA206 =0x0000000000040000ULL , #define PPC_TCG_INSNS2 (PPC2_BOOKE206 | PPC2_VSX | PPC2_PRCNTL | PPC2_DBRX | \ PPC2_ISA205 | PPC2_VSX207 | PPC2_PERM_ISA206 | \
@@ -2075,7 +2090,7 @@ enum {PPC2_FP_CVT_ISA206 |PPC2_FP_TST_ISA206 | \PPC2_BCTAR_ISA207 |PPC2_LSQ_ISA207 | \PPC2_ALTIVEC_207 |PPC2_ISA207S |PPC2_DFP | \ - PPC2_FP_CVT_S64 | PPC2_TM) + PPC2_FP_CVT_S64 | PPC2_TM | PPC2_PM_ISA206) };/*****************************************************************************/
target-ppc/excp_helper.c +59 -0
71 lines not on this page · raw message
target-ppc/helper.h +1 -0
@@ -13,6 +13,7 @@ DEF_HELPER_1(rfci, void, env) DEF_HELPER_1(rfdi, void, env) DEF_HELPER_1(rfmci, void, env)#if defined(TARGET_PPC64 ) +DEF_HELPER_2(pminsn, void, env, i32) DEF_HELPER_1(rfid, void, env) DEF_HELPER_1(hrfid, void, env)#endif
target-ppc/translate.c +66 -0
78 lines not on this page · raw message
target-ppc/translate_init.c +90 -2
142 lines not on this page · raw message
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 05/17] ppc: Improve emulation of THRM registers
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
The 75x and 74xx processors have some thermal monitoring SPRs that some OSes such as MacOS do use. Our current "dumb" implementation isn't good enough and will cause some versions of MacOS to hang during boot.
This lifts an improved emulation from MacOnLinux and adapts it to qemu, thus fixing the problem.
[dwg: Fixed typo in comment, a number of minor checkpatch warnings,
and a compile failure with CONFIG_USER_ONLY]
--- target-ppc/helper.h | 1 + target-ppc/misc_helper.c | 41 +++++++++++++++++++++++++++++++++++++++++ target-ppc/translate_init.c | 15 ++++++++++++--- 3 files changed, 54 insertions(+), 3 deletions(-)
target-ppc/helper.h +1 -0
@@ -670,3 +670,4 @@ DEF_HELPER_4(dscli, void, env, fprp, fprp, i32) DEF_HELPER_4(dscliq, void, env, fprp, fprp, i32) DEF_HELPER_1(tbegin, void, env) +DEF_HELPER_1 (fixup_thrm, void, env)
target-ppc/misc_helper.c +41 -0
44 lines not on this page · raw message
target-ppc/translate_init.c +12 -3
@@ -1179,23 +1179,32 @@ static void gen_spr_amr(CPUPPCState *env, bool has_iamr) }#endif /* TARGET_PPC64 */ +#ifndef CONFIG_USER_ONLY +static void spr_read_thrm (DisasContext *ctx,int gprn,int sprn) +{ +gen_helper_fixup_thrm (cpu_env); +gen_load_spr (cpu_gpr[gprn], sprn); +spr_load_dump_spr (sprn); +} +#endif /* !CONFIG_USER_ONLY */ +static void gen_spr_thrm (CPUPPCState *env) {/* Thermal management */ /* XXX : not implemented */ spr_register (env,SPR_THRM1 ,"THRM1" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_generic, + &spr_read_thrm, &spr_write_generic,0x00000000 );/* XXX : not implemented */ spr_register (env,SPR_THRM2 ,"THRM2" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_generic, + &spr_read_thrm, &spr_write_generic,0x00000000 );/* XXX : not implemented */ spr_register (env,SPR_THRM3 ,"THRM3" ,SPR_NOACCESS ,SPR_NOACCESS , - &spr_read_generic, &spr_write_generic, + &spr_read_thrm, &spr_write_generic,0x00000000 ); }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 10/17] ppc: Fix POWER7 and POWER8 exception definitions
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
We were initializing unused ones and missing some
--- target-ppc/cpu.h | 11 ++++++++++- target-ppc/translate_init.c | 27 +++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-)
target-ppc/cpu.h +10 -1
@@ -116,6 +116,9 @@ enum { POWERPC_EXCP_HYPPRIV = 41, /* Embedded hypervisor priv instruction *//* Vectors 42 to 63 are reserved */ /* Exceptions defined in the PowerPC server specification */ +/* Server doorbell variants */ +#define POWERPC_EXCP_SDOOR POWERPC_EXCP_GDOORI +#define POWERPC_EXCP_SDOOR_HV POWERPC_EXCP_DOORIPOWERPC_EXCP_RESET =64 ,/* System reset exception */ POWERPC_EXCP_DSEG =65 ,/* Data segment exception */ POWERPC_EXCP_ISEG = 66, /* Instruction segment exception */
@@ -158,8 +161,12 @@ enum {/* VSX Unavailable (Power ISA 2.06 and later) */ POWERPC_EXCP_VSXU =94 ,/* VSX Unavailable */ POWERPC_EXCP_FU =95 ,/* Facility Unavailable */ +/* Additional ISA 2.06 and later server exceptions */ +POWERPC_EXCP_HV_EMU =96 ,/* HV emulation assistance */ +POWERPC_EXCP_HV_MAINT =97 ,/* HMI */ +POWERPC_EXCP_HV_FU =98 ,/* Hypervisor Facility unavailable */ /* EOL */ -POWERPC_EXCP_NB =96 , +POWERPC_EXCP_NB =99 ,/* QEMU exceptions: used internally during code translation */ POWERPC_EXCP_STOP =0x200 ,/* stop translation */ POWERPC_EXCP_BRANCH = 0x201, /* branch instruction */
@@ -2196,6 +2203,8 @@ enum {PPC_INTERRUPT_CDOORBELL ,/* Critical doorbell interrupt */ PPC_INTERRUPT_DOORBELL ,/* Doorbell interrupt */ PPC_INTERRUPT_PERFM ,/* Performance monitor interrupt */ +PPC_INTERRUPT_HMI ,/* Hypervisor Maintainance interrupt */ + PPC_INTERRUPT_HDOORBELL, /* Hypervisor Doorbell interrupt */ };/* Processor Compatibility mask (PCR) */
target-ppc/translate_init.c +21 -6
@@ -3180,18 +3180,30 @@ static void init_excp_POWER7 (CPUPPCState *env) env->excp_vectors[POWERPC_EXCP_HDECR ] =0x00000980 ; env->excp_vectors[POWERPC_EXCP_SYSCALL ] =0x00000C00 ; env->excp_vectors[POWERPC_EXCP_TRACE ] =0x00000D00 ; + env->excp_vectors[POWERPC_EXCP_HDSI ] =0x00000E00 ; + env->excp_vectors[POWERPC_EXCP_HISI ] =0x00000E20 ; + env->excp_vectors[POWERPC_EXCP_HV_EMU ] =0x00000E40 ; + env->excp_vectors[POWERPC_EXCP_HV_MAINT ] =0x00000E60 ; env->excp_vectors[POWERPC_EXCP_PERFM ] =0x00000F00 ; env->excp_vectors[POWERPC_EXCP_VPU ] =0x00000F20 ; env->excp_vectors[POWERPC_EXCP_VSXU ] =0x00000F40 ; - env->excp_vectors[POWERPC_EXCP_FU ] =0x00000F60 ; - env->excp_vectors[POWERPC_EXCP_IABR ] =0x00001300 ; - env->excp_vectors[POWERPC_EXCP_MAINT ] =0x00001600 ; - env->excp_vectors[POWERPC_EXCP_VPUA ] =0x00001700 ; - env->excp_vectors[POWERPC_EXCP_THERM ] =0x00001800 ;/* Hardware reset vector */ env->hreset_vector =0x0000000000000100ULL ; #endif } + +static void init_excp_POWER8 (CPUPPCState *env) +{ +init_excp_POWER7 (env); + +#if !defined(CONFIG_USER_ONLY ) + env->excp_vectors[POWERPC_EXCP_SDOOR ] =0x00000A00 ; + env->excp_vectors[POWERPC_EXCP_FU ] =0x00000F60 ; + env->excp_vectors[POWERPC_EXCP_HV_FU ] =0x00000F80 ; + env->excp_vectors[POWERPC_EXCP_SDOOR_HV ] =0x00000E80 ; +#endif +} +#endif /*****************************************************************************/
@@ -8132,10 +8144,13 @@ static void init_proc_book3s_64(CPUPPCState *env, int version)ppc970_irq_init (ppc_env_get_cpu (env));break ;case BOOK3S_CPU_POWER7 : -case BOOK3S_CPU_POWER8 :init_excp_POWER7 (env);ppcPOWER7_irq_init (ppc_env_get_cpu (env));break ; +case BOOK3S_CPU_POWER8 : +init_excp_POWER8 (env); +ppcPOWER7_irq_init (ppc_env_get_cpu (env)); +break ;default :g_assert_not_reached (); }
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 12/17] ppc: Rework generation of priv and inval interrupts
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
Recent server processors use the Hypervisor Emulation Assistance interrupt for illegal instructions and *some* type of SPR accesses.
Also the code was always generating inval instructions even for priv violations due to setting the wrong flags
Finally, the checking for PR/HV was open coded everywhere.
This reworks it all, using little helper macros for checking, and adding the HV interrupt (which gets converted back to program check in the slow path of excp_helper.c on CPUs that don't want it).
--- linux-user/main.c | 1 + target-ppc/excp_helper.c | 19 ++ target-ppc/translate.c | 690 ++++++++++++++++++++--------------------------- 3 files changed, 311 insertions(+), 399 deletions(-)
linux-user/main.c +1 -0
@@ -1721,6 +1721,7 @@ void cpu_loop(CPUPPCState *env)queue_signal (env, info.si_signo, &info);break ;case POWERPC_EXCP_PROGRAM :/* Program exception */ +case POWERPC_EXCP_HV_EMU :/* HV emulation */ /* XXX: check this */ switch (env->error_code & ~0xF ) {case POWERPC_EXCP_FP :
target-ppc/excp_helper.c +19 -0
@@ -128,6 +128,19 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) ail =0 ; } +/* Hypervisor emulation assistance interrupt only exists on server +* arch 2.05 server or later. We also don't want to generate it if +* we don't have HVB in msr_mask (PAPR mode). +*/ + if (excp == POWERPC_EXCP_HV_EMU +#if defined(TARGET_PPC64 ) + && !((env->mmu_model & POWERPC_MMU_64) && (env->msr_mask & MSR_HVB)) +#endif /* defined(TARGET_PPC64) */ + + ) { + excp =POWERPC_EXCP_PROGRAM ; + } +switch (excp) {case POWERPC_EXCP_NONE :/* Should never happen */
@@ -249,6 +262,12 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)break ; } goto store_current; +case POWERPC_EXCP_HV_EMU : + srr0 =SPR_HSRR0 ; + srr1 =SPR_HSRR1 ; + new_msr |= (target_ulong )MSR_HVB ; + new_msr |= env->msr & ((target_ulong )1 <<MSR_RI ); + goto store_current;case POWERPC_EXCP_FPU :/* Floating-point unavailable exception */ goto store_current;case POWERPC_EXCP_SYSCALL :/* System call exception */
target-ppc/translate.c +291 -399
1,396 lines not on this page · raw message
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 14/17] ppc: Turn a bunch of booleans from int to bool
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
--- target-ppc/translate.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-)
target-ppc/translate.c +18 -19
@@ -193,22 +193,21 @@ struct DisasContext {uint32_t opcode;uint32_t exception;/* Routine used to access memory */ -bool pr, hv, dr; +bool pr, hv, dr, le_mode;bool lazy_tlb_flush;int mem_idx;int access_type;/* Translation flags */ -int le_mode;TCGMemOp default_tcg_memop_mask;#if defined(TARGET_PPC64 ) -int sf_mode; -int has_cfar; +bool sf_mode; +bool has_cfar;#endif -int fpu_enabled; -int altivec_enabled; -int vsx_enabled; -int spe_enabled; -int tm_enabled; +bool fpu_enabled; +bool altivec_enabled; +bool vsx_enabled; +bool spe_enabled; +bool tm_enabled;ppc_spr_t *spr_cb;/* Needed to check rights for mfspr/mtspr */ int singlestep_enabled;uint64_t insns_flags;
@@ -11496,7 +11495,7 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb) ctx.insns_flags = env->insns_flags; ctx.insns_flags2 = env->insns_flags2; ctx.access_type =-1 ; - ctx.le_mode = env->hflags & (1 <<MSR_LE ) ?1 :0 ; + ctx.le_mode = !!(env->hflags & (1 <<MSR_LE )); ctx.default_tcg_memop_mask = ctx.le_mode ?MO_LE :MO_BE ;#if defined(TARGET_PPC64 ) ctx.sf_mode =msr_is_64bit (env, env->msr);
@@ -11507,25 +11506,25 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb) (env->mmu_model & POWERPC_MMU_64B)) ctx.lazy_tlb_flush = true; - ctx.fpu_enabled = msr_fp; + ctx.fpu_enabled = !!msr_fp;if ((env->flags &POWERPC_FLAG_SPE ) && msr_spe) - ctx.spe_enabled = msr_spe; + ctx.spe_enabled = !!msr_spe;else - ctx.spe_enabled =0 ; + ctx.spe_enabled = false;if ((env->flags &POWERPC_FLAG_VRE ) && msr_vr) - ctx.altivec_enabled = msr_vr; + ctx.altivec_enabled = !!msr_vr;else - ctx.altivec_enabled =0 ; + ctx.altivec_enabled = false;if ((env->flags &POWERPC_FLAG_VSX ) && msr_vsx) { - ctx.vsx_enabled = msr_vsx; + ctx.vsx_enabled = !!msr_vsx; }else { - ctx.vsx_enabled =0 ; + ctx.vsx_enabled = false; }#if defined(TARGET_PPC64 )if ((env->flags &POWERPC_FLAG_TM ) && msr_tm) { - ctx.tm_enabled = msr_tm; + ctx.tm_enabled = !!msr_tm; }else { - ctx.tm_enabled =0 ; + ctx.tm_enabled = false; }#endif if ((env->flags &POWERPC_FLAG_SE ) && msr_se)
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 15/17] ppc: Move exception generation code out of line
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
There's no point inlining this, if you hit the exception case you exit anyway, and not inlining saves about 100K of code size (and cache footprint).
--- target-ppc/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-ppc/translate.c +3 -3
@@ -284,7 +284,7 @@ void gen_update_current_nip(void *opaque)tcg_gen_movi_tl (cpu_nip, ctx->nip); } -static inline void gen_exception_err (DisasContext *ctx,uint32_t excp,uint32_t error) +static void gen_exception_err (DisasContext *ctx,uint32_t excp,uint32_t error) {TCGv_i32 t0, t1;if (ctx->exception ==POWERPC_EXCP_NONE ) {
@@ -298,7 +298,7 @@ static inline void gen_exception_err(DisasContext *ctx, uint32_t excp, uint32_t ctx->exception = (excp); } -static inline void gen_exception (DisasContext *ctx,uint32_t excp) +static void gen_exception (DisasContext *ctx,uint32_t excp) {TCGv_i32 t0;if (ctx->exception ==POWERPC_EXCP_NONE ) {
@@ -310,7 +310,7 @@ static inline void gen_exception(DisasContext *ctx, uint32_t excp) ctx->exception = (excp); } -static inline void gen_debug_exception (DisasContext *ctx) +static void gen_debug_exception (DisasContext *ctx) {TCGv_i32 t0;
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 08/17] ppc: define a default LPCR value
In reply to David GibsonFrom: Benjamin Herrenschmidt <[email protected]>
This allows us to set the appropriate LPCR bits which will be used when fixing the exception model for the HV mode.
[clg: previous commit 26a7f1291bb5 did not include the LPCR setting as
it was not needed at the time, adapted commit log ]
--- target-ppc/translate_init.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
target-ppc/translate_init.c +14 -0
@@ -8518,6 +8518,7 @@ POWERPC_FAMILY(POWER8)(ObjectClass *oc, void *data)void cpu_ppc_set_papr (PowerPCCPU *cpu) {CPUPPCState *env = &cpu->env; +ppc_spr_t *lpcr = &env->spr_cb[SPR_LPCR ];ppc_spr_t *amor = &env->spr_cb[SPR_AMOR ];/* PAPR always has exception vectors in RAM not ROM. To ensure this,
@@ -8527,6 +8528,19 @@ void cpu_ppc_set_papr(PowerPCCPU *cpu)*/ env->msr_mask &= ~((1ull <<MSR_EP ) |MSR_HVB ); +/* Set emulated LPCR to not send interrupts to hypervisor. Note that +* under KVM, the actual HW LPCR will be set differently by KVM itself, +* the settings below ensure proper operations with TCG in absence of +* a real hypervisor +*/ + lpcr->default_value &= ~(LPCR_VPM0 |LPCR_VPM1 |LPCR_ISL |LPCR_KBV ); + lpcr->default_value |=LPCR_LPES0 |LPCR_LPES1 ; + +/* We should be followed by a CPU reset but update the active value +* just in case... +*/ + env->spr[SPR_LPCR ] = lpcr->default_value; +/* Set a full AMOR so guest can use the AMR as it sees fit */ env->spr[SPR_AMOR ] = amor->default_value =0xffffffffffffffffull ;
Signature · 1 line
2.5.5
[Qemu-devel] [PULL 04/17] target-ppc: Fix rlwimi, rlwinm, rlwnm again
In reply to David GibsonFrom: Richard Henderson <[email protected]>
In 63ae0915f8ec, I arranged to use a 32-bit rotate, without considering the effect of a mask value that wraps around to the high bits of the word.
[dwg: In 2e11b15 this was partially fixed, but an edge case was still incorrect, which this fixes]
[dwg: Folded with a revert of 2e11b15, an earlier buggy version of
this patch which already went upstream]
--- target-ppc/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
target-ppc/translate.c +1 -3
@@ -1696,9 +1696,7 @@ static void gen_rlwinm(DisasContext *ctx)#endif mask =MASK (mb, me); -if (sh ==0 ) { -tcg_gen_andi_tl (t_ra, t_rs, mask); - }else if (mask <=0xffffffffu ) { +if (mask <=0xffffffffu ) {TCGv_i32 t0 =tcg_temp_new_i32 ();tcg_gen_trunc_tl_i32 (t0, t_rs);tcg_gen_rotli_i32 (t0, t0, sh);
Signature · 1 line
2.5.5
Peter Maydell
AppliedQuoted 22 lines · David Gibson
The following changes since commit
6f1d2d1c5ad20d464705b17318cb7ca495f8078a:Merge remote-tracking branch 'remotes/stsquad/tags/pull-travis-20160621-1' into staging (2016-06-21 15:19:58 +0100)
are available in the git repository at:
git://github.com/dgibson/qemu.gittags/ppc-for-2.7-20160623for you to fetch changes up to
86b50f2e1befc33407bdfeb6f45f7b0d2439a740:ppc: Disable huge page support if it is not available for main RAM (2016-06-23 12:53:42 +1000)
----------------------------------------------------------------
ppc patch queue for 2016-06-23Currently outstanding patches for spapr, target-ppc and related devices. This batch has:
* Significant new progress towards full support for hypervisor mode
* Assorted bugfixes
* Some preliminary patches towards dynamic DMA window support
Quoted 4 lines
The last involves a change to
memory.c, which Paolo has said I can take through this tree.----------------------------------------------------------------
Applied, thanks.
-- PMM