From patchwork Fri May 20 05:15:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1633681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Y9Y4zgnU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L4FLR6fzcz9sG0 for ; Fri, 20 May 2022 15:15:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE44E3835813 for ; Fri, 20 May 2022 05:15:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE44E3835813 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653023753; bh=EwH/SFZaRMJzk1GvTtFeTgzAMHl5cmVPnVOuGAvxUkM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Y9Y4zgnUuM05ka+jUT3OE5nrnkijLRjgADS+karCzl8jbD4L2WIEgTTnaSatMeuAI UhHgZ/HhEq8Swry6GkFtGCxoFi0/EQyU4SjRK6JQM4n5jYLxdgUZlXueOgxQ+jo37C 7EUXap8jh0C8lSqQ1R+7rPUV2zPXjZok0KVQ92G4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by sourceware.org (Postfix) with ESMTPS id 3D7BC3835822 for ; Fri, 20 May 2022 05:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D7BC3835822 Received: by mail-pj1-x1034.google.com with SMTP id ev18so7069519pjb.4 for ; Thu, 19 May 2022 22:15:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EwH/SFZaRMJzk1GvTtFeTgzAMHl5cmVPnVOuGAvxUkM=; b=OOVWVkBsNXuSiD9cc1xCr4nbTbd28wWwRe6XJbRRgp/Boq8UDTyMHmcaJ/Te/kT64d bfneIx39//PohNabj0pGbm+pZKRlpUA6BNwEFx3fNI8EkdsgwgSmiysIBzV8kltCKLQf hlzrURZYwXlXbknCbq9lIJmyOPd9Dpq9R2kKLP7c6EtqCHRe8Ab5FNgcFIbH/iTsc7hx 9bJbFEpJ4SxBEu6OVJkmBXZ7YsOiCJaFhAQIXr/TvIHhdPju5FnPnBj6WdyDFubDdAN1 blory3xk5Y26gnAyCWLqKvmdDfKbKeczPdhPu9kCUxSHe6P37LKW8OMGaHWnUQOkk85g yapg== X-Gm-Message-State: AOAM533OjY/6rFn2KmRfsmqoKbv+wf/5VhK+j0Jx5A9rcmduCQzZQR7k Pxi4MeTtE+zdrSs5FDPY4+I= X-Google-Smtp-Source: ABdhPJykOric1D2miPgxPGH25GiUojyXhCgA8wY1eckhPFCwD+QE/+RTYeSG0HMXIUKjg4tpQyWDfw== X-Received: by 2002:a17:90a:2809:b0:1df:35ca:2e6a with SMTP id e9-20020a17090a280900b001df35ca2e6amr8976633pjd.8.1653023738013; Thu, 19 May 2022 22:15:38 -0700 (PDT) Received: from bobo.ozlabs.ibm.com ([203.87.15.124]) by smtp.gmail.com with ESMTPSA id p9-20020a1709027ec900b0015e8d4eb1b8sm4863455plb.2.2022.05.19.22.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 22:15:37 -0700 (PDT) To: linuxppc-dev@lists.ozlabs.org Subject: [RFC Linux patch] powerpc: add documentation for HWCAPs Date: Fri, 20 May 2022 15:15:28 +1000 Message-Id: <20220520051528.98097-1-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Nicholas Piggin via Libc-alpha From: Nicholas Piggin Reply-To: Nicholas Piggin Cc: gcc@gcc.gnu.org, libc-alpha@sourceware.org, Nicholas Piggin Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" This takes the arm64 file and adjusts it for powerpc. Feature descriptions are vaguely handwaved by me. --- Anybody care to expand on or correct the meaning of these entries or bikeshed the wording of the intro? Many of them are no longer used anywhere by upstream kernels and even where they are it's not always quite clear what the exact intent was, a lot of them are old history and I don't know what or where they are used. I may try to get these descriptions pushed into the ABI doc after a time, but for now they can live in the kernel tree. Thanks, Nick Documentation/powerpc/elf_hwcaps.rst | 192 +++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 Documentation/powerpc/elf_hwcaps.rst diff --git a/Documentation/powerpc/elf_hwcaps.rst b/Documentation/powerpc/elf_hwcaps.rst new file mode 100644 index 000000000000..d712aae8b867 --- /dev/null +++ b/Documentation/powerpc/elf_hwcaps.rst @@ -0,0 +1,192 @@ +.. _elf_hwcaps_index: + +================== +POWERPC ELF hwcaps +================== + +This document describes the usage and semantics of the powerpc ELF hwcaps. + + +1. Introduction +--------------- + +Some hardware or software features are only available on some CPU +implementations, and/or with certain kernel configurations, but have no +architected discovery mechanism available to userspace code. The kernel +exposes the presence of these features to userspace through a set +of flags called hwcaps, exposed in the auxilliary vector. + +Userspace software can test for features by acquiring the AT_HWCAP or +AT_HWCAP2 entry of the auxiliary vector, and testing whether the relevant +flags are set, e.g.:: + + bool floating_point_is_present(void) + { + unsigned long hwcaps = getauxval(AT_HWCAP); + if (hwcaps & PPC_FEATURE_HAS_FPU) + return true; + + return false; + } + +Where software relies on a feature described by a hwcap, it should check +the relevant hwcap flag to verify that the feature is present before +attempting to make use of the feature. + +Features cannot be probed reliably through other means. When a feature +is not available, attempting to use it may result in unpredictable +behaviour, and is not guaranteed to result in any reliable indication +that the feature is unavailable, such as a SIGILL. + +2. hwcap allocation +------------------- + +HWCAPs are allocated as described in Power Architecture 64-Bit ELF V2 ABI +Specification (which will be reflected in the kernel's uapi headers). + +3. The hwcaps exposed in AT_HWCAP +--------------------------------- + +PPC_FEATURE_32 + 32-bit CPU + +PPC_FEATURE_64 + 64-bit CPU (userspace may be running in 32-bit mode). + +PPC_FEATURE_601_INSTR + The processor is PowerPC 601 + +PPC_FEATURE_HAS_ALTIVEC + Vector (aka Altivec, VSX) facility is available. + +PPC_FEATURE_HAS_FPU + Floating point facility is available. + +PPC_FEATURE_HAS_MMU + Memory management unit is present. + +PPC_FEATURE_HAS_4xxMAC + ? + +PPC_FEATURE_UNIFIED_CACHE + ? + +PPC_FEATURE_HAS_SPE + ? + +PPC_FEATURE_HAS_EFP_SINGLE + ? + +PPC_FEATURE_HAS_EFP_DOUBLE + ? + +PPC_FEATURE_NO_TB + The timebase facility (mftb instruction) is not available. + +PPC_FEATURE_POWER4 + The processor is POWER4. + +PPC_FEATURE_POWER5 + The processor is POWER5. + +PPC_FEATURE_POWER5_PLUS + The processor is POWER5+. + +PPC_FEATURE_CELL + The processor is Cell. + +PPC_FEATURE_BOOKE + The processor implements the BookE architecture. + +PPC_FEATURE_SMT + The processor implements SMT. + +PPC_FEATURE_ICACHE_SNOOP + The processor icache is coherent with the dcache, and instruction storage + can be made consistent with data storage for the purpose of executing + instructions with the instruction sequence: + sync + icbi (to any address) + isync + +PPC_FEATURE_ARCH_2_05 + The processor supports the v2.05 userlevel architecture. Processors + supporting later architectures also set this feature. + +PPC_FEATURE_PA6T + The processor is PA6T. + +PPC_FEATURE_HAS_DFP + DFP facility is available. + +PPC_FEATURE_POWER6_EXT + The processor is POWER6. + +PPC_FEATURE_ARCH_2_06 + The processor supports the v2.06 userlevel architecture. Processors + supporting later architectures also set this feature. + +PPC_FEATURE_HAS_VSX + VSX facility is available. + +PPC_FEATURE_PSERIES_PERFMON_COMPAT + +PPC_FEATURE_TRUE_LE + Reserved, do not use + +PPC_FEATURE_PPC_LE + Reserved, do not use + +3. The hwcaps exposed in AT_HWCAP2 +---------------------------------- + +PPC_FEATURE2_ARCH_2_07 + The processor supports the v2.07 userlevel architecture. Processors + supporting later architectures also set this feature. + +PPC_FEATURE2_HTM + Transactional Memory feature is available. + +PPC_FEATURE2_DSCR + DSCR facility is available. + +PPC_FEATURE2_EBB + EBB facility is available. + +PPC_FEATURE2_ISEL + isel instruction is available. This is superseded by ARCH_2_07 and + later. + +PPC_FEATURE2_TAR + VSX facility is available. + +PPC_FEATURE2_VEC_CRYPTO + v2.07 crypto instructions are available. + +PPC_FEATURE2_HTM_NOSC + System calls fail if called in a transactional state, see + Documentation/powerpc/syscall64-abi.rst + +PPC_FEATURE2_ARCH_3_00 + The processor supports the v3.0B / v3.0C userlevel architecture. Processors + supporting later architectures also set this feature. + +PPC_FEATURE2_HAS_IEEE128 + IEEE 128 is available? What instructions/data? + +PPC_FEATURE2_DARN + darn instruction is available. + +PPC_FEATURE2_SCV + scv instruction is available. + +PPC_FEATURE2_HTM_NO_SUSPEND + A limited Transactional Memory facility that does not support suspend is + available, see Documentation/powerpc/transactional_memory.rst. + +PPC_FEATURE2_ARCH_3_1 + The processor supports the v3.1 userlevel architecture. Processors + supporting later architectures also set this feature. + +PPC_FEATURE2_MMA + MMA facility is available.