From patchwork Thu Sep 22 06:37:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 673175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sfnmB3pXmz9t0p for ; Thu, 22 Sep 2016 17:14:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=EKevXF7Q; dkim-atps=neutral Received: from localhost ([::1]:56244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmyCm-0002QM-0m for incoming@patchwork.ozlabs.org; Thu, 22 Sep 2016 03:14:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmxeW-0007gr-Gu for qemu-devel@nongnu.org; Thu, 22 Sep 2016 02:38:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmxeS-0006S9-Ru for qemu-devel@nongnu.org; Thu, 22 Sep 2016 02:38:36 -0400 Received: from ozlabs.org ([103.22.144.67]:40013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmxeS-0006I5-EH; Thu, 22 Sep 2016 02:38:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3sfmyc4rY5z9vDk; Thu, 22 Sep 2016 16:37:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1474526280; bh=XyykRsESn+9QkK/EXEOCIxH376aCEAE2Bb5EtiXXRiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EKevXF7Qamki9hEOww2XAU73FVkg5aZqKHYwtaDx1IdmthLhXMw0cjTCNhyfQfVJg B7x8iKnW5jjGQToOJGMyCUyt02RG76SBO/EZmiuVgxLPsh29Q7qU8InObHAAf5iKvO I47hGsWsGuRVbqrp7xj12nm7dx3Kcr6HokpAAA0U= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 22 Sep 2016 16:37:41 +1000 Message-Id: <1474526262-27011-44-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474526262-27011-1-git-send-email-david@gibson.dropbear.id.au> References: <1474526262-27011-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 43/44] linux-user: ppc64: fix ARCH_206 bit in AT_HWCAP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Walle , David Gibson , qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Michael Walle Only the POWER[789] CPUs should have the ARCH_206 bit set. This is what the linux kernel does. I guess this was also the intention of commit 0e019746. We have to make sure all *206 bits are set. Before this patch, the flags check in the GET_FEATURES2 macro returned true if _any_ bit was set. This worked well as long as there was only one bit set in the 'flag' parameter. But as explained before, we have to make sure all bits in the 'flag' parameter are set. Signed-off-by: Michael Walle Signed-off-by: David Gibson --- linux-user/elfload.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 29455e4..b70f504 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -741,8 +741,12 @@ static uint32_t get_elf_hwcap(void) Altivec/FP/SPE support. Anything else is just a bonus. */ #define GET_FEATURE(flag, feature) \ do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0) -#define GET_FEATURE2(flag, feature) \ - do { if (cpu->env.insns_flags2 & flag) { features |= feature; } } while (0) +#define GET_FEATURE2(flags, feature) \ + do { \ + if ((cpu->env.insns_flags2 & flags) == flags) { \ + features |= feature; \ + } \ + } while (0) GET_FEATURE(PPC_64B, QEMU_PPC_FEATURE_64); GET_FEATURE(PPC_FLOAT, QEMU_PPC_FEATURE_HAS_FPU); GET_FEATURE(PPC_ALTIVEC, QEMU_PPC_FEATURE_HAS_ALTIVEC);