From patchwork Tue May 31 02:54:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Chen X-Patchwork-Id: 68859 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1695900qge; Mon, 30 May 2016 19:55:58 -0700 (PDT) X-Received: by 10.200.46.82 with SMTP id s18mr29880679qta.12.1464663358284; Mon, 30 May 2016 19:55:58 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y141si29677381qhy.26.2016.05.30.19.55.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 19:55:58 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7ZpB-0000Sj-SO; Tue, 31 May 2016 02:54:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b7ZpA-0000SY-8e for xen-devel@lists.xen.org; Tue, 31 May 2016 02:54:32 +0000 Received: from [85.158.139.211] by server-13.bemta-5.messagelabs.com id C2/4D-25698-7ECFC475; Tue, 31 May 2016 02:54:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsVyMfTAet1nf3z CDdb9NrBY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDNW/p/NVvBMsWJ3n14D4y/JLkYuDiGByYwS fzfvYwdxWATmMUt8abjMDOJICPSzSjy7f5qli5ETyImRWLpvARuEXSXRMP02kM0B1K4k0TGhA mLSb0aJPUsfMoHUsAmoSHx/088KUW8mcf7kTLC4iIC0xLXPlxlBbGaBTIkbXyayg9jCAlES/e 1fmEFsFgFVidPvX4LFeQUsJDpf/mGEmKMk8erKMbB7OAUsJX61HQSrEQKqeT39HfsERsEFjAy rGDWKU4vKUot0DQ30kooy0zNKchMzc4A8U73c1OLixPTUnMSkYr3k/NxNjMCAYwCCHYxrpjof YpTkYFIS5bX67RMuxJeUn1KZkVicEV9UmpNafIhRhoNDSYJ3BkhOsCg1PbUiLTMHGPowaQkOH iUR3qUgad7igsTc4sx0iNQpRmOOLb+vrWXi2Db13lomIZa8/LxUKXHeNJBSAZDSjNI8uEGwmL zEKCslzMsIdJoQT0FqUW5mCar8K0ZxDkYlYd6VIFN4MvNK4Pa9AjqFCeiU+AywU0oSEVJSDYy SOmWWKnMXP5I92et38PA/Hq5ipzLb8IkqzgylJVo27/uT4i9V3LH8Wfes3EXkX2nLzEc39bsD rOQ5VFif8pp6/eHM93nRFxBoHhHnfWbaksb8xdt+PuYzndhZdUqx4EP1bNcibeuU5w817Lzer ti1enN+7/YfLz/3ff3DffxOSfeeWKdZS5VYijMSDbWYi4oTAYKYvK7EAgAA X-Env-Sender: wei.chen@linaro.org X-Msg-Ref: server-9.tower-206.messagelabs.com!1464663269!42432056!1 X-Originating-IP: [209.85.192.175] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47978 invoked from network); 31 May 2016 02:54:30 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-9.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 31 May 2016 02:54:30 -0000 Received: by mail-pf0-f175.google.com with SMTP id b124so69354433pfb.0 for ; Mon, 30 May 2016 19:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TKFIieaGdzlXmc/B+zuQdOcw61dyfUQIigphGn/TYHM=; b=MWwqIp2nrbWMjBL/8M47KGsIHdUMBxS02soDxkbRnTCbGE6BfN3vBa0VmamqQ72KUg nAuPTiBy9Sc7ZFOHrEmotJX3y2a/35BCIKz9IH10YTF+TJsap9ePLI29g3vz54+fbD4X Xu7KR4DnMvA23QyNOOMPjZ6D2ewh+EjiiP81A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TKFIieaGdzlXmc/B+zuQdOcw61dyfUQIigphGn/TYHM=; b=FKiP/bjcN1MN2nf/gDgJ5jVzhYlendKjhj1ACrnOfOg1fFLNQ60ENIo/GqlrzhxLO5 7U9ecUBLP/e9bYCKxCEksEh5XAyrePchcXe0qZcnBaTDDnRWA4+Gp7cWOlkGw8FusmZ7 jCVOrILVzIvbGEBcspTWNwfoFjK13YF1/IN6LFGTJ/UhhVuLOwYDjVneIR7hfk7P4fgw 33UYi2wGxq2AcVjL3keRQAxIkIfexy/Q7u0I5fItapMXagSR6tN3oHDNgz2pODYlk+/G LrsALtJlzhpozh7ilqAd7i6vsNP2cO5PDqmB0cwplen6Pgp/zOlaP3PYlbW9i9iFW7Wy Ac2A== X-Gm-Message-State: ALyK8tKyNLlG+u0Brq4bXCQbwcs6oiZzTLjNY8Z8orkVBFjFTROx9aIV9h3XKZBVeNQnoogV X-Received: by 10.98.58.156 with SMTP id v28mr51361467pfj.137.1464663269003; Mon, 30 May 2016 19:54:29 -0700 (PDT) Received: from localhost.members.linode.com ([2400:8900::f03c:91ff:fe56:1324]) by smtp.gmail.com with ESMTPSA id n190sm35879825pfn.23.2016.05.30.19.54.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 May 2016 19:54:28 -0700 (PDT) From: Wei Chen X-Google-Original-From: Wei Chen To: xen-devel@lists.xen.org Date: Tue, 31 May 2016 10:54:11 +0800 Message-Id: <20160531025414.15539-2-Wei.Chen@linaro.org> X-Mailer: git-send-email 2.9.0.rc0 In-Reply-To: <20160531025414.15539-1-Wei.Chen@linaro.org> References: <20160531025414.15539-1-Wei.Chen@linaro.org> Cc: julien.grall@arm.com, sstabellini@kernel.org, Wei Chen , steve.capper@arm.com Subject: [Xen-devel] [PATCH v4 1/4] xen/arm: Change the variable type of cpu_logical_map to register_t X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" The cpu_logical_map is used to store CPU hardware ID from MPIDR_EL1 or from CPU node of DT. Currently, the cpu_logical_map is using the u32 as its variable type. It can work properly while Xen is running on ARM32, because the hardware ID is 32-bits. While Xen is running on ARM64, the hardware ID expands to 64-bits and then the cpu_logical_map will overflow. Change the variable type of cpu_logical_map to register_t will make cpu_logical_map to store hardware IDs correctly on ARM32 and ARM64. Signed-off-by: Wei Chen Acked-by: Julien Grall --- v3-->v4: 1. Add missed Acked-by tag. v2-->v3: 1. Update verion number. v1-->v2: 1. Fix typos in commit messages that were commented by Julien. 2. Add Julien's Acked-by. --- xen/arch/arm/gic-v3.c | 2 +- xen/arch/arm/smpboot.c | 13 +++++++------ xen/include/asm-arm/processor.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index a095064..9910877 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -674,7 +674,7 @@ static int __init gicv3_populate_rdist(void) } while ( !(typer & GICR_TYPER_LAST) ); } - dprintk(XENLOG_ERR, "GICv3: CPU%d: mpidr 0x%x has no re-distributor!\n", + dprintk(XENLOG_ERR, "GICv3: CPU%d: mpidr 0x%"PRIregister" has no re-distributor!\n", smp_processor_id(), cpu_logical_map(smp_processor_id())); return -ENODEV; diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index c5109bf..ba83406 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -40,7 +40,7 @@ cpumask_t cpu_possible_map; struct cpuinfo_arm cpu_data[NR_CPUS]; /* CPU logical map: map xen cpuid to an MPIDR */ -u32 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID }; +register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID }; /* Fake one node for now. See also include/asm-arm/numa.h */ nodemask_t __read_mostly node_online_map = { { [0] = 1UL } }; @@ -100,7 +100,7 @@ static void __init dt_smp_init_cpus(void) struct dt_device_node *cpu; unsigned int i, j; unsigned int cpuidx = 1; - static u32 tmp_map[NR_CPUS] __initdata = + static register_t tmp_map[NR_CPUS] __initdata = { [0 ... NR_CPUS - 1] = MPIDR_INVALID }; @@ -120,7 +120,8 @@ static void __init dt_smp_init_cpus(void) { const __be32 *prop; u64 addr; - u32 reg_len, hwid; + u32 reg_len; + register_t hwid; if ( !dt_device_type_is_equal(cpu, "cpu") ) continue; @@ -160,7 +161,7 @@ static void __init dt_smp_init_cpus(void) */ if ( hwid & ~MPIDR_HWID_MASK ) { - printk(XENLOG_WARNING "cpu node `%s`: invalid hwid value (0x%x)\n", + printk(XENLOG_WARNING "cpu node `%s`: invalid hwid value (0x%"PRIregister")\n", dt_node_full_name(cpu), hwid); continue; } @@ -176,7 +177,7 @@ static void __init dt_smp_init_cpus(void) if ( tmp_map[j] == hwid ) { printk(XENLOG_WARNING - "cpu node `%s`: duplicate /cpu reg properties %"PRIx32" in the DT\n", + "cpu node `%s`: duplicate /cpu reg properties %"PRIregister" in the DT\n", dt_node_full_name(cpu), hwid); break; } @@ -211,7 +212,7 @@ static void __init dt_smp_init_cpus(void) if ( (rc = arch_cpu_init(i, cpu)) < 0 ) { - printk("cpu%d init failed (hwid %x): %d\n", i, hwid, rc); + printk("cpu%d init failed (hwid %"PRIregister"): %d\n", i, hwid, rc); tmp_map[i] = MPIDR_INVALID; } else diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 6789cd0..7de9c8e 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -348,7 +348,7 @@ extern void identify_cpu(struct cpuinfo_arm *); extern struct cpuinfo_arm cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] -extern u32 __cpu_logical_map[]; +extern register_t __cpu_logical_map[]; #define cpu_logical_map(cpu) __cpu_logical_map[cpu] /* HSR data abort size definition */