On 17 July 2012 18:31, Peter Maydell <peter.maydell at linaro.org> wrote: > 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... Having thought more about this, I don't think there is anywhere we can do a check that would give the failure semantics we'd like (ie respecting whatever the user's accel= options were). We don't know what the guest CPU is until we get to trying to construct the CPU in the machine. But other devices the machine constructs might want to know kvm vs tcg (eg irqchip), and we can't enforce ordering restrictions on device construction really. (That's ignoring the question of whether we could even postpone kvm_init() at all, which I'm not convinced wouldn't break something.) So I can't see anything better than "complain and return failure from kvm_arch_init_vcpu() if the guest CPU isn't going to work". -- PMM