public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Lei Wen <adrian.wenl@gmail.com>
Cc: Christoffer Dall <c.dall@virtualopensystems.com>,
	<kvmarm@lists.cs.columbia.edu>, <kvm@vger.kernel.org>
Subject: Re: [kvmarm] [PATCH v10 06/14] KVM: ARM: Hypervisor inititalization
Date: Fri, 24 Aug 2012 15:38:54 +0200	[thread overview]
Message-ID: <fb987744e2f114466bc908b66c4ccd76@localhost> (raw)
In-Reply-To: <CALZhoSSDBNPUKJoH16+PfqvOafsGYzLW-i8frXJUa1C1=5qpdQ@mail.gmail.com>

On Fri, 24 Aug 2012 16:04:02 +0800, Lei Wen <adrian.wenl@gmail.com> wrote:
> On Thu, Aug 23, 2012 at 11:27 PM, Christoffer Dall
> <c.dall@virtualopensystems.com> wrote:
>> On Thu, Aug 23, 2012 at 11:08 AM, Lei Wen <adrian.wenl@gmail.com>
wrote:
>>> Hi Christoffer,
>>>
>>> [snip]
>>>
>>>> diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
>>>> index 1dc8926..4db26cb 100644
>>>> --- a/arch/arm/kvm/init.S
>>>> +++ b/arch/arm/kvm/init.S
>>>> @@ -15,5 +15,135 @@
>>>>   * along with this program; if not, write to the Free Software
>>>>   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 
>>>>   02110-1301, USA.
>>>>   */
>>>> +
>>>> +#include <linux/linkage.h>
>>>> +#include <asm/unified.h>
>>>>  #include <asm/asm-offsets.h>
>>>>  #include <asm/kvm_asm.h>
>>>> +#include <asm/kvm_arm.h>
>>>> +
>>>>
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>>>> +@  Hypervisor initialization
>>>> +@    - should be called with:
>>>> +@        r0 = Hypervisor pgd pointer
>>>> +@        r1 = top of Hyp stack (kernel VA)
>>>>
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>>>> +       .text
>>>> +       .arm
>>>> +        .pushsection    .hyp.idmap.text,"ax"
>>>> +       .align 12
>>>> +__kvm_hyp_init:
>>>> +       .globl __kvm_hyp_init
>>>> +
>>>> +       @ Hyp-mode exception vector
>>>> +       nop
>>>> +       nop
>>>> +       nop
>>>> +       nop
>>>> +       nop
>>>> +       b       __do_hyp_init
>>>> +       nop
>>>> +       nop
>>>> +
>>>> +__do_hyp_init:
>>>> +       @ Set the sp to end of this page and push data for later use
>>>> +       mov     sp, pc
>>>> +       bic     sp, sp, #0x0ff
>>>> +       bic     sp, sp, #0xf00
>>>> +       add     sp, sp, #0x1000
>>>> +       push    {r0, r1, r2, r12}
>>>
>>> Is safe to use the stack here? Since our HYP memory mapping is
>>> gotten valid after the following HTTBR being set as I think.
>>>
>>
>> yes, as you can see in the end of this block we have a .align 12
>> before __kvm_hyp_init_end giving us the stack space we need in this
>> page (as long as this init code doesn't grow beyond ~3K
> 
> I know this area is already being mapped in hyp_init_static_idmap,
> however, due to the HTTBR is not being set up yet in the below code.
> So how the memory get mapped in the hyp mode? I mean what I could
> understand the hyp virtual address only could be seen after HTTBR
> being set up.

Hint: look at HSCTLR, and when the M bit gets set. Until then, the words
"virtual address" have no meaning.

        M.
-- 
Fast, cheap, reliable. Pick two.

  reply	other threads:[~2012-08-24 14:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16 15:27 [PATCH v10 00/14] KVM/ARM Implementation Christoffer Dall
2012-08-16 15:28 ` [PATCH v10 01/14] ARM: add mem_type prot_pte accessor Christoffer Dall
2012-08-16 15:28 ` [PATCH v10 02/14] ARM: Add config option ARM_VIRT_EXT Christoffer Dall
2012-08-16 15:28 ` [PATCH v10 03/14] ARM: Section based HYP idmap Christoffer Dall
2012-08-16 15:28 ` [PATCH v10 04/14] ARM: Expose PMNC bitfields for KVM use Christoffer Dall
2012-08-16 15:28 ` [PATCH v10 05/14] KVM: ARM: Initial skeleton to compile KVM support Christoffer Dall
2012-08-16 15:29 ` [PATCH v10 06/14] KVM: ARM: Hypervisor inititalization Christoffer Dall
2012-08-23 15:08   ` [kvmarm] " Lei Wen
2012-08-23 15:27     ` Christoffer Dall
2012-08-24  8:04       ` Lei Wen
2012-08-24 13:38         ` Marc Zyngier [this message]
2012-08-24 14:34           ` Lei Wen
2012-08-16 15:29 ` [PATCH v10 07/14] KVM: ARM: Memory virtualization setup Christoffer Dall
2012-08-16 18:25   ` [kvmarm] " Alexander Graf
2012-08-19  4:34     ` Christoffer Dall
2012-08-19  9:38       ` Peter Maydell
2012-08-19 13:00         ` Avi Kivity
2012-08-19 20:00           ` Christoffer Dall
2012-08-23  8:12   ` Min-gyu Kim
2012-08-23 14:46     ` Christoffer Dall
2012-08-16 15:29 ` [PATCH v10 08/14] KVM: ARM: Inject IRQs and FIQs from userspace Christoffer Dall
2012-08-21  8:20   ` Jan Kiszka
2012-08-21 14:13     ` Christoffer Dall
2012-08-16 15:29 ` [PATCH v10 09/14] KVM: ARM: World-switch implementation Christoffer Dall
2012-08-16 15:29 ` [PATCH v10 10/14] KVM: ARM: Emulation framework and CP15 emulation Christoffer Dall
2012-08-16 15:30 ` [PATCH v10 11/14] KVM: ARM: User space API for getting/setting co-proc registers Christoffer Dall
2012-08-16 15:30 ` [PATCH v10 12/14] KVM: ARM: Handle guest faults in KVM Christoffer Dall
2012-08-16 15:30 ` [PATCH v10 13/14] KVM: ARM: Handle I/O aborts Christoffer Dall
2012-08-16 15:30 ` [PATCH v10 14/14] KVM: ARM: Guest wait-for-interrupts (WFI) support Christoffer Dall

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=fb987744e2f114466bc908b66c4ccd76@localhost \
    --to=marc.zyngier@arm.com \
    --cc=adrian.wenl@gmail.com \
    --cc=c.dall@virtualopensystems.com \
    --cc=kvm@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox