[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property
From: |
Peter Crosthwaite |
Subject: |
Re: [Qemu-devel] [PATCH arm-midr v1 1/2] ARM: Convert MIDR to a property |
Date: |
Mon, 13 Jan 2014 10:03:20 +1000 |
On Mon, Jan 13, 2014 at 9:54 AM, Andreas Färber <address@hidden> wrote:
> Am 13.01.2014 00:33, schrieb Alistair Francis:
>> Convert the MIDR register to a property. This allows boards to later set
>> a custom MIDR value. This has been done in such a way to maintain
>> compatibility with all existing CPUs and boards
>>
>> Signed-off-by: Alistair Francis <address@hidden>
>> ---
>> I added the properties to the cpu->midr variable in a similar method to
>> how Peter Crosthwaite did in his 'Fix Support for ARM CBAR and
>> reset-hivecs' series.
>>
>> target-arm/cpu.c | 17 +++++++++++++++++
>> 1 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-arm/cpu.c b/target-arm/cpu.c
>> index 408d207..bf625b0 100644
>> --- a/target-arm/cpu.c
>> +++ b/target-arm/cpu.c
>> @@ -249,10 +249,14 @@ static Property arm_cpu_reset_cbar_property =
>> static Property arm_cpu_reset_hivecs_property =
>> DEFINE_PROP_BOOL("reset-hivecs", ARMCPU, reset_hivecs, false);
>>
>> +static Property arm_cpu_midr_property =
>> + DEFINE_PROP_UINT32("midr", ARMCPU, midr, 0);
>> +
>> static void arm_cpu_post_init(Object *obj)
>> {
>> ARMCPU *cpu = ARM_CPU(obj);
>> Error *err = NULL;
>> + uint32_t temp = cpu->midr;
>>
>> if (arm_feature(&cpu->env, ARM_FEATURE_CBAR)) {
>> qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_cbar_property,
>> @@ -265,6 +269,19 @@ static void arm_cpu_post_init(Object *obj)
>> &err);
>> assert_no_error(err);
>> }
>> +
>> + /*
>> + * Initialise the midr property and set it to the original CPU MIDR
>> + * This is used to maintain compatibility with boards that don't set
>> + * a custom MIDR
>> + */
>> + qdev_property_add_static(DEVICE(obj), &arm_cpu_midr_property, &err);
>
> This looks wrong to me. Use dc->props to add properties that are always
> present. Any qdev_* functions shouldn't spread further than necessary.
>
If it is always present - PMM do you have any thoughts on this? does
MIDR universally exist in the ARM universe?
>> + assert_no_error(err);
>
> Further, this seems to conflict with Peter C.'s work of introducing
> error_abort.
>
While we are on that topic, that pull (QMP queue) is progressing
slowly. Seems to be skipped over by Anthony in latest round of pulls
for some reason?
Regards,
Peter
> Andreas
>
>> + object_property_set_int(OBJECT(cpu), temp, "midr", &err);
>> + if (err) {
>> + error_report("%s", error_get_pretty(err));
>> + exit(1);
>> + }
>> }
>>
>> static void arm_cpu_finalizefn(Object *obj)
>>
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>