target-arm queue:

* fix instruction-length bit in syndrome for WFI/WFE traps
  * xlnx-zcu102: Specify the max number of CPUs
  * msf2: Remove dead code reported by Coverity
  * msf2: Wire up SYSRESETREQ in SoC for system reset
  * hw/pci-host/gpex: Improve INTX to gsi routing error checking
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJZ+HYqAAoJEDwlJe0UNgzeFiUP/04TwP/bZzGFo2QArN6jWMg/
 roSDPJRY/pAo6L7IqMpkz9R0uzDTWq8p1GeGcMr5Nl13iWBQY1GW8PdWtyz4bgxw
 tpswSWUVlqcsE4FKNITQgYdVziGd89N0Hyw2rtqwU94vbp13YeS1LHinm+vgnDKj
 3C3oX6jZkkFWVF5sG6GoVisn+yUEVUHs7smWT3tPNxdoZetNaB6hrKeN3zuN/sEs
 STNErYUzj/E/MIBJxaNEYrdJotBLuEbBox9sLw6iTrR7rjeJTHreIg2bOJu5lk7G
 6WAI5w68oHyYvgB6YXylU4R7pTpuWCAQOHdhMHkHMjyN8k4V6ohbghw/COA92aAY
 KmETrloNBOu0uhjSFYN32nM4z28AMYdtNwjQW8p1v46bPAsP9stvvcRux2xSuPL7
 1YzQUUCDyi109u6YQF7GNWdsWTSFhY/EnC/n3fizolsBtuP3Nirye99RgXokSS+K
 yY+MSW1Vm0GOs9UsHnd5Hor1NQFSXWC8MXSnw/ij+dAoSHDvQ3KPBk3O+UBLlEMx
 wTt/CUoI7ZJdIonOUS5bNNh47k+/v6sxPgVY2RL5IVOxfPQerVnVLlGEionQRrNO
 nXi1oE+jLLyCVZ8bhXIJ6Hq4yZuAHm1FEMweuDAF5ETCW0HqqPNiK+LclwlIoNPv
 nfTVovqyEgmJxZeChL25
 =MbGE
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171031' into staging

target-arm queue:
 * fix instruction-length bit in syndrome for WFI/WFE traps
 * xlnx-zcu102: Specify the max number of CPUs
 * msf2: Remove dead code reported by Coverity
 * msf2: Wire up SYSRESETREQ in SoC for system reset
 * hw/pci-host/gpex: Improve INTX to gsi routing error checking

# gpg: Signature made Tue 31 Oct 2017 13:10:02 GMT
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20171031:
  hw/pci-host/gpex: Improve INTX to gsi routing error checking
  msf2: Wire up SYSRESETREQ in SoC for system reset
  msf2: Remove dead code reported by Coverity
  xlnx-zcu102: Specify the max number of CPUs
  fix WFI/WFE length in syndrome register

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-10-31 14:28:25 +00:00
commit 7fa00e2049
10 changed files with 57 additions and 14 deletions

View File

@ -57,6 +57,13 @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };
static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 }; static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };
static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 }; static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };
static void do_sys_reset(void *opaque, int n, int level)
{
if (level) {
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
}
}
static void m2sxxx_soc_initfn(Object *obj) static void m2sxxx_soc_initfn(Object *obj)
{ {
MSF2State *s = MSF2_SOC(obj); MSF2State *s = MSF2_SOC(obj);
@ -125,6 +132,10 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
error_append_hint(errp, "m3clk can not be zero\n"); error_append_hint(errp, "m3clk can not be zero\n");
return; return;
} }
qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0,
qemu_allocate_irq(&do_sys_reset, NULL, 0));
system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk; system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;
for (i = 0; i < MSF2_NUM_UARTS; i++) { for (i = 0; i < MSF2_NUM_UARTS; i++) {

View File

@ -240,6 +240,7 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
mc->block_default_type = IF_IDE; mc->block_default_type = IF_IDE;
mc->units_per_default_bus = 1; mc->units_per_default_bus = 1;
mc->ignore_memory_transaction_failures = true; mc->ignore_memory_transaction_failures = true;
mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
} }
static const TypeInfo xlnx_zcu102_machine_init_typeinfo = { static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {

View File

@ -57,9 +57,14 @@ static PCIINTxRoute gpex_route_intx_pin_to_irq(void *opaque, int pin)
{ {
PCIINTxRoute route; PCIINTxRoute route;
GPEXHost *s = opaque; GPEXHost *s = opaque;
int gsi = s->irq_num[pin];
route.irq = gsi;
if (gsi < 0) {
route.mode = PCI_INTX_DISABLED;
} else {
route.mode = PCI_INTX_ENABLED; route.mode = PCI_INTX_ENABLED;
route.irq = s->irq_num[pin]; }
return route; return route;
} }
@ -81,6 +86,7 @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->io_ioport); sysbus_init_mmio(sbd, &s->io_ioport);
for (i = 0; i < GPEX_NUM_IRQS; i++) { for (i = 0; i < GPEX_NUM_IRQS; i++) {
sysbus_init_irq(sbd, &s->irq[i]); sysbus_init_irq(sbd, &s->irq[i]);
s->irq_num[i] = -1;
} }
pci->bus = pci_register_bus(dev, "pcie.0", gpex_set_irq, pci->bus = pci_register_bus(dev, "pcie.0", gpex_set_irq,

View File

@ -76,9 +76,10 @@
#define C_BIGFIFO (1 << 29) #define C_BIGFIFO (1 << 29)
#define C_RESET (1 << 31) #define C_RESET (1 << 31)
#define FRAMESZ_MASK 0x1F #define FRAMESZ_MASK 0x3F
#define FMCOUNT_MASK 0x00FFFF00 #define FMCOUNT_MASK 0x00FFFF00
#define FMCOUNT_SHIFT 8 #define FMCOUNT_SHIFT 8
#define FRAMESZ_MAX 32
static void txfifo_reset(MSSSpiState *s) static void txfifo_reset(MSSSpiState *s)
{ {
@ -104,10 +105,8 @@ static void set_fifodepth(MSSSpiState *s)
s->fifo_depth = 32; s->fifo_depth = 32;
} else if (size <= 16) { } else if (size <= 16) {
s->fifo_depth = 16; s->fifo_depth = 16;
} else if (size <= 32) {
s->fifo_depth = 8;
} else { } else {
s->fifo_depth = 4; s->fifo_depth = 8;
} }
} }
@ -301,6 +300,17 @@ static void spi_write(void *opaque, hwaddr addr,
if (s->enabled) { if (s->enabled) {
break; break;
} }
/*
* [31:6] bits are reserved bits and for future use.
* [5:0] are for frame size. Only [5:0] bits are validated
* during write, [31:6] bits are untouched.
*/
if ((value & FRAMESZ_MASK) > FRAMESZ_MAX) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: Incorrect size %u provided."
"Maximum frame size is %u\n",
__func__, value & FRAMESZ_MASK, FRAMESZ_MAX);
break;
}
s->regs[R_SPI_DFSIZE] = value; s->regs[R_SPI_DFSIZE] = value;
break; break;

View File

@ -48,7 +48,7 @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE,
DEF_HELPER_2(exception_internal, void, env, i32) DEF_HELPER_2(exception_internal, void, env, i32)
DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32)
DEF_HELPER_1(setend, void, env) DEF_HELPER_1(setend, void, env)
DEF_HELPER_1(wfi, void, env) DEF_HELPER_2(wfi, void, env, i32)
DEF_HELPER_1(wfe, void, env) DEF_HELPER_1(wfe, void, env)
DEF_HELPER_1(yield, void, env) DEF_HELPER_1(yield, void, env)
DEF_HELPER_1(pre_hvc, void, env) DEF_HELPER_1(pre_hvc, void, env)

View File

@ -428,9 +428,10 @@ static inline uint32_t syn_breakpoint(int same_el)
| ARM_EL_IL | 0x22; | ARM_EL_IL | 0x22;
} }
static inline uint32_t syn_wfx(int cv, int cond, int ti) static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit)
{ {
return (EC_WFX_TRAP << ARM_EL_EC_SHIFT) | return (EC_WFX_TRAP << ARM_EL_EC_SHIFT) |
(is_16bit ? 0 : (1 << ARM_EL_IL_SHIFT)) |
(cv << 24) | (cond << 20) | ti; (cv << 24) | (cond << 20) | ti;
} }

View File

@ -463,7 +463,7 @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe)
return 0; return 0;
} }
void HELPER(wfi)(CPUARMState *env) void HELPER(wfi)(CPUARMState *env, uint32_t insn_len)
{ {
CPUState *cs = CPU(arm_env_get_cpu(env)); CPUState *cs = CPU(arm_env_get_cpu(env));
int target_el = check_wfx_trap(env, false); int target_el = check_wfx_trap(env, false);
@ -476,8 +476,9 @@ void HELPER(wfi)(CPUARMState *env)
} }
if (target_el) { if (target_el) {
env->pc -= 4; env->pc -= insn_len;
raise_exception(env, EXCP_UDEF, syn_wfx(1, 0xe, 0), target_el); raise_exception(env, EXCP_UDEF, syn_wfx(1, 0xe, 0, insn_len == 2),
target_el);
} }
cs->exception_index = EXCP_HLT; cs->exception_index = EXCP_HLT;

View File

@ -189,7 +189,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
} else { } else {
env->regs[0] = 0; env->regs[0] = 0;
} }
helper_wfi(env); helper_wfi(env, 4);
break; break;
case QEMU_PSCI_0_1_FN_MIGRATE: case QEMU_PSCI_0_1_FN_MIGRATE:
case QEMU_PSCI_0_2_FN_MIGRATE: case QEMU_PSCI_0_2_FN_MIGRATE:

View File

@ -11400,11 +11400,15 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
gen_helper_yield(cpu_env); gen_helper_yield(cpu_env);
break; break;
case DISAS_WFI: case DISAS_WFI:
{
/* This is a special case because we don't want to just halt the CPU /* This is a special case because we don't want to just halt the CPU
* if trying to debug across a WFI. * if trying to debug across a WFI.
*/ */
TCGv_i32 tmp = tcg_const_i32(4);
gen_a64_set_pc_im(dc->pc); gen_a64_set_pc_im(dc->pc);
gen_helper_wfi(cpu_env); gen_helper_wfi(cpu_env, tmp);
tcg_temp_free_i32(tmp);
/* The helper doesn't necessarily throw an exception, but we /* The helper doesn't necessarily throw an exception, but we
* must go back to the main loop to check for interrupts anyway. * must go back to the main loop to check for interrupts anyway.
*/ */
@ -11412,6 +11416,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
break; break;
} }
} }
}
/* Functions above can change dc->pc, so re-align db->pc_next */ /* Functions above can change dc->pc, so re-align db->pc_next */
dc->base.pc_next = dc->pc; dc->base.pc_next = dc->pc;

View File

@ -12125,6 +12125,7 @@ static void arm_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
} }
insn = arm_ldl_code(env, dc->pc, dc->sctlr_b); insn = arm_ldl_code(env, dc->pc, dc->sctlr_b);
dc->insn = insn;
dc->pc += 4; dc->pc += 4;
disas_arm_insn(dc, insn); disas_arm_insn(dc, insn);
@ -12200,6 +12201,7 @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
insn = insn << 16 | insn2; insn = insn << 16 | insn2;
dc->pc += 2; dc->pc += 2;
} }
dc->insn = insn;
if (dc->condexec_mask && !thumb_insn_is_unconditional(dc, insn)) { if (dc->condexec_mask && !thumb_insn_is_unconditional(dc, insn)) {
uint32_t cond = dc->condexec_cond; uint32_t cond = dc->condexec_cond;
@ -12326,12 +12328,18 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
/* nothing more to generate */ /* nothing more to generate */
break; break;
case DISAS_WFI: case DISAS_WFI:
gen_helper_wfi(cpu_env); {
TCGv_i32 tmp = tcg_const_i32((dc->thumb &&
!(dc->insn & (1U << 31))) ? 2 : 4);
gen_helper_wfi(cpu_env, tmp);
tcg_temp_free_i32(tmp);
/* The helper doesn't necessarily throw an exception, but we /* The helper doesn't necessarily throw an exception, but we
* must go back to the main loop to check for interrupts anyway. * must go back to the main loop to check for interrupts anyway.
*/ */
tcg_gen_exit_tb(0); tcg_gen_exit_tb(0);
break; break;
}
case DISAS_WFE: case DISAS_WFE:
gen_helper_wfe(cpu_env); gen_helper_wfe(cpu_env);
break; break;