On Fri, Nov 4, 2016 at 10:19 PM, Richard Henderson <r...@twiddle.net> wrote:
> On 11/04/2016 02:50 PM, Artyom Tarasenko wrote:
>>
>> +    if (is_exec) { /* XXX has_hypervisor */
>> +        if (env->lsu & (IMMU_E)) {
>> +            cpu_raise_exception_ra(env, TT_CODE_ACCESS, GETPC());
>> +        } else if (cpu_has_hypervisor(env) && !(env->hpstate & HS_PRIV))
>> {
>> +            cpu_raise_exception_ra(env, TT_INSN_REAL_TRANSLATION_MISS,
>> GETPC());
>> +        }
>> +    } else {
>> +        if (env->lsu & (DMMU_E)) {
>> +            cpu_raise_exception_ra(env, TT_DATA_ACCESS, GETPC());
>> +        } else if (cpu_has_hypervisor(env) && !(env->hpstate & HS_PRIV))
>> {
>> +            cpu_raise_exception_ra(env, TT_DATA_REAL_TRANSLATION_MISS,
>> GETPC());
>> +        }
>> +    }
>
>
> And if the hypervisor itself has a bug and references bad memory?

The MMU is usually switched on. The exception is the early initialization.

> Or does
> the hypervisor *have* to do such things in order to probe for device on
> startup, and should therefore not trap.
>
> I'm actually assuming this is the case based on the fact that you wrote this
> patch in the first place.

Yep.

> But if so, we need a comment here.

With MMU switched off there is no circuit which would produce a MMU fault.
Neither under sun4v nor under sun4u. Do we really have to document it?

Btw it works the same way under sun4m just 26 lines above.

-- 
Regards,
Artyom Tarasenko

SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu

Reply via email to