Skip to contentSkip to conversation

***SPAM*** KVM on ARM: How to add some functions into interrupt.S with C code?

DISCUSSION harry 2 participants 2 messages Jul 10, 2015 KVM arm64

lore
Share & tools
lore

harry

author
#0 lore raw

I want to add some functions into interrupt.S with C code to do some operations in hyp mode with a hypcall.

I have tried to add .global [function name] and use bl [function name], but there will be a prefetch abort.

So I want to know if the C code can be linked into interrupt.S and how to achieve this.

Thank you for help.

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

#1 lore raw

Hi Harry,

Quoted 8 lines · harry

I want to add some functions into interrupt.S with C code to do some operations in hyp mode with a hypcall.

I have tried to add .global [function name] and use bl [function name], but there will be a prefetch abort.

So I want to know if the C code can be linked into interrupt.S and how to achieve this.

It is most likely to fail if your C code is not part of the section that gets mapped in HYP mode. So jumping there gets you an abort because this area is not covered by any HYP page table.

At the moment, only the code that is between __kvm_hyp_code_start and __kvm_hyp_code_end is mapped at HYP, and that's fairly restrictive. You could adopt something similar to what we've done for arm64, where __kvm_hyp_code_{start,end} are just #defines that resolve as symbols created in vmlinux.lds.S.

You could then make both interrupt.S and your C code to be part of the same .hyp.text section, using something an attribute like __attribute__((__section__(".hyp.text"))). This should ensure that all the HYP code can get mapped by create_hyp_mapping in one go.

Hope this helps,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...