[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target-arm: kvm: use KVM_SET_SREGS to set targe

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] target-arm: kvm: use KVM_SET_SREGS to set target to Cortex A15
Date: Tue, 17 Jul 2012 18:31:00 +0100

On 13 July 2012 04:37, Rusty Russell <address@hidden> wrote:
>  int kvm_arch_init_vcpu(CPUARMState *env)
>  {
> -    return 0;
> +    struct kvm_sregs sregs;
> +
> +    sregs.target = KVM_ARM_TARGET_CORTEX_A15;
> +    sregs.num_features = 0;

We need to add a check somewhere that if we're not emulating
an A15 then we either fail noisily or silently drop back to
TCG. Then we should have an assert in here that env refers
to an A15 I guess. [not yet figured out how to do that, I
don't want to look at the cpu->midr, we only just finished
cleaning out all the references to that. Maybe there should
be a field in the struct ARMCPU which gives the KVM_ARM_TARGET_*
value to use?]

Unfortunately I can't find a good place to put the CPU type
check -- ideally we would fail kvm_init() as this would make
us fall back to TCG in the usual way, but in kvm_init() you
don't yet know what guest CPU you're going to be emulating...

> +
> +    /* Ignore failure for compatibility with old kvm versions. */
> +    return kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs) ? 0 : 0;

I assume this weird "? 0 : 0" construct is going to go away
when we drop the back-compat?

Since this back-compat code is going to go away within a
few weeks, it would make my life easier if all the back
compat code was flagged with ifdefs or something, so we
don't leave it in by mistake (and so I know what not to
worry about reviewing in patches).

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]