All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: harry <13401187209@126.com>, kvmarm@lists.cs.columbia.edu
Subject: Re: ***SPAM*** KVM on ARM: How to add some functions into interrupt.S with C code?
Date: Fri, 10 Jul 2015 14:38:38 +0100	[thread overview]
Message-ID: <559FCADE.3030200@arm.com> (raw)
In-Reply-To: <5675dfef.1beed.14e77374fec.Coremail.13401187209@126.com>

Hi Harry,

On 10/07/15 10:06, harry wrote:
> 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.
-- 
Jazz is not dead. It just smells funny...

      reply	other threads:[~2015-07-10 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  9:06 ***SPAM*** KVM on ARM: How to add some functions into interrupt.S with C code? harry
2015-07-10 13:38 ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559FCADE.3030200@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=13401187209@126.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.