mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
target-arm queue:
* Support M profile derived exceptions on exception entry and exit * Implement AArch64 v8.2 crypto insns (SHA-512, SHA-3, SM3, SM4) * Implement working i.MX6 SD controller * Various devices preparatory to i.MX7 support * Preparatory patches for SVE emulation * v8M: Fix bug in implementation of 'TT' insn * Give useful error if user tries to use userspace GICv3 with KVM -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJafX+DAAoJEDwlJe0UNgzegGgP/2OepsVnpg++NkBpJdCq0wjC DFaGLpDqaXabv0E5b56flkqBsK6mO2vXoIiWOLF3f25G5pBf5zu7XOEYXWuOIBEP Yr/vl4/yWRZfiNKl6aPC5HwHKN8SWMV+Mp/GtKz0PtHLY+oGl3fBRBu8fbeoOyj9 3x+HB0c5fpAtWrRoS+XrUJfQPdkkZ4c5lDvpxec57cqOzJ8qYZEcFCi7WP3Rglox sQJEls5IXkOVGx35o7k0rIw0qzcV8iCGBsuA+4QAonxE5B0ip6aolPAaq+gf/mLP StX2UJG9JO5tOhaNBexHE/QwLNu2pver8mghIyluirLvisB6kx+dEoa0Zj/7J7or LD9O6pqpSPCCKLSw0xPOl2FqjXzbIYcjgddxrOGvUQgAhdagB2EeRHiCdZ7hQXvm Pg4gAsIAZURPrbj7LaXgDCzM0IP6bZjNR2U+C0ekJDBRJb/NTLcvlmx3MQo3s4ot s/t6FP728tnmMk7ib8w95oo2oSMiPUZBfj2IMYogXgY+pup0OunKwOQL93Lmj4By LJwawcsa/9ctyzF/XvBUHO/n4l0zZi3wLmtVojbxkxtHiFmvv5gQMlyHYM08aTJ1 Vu/V0tiX6+oXoNrJg5e8TAchsS5PmO54Sj/ywMm5Q8FWfBE19KTRl5BatxbMYahU gQQt64esxQQFxxjdSrZY =bokK -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180209' into staging target-arm queue: * Support M profile derived exceptions on exception entry and exit * Implement AArch64 v8.2 crypto insns (SHA-512, SHA-3, SM3, SM4) * Implement working i.MX6 SD controller * Various devices preparatory to i.MX7 support * Preparatory patches for SVE emulation * v8M: Fix bug in implementation of 'TT' insn * Give useful error if user tries to use userspace GICv3 with KVM # gpg: Signature made Fri 09 Feb 2018 11:01:23 GMT # gpg: using RSA key 3C2525ED14360CDE # 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-20180209: (30 commits) hw/core/generic-loader: Allow PC to be set on command line target/arm/translate.c: Fix missing 'break' for TT insns target/arm/kvm: gic: Prevent creating userspace GICv3 with KVM target/arm: Add SVE state to TB->FLAGS target/arm: Add ZCR_ELx target/arm: Add SVE to migration state target/arm: Add predicate registers for SVE target/arm: Expand vector registers for SVE hw/arm: Move virt's PSCI DT fixup code to arm/boot.c usb: Add basic code to emulate Chipidea USB IP i.MX: Add implementation of i.MX7 GPR IP block i.MX: Add i.MX7 GPT variant i.MX: Add code to emulate GPCv2 IP block i.MX: Add code to emulate i.MX7 SNVS IP-block i.MX: Add code to emulate i.MX2 watchdog IP block i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks hw: i.MX: Convert i.MX6 to use TYPE_IMX_USDHC sdhci: Add i.MX specific subtype of SDHCI target/arm: enable user-mode SHA-3, SM3, SM4 and SHA-512 instruction support target/arm: implement SM4 instructions ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
f31cd9e4e2
38 changed files with 2928 additions and 187 deletions
|
@ -6,7 +6,7 @@ common-obj-$(CONFIG_XILINX) += xilinx_intc.o
|
|||
common-obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-pmu-iomod-intc.o
|
||||
common-obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp-ipi.o
|
||||
common-obj-$(CONFIG_ETRAXFS) += etraxfs_pic.o
|
||||
common-obj-$(CONFIG_IMX) += imx_avic.o
|
||||
common-obj-$(CONFIG_IMX) += imx_avic.o imx_gpcv2.o
|
||||
common-obj-$(CONFIG_LM32) += lm32_pic.o
|
||||
common-obj-$(CONFIG_REALVIEW) += realview_gic.o
|
||||
common-obj-$(CONFIG_SLAVIO) += slavio_intctl.o
|
||||
|
|
|
@ -503,8 +503,25 @@ static void armv7m_nvic_clear_pending(void *opaque, int irq, bool secure)
|
|||
}
|
||||
}
|
||||
|
||||
void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
|
||||
static void do_armv7m_nvic_set_pending(void *opaque, int irq, bool secure,
|
||||
bool derived)
|
||||
{
|
||||
/* Pend an exception, including possibly escalating it to HardFault.
|
||||
*
|
||||
* This function handles both "normal" pending of interrupts and
|
||||
* exceptions, and also derived exceptions (ones which occur as
|
||||
* a result of trying to take some other exception).
|
||||
*
|
||||
* If derived == true, the caller guarantees that we are part way through
|
||||
* trying to take an exception (but have not yet called
|
||||
* armv7m_nvic_acknowledge_irq() to make it active), and so:
|
||||
* - s->vectpending is the "original exception" we were trying to take
|
||||
* - irq is the "derived exception"
|
||||
* - nvic_exec_prio(s) gives the priority before exception entry
|
||||
* Here we handle the prioritization logic which the pseudocode puts
|
||||
* in the DerivedLateArrival() function.
|
||||
*/
|
||||
|
||||
NVICState *s = (NVICState *)opaque;
|
||||
bool banked = exc_is_banked(irq);
|
||||
VecInfo *vec;
|
||||
|
@ -514,7 +531,44 @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
|
|||
|
||||
vec = (banked && secure) ? &s->sec_vectors[irq] : &s->vectors[irq];
|
||||
|
||||
trace_nvic_set_pending(irq, secure, vec->enabled, vec->prio);
|
||||
trace_nvic_set_pending(irq, secure, derived, vec->enabled, vec->prio);
|
||||
|
||||
if (derived) {
|
||||
/* Derived exceptions are always synchronous. */
|
||||
assert(irq >= ARMV7M_EXCP_HARD && irq < ARMV7M_EXCP_PENDSV);
|
||||
|
||||
if (irq == ARMV7M_EXCP_DEBUG &&
|
||||
exc_group_prio(s, vec->prio, secure) >= nvic_exec_prio(s)) {
|
||||
/* DebugMonitorFault, but its priority is lower than the
|
||||
* preempted exception priority: just ignore it.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (irq == ARMV7M_EXCP_HARD && vec->prio >= s->vectpending_prio) {
|
||||
/* If this is a terminal exception (one which means we cannot
|
||||
* take the original exception, like a failure to read its
|
||||
* vector table entry), then we must take the derived exception.
|
||||
* If the derived exception can't take priority over the
|
||||
* original exception, then we go into Lockup.
|
||||
*
|
||||
* For QEMU, we rely on the fact that a derived exception is
|
||||
* terminal if and only if it's reported to us as HardFault,
|
||||
* which saves having to have an extra argument is_terminal
|
||||
* that we'd only use in one place.
|
||||
*/
|
||||
cpu_abort(&s->cpu->parent_obj,
|
||||
"Lockup: can't take terminal derived exception "
|
||||
"(original exception priority %d)\n",
|
||||
s->vectpending_prio);
|
||||
}
|
||||
/* We now continue with the same code as for a normal pending
|
||||
* exception, which will cause us to pend the derived exception.
|
||||
* We'll then take either the original or the derived exception
|
||||
* based on which is higher priority by the usual mechanism
|
||||
* for selecting the highest priority pending interrupt.
|
||||
*/
|
||||
}
|
||||
|
||||
if (irq >= ARMV7M_EXCP_HARD && irq < ARMV7M_EXCP_PENDSV) {
|
||||
/* If a synchronous exception is pending then it may be
|
||||
|
@ -585,25 +639,31 @@ void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
|
|||
}
|
||||
}
|
||||
|
||||
void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
|
||||
{
|
||||
do_armv7m_nvic_set_pending(opaque, irq, secure, false);
|
||||
}
|
||||
|
||||
void armv7m_nvic_set_pending_derived(void *opaque, int irq, bool secure)
|
||||
{
|
||||
do_armv7m_nvic_set_pending(opaque, irq, secure, true);
|
||||
}
|
||||
|
||||
/* Make pending IRQ active. */
|
||||
bool armv7m_nvic_acknowledge_irq(void *opaque)
|
||||
void armv7m_nvic_acknowledge_irq(void *opaque)
|
||||
{
|
||||
NVICState *s = (NVICState *)opaque;
|
||||
CPUARMState *env = &s->cpu->env;
|
||||
const int pending = s->vectpending;
|
||||
const int running = nvic_exec_prio(s);
|
||||
VecInfo *vec;
|
||||
bool targets_secure;
|
||||
|
||||
assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq);
|
||||
|
||||
if (s->vectpending_is_s_banked) {
|
||||
vec = &s->sec_vectors[pending];
|
||||
targets_secure = true;
|
||||
} else {
|
||||
vec = &s->vectors[pending];
|
||||
targets_secure = !exc_is_banked(s->vectpending) &&
|
||||
exc_targets_secure(s, s->vectpending);
|
||||
}
|
||||
|
||||
assert(vec->enabled);
|
||||
|
@ -611,7 +671,7 @@ bool armv7m_nvic_acknowledge_irq(void *opaque)
|
|||
|
||||
assert(s->vectpending_prio < running);
|
||||
|
||||
trace_nvic_acknowledge_irq(pending, s->vectpending_prio, targets_secure);
|
||||
trace_nvic_acknowledge_irq(pending, s->vectpending_prio);
|
||||
|
||||
vec->active = 1;
|
||||
vec->pending = 0;
|
||||
|
@ -619,8 +679,28 @@ bool armv7m_nvic_acknowledge_irq(void *opaque)
|
|||
write_v7m_exception(env, s->vectpending);
|
||||
|
||||
nvic_irq_update(s);
|
||||
}
|
||||
|
||||
return targets_secure;
|
||||
void armv7m_nvic_get_pending_irq_info(void *opaque,
|
||||
int *pirq, bool *ptargets_secure)
|
||||
{
|
||||
NVICState *s = (NVICState *)opaque;
|
||||
const int pending = s->vectpending;
|
||||
bool targets_secure;
|
||||
|
||||
assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq);
|
||||
|
||||
if (s->vectpending_is_s_banked) {
|
||||
targets_secure = true;
|
||||
} else {
|
||||
targets_secure = !exc_is_banked(pending) &&
|
||||
exc_targets_secure(s, pending);
|
||||
}
|
||||
|
||||
trace_nvic_get_pending_irq_info(pending, targets_secure);
|
||||
|
||||
*ptargets_secure = targets_secure;
|
||||
*pirq = pending;
|
||||
}
|
||||
|
||||
int armv7m_nvic_complete_irq(void *opaque, int irq, bool secure)
|
||||
|
|
125
hw/intc/imx_gpcv2.c
Normal file
125
hw/intc/imx_gpcv2.c
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Impinj, Inc.
|
||||
*
|
||||
* i.MX7 GPCv2 block emulation code
|
||||
*
|
||||
* Author: Andrey Smirnov <andrew.smirnov@gmail.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/osdep.h"
|
||||
#include "hw/intc/imx_gpcv2.h"
|
||||
#include "qemu/log.h"
|
||||
|
||||
#define GPC_PU_PGC_SW_PUP_REQ 0x0f8
|
||||
#define GPC_PU_PGC_SW_PDN_REQ 0x104
|
||||
|
||||
#define USB_HSIC_PHY_SW_Pxx_REQ BIT(4)
|
||||
#define USB_OTG2_PHY_SW_Pxx_REQ BIT(3)
|
||||
#define USB_OTG1_PHY_SW_Pxx_REQ BIT(2)
|
||||
#define PCIE_PHY_SW_Pxx_REQ BIT(1)
|
||||
#define MIPI_PHY_SW_Pxx_REQ BIT(0)
|
||||
|
||||
|
||||
static void imx_gpcv2_reset(DeviceState *dev)
|
||||
{
|
||||
IMXGPCv2State *s = IMX_GPCV2(dev);
|
||||
|
||||
memset(s->regs, 0, sizeof(s->regs));
|
||||
}
|
||||
|
||||
static uint64_t imx_gpcv2_read(void *opaque, hwaddr offset,
|
||||
unsigned size)
|
||||
{
|
||||
IMXGPCv2State *s = opaque;
|
||||
|
||||
return s->regs[offset / sizeof(uint32_t)];
|
||||
}
|
||||
|
||||
static void imx_gpcv2_write(void *opaque, hwaddr offset,
|
||||
uint64_t value, unsigned size)
|
||||
{
|
||||
IMXGPCv2State *s = opaque;
|
||||
const size_t idx = offset / sizeof(uint32_t);
|
||||
|
||||
s->regs[idx] = value;
|
||||
|
||||
/*
|
||||
* Real HW will clear those bits once as a way to indicate that
|
||||
* power up request is complete
|
||||
*/
|
||||
if (offset == GPC_PU_PGC_SW_PUP_REQ ||
|
||||
offset == GPC_PU_PGC_SW_PDN_REQ) {
|
||||
s->regs[idx] &= ~(USB_HSIC_PHY_SW_Pxx_REQ |
|
||||
USB_OTG2_PHY_SW_Pxx_REQ |
|
||||
USB_OTG1_PHY_SW_Pxx_REQ |
|
||||
PCIE_PHY_SW_Pxx_REQ |
|
||||
MIPI_PHY_SW_Pxx_REQ);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct MemoryRegionOps imx_gpcv2_ops = {
|
||||
.read = imx_gpcv2_read,
|
||||
.write = imx_gpcv2_write,
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
.impl = {
|
||||
/*
|
||||
* Our device would not work correctly if the guest was doing
|
||||
* unaligned access. This might not be a limitation on the real
|
||||
* device but in practice there is no reason for a guest to access
|
||||
* this device unaligned.
|
||||
*/
|
||||
.min_access_size = 4,
|
||||
.max_access_size = 4,
|
||||
.unaligned = false,
|
||||
},
|
||||
};
|
||||
|
||||
static void imx_gpcv2_init(Object *obj)
|
||||
{
|
||||
SysBusDevice *sd = SYS_BUS_DEVICE(obj);
|
||||
IMXGPCv2State *s = IMX_GPCV2(obj);
|
||||
|
||||
memory_region_init_io(&s->iomem,
|
||||
obj,
|
||||
&imx_gpcv2_ops,
|
||||
s,
|
||||
TYPE_IMX_GPCV2 ".iomem",
|
||||
sizeof(s->regs));
|
||||
sysbus_init_mmio(sd, &s->iomem);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_imx_gpcv2 = {
|
||||
.name = TYPE_IMX_GPCV2,
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32_ARRAY(regs, IMXGPCv2State, GPC_NUM),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
||||
static void imx_gpcv2_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->reset = imx_gpcv2_reset;
|
||||
dc->vmsd = &vmstate_imx_gpcv2;
|
||||
dc->desc = "i.MX GPCv2 Module";
|
||||
}
|
||||
|
||||
static const TypeInfo imx_gpcv2_info = {
|
||||
.name = TYPE_IMX_GPCV2,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(IMXGPCv2State),
|
||||
.instance_init = imx_gpcv2_init,
|
||||
.class_init = imx_gpcv2_class_init,
|
||||
};
|
||||
|
||||
static void imx_gpcv2_register_type(void)
|
||||
{
|
||||
type_register_static(&imx_gpcv2_info);
|
||||
}
|
||||
type_init(imx_gpcv2_register_type)
|
|
@ -177,10 +177,11 @@ nvic_set_prio(int irq, bool secure, uint8_t prio) "NVIC set irq %d secure-bank %
|
|||
nvic_irq_update(int vectpending, int pendprio, int exception_prio, int level) "NVIC vectpending %d pending prio %d exception_prio %d: setting irq line to %d"
|
||||
nvic_escalate_prio(int irq, int irqprio, int runprio) "NVIC escalating irq %d to HardFault: insufficient priority %d >= %d"
|
||||
nvic_escalate_disabled(int irq) "NVIC escalating irq %d to HardFault: disabled"
|
||||
nvic_set_pending(int irq, bool secure, int en, int prio) "NVIC set pending irq %d secure-bank %d (enabled: %d priority %d)"
|
||||
nvic_set_pending(int irq, bool secure, bool derived, int en, int prio) "NVIC set pending irq %d secure-bank %d derived %d (enabled: %d priority %d)"
|
||||
nvic_clear_pending(int irq, bool secure, int en, int prio) "NVIC clear pending irq %d secure-bank %d (enabled: %d priority %d)"
|
||||
nvic_set_pending_level(int irq) "NVIC set pending: irq %d higher prio than vectpending: setting irq line to 1"
|
||||
nvic_acknowledge_irq(int irq, int prio, bool targets_secure) "NVIC acknowledge IRQ: %d now active (prio %d targets_secure %d)"
|
||||
nvic_acknowledge_irq(int irq, int prio) "NVIC acknowledge IRQ: %d now active (prio %d)"
|
||||
nvic_get_pending_irq_info(int irq, bool secure) "NVIC next IRQ %d: targets_secure: %d"
|
||||
nvic_complete_irq(int irq, bool secure) "NVIC complete IRQ %d (secure %d)"
|
||||
nvic_set_irq_level(int irq, int level) "NVIC external irq %d level set to %d"
|
||||
nvic_sysreg_read(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue