On Wed, Jul 25, 2018 at 07:50:21PM +0200, David Hildenbrand wrote:
> On 25.07.2018 19:09, Eduardo Habkost wrote:
[...]
> >> + if (local_err) {
> >> + g_assert(kvm_enabled());
> >> + error_report_err(local_err);
> >> + /* fallback to unsupported CPU models */
> >> + return;
> >
> > What about moving this outside instance_init?
>
> To which place for example? We at least have to copy the CPU model
> for each and every CPU instance (so we can modify it without side
> effects using properties).
To any code that will look at cpu->model.
You are wrapping an interface that needs to report errors
(kvm_s390_get_host_cpu_model()) behind an interface that is not
able to report errors (object_new()). There's nothing that
requires you to do that, does it? You are free to provide an API
that is actually able to report errors, instead of relying on
object_new() only.
But I understand that the QOM/qdev API doesn't make that job
easy. On x86 we have X86CPU::max_features and
X86CPU::user_features because of that.
--
Eduardo