Skip to contentSkip to conversation

How is code passed for KVM_RUN?

DISCUSSION Christoffer Dall 3 participants 3 messages Mar 6, 2009

lore
Share & tools
lore
#0 lore raw

Hi.

We are a small group trying to port KVM to ARM and taking inspiration in the work done for PowerPC.

We are just beginning to understand KVM, so bear with us for noob questions. We are willing to put a lot of work into this though.

When going through the code in booke_interrupts.S, I can see that the execution of code is performed by the rfi instruction, which jumps to the location stored in the vcpu struct, but I cannot see how the actual code to run is ever loaded in that place.

I have tried going through the userspace code as well, but I am unsure if loading the code for execution happens through mmap, a page fault signal or ...?

Any help would be GREATLY appreciated!

Thank you!

Best regards,
Christoffer Dall

#1 lore raw
Quoted 7 lines · Christoffer Dall

Hi.

We are a small group trying to port KVM to ARM and taking inspiration in the work done for PowerPC.

We are just beginning to understand KVM, so bear with us for noob questions. We are willing to put a lot of work into this though.

Sounds like fun.

Quoted 8 lines

When going through the code in booke_interrupts.S, I can see that the execution of code is performed by the rfi instruction, which jumps to the location stored in the vcpu struct, but I cannot see how the actual code to run is ever loaded in that place.

I have tried going through the userspace code as well, but I am unsure if loading the code for execution happens through mmap, a page fault signal or ...?

Guest code is just copied into place by userspace. Probably the easiest example of this is in user/main-ppc.c, which just loads a flat binary. (Qemu has loaders for ELF and uImages.)

Userspace allocates memory, then tells the kernel where that is (look for memslot registration).

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#2 lore raw
In reply to Christoffer Dall
Quoted 4 lines · Christoffer Dall

Hi.

We are a small group trying to port KVM to ARM and taking inspiration in the work done for PowerPC.

Wow, awesome. Do you have any idea how to come around the limitations of the platform?
As far as I know ARM is not virtualizable. One reason I remember is that the status register for context switches (supervisor/privileged) is not trappable.

Alex

Quoted 25 lines

We are just beginning to understand KVM, so bear with us for noob questions. We are willing to put a lot of work into this though.

When going through the code in booke_interrupts.S, I can see that the execution of code is performed by the rfi instruction, which jumps to the location stored in the vcpu struct, but I cannot see how the actual code to run is ever loaded in that place.

I have tried going through the userspace code as well, but I am unsure if loading the code for execution happens through mmap, a page fault signal or ...?

Any help would be GREATLY appreciated!

Thank you!

Best regards,
Christoffer Dall
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html