Re: [PATCH v6 04/12] ARM: KVM: Hypervisor inititalization

Christoffer Dall
2012-03-05T02:13:50Z

On Sun, Mar 4, 2012 at 8:12 PM, Rusty Russell <rusty@rustcorp.com.au> wrote:
> On Thu, 23 Feb 2012 02:32:39 -0500, Christoffer Dall <c.dall@virtualopensystems.com> wrote:
>> From: Christoffer Dall <c.dall@virtualopensystems.com>
>>
>> +static void cpu_set_vector(void *vector)
>> +{
>> +     unsigned long vector_ptr;
>> +     unsigned long smc_hyp_nr;
>> +
>> +     vector_ptr = (unsigned long)vector;
>> +     smc_hyp_nr = SMCHYP_HVBAR_W;
>> +
>> +     /*
>> +      * Set the HVBAR
>> +      */
>> +     asm volatile (
>> +             "mov    r0, %[vector_ptr]\n\t"
>> +             "mov    r7, %[smc_hyp_nr]\n\t"
>> +             "smc    #0\n\t" : :
>> +             [vector_ptr] "r" (vector_ptr),
>> +             [smc_hyp_nr] "r" (smc_hyp_nr) :
>> +             "r0", "r1");
>
> Testing this recently, trying to get a kvm guest to boot.  No success
> yet, but I did get another issue when I compiled the host non-SMP: you
> need to mark r7 as clobbered here (on SMP we didn't clobber anything
> important, but on UP it hit init_end_phys_addr and changed it to
> 0xffffffff and we died horribly in hyp_idmap_del().
>

you're absolutely right. Nice catch. Thanks.