提交 d345e0d7 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/agraf/tags/signed-ppc-for-upstream' into staging

Patch queue for ppc - 2015-09-20

Highlights this time around:

  - e500: Fix u-boot boot with -M virt by updating to new version
  - e500: fix ATMU reads
  - book3s: Fixes (unaligned exceptions, vector instructions)
  - yet another dbdma ide fix

I'm out taking care of my son for the next 2 months. During that time
please consider David Gibson the interim ppc queue maintainer. I'm sure
Aurelien will be more than happy to help him review patches as well ;-).

# gpg: Signature made Sun 20 Sep 2015 21:51:16 BST using RSA key ID 03FEDC60
# gpg: Good signature from "Alexander Graf <agraf@suse.de>"
# gpg:                 aka "Alexander Graf <alex@csgraf.de>"

* remotes/agraf/tags/signed-ppc-for-upstream:
  target-ppc: fix xscmpodp and xscmpudp decoding
  target-ppc: fix vcipher, vcipherlast, vncipherlast and vpermxor
  PPC: E500: Update u-boot to commit 79c884d7e4
  target-ppc: Fix SRR0 when taking unaligned exceptions
  PPC: e500 pci host: Fix ATMUs register reads
  mac_dbdma: always clear FLUSH bit once DBDMA channel flush is complete
  kvm_ppc: remove kvmppc_timer_hack
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -590,10 +590,11 @@ dbdma_control_write(DBDMA_channel *ch) ...@@ -590,10 +590,11 @@ dbdma_control_write(DBDMA_channel *ch)
if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) { if ((ch->regs[DBDMA_STATUS] & RUN) && !(status & RUN)) {
/* RUN is cleared */ /* RUN is cleared */
status &= ~(ACTIVE|DEAD); status &= ~(ACTIVE|DEAD);
if ((status & FLUSH) && ch->flush) { }
ch->flush(&ch->io);
status &= ~FLUSH; if ((status & FLUSH) && ch->flush) {
} ch->flush(&ch->io);
status &= ~FLUSH;
} }
DBDMA_DPRINTF(" status 0x%08x\n", status); DBDMA_DPRINTF(" status 0x%08x\n", status);
...@@ -603,9 +604,6 @@ dbdma_control_write(DBDMA_channel *ch) ...@@ -603,9 +604,6 @@ dbdma_control_write(DBDMA_channel *ch)
if (status & ACTIVE) { if (status & ACTIVE) {
DBDMA_kick(dbdma_from_ch(ch)); DBDMA_kick(dbdma_from_ch(ch));
} }
if ((status & FLUSH) && ch->flush) {
ch->flush(&ch->io);
}
} }
static void dbdma_write(void *opaque, hwaddr addr, static void dbdma_write(void *opaque, hwaddr addr,
......
...@@ -140,7 +140,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr, ...@@ -140,7 +140,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
case PPCE500_PCI_OW3: case PPCE500_PCI_OW3:
case PPCE500_PCI_OW4: case PPCE500_PCI_OW4:
idx = (addr >> 5) & 0x7; idx = (addr >> 5) & 0x7;
switch (addr & 0xC) { switch (addr & 0x1F) {
case PCI_POTAR: case PCI_POTAR:
value = pci->pob[idx].potar; value = pci->pob[idx].potar;
break; break;
...@@ -162,7 +162,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr, ...@@ -162,7 +162,7 @@ static uint64_t pci_reg_read4(void *opaque, hwaddr addr,
case PPCE500_PCI_IW2: case PPCE500_PCI_IW2:
case PPCE500_PCI_IW1: case PPCE500_PCI_IW1:
idx = ((addr >> 5) & 0x3) - 1; idx = ((addr >> 5) & 0x3) - 1;
switch (addr & 0xC) { switch (addr & 0x1F) {
case PCI_PITAR: case PCI_PITAR:
value = pci->pib[idx].pitar; value = pci->pib[idx].pitar;
break; break;
......
...@@ -1048,10 +1048,6 @@ void ppce500_init(MachineState *machine, PPCE500Params *params) ...@@ -1048,10 +1048,6 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
boot_info->entry = bios_entry; boot_info->entry = bios_entry;
boot_info->dt_base = dt_base; boot_info->dt_base = dt_base;
boot_info->dt_size = dt_size; boot_info->dt_size = dt_size;
if (kvm_enabled()) {
kvmppc_init();
}
} }
static int e500_ccsr_initfn(SysBusDevice *dev) static int e500_ccsr_initfn(SysBusDevice *dev)
......
...@@ -288,9 +288,6 @@ static void bamboo_init(MachineState *machine) ...@@ -288,9 +288,6 @@ static void bamboo_init(MachineState *machine)
exit(1); exit(1);
} }
} }
if (kvm_enabled())
kvmppc_init();
} }
static void bamboo_machine_init(MachineClass *mc) static void bamboo_machine_init(MachineClass *mc)
......
...@@ -1650,7 +1650,7 @@ void cpu_loop(CPUPPCState *env) ...@@ -1650,7 +1650,7 @@ void cpu_loop(CPUPPCState *env)
info.si_signo = TARGET_SIGBUS; info.si_signo = TARGET_SIGBUS;
info.si_errno = 0; info.si_errno = 0;
info.si_code = TARGET_BUS_ADRALN; info.si_code = TARGET_BUS_ADRALN;
info._sifields._sigfault._addr = env->nip - 4; info._sifields._sigfault._addr = env->nip;
queue_signal(env, info.si_signo, &info); queue_signal(env, info.si_signo, &info);
break; break;
case POWERPC_EXCP_PROGRAM: /* Program exception */ case POWERPC_EXCP_PROGRAM: /* Program exception */
......
...@@ -4,7 +4,7 @@ ifeq ($(CONFIG_SOFTMMU),y) ...@@ -4,7 +4,7 @@ ifeq ($(CONFIG_SOFTMMU),y)
obj-y += machine.o mmu_helper.o mmu-hash32.o monitor.o obj-y += machine.o mmu_helper.o mmu-hash32.o monitor.o
obj-$(TARGET_PPC64) += mmu-hash64.o arch_dump.o obj-$(TARGET_PPC64) += mmu-hash64.o arch_dump.o
endif endif
obj-$(CONFIG_KVM) += kvm.o kvm_ppc.o obj-$(CONFIG_KVM) += kvm.o
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
obj-y += dfp_helper.o obj-y += dfp_helper.o
obj-y += excp_helper.o obj-y += excp_helper.o
......
...@@ -200,7 +200,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp) ...@@ -200,7 +200,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
/* Get rS/rD and rA from faulting opcode */ /* Get rS/rD and rA from faulting opcode */
env->spr[SPR_DSISR] |= (cpu_ldl_code(env, (env->nip - 4)) env->spr[SPR_DSISR] |= (cpu_ldl_code(env, (env->nip - 4))
& 0x03FF0000) >> 16; & 0x03FF0000) >> 16;
goto store_current; goto store_next;
case POWERPC_EXCP_PROGRAM: /* Program exception */ case POWERPC_EXCP_PROGRAM: /* Program exception */
switch (env->error_code & ~0xF) { switch (env->error_code & ~0xF) {
case POWERPC_EXCP_FP: case POWERPC_EXCP_FP:
......
...@@ -2327,24 +2327,28 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) ...@@ -2327,24 +2327,28 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a)
void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{ {
ppc_avr_t result;
int i; int i;
VECTOR_FOR_INORDER_I(i, u32) { VECTOR_FOR_INORDER_I(i, u32) {
r->AVRW(i) = b->AVRW(i) ^ result.AVRW(i) = b->AVRW(i) ^
(AES_Te0[a->AVRB(AES_shifts[4*i + 0])] ^ (AES_Te0[a->AVRB(AES_shifts[4*i + 0])] ^
AES_Te1[a->AVRB(AES_shifts[4*i + 1])] ^ AES_Te1[a->AVRB(AES_shifts[4*i + 1])] ^
AES_Te2[a->AVRB(AES_shifts[4*i + 2])] ^ AES_Te2[a->AVRB(AES_shifts[4*i + 2])] ^
AES_Te3[a->AVRB(AES_shifts[4*i + 3])]); AES_Te3[a->AVRB(AES_shifts[4*i + 3])]);
} }
*r = result;
} }
void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{ {
ppc_avr_t result;
int i; int i;
VECTOR_FOR_INORDER_I(i, u8) { VECTOR_FOR_INORDER_I(i, u8) {
r->AVRB(i) = b->AVRB(i) ^ (AES_sbox[a->AVRB(AES_shifts[i])]); result.AVRB(i) = b->AVRB(i) ^ (AES_sbox[a->AVRB(AES_shifts[i])]);
} }
*r = result;
} }
void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
...@@ -2369,11 +2373,13 @@ void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) ...@@ -2369,11 +2373,13 @@ void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)
{ {
ppc_avr_t result;
int i; int i;
VECTOR_FOR_INORDER_I(i, u8) { VECTOR_FOR_INORDER_I(i, u8) {
r->AVRB(i) = b->AVRB(i) ^ (AES_isbox[a->AVRB(AES_ishifts[i])]); result.AVRB(i) = b->AVRB(i) ^ (AES_isbox[a->AVRB(AES_ishifts[i])]);
} }
*r = result;
} }
#define ROTRu32(v, n) (((v) >> (n)) | ((v) << (32-n))) #define ROTRu32(v, n) (((v) >> (n)) | ((v) << (32-n)))
...@@ -2460,16 +2466,19 @@ void helper_vshasigmad(ppc_avr_t *r, ppc_avr_t *a, uint32_t st_six) ...@@ -2460,16 +2466,19 @@ void helper_vshasigmad(ppc_avr_t *r, ppc_avr_t *a, uint32_t st_six)
void helper_vpermxor(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c) void helper_vpermxor(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, ppc_avr_t *c)
{ {
ppc_avr_t result;
int i; int i;
VECTOR_FOR_INORDER_I(i, u8) { VECTOR_FOR_INORDER_I(i, u8) {
int indexA = c->u8[i] >> 4; int indexA = c->u8[i] >> 4;
int indexB = c->u8[i] & 0xF; int indexB = c->u8[i] & 0xF;
#if defined(HOST_WORDS_BIGENDIAN) #if defined(HOST_WORDS_BIGENDIAN)
r->u8[i] = a->u8[indexA] ^ b->u8[indexB]; result.u8[i] = a->u8[indexA] ^ b->u8[indexB];
#else #else
r->u8[i] = a->u8[15-indexA] ^ b->u8[15-indexB]; result.u8[i] = a->u8[15-indexA] ^ b->u8[15-indexB];
#endif #endif
} }
*r = result;
} }
#undef VECTOR_FOR_INORDER_I #undef VECTOR_FOR_INORDER_I
......
/*
* PowerPC KVM support
*
* Copyright IBM Corp. 2008
*
* Authors:
* Hollis Blanchard <hollisb@us.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*
*/
#include "qemu-common.h"
#include "qemu/timer.h"
#include "kvm_ppc.h"
#include "sysemu/device_tree.h"
#include "qemu/main-loop.h"
#define PROC_DEVTREE_PATH "/proc/device-tree"
static QEMUTimer *kvmppc_timer;
static unsigned int kvmppc_timer_rate;
static void kvmppc_timer_hack(void *opaque)
{
qemu_notify_event();
timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);
}
void kvmppc_init(void)
{
/* XXX The only reason KVM yields control back to qemu is device IO. Since
* an idle guest does no IO, qemu's device model will never get a chance to
* run. So, until QEMU gains IO threads, we create this timer to ensure
* that the device model gets a chance to run. */
kvmppc_timer_rate = get_ticks_per_sec() / 10;
kvmppc_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &kvmppc_timer_hack, NULL);
timer_mod(kvmppc_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + kvmppc_timer_rate);
}
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
void kvmppc_init(void);
#ifdef CONFIG_KVM #ifdef CONFIG_KVM
uint32_t kvmppc_get_tbfreq(void); uint32_t kvmppc_get_tbfreq(void);
......
...@@ -10670,6 +10670,13 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \ ...@@ -10670,6 +10670,13 @@ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 0, PPC_NONE, fl2), \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 0, PPC_NONE, fl2), \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 0, PPC_NONE, fl2) GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 0, PPC_NONE, fl2)
#undef GEN_XX2IFORM
#define GEN_XX2IFORM(name, opc2, opc3, fl2) \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0, opc3, 1, PPC_NONE, fl2), \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 1, opc3, 1, PPC_NONE, fl2), \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 2, opc3, 1, PPC_NONE, fl2), \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 3, opc3, 1, PPC_NONE, fl2)
#undef GEN_XX3_RC_FORM #undef GEN_XX3_RC_FORM
#define GEN_XX3_RC_FORM(name, opc2, opc3, fl2) \ #define GEN_XX3_RC_FORM(name, opc2, opc3, fl2) \
GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0x00, opc3 | 0x00, 0, PPC_NONE, fl2), \ GEN_HANDLER2_E(name, #name, 0x3C, opc2 | 0x00, opc3 | 0x00, 0, PPC_NONE, fl2), \
...@@ -10731,8 +10738,8 @@ GEN_XX3FORM(xsnmaddadp, 0x04, 0x14, PPC2_VSX), ...@@ -10731,8 +10738,8 @@ GEN_XX3FORM(xsnmaddadp, 0x04, 0x14, PPC2_VSX),
GEN_XX3FORM(xsnmaddmdp, 0x04, 0x15, PPC2_VSX), GEN_XX3FORM(xsnmaddmdp, 0x04, 0x15, PPC2_VSX),
GEN_XX3FORM(xsnmsubadp, 0x04, 0x16, PPC2_VSX), GEN_XX3FORM(xsnmsubadp, 0x04, 0x16, PPC2_VSX),
GEN_XX3FORM(xsnmsubmdp, 0x04, 0x17, PPC2_VSX), GEN_XX3FORM(xsnmsubmdp, 0x04, 0x17, PPC2_VSX),
GEN_XX2FORM(xscmpodp, 0x0C, 0x05, PPC2_VSX), GEN_XX2IFORM(xscmpodp, 0x0C, 0x05, PPC2_VSX),
GEN_XX2FORM(xscmpudp, 0x0C, 0x04, PPC2_VSX), GEN_XX2IFORM(xscmpudp, 0x0C, 0x04, PPC2_VSX),
GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX), GEN_XX3FORM(xsmaxdp, 0x00, 0x14, PPC2_VSX),
GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX), GEN_XX3FORM(xsmindp, 0x00, 0x15, PPC2_VSX),
GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX), GEN_XX2FORM(xscvdpsp, 0x12, 0x10, PPC2_VSX),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册