From nobody Sat Oct 25 11:05:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 152104146193972.37386030531161; Wed, 14 Mar 2018 08:31:01 -0700 (PDT) Received: from localhost ([::1]:46820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew8MZ-0000aO-Th for importer@patchew.org; Wed, 14 Mar 2018 11:30:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew8Li-0000AT-9i for qemu-devel@nongnu.org; Wed, 14 Mar 2018 11:29:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew8Le-0003KF-BL for qemu-devel@nongnu.org; Wed, 14 Mar 2018 11:29:54 -0400 Received: from 9pmail.ess.barracuda.com ([64.235.150.224]:53283) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ew8Le-0003Ho-5X for qemu-devel@nongnu.org; Wed, 14 Mar 2018 11:29:50 -0400 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx2.ess.sfj.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Wed, 14 Mar 2018 15:29:40 +0000 Received: from LDT-J-COWGILL.mipstec.com (192.168.155.34) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 14 Mar 2018 07:20:34 -0700 From: James Cowgill To: , Riku Voipio , Laurent Vivier Date: Wed, 14 Mar 2018 14:20:18 +0000 Message-ID: <20180314142018.13612-1-james.cowgill@mips.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 X-Originating-IP: [192.168.155.34] X-BESS-ID: 1521041379-298553-10884-5656-4 X-BESS-VER: 2018.2-r1803082101 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.191055 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 64.235.150.224 Subject: [Qemu-devel] [PATCH] linux-user: implement HWCAP bits on MIPS 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: James Cowgill Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the two currently defined HWCAP bits on MIPS - R6 and MSA. Buglink: https://bugs.launchpad.net/qemu/+bug/1754372 Signed-off-by: James Cowgill --- linux-user/elfload.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5fc130cc20..747b0ed10b 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -950,6 +950,30 @@ static void elf_core_copy_regs(target_elf_gregset_t *r= egs, const CPUMIPSState *e #define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 =20 +/* See arch/mips/include/uapi/hwcap.h. */ +enum { + HWCAP_MIPS_R6 =3D (1 << 0), + HWCAP_MIPS_MSA =3D (1 << 1), +}; + +#define ELF_HWCAP get_elf_hwcap() + +static uint32_t get_elf_hwcap(void) +{ + MIPSCPU *cpu =3D MIPS_CPU(thread_cpu); + uint32_t hwcaps =3D 0; + +#define GET_FEATURE(flag, hwcap) \ + do { if (cpu->env.insn_flags & (flag)) { hwcaps |=3D hwcap; } } while = (0) + + GET_FEATURE(ISA_MIPS32R6 | ISA_MIPS64R6, HWCAP_MIPS_R6); + GET_FEATURE(ASE_MSA, HWCAP_MIPS_MSA); + +#undef GET_FEATURE + + return hwcaps; +} + #endif /* TARGET_MIPS */ =20 #ifdef TARGET_MICROBLAZE --=20 2.16.2