Received: from eggs.gnu.org ([209.51.188.92]:51000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLJL5-0001pB-85 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 23:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLJL4-0007iS-D4 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 23:21:51 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42388 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hLJL4-0007eg-0u for qemu-devel@nongnu.org; Mon, 29 Apr 2019 23:21:50 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BE80D3CC4C492BA067D2 for ; Tue, 30 Apr 2019 11:16:12 +0800 (CST) From: Yang Chuanlong Date: Tue, 30 Apr 2019 11:12:38 +0800 Message-ID: <20190430031238.40499-1-yangchuanlong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v1] target/arm/arm-powerctl: mask the cpuid with affinity bits when get cpu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, gengdongjiu@huawei.com Currently, the cpuid passed from the device tree may still contain non-affinity fields, which will cause arm_set_cpu_on failure. Therefore, we mask the cpuid with affinity fields here to improve qemu compatibility. Signed-off-by: Yang Chuanlong --- target/arm/arm-powerctl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index f77a950db6..ef9fec0b4d 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -31,7 +31,13 @@ CPUState *arm_get_cpu_by_id(uint64_t id) { CPUState *cpu; =20 - DPRINTF("cpu %" PRId64 "\n", id); +#ifdef TARGET_AARCH64 + id &=3D ARM64_AFFINITY_MASK; +#else + id &=3D ARM32_AFFINITY_MASK; +#endif + + DPRINTF("cpu %" PRId64 " after mask affinity\n", id); =20 CPU_FOREACH(cpu) { ARMCPU *armcpu =3D ARM_CPU(cpu); --=20 2.21.0