mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/intc/armv7m_nvic: Implement cache ID registers
M profile cores have a similar setup for cache ID registers to A profile: * Cache Level ID Register (CLIDR) is a fixed value * Cache Type Register (CTR) is a fixed value * Cache Size ID Registers (CCSIDR) are a bank of registers; which one you see is selected by the Cache Size Selection Register (CSSELR) The only difference is that they're in the NVIC memory mapped register space rather than being coprocessor registers. Implement the M profile view of them. Since neither Cortex-M3 nor Cortex-M4 implement caches, we don't need to update their init functions and can leave the ctr/clidr/ccsidr[] fields in their ARMCPU structs at zero. Newer cores (like the Cortex-M33) will want to be able to set these ID registers to non-zero values, though. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20180209165810.6668-6-peter.maydell@linaro.org
This commit is contained in:
parent
ae7c5c855b
commit
43bbce7fbe
3 changed files with 78 additions and 0 deletions
|
@ -191,6 +191,41 @@ static const VMStateDescription vmstate_m_faultmask_primask = {
|
|||
}
|
||||
};
|
||||
|
||||
/* CSSELR is in a subsection because we didn't implement it previously.
|
||||
* Migration from an old implementation will leave it at zero, which
|
||||
* is OK since the only CPUs in the old implementation make the
|
||||
* register RAZ/WI.
|
||||
* Since there was no version of QEMU which implemented the CSSELR for
|
||||
* just non-secure, we transfer both banks here rather than putting
|
||||
* the secure banked version in the m-security subsection.
|
||||
*/
|
||||
static bool csselr_vmstate_validate(void *opaque, int version_id)
|
||||
{
|
||||
ARMCPU *cpu = opaque;
|
||||
|
||||
return cpu->env.v7m.csselr[M_REG_NS] <= R_V7M_CSSELR_INDEX_MASK
|
||||
&& cpu->env.v7m.csselr[M_REG_S] <= R_V7M_CSSELR_INDEX_MASK;
|
||||
}
|
||||
|
||||
static bool m_csselr_needed(void *opaque)
|
||||
{
|
||||
ARMCPU *cpu = opaque;
|
||||
|
||||
return !arm_v7m_csselr_razwi(cpu);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_m_csselr = {
|
||||
.name = "cpu/m/csselr",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.needed = m_csselr_needed,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32_ARRAY(env.v7m.csselr, ARMCPU, M_REG_NUM_BANKS),
|
||||
VMSTATE_VALIDATE("CSSELR is valid", csselr_vmstate_validate),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_m = {
|
||||
.name = "cpu/m",
|
||||
.version_id = 4,
|
||||
|
@ -212,6 +247,7 @@ static const VMStateDescription vmstate_m = {
|
|||
},
|
||||
.subsections = (const VMStateDescription*[]) {
|
||||
&vmstate_m_faultmask_primask,
|
||||
&vmstate_m_csselr,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue