Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines

From: Andreas Färber
Date: Fri Feb 20 2015 - 10:42:08 EST


Am 20.02.2015 um 16:32 schrieb Michael Mueller:
> On Fri, 20 Feb 2015 15:03:30 +0100
> Alexander Graf <agraf@xxxxxxx> wrote:
>
>>>
>>> - s390_get_proceccor_props()
>>> - s390_set_proceccor_props()
>>>
>>> They can be used to request or retrieve processor related information from an accelerator.
>>> That information comprises the cpu identifier, the ICB value and the facility lists.
>>>
>>> Signed-off-by: Michael Mueller <mimu@xxxxxxxxxxxxxxxxxx>
>>
>> Hrm, I still seem to miss the point of this interface. What do you need
>> it for?
>
> These functions make the internal s390 cpu model API independent from a specific accelerator:
>
> int s390_set_processor_props(S390ProcessorProps *prop)
> {
> if (kvm_enabled()) {
> return kvm_s390_set_processor_props(prop);
> }
> return -ENOSYS;
> }
>
> It's called by:
>
> s390_select_cpu_model(const char *model)
>
> which is itself called by:
>
> S390CPU *cpu_s390x_init(const char *cpu_model)
> {
> S390CPU *cpu;
>
> cpu = S390_CPU(object_new(s390_select_cpu_model(cpu_model)));
>
> object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
>
> return cpu;
> }
>
> So above s390_set/get_processor_props() the code is accelerator independent.

Can't you just implement the class-level name-to-ObjectClass callback
that other CPUs have grown for the above use case?

Also a general comment: cpu-model/ is not an existing directory nor one
you add, so please use "target-s390x: Add foo to S390CPU" or so.

Regards,
Andreas

--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/