[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200108135957.4milt3brij7lvfd3@kamzik.brq.redhat.com>
Date: Wed, 8 Jan 2020 14:59:57 +0100
From: Andrew Jones <drjones@...hat.com>
To: Ben Gardon <bgardon@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Cannon Matthews <cannonmatthews@...gle.com>,
Peter Xu <peterx@...hat.com>
Subject: Re: [PATCH v3 5/8] KVM: selftests: Pass args to vCPU instead of
using globals
On Tue, Jan 07, 2020 at 10:26:10AM -0800, Ben Gardon wrote:
> On Tue, Jan 7, 2020 at 7:23 AM Andrew Jones <drjones@...hat.com> wrote:
> >
> > On Mon, Dec 16, 2019 at 01:38:58PM -0800, Ben Gardon wrote:
> > > In preparation for supporting multiple vCPUs in the demand paging test,
> > > pass arguments to the vCPU instead of syncing globals to it.
> >
> > This will only work if we don't spill parameters onto the stack and all
> > data we want to pass fit in registers.
>
> That's a great point. I'll see about using globals and deriving the
> cpu ID to look up args. In your pseudocode below I see you use
> arch_get_cpu_id, but I don't believe this function exists in selftests
> and I don't have the knowledge off the top of my head to implement it
> for s390 and aarch64. Do you have any pointers for implementing such a
> function?
Yeah, I never posted the patches that I used this approach on. For aarch64
my "arch_get_cpu_id", which was actually just open-coded in guest_code,
was something similar to this
/* We only look at the first two affinity levels for now. */
int arch_get_cpu_id(void)
{
uint64_t mpidr_el1, aff1, aff0;
asm volatile("mrs %0, mpidr_el1" : "=r" (mpidr_el1));
aff0 = mpidr_el1 & 0xf;
aff1 = (mpidr_el1 >> 8) & 0xff;
return aff1 * 16 + aff0;
}
Thanks,
drew
Powered by blists - more mailing lists