From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935646AbcIGJfZ (ORCPT ); Wed, 7 Sep 2016 05:35:25 -0400 Received: from foss.arm.com ([217.140.101.70]:45530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933840AbcIGJfY (ORCPT ); Wed, 7 Sep 2016 05:35:24 -0400 Subject: Re: [PATCH linux v3 3/9] xen: introduce xen_vcpu_id mapping To: Vitaly Kuznetsov , Stefano Stabellini References: <1469536228-29932-1-git-send-email-vkuznets@redhat.com> <1469536228-29932-4-git-send-email-vkuznets@redhat.com> <258e8e2e-29c4-1a88-2271-581f2ea59ec2@arm.com> <87d1kiwum9.fsf@vitty.brq.redhat.com> <87d1khv38p.fsf@vitty.brq.redhat.com> <87d1kgt6vs.fsf@vitty.brq.redhat.com> Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, x86@kernel.org, Boris Ostrovsky , David Vrabel , Juergen Gross , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Jan Beulich , Andrew Cooper , Steve Capper , Wei Chen , Kaly Xin From: Julien Grall Message-ID: Date: Wed, 7 Sep 2016 10:35:19 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <87d1kgt6vs.fsf@vitty.brq.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vitaly, On 07/09/2016 10:07, Vitaly Kuznetsov wrote: > Stefano Stabellini writes: >> I don't know that much about cpuid, but the virtual MPIDR is constructed >> from the vcpu id right now: >> >> v->arch.vmpidr = MPIDR_SMP | vcpuid_to_vaffinity(v->vcpu_id); >> >> [...] >> >> static inline register_t vcpuid_to_vaffinity(unsigned int vcpuid) >> { >> register_t vaff; >> >> vaff = (vcpuid & 0x0f) << MPIDR_LEVEL_SHIFT(0); >> vaff |= ((vcpuid >> 4) & MPIDR_LEVEL_MASK) << MPIDR_LEVEL_SHIFT(1); >> >> return vaff; >> } > > This could work but only in case there is a way to get MPIDR for _other_ > cpu (e.g. CPU0 needs to get MPIDR of CPU1 when CPU1 is not yet runnning) > or we'll have to change the machinery of how we bring up secondary CPUs > - e.g. CPUn starts, writes its id somewhere and 'hangs' waiting for CPU0 > to set up event channels. You can get the MPIDR from both the device tree and ACPI. The firmware table is parsed at boot time and the value is stored in cpu_logical_map(). Regards, -- Julien Grall