From patchwork Wed Sep 21 09:57:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 9343223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D6F3C607D0 for ; Wed, 21 Sep 2016 09:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C82492A51F for ; Wed, 21 Sep 2016 09:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5BBF2A528; Wed, 21 Sep 2016 09:58:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 98EA52A521 for ; Wed, 21 Sep 2016 09:58:11 +0000 (UTC) Received: from localhost ([::1]:41170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmeI5-00085v-9s for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Sep 2016 05:58:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmeHi-00085l-Md for qemu-devel@nongnu.org; Wed, 21 Sep 2016 05:57:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmeHf-00083g-Gv for qemu-devel@nongnu.org; Wed, 21 Sep 2016 05:57:46 -0400 Received: from ssl.serverraum.org ([213.133.101.245]:36565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmeHf-0007kl-7K; Wed, 21 Sep 2016 05:57:43 -0400 Received: from mwalle01.kse.adk.loc (unknown [194.25.174.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 901AB22249; Wed, 21 Sep 2016 11:57:14 +0200 (CEST) Authentication-Results: ssl.serverraum.org; dmarc=none header.from=walle.cc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1474451834; bh=rHXm+esqazsVvJUhebh/pvSJfqORIGFxwvM63MjqYxI=; h=From:To:Cc:Subject:Date:From; b=GhC1OwX30fjtdSx/3+XC48Q6nyyuqwhpQH2PnlUHAwVXe0H2altiAqkKvfy+KJhFG FnuxlAem8iwV13NGhu2OEvn5FfddBjdUkvAaEWGT8uJjlxDLMXSPZAtmv3eIXIHNG9 YygzLqUzhVh5Bp1LlSm9Em1MT9b0pcVlF0TiVOFU= From: Michael Walle To: Riku Voipio Date: Wed, 21 Sep 2016 11:57:05 +0200 Message-Id: <1474451825-17144-1-git-send-email-michael@walle.cc> X-Mailer: git-send-email 2.1.4 X-Virus-Scanned: clamav-milter 0.99.2 at web X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 213.133.101.245 Subject: [Qemu-devel] [PATCH v2] 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: Tom Musta , Alexander Graf , qemu-devel@nongnu.org, Michael Walle , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- v2: - rename flag to flags - use normal indent style in macro (also makes checkpatch.pl happy ;) - add explanation in commit message 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 f807baf..515ba6c 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);