From patchwork Wed Sep 11 11:59:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19968 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1EB625E63 for ; Wed, 11 Sep 2013 11:59:56 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf10189953vbg.3 for ; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=RFZ8F3BtLg4ckUzbSEhmxO2hy8hjQ87z50YwZNGekHA=; b=ZnmWG7I7wzmVWxf5p0NyjLJE1qFWYf+hjwZwd2TAHPu97JRB+XBFTMfqCVcvH/hoHu 9sb73exNs3mSNLo4dpbf0bsIAnJvfQ9OFyYDAgWM+gn5NAmSTY4AHGufL5okvN43StBn mmFo95j/KhZ40Z1L3/9kke4TaiTp1EuhbAKpCHuhX41pc3ylJGauQ1YsLZmJMpVBNkmR B9wPdPTIQCSFNeLIYdhU12Q/lgiRVE+HsJoOSn26TiIOlHv5EIETjugsBIpgLQWGdvyV RulAZ+22C/lxNa4xydd/NDnC1ogdEiuhuZP/azrnzSnjFRmtJfzjOVIrrs7HkQ0Cs41Y ZMbA== X-Received: by 10.236.116.135 with SMTP id g7mr420331yhh.53.1378900796739; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.231 with SMTP id ln7ls185733qeb.57.gmail; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) X-Received: by 10.220.249.67 with SMTP id mj3mr904923vcb.23.1378900796536; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id tj1si5873644vdc.118.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 04:59:56 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id w16so5884434vbf.7 for ; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) X-Gm-Message-State: ALoCoQnu8wWFySPYi+7ya/CzoqZMQrfCrh7Eu/Y2YHShJ6kQPdAUxWAC3FFAe+2DIufviVG2MMGF X-Received: by 10.58.19.162 with SMTP id g2mr949051vee.12.1378900796463; Wed, 11 Sep 2013 04:59:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp52088vcz; Wed, 11 Sep 2013 04:59:55 -0700 (PDT) X-Received: by 10.14.127.137 with SMTP id d9mr562126eei.90.1378900795557; Wed, 11 Sep 2013 04:59:55 -0700 (PDT) Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by mx.google.com with ESMTPS id h5si4262404eeg.230.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 04:59:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.177 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.177; Received: by mail-ea0-f177.google.com with SMTP id f15so4517448eak.22 for ; Wed, 11 Sep 2013 04:59:54 -0700 (PDT) X-Received: by 10.15.67.131 with SMTP id u3mr1787675eex.34.1378900794688; Wed, 11 Sep 2013 04:59:54 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id p5sm39687866eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Sep 2013 04:59:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, Julien Grall Subject: [PATCH v2 6/6] xen/arm: Use the hardware ID to boot correctly secondary cpus Date: Wed, 11 Sep 2013 12:59:44 +0100 Message-Id: <1378900784-16949-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378900784-16949-1-git-send-email-julien.grall@linaro.org> References: <1378900784-16949-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Secondary CPUs will spin in head.S until their MPIDR[23:0] correspond to the smp_up_cpu. Actually Xen will set the value with the logical CPU ID which is wrong. Use the cpu_logical_map to get the correct CPU ID. Signed-off-by: Julien Grall --- Changes in v2: - Replace Acked-by by a s-o-b - s/TMP/to in commit title --- xen/arch/arm/smpboot.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index c0d25de..1952287 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -124,8 +124,7 @@ make_cpus_ready(unsigned int max_cpus, unsigned long boot_phys_offset) for ( i = 1; i < max_cpus; i++ ) { /* Tell the next CPU to get ready */ - /* TODO: handle boards where CPUIDs are not contiguous */ - *gate = i; + *gate = cpu_logical_map(i); flush_xen_dcache(*gate); isb(); sev(); @@ -139,11 +138,22 @@ make_cpus_ready(unsigned int max_cpus, unsigned long boot_phys_offset) /* Boot the current CPU */ void __cpuinit start_secondary(unsigned long boot_phys_offset, unsigned long fdt_paddr, - unsigned long cpuid) + unsigned long hwid) { + unsigned int cpuid; + memset(get_cpu_info(), 0, sizeof (struct cpu_info)); - /* TODO: handle boards where CPUIDs are not contiguous */ + /* Browse the logical map and find the associate logical cpu ID */ + for ( cpuid = 1; cpuid < nr_cpu_ids; cpuid++ ) + { + if ( cpu_logical_map(cpuid) == hwid ) + break; + } + + if ( cpuid == nr_cpu_ids ) + panic("Can't find logical CPU id for cpu MPIDR[23:0] = 0x%lx\n", hwid); + set_processor_id(cpuid); current_cpu_data = boot_cpu_data; @@ -232,7 +242,7 @@ int __cpu_up(unsigned int cpu) /* Unblock the CPU. It should be waiting in the loop in head.S * for an event to arrive when smp_up_cpu matches its cpuid. */ - smp_up_cpu = cpu; + smp_up_cpu = cpu_logical_map(cpu); /* we need to make sure that the change to smp_up_cpu is visible to * secondary cpus with D-cache off */ flush_xen_dcache(smp_up_cpu);