From: Avi Kivity <avi@redhat.com>
To: Rusty Russell <rusty.russell@linaro.org>
Cc: Christoffer Dall <c.dall@virtualopensystems.com>,
android-virt@lists.cs.columbia.edu, kvm@vger.kernel.org,
Peter Maydell <peter.maydell@linaro.org>,
tech@virtualopensystems.com
Subject: Re: [PATCH v7 08/12] ARM: KVM: World-switch implementation
Date: Wed, 28 Mar 2012 15:05:55 +0200 [thread overview]
Message-ID: <4F730CB3.6010402@redhat.com> (raw)
In-Reply-To: <87wr6c88s3.fsf@rustcorp.com.au>
On 03/23/2012 02:23 AM, Rusty Russell wrote:
> On Mon, 12 Mar 2012 02:52:41 -0400, Christoffer Dall <c.dall@virtualopensystems.com> wrote:
> > @@ -236,6 +237,24 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
> >
> > int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
> > {
> > + unsigned long cpsr;
> > + unsigned long sctlr;
> > +
> > +
> > + /* Init execution CPSR */
> > + asm volatile ("mrs %[cpsr], cpsr" :
> > + [cpsr] "=r" (cpsr));
> > + vcpu->arch.regs.cpsr = SVC_MODE | PSR_I_BIT | PSR_F_BIT | PSR_A_BIT |
> > + (cpsr & PSR_E_BIT);
> > +
> > + /* Init SCTLR with MMU disabled */
> > + asm volatile ("mrc p15, 0, %[sctlr], c1, c0, 0" :
> > + [sctlr] "=r" (sctlr));
> > + vcpu->arch.cp15[c1_SCTLR] = sctlr & ~1U;
> > +
> > + /* Compute guest MPIDR */
> > + vcpu->arch.cp15[c0_MPIDR] = (read_cpuid_mpidr() & ~0xff)
> > + | vcpu->vcpu_id;
> > return 0;
> > }
>
> Hi Christoffer!
>
> I started cleaning this up, on the theory that we should use the
> defined reset values rather than basing them on host values. Then I
> discovered that this is ignored by qemu anyway, which overrides the
> values (except for MPIDR: I set that to 0x80000000 | vcpu->vcpu_id,
> which seems correct to me).
>
> Should this code be dropped altogether? Peter points out that once we
> add new regs, they *must* be initialized to correct reset values in case
> older QEMU knows nothing about them, but for the rest it just seems
> confusing...
>
It's best to initialize everything. As far as this code is concerned
qemu is just another user and we shouldn't rely on its implementation.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-03-28 13:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 6:51 [PATCH v7 00/12] KVM/ARM Implementation Christoffer Dall
2012-03-12 6:51 ` [PATCH v7 01/12] KVM: Introduce __KVM_HAVE_IRQ_LINE Christoffer Dall
2012-03-23 0:41 ` [PATCH] ARM: KVM: Check the cpuid we're being asked to emulate Rusty Russell
2012-05-14 22:57 ` Christoffer Dall
2012-05-16 23:58 ` Rusty Russell
2012-05-20 18:34 ` Christoffer Dall
2012-05-21 1:13 ` Rusty Russell
2012-03-12 6:52 ` [PATCH v7 02/12] KVM: Guard mmu_notifier specific code with CONFIG_MMU_NOTIFIER Christoffer Dall
2012-03-12 15:50 ` Avi Kivity
2012-03-12 6:52 ` [PATCH v7 03/12] ARM: KVM: Initial skeleton to compile KVM support Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 04/12] ARM: KVM: Hypervisor identity mapping Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 05/12] ARM: KVM: Hypervisor inititalization Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 06/12] ARM: KVM: Memory virtualization setup Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 07/12] ARM: KVM: Inject IRQs and FIQs from userspace Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 08/12] ARM: KVM: World-switch implementation Christoffer Dall
2012-03-23 0:23 ` Rusty Russell
2012-03-28 13:05 ` Avi Kivity [this message]
2012-03-28 21:57 ` Rusty Russell
2012-03-29 10:49 ` Avi Kivity
2012-05-14 18:08 ` Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 09/12] ARM: KVM: Emulation framework and CP15 emulation Christoffer Dall
2012-03-12 6:52 ` [PATCH v7 10/12] ARM: KVM: Handle guest faults in KVM Christoffer Dall
2012-03-12 15:31 ` [Android-virt] " Marc Zyngier
2012-03-12 16:23 ` Christoffer Dall
2012-03-12 16:28 ` Marc Zyngier
2012-03-12 6:53 ` [PATCH v7 11/12] ARM: KVM: Handle I/O aborts Christoffer Dall
2012-03-12 6:53 ` [PATCH v7 12/12] ARM: KVM: Guest wait-for-interrupts (WFI) support Christoffer Dall
2012-03-12 17:36 ` [PATCH v7 00/12] KVM/ARM Implementation Avi Kivity
2012-03-23 0:40 ` [PATCH] ARM: KVM: Remove l2ctlr write Rusty Russell
2012-05-14 22:59 ` Christoffer Dall
2012-03-29 5:11 ` [PATCH 0/3] Emulation cleanups Rusty, Russell <rusty.russell
2012-03-29 5:15 ` [PATCH 1/3] ARM: KVM: Remove l2ctlr write Rusty Russell
2012-03-29 5:17 ` [PATCH 2/3] ARM: KVM: Fake up performance counters a little more precisely Rusty Russell
2012-05-14 22:49 ` Christoffer Dall
2012-05-17 0:12 ` Rusty Russell
2012-03-29 5:17 ` [PATCH 3/3] ARM: KVM: Check the cpuid we're being asked to emulate Rusty Russell
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=4F730CB3.6010402@redhat.com \
--to=avi@redhat.com \
--cc=android-virt@lists.cs.columbia.edu \
--cc=c.dall@virtualopensystems.com \
--cc=kvm@vger.kernel.org \
--cc=peter.maydell@linaro.org \
--cc=rusty.russell@linaro.org \
--cc=tech@virtualopensystems.com \
/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;
as well as URLs for NNTP newsgroup(s).