[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 06/18] hw/arm/allwinner: add CPU Configuration module
From: |
Peter Maydell |
Subject: |
Re: [PATCH v6 06/18] hw/arm/allwinner: add CPU Configuration module |
Date: |
Mon, 9 Mar 2020 11:18:12 +0000 |
On Tue, 3 Mar 2020 at 20:15, Niek Linnenbank <address@hidden> wrote:
> On Tue, Mar 3, 2020 at 1:09 PM Alex Bennée <address@hidden> wrote:
>> Niek Linnenbank <address@hidden> writes:
>> > +static void allwinner_cpucfg_cpu_reset(AwCpuCfgState *s, uint8_t cpu_id)
>> > +{
>> > + int ret;
>> > +
>> > + trace_allwinner_cpucfg_cpu_reset(cpu_id, s->entry_addr);
>> > +
>> > + ret = arm_set_cpu_on(cpu_id, s->entry_addr, 0,
>> > + CPU_EXCEPTION_LEVEL_ON_RESET, false);
>>
>> According to the arm_set_cpu_on code:
>>
>> if (!target_aa64 && arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64)) {
>> /*
>> * For now we don't support booting an AArch64 CPU in AArch32 mode
>> * TODO: We should add this support later
>> */
>> qemu_log_mask(LOG_UNIMP,
>> "[ARM]%s: Starting AArch64 CPU %" PRId64
>> " in AArch32 mode is not supported yet\n",
>> __func__, cpuid);
>> return QEMU_ARM_POWERCTL_INVALID_PARAM;
>> }
>>
>> Do you really want to reboot in aarch32 mode on a reset? If so we should
>> fix the TODO.
>
> The Allwinner H3 has four ARM Cortex-A7 cores and are 32-bit, so in the
> early version I filled the @target_aa64 parameter with false to
> keep it in 32-bit mode. And for usage in the current Allwinner H3 SoC
> that is sufficient, but as soon as a potential new SoC implementation
> with a 64-bit CPU starts to use this module, the hardcoded @target_aa64
> parameter will become a problem.
> Maybe I should just use some function to check if the current emulated
> CPU its 32-bit or 64-bit and use that for @target_aa64?
If the intended behaviour is "just power on the CPU into EL3
in the aarch32/aarch64 state it would naturally have out of reset"
then you can get the right value to pass to target_aa64 like this:
ARMCPU *target_cpu = ARM_CPU(arm_get_cpu_by_id(cpu_id));
if (!target_cpu) {
/*
* handle the case of "guest wrote bogus value to RST_CTRL
* field, probably by returning doing nothing
*/
}
target_aa64 = arm_feature(&target_cpu->env, ARM_FEATURE_AARCH64);
Or if the required behaviour for a 64-bit CPU is more complicated
you can just assert or something with a comment that this would need
updating if we ever modelled a 64-bit Allwinner SoC.
thanks
-- PMM
- [PATCH v6 00/18] Add Allwinner H3 SoC and Orange Pi PC Machine, Niek Linnenbank, 2020/03/01
- [PATCH v6 04/18] hw/arm/allwinner-h3: add USB host controller, Niek Linnenbank, 2020/03/01
- [PATCH v6 05/18] hw/arm/allwinner-h3: add System Control module, Niek Linnenbank, 2020/03/01
- [PATCH v6 10/18] hw/arm/allwinner-h3: add Boot ROM support, Niek Linnenbank, 2020/03/01
- [PATCH v6 07/18] hw/arm/allwinner: add Security Identifier device, Niek Linnenbank, 2020/03/01
- [PATCH v6 06/18] hw/arm/allwinner: add CPU Configuration module, Niek Linnenbank, 2020/03/01
[PATCH v6 15/18] tests/boot_linux_console: Add a SD card test for the OrangePi PC board, Niek Linnenbank, 2020/03/01
[PATCH v6 02/18] hw/arm: add Xunlong Orange Pi PC machine, Niek Linnenbank, 2020/03/01
[PATCH v6 17/18] tests/boot_linux_console: Test booting NetBSD via U-Boot on OrangePi PC, Niek Linnenbank, 2020/03/01
[PATCH v6 12/18] hw/arm/allwinner: add RTC device support, Niek Linnenbank, 2020/03/01
[PATCH v6 18/18] docs: add Orange Pi PC document, Niek Linnenbank, 2020/03/01