From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927465; cv=none; d=zohomail.com; s=zohoarc; b=LK8ZeFNvkdRbIIU4hWhSLcfQCjZLM79HLgkDtu207NXVcPOK0BXYNA6/3C6G6pp/MpBX7S0skAXurF5u9y4gvxLB24O1XNPZmyMshnOu1iLoT/xjp53xmkahHyhoL5xtFjZWkz5Ea3AzR9lb9/PP9qyvGzHjO5jp5ln4ZOiQeTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927465; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KMA70dMb1SJ/eTe/2+zO5JW0aBcXeIGHYSkfDyZwFgY=; b=cGZ+BOtZk3UaMWOgqiAYb9a1vuuqkd69di08qTgGJ7f5jrNEM/P04AgkF2Hs6BQzk//uA8qSuTYGJjULUW/hjLrKqKmCOpphDf7YOA7pkZ4DTcTKYC/Cx6XiCJNqUUQUhQKuSf3xBZ1Cy9BfXRDDjDuy1cLDvsUEOu0pXNTLI2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927465933214.48937753929204; Sun, 9 Jul 2023 11:31:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAQ-0008Go-R8; Sun, 09 Jul 2023 14:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAI-0008Dg-1b for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:46 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAE-0000DT-DO for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:45 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbea147034so37211135e9.0 for ; Sun, 09 Jul 2023 11:29:39 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927378; x=1691519378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KMA70dMb1SJ/eTe/2+zO5JW0aBcXeIGHYSkfDyZwFgY=; b=qBVPJ2MnRNSW4BqnYe+HeO6n6IxtwRo3NqXuUSgPWQNNFhNFrEXqE5GweGQLqJKB/+ ZjmQDSU7V6vPNXNd2q29l7K96aIdQGYx5wIxCd5qJqmaYFigkm/XoMHnP2uaZy/kYs9F tCmU8Em8Cks4d2qWjuyf/75kU+xgCKqj8gH8rqBlXbtkbd/JSfHwELrtnKAgAUb9FcYe zl333+aPIp2MuTQAZHhNVtv59vfkpvTbiHBUvU8CF8hMfZDsUfAJqrrRjGDaIgveorO/ wAshQS99G/rNI+K6MUsHF4lz+qqfHcsW+Njns83/XNG3AM4Qbk0GXSl0AuzORAVclLFv KqnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927378; x=1691519378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KMA70dMb1SJ/eTe/2+zO5JW0aBcXeIGHYSkfDyZwFgY=; b=MkrGHwcBNi8K0fdKXh6UI2buL5g4JhJm7toXA3Uo0tcFv9MBxxdmmBMO7sKjIffpuf NyJgGx/OLahO6hpRhJesaWXV0dJW1T/BQ+ZqtEz3tY+7QAqw9zMjiCf9nHM9CckZikrQ hqcMkwmc08U2+lgnI//LAxb1L9YmS5qHIknx4kxWQtGnqTFCIkh+bKdUaC4ctg4XMliM 6yD28u4tmGWtpH0a6XW7CPd2sa2/w5Phfr2AaDVUZDpWeQT04kQ/zTNBfdXliVHfRne6 GGULNioIYloGOp3H5rVLDCXEto6YxqRGeHggkVgivCeNTK8qPNH3xsgPTMvMJNl+hzoW bP9w== X-Gm-Message-State: ABy/qLadFzZnRkAWiCHoJKex33ioqyvQvOY2nxfBpecs2Aj1SJtwrVXe TEBZsL5C/j8oy02oJIZ9TzB9YA/gs1aKess9nYYZLQ== X-Google-Smtp-Source: APBJJlEt+OzP4hNfNeJnCOumOQkeCTRBBgZxaMJx5irg7wMTEN40iKNxJmOXoJiBYdmvxgVSDreCHg== X-Received: by 2002:a1c:730b:0:b0:3fb:c384:89ef with SMTP id d11-20020a1c730b000000b003fbc38489efmr8136991wmb.17.1688927378392; Sun, 09 Jul 2023 11:29:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 01/37] util: Add cpuinfo-ppc.c Date: Sun, 9 Jul 2023 19:28:14 +0100 Message-Id: <20230709182934.309468-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927466768100001 Move the code from tcg/. Fix a bug in that PPC_FEATURE2_ARCH_3_10 is actually spelled PPC_FEATURE2_ARCH_3_1. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- host/include/ppc/host/cpuinfo.h | 29 ++++++++++++++++ host/include/ppc64/host/cpuinfo.h | 1 + tcg/ppc/tcg-target.h | 16 ++++----- util/cpuinfo-ppc.c | 56 +++++++++++++++++++++++++++++++ tcg/ppc/tcg-target.c.inc | 44 +----------------------- util/meson.build | 2 ++ 6 files changed, 97 insertions(+), 51 deletions(-) create mode 100644 host/include/ppc/host/cpuinfo.h create mode 100644 host/include/ppc64/host/cpuinfo.h create mode 100644 util/cpuinfo-ppc.c diff --git a/host/include/ppc/host/cpuinfo.h b/host/include/ppc/host/cpuinf= o.h new file mode 100644 index 0000000000..df11e8d417 --- /dev/null +++ b/host/include/ppc/host/cpuinfo.h @@ -0,0 +1,29 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Host specific cpu indentification for ppc. + */ + +#ifndef HOST_CPUINFO_H +#define HOST_CPUINFO_H + +/* Digested version of */ + +#define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */ +#define CPUINFO_V2_06 (1u << 1) +#define CPUINFO_V2_07 (1u << 2) +#define CPUINFO_V3_0 (1u << 3) +#define CPUINFO_V3_1 (1u << 4) +#define CPUINFO_ISEL (1u << 5) +#define CPUINFO_ALTIVEC (1u << 6) +#define CPUINFO_VSX (1u << 7) + +/* Initialized with a constructor. */ +extern unsigned cpuinfo; + +/* + * We cannot rely on constructor ordering, so other constructors must + * use the function interface rather than the variable above. + */ +unsigned cpuinfo_init(void); + +#endif /* HOST_CPUINFO_H */ diff --git a/host/include/ppc64/host/cpuinfo.h b/host/include/ppc64/host/cp= uinfo.h new file mode 100644 index 0000000000..2f036a0627 --- /dev/null +++ b/host/include/ppc64/host/cpuinfo.h @@ -0,0 +1 @@ +#include "host/include/ppc/host/cpuinfo.h" diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index c7552b6391..9a41fab8cc 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -25,6 +25,8 @@ #ifndef PPC_TCG_TARGET_H #define PPC_TCG_TARGET_H =20 +#include "host/cpuinfo.h" + #define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1) =20 #define TCG_TARGET_NB_REGS 64 @@ -61,14 +63,12 @@ typedef enum { tcg_isa_3_10, } TCGPowerISA; =20 -extern TCGPowerISA have_isa; -extern bool have_altivec; -extern bool have_vsx; - -#define have_isa_2_06 (have_isa >=3D tcg_isa_2_06) -#define have_isa_2_07 (have_isa >=3D tcg_isa_2_07) -#define have_isa_3_00 (have_isa >=3D tcg_isa_3_00) -#define have_isa_3_10 (have_isa >=3D tcg_isa_3_10) +#define have_isa_2_06 (cpuinfo & CPUINFO_V2_06) +#define have_isa_2_07 (cpuinfo & CPUINFO_V2_07) +#define have_isa_3_00 (cpuinfo & CPUINFO_V3_0) +#define have_isa_3_10 (cpuinfo & CPUINFO_V3_1) +#define have_altivec (cpuinfo & CPUINFO_ALTIVEC) +#define have_vsx (cpuinfo & CPUINFO_VSX) =20 /* optional instructions automatically implemented */ #define TCG_TARGET_HAS_ext8u_i32 0 /* andi */ diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c new file mode 100644 index 0000000000..d95adc8ccd --- /dev/null +++ b/util/cpuinfo-ppc.c @@ -0,0 +1,56 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * Host specific cpu indentification for ppc. + */ + +#include "qemu/osdep.h" +#include "host/cpuinfo.h" + +#ifdef CONFIG_GETAUXVAL +# include +#else +# include +# include "elf.h" +#endif + +unsigned cpuinfo; + +/* Called both as constructor and (possibly) via other constructors. */ +unsigned __attribute__((constructor)) cpuinfo_init(void) +{ + unsigned info =3D cpuinfo; + unsigned long hwcap, hwcap2; + + if (info) { + return info; + } + + hwcap =3D qemu_getauxval(AT_HWCAP); + hwcap2 =3D qemu_getauxval(AT_HWCAP2); + info =3D CPUINFO_ALWAYS; + + /* Version numbers are monotonic, and so imply all lower versions. */ + if (hwcap2 & PPC_FEATURE2_ARCH_3_1) { + info |=3D CPUINFO_V3_1 | CPUINFO_V3_0 | CPUINFO_V2_07 | CPUINFO_V2= _06; + } else if (hwcap2 & PPC_FEATURE2_ARCH_3_00) { + info |=3D CPUINFO_V3_0 | CPUINFO_V2_07 | CPUINFO_V2_06; + } else if (hwcap2 & PPC_FEATURE2_ARCH_2_07) { + info |=3D CPUINFO_V2_07 | CPUINFO_V2_06; + } else if (hwcap & PPC_FEATURE_ARCH_2_06) { + info |=3D CPUINFO_V2_06; + } + + if (hwcap2 & PPC_FEATURE2_HAS_ISEL) { + info |=3D CPUINFO_ISEL; + } + if (hwcap & PPC_FEATURE_HAS_ALTIVEC) { + info |=3D CPUINFO_ALTIVEC; + /* We only care about the portion of VSX that overlaps Altivec. */ + if (hwcap & PPC_FEATURE_HAS_VSX) { + info |=3D CPUINFO_VSX; + } + } + + cpuinfo =3D info; + return info; +} diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index 5c8378f8f6..c866f2c997 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -101,10 +101,7 @@ #define ALL_GENERAL_REGS 0xffffffffu #define ALL_VECTOR_REGS 0xffffffff00000000ull =20 -TCGPowerISA have_isa; -static bool have_isel; -bool have_altivec; -bool have_vsx; +#define have_isel (cpuinfo & CPUINFO_ISEL) =20 #ifndef CONFIG_SOFTMMU #define TCG_GUEST_BASE_REG 30 @@ -3879,45 +3876,6 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOp= code op) =20 static void tcg_target_init(TCGContext *s) { - unsigned long hwcap =3D qemu_getauxval(AT_HWCAP); - unsigned long hwcap2 =3D qemu_getauxval(AT_HWCAP2); - - have_isa =3D tcg_isa_base; - if (hwcap & PPC_FEATURE_ARCH_2_06) { - have_isa =3D tcg_isa_2_06; - } -#ifdef PPC_FEATURE2_ARCH_2_07 - if (hwcap2 & PPC_FEATURE2_ARCH_2_07) { - have_isa =3D tcg_isa_2_07; - } -#endif -#ifdef PPC_FEATURE2_ARCH_3_00 - if (hwcap2 & PPC_FEATURE2_ARCH_3_00) { - have_isa =3D tcg_isa_3_00; - } -#endif -#ifdef PPC_FEATURE2_ARCH_3_10 - if (hwcap2 & PPC_FEATURE2_ARCH_3_10) { - have_isa =3D tcg_isa_3_10; - } -#endif - -#ifdef PPC_FEATURE2_HAS_ISEL - /* Prefer explicit instruction from the kernel. */ - have_isel =3D (hwcap2 & PPC_FEATURE2_HAS_ISEL) !=3D 0; -#else - /* Fall back to knowing Power7 (2.06) has ISEL. */ - have_isel =3D have_isa_2_06; -#endif - - if (hwcap & PPC_FEATURE_HAS_ALTIVEC) { - have_altivec =3D true; - /* We only care about the portion of VSX that overlaps Altivec. */ - if (hwcap & PPC_FEATURE_HAS_VSX) { - have_vsx =3D true; - } - } - tcg_target_available_regs[TCG_TYPE_I32] =3D 0xffffffff; tcg_target_available_regs[TCG_TYPE_I64] =3D 0xffffffff; if (have_altivec) { diff --git a/util/meson.build b/util/meson.build index 3a93071d27..a375160286 100644 --- a/util/meson.build +++ b/util/meson.build @@ -113,4 +113,6 @@ if cpu =3D=3D 'aarch64' util_ss.add(files('cpuinfo-aarch64.c')) elif cpu in ['x86', 'x86_64'] util_ss.add(files('cpuinfo-i386.c')) +elif cpu in ['ppc', 'ppc64'] + util_ss.add(files('cpuinfo-ppc.c')) endif --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927627; cv=none; d=zohomail.com; s=zohoarc; b=bSpxX0kMmBfA/pLtEZUZdvCR28cG5yifqRtMFFWoO6GlVFGejlJ2RDAoe1Z5A80WP5dE19qgxMm0CfbRWe8A6ZxZvFOMFYt5j0K2KnBEJVXJuciNuhRFD/Cv0FHIjPenkHThxVIlyYAt9fNpAkgO0VxlCDc8xbThHV5GGeWo8rA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=kaEhb3k1vM3d8g1dEujHw7xBG+s05IgZNJ+Fs2QHIwPUdr5RcbiEBN2yY8M0dhmIGnrJe9r8ic2QlMxP0aSV9kbvuIpIKg3JIqF6sWUFkTQ/WOGlXJ1f0IvwulxgaER9wHKVNikiP/rccEX6eb6DnaKRFqBpEH9UZMxN2vcmPno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927627292717.8505653833755; Sun, 9 Jul 2023 11:33:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAU-0008JG-FT; Sun, 09 Jul 2023 14:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAI-0008Do-Jk for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:46 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAC-0000DJ-VQ for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:46 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so39378525e9.3 for ; Sun, 09 Jul 2023 11:29:38 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927378; x=1691519378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=C7rr5EnAaWgxrze5ZPQlS5ZLowlNAxvHmj5woL6en605SXdg4EDj3SIizqLzLu0UGs hueIN3Sy47jb8Ay5MT3yt/SSaNzJc8mdmHvvSnejnmlO8wHY1pQ8tszREFyDKcptojoJ z7Z5+YTNkbbI8yHsuIBUIbg1kSOk33seqxVnJX27YjTIrV5a+lWDJ65aJYkX1GKcisbS 8hoKQJpeuDuFU9evdbvCAm4ikrF0mvwN/B6RcV/z55N4+1Dsn0sYY2wOzFqMP+BjM7MR HDmvQQ0CL4SUGCIVE5W603mekHH+l8RTh2/RkcL/+BEWu550FbYjxx3gWEvG9RtMf0S8 ISNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927378; x=1691519378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ucetWZKQxGf1H8/69kqF4wjbJkZDEr6t/e7SdhPKj/g=; b=NvbpCUtkni+DrsZIuMqjP+oOZVFSk6Vn5Ez+LWwf42rDmEtknjywvmaXWo9cDKwDib SwMorGSwsjw/BoTc+2DyuJVJ9O50rbEy7dgnqstWDA2PQXUNUgd/7g6hQdfxrJ+W4368 5JYwlUiyA99XWBdGUEVVyb1iWOtGCguJLGHwK/NBnOTd9IBALQSDb3vTOVi2jih5xI9a z3MWgdLQB+l0zcblyI88UCiUgoM3PDSd1aN5tflowqGTELu+D/V5FFXQMLRQCcZzTFMz 0+nwvtj7nsEBOMOtmMR5c4o7aQz3sm2c32YQtkS+XSpF3hzcy+wpnvdBw3FkSGcU1LLt W8eA== X-Gm-Message-State: ABy/qLYmtxzGSoePsAG8WivBWhKu3HL2XNjuGck3CuOVw/iWZvUijJR/ fjnX7y/UIZgGIXKKrbyRSB8rTnP8l342ylrid0m9mA== X-Google-Smtp-Source: APBJJlEYdZyOrXtWSo0QByC7Rx1gH4cbBk2iUFGP34Mt32qNfFUFnMjbkfWW6wPvEDniPL3CWaE1Ng== X-Received: by 2002:a7b:c04b:0:b0:3fb:f926:4937 with SMTP id u11-20020a7bc04b000000b003fbf9264937mr7665690wmc.31.1688927377342; Sun, 09 Jul 2023 11:29:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 01/45] linux-user: Reformat syscall_defs.h Date: Sun, 9 Jul 2023 19:28:13 +0100 Message-Id: <20230709182934.309468-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927629505100007 Untabify and re-indent. We had a mix of 2, 3, 4, and 8 space indentation. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 1948 ++++++++++++++++++------------------- 1 file changed, 974 insertions(+), 974 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index cc37054cb5..e80d54780b 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -33,18 +33,18 @@ #define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */ =20 #define IPCOP_CALL(VERSION, OP) ((VERSION) << 16 | (OP)) -#define IPCOP_semop 1 -#define IPCOP_semget 2 -#define IPCOP_semctl 3 -#define IPCOP_semtimedop 4 -#define IPCOP_msgsnd 11 -#define IPCOP_msgrcv 12 -#define IPCOP_msgget 13 -#define IPCOP_msgctl 14 -#define IPCOP_shmat 21 -#define IPCOP_shmdt 22 -#define IPCOP_shmget 23 -#define IPCOP_shmctl 24 +#define IPCOP_semop 1 +#define IPCOP_semget 2 +#define IPCOP_semctl 3 +#define IPCOP_semtimedop 4 +#define IPCOP_msgsnd 11 +#define IPCOP_msgrcv 12 +#define IPCOP_msgget 13 +#define IPCOP_msgctl 14 +#define IPCOP_shmat 21 +#define IPCOP_shmdt 22 +#define IPCOP_shmget 23 +#define IPCOP_shmctl 24 =20 #define TARGET_SEMOPM 500 =20 @@ -56,42 +56,42 @@ * this explicit here. Please be sure to use the decoding macros * below from now on. */ -#define TARGET_IOC_NRBITS 8 -#define TARGET_IOC_TYPEBITS 8 +#define TARGET_IOC_NRBITS 8 +#define TARGET_IOC_TYPEBITS 8 =20 -#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ - || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ - || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ +#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ + || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ + || (defined(TARGET_SPARC) && defined(TARGET_ABI32)) \ || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) - /* 16 bit uid wrappers emulation */ +/* 16 bit uid wrappers emulation */ #define USE_UID16 #define target_id uint16_t #else #define target_id uint32_t #endif =20 -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ - || defined(TARGET_M68K) || defined(TARGET_CRIS) \ - || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ - || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ + || defined(TARGET_M68K) || defined(TARGET_CRIS) \ + || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ + || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ || defined(TARGET_XTENSA) || defined(TARGET_LOONGARCH64) =20 -#define TARGET_IOC_SIZEBITS 14 -#define TARGET_IOC_DIRBITS 2 +#define TARGET_IOC_SIZEBITS 14 +#define TARGET_IOC_DIRBITS 2 =20 -#define TARGET_IOC_NONE 0U +#define TARGET_IOC_NONE 0U #define TARGET_IOC_WRITE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_READ 2U =20 -#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ - defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ - defined(TARGET_MIPS) +#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \ + defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \ + defined(TARGET_MIPS) =20 -#define TARGET_IOC_SIZEBITS 13 -#define TARGET_IOC_DIRBITS 3 +#define TARGET_IOC_SIZEBITS 13 +#define TARGET_IOC_DIRBITS 3 =20 -#define TARGET_IOC_NONE 1U -#define TARGET_IOC_READ 2U +#define TARGET_IOC_NONE 1U +#define TARGET_IOC_READ 2U #define TARGET_IOC_WRITE 4U =20 #elif defined(TARGET_HPPA) @@ -115,32 +115,32 @@ #error unsupported CPU #endif =20 -#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) -#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) -#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) -#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) +#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) +#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) +#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) +#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) =20 -#define TARGET_IOC_NRSHIFT 0 -#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) -#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) -#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) +#define TARGET_IOC_NRSHIFT 0 +#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS) +#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS) +#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS) =20 -#define TARGET_IOC(dir,type,nr,size) \ - (((dir) << TARGET_IOC_DIRSHIFT) | \ - ((type) << TARGET_IOC_TYPESHIFT) | \ - ((nr) << TARGET_IOC_NRSHIFT) | \ - ((size) << TARGET_IOC_SIZESHIFT)) +#define TARGET_IOC(dir,type,nr,size) \ + (((dir) << TARGET_IOC_DIRSHIFT) | \ + ((type) << TARGET_IOC_TYPESHIFT) | \ + ((nr) << TARGET_IOC_NRSHIFT) | \ + ((size) << TARGET_IOC_SIZESHIFT)) =20 /* used to create numbers */ -#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) -#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),si= zeof(size)) -#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),s= izeof(size)) -#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WR= ITE,(type),(nr),sizeof(size)) +#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),= (nr),0) +#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),= (nr),sizeof(size)) +#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type)= ,(nr),sizeof(size)) +#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_= IOC_WRITE,(type),(nr),sizeof(size)) =20 /* the size is automatically computed for these defines */ -#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET= _IOC_SIZEMASK) -#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGE= T_IOC_SIZEMASK) -#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,= (type),(nr),TARGET_IOC_SIZEMASK) +#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TAR= GET_IOC_SIZEMASK) +#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TA= RGET_IOC_SIZEMASK) +#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRIT= E,(type),(nr),TARGET_IOC_SIZEMASK) =20 struct target_sockaddr { abi_ushort sa_family; @@ -174,12 +174,12 @@ struct target_in_addr { }; =20 struct target_sockaddr_in { - abi_ushort sin_family; - abi_short sin_port; /* big endian */ - struct target_in_addr sin_addr; - uint8_t __pad[sizeof(struct target_sockaddr) - - sizeof(abi_ushort) - sizeof(abi_short) - - sizeof(struct target_in_addr)]; + abi_ushort sin_family; + abi_short sin_port; /* big endian */ + struct target_in_addr sin_addr; + uint8_t __pad[sizeof(struct target_sockaddr) - + sizeof(abi_ushort) - sizeof(abi_short) - + sizeof(struct target_in_addr)]; }; =20 struct target_sockaddr_in6 { @@ -360,12 +360,12 @@ struct target_iovec { }; =20 struct target_msghdr { - abi_long msg_name; /* Socket name */ - int msg_namelen; /* Length of name */ - abi_long msg_iov; /* Data blocks */ - abi_long msg_iovlen; /* Number of blocks */ - abi_long msg_control; /* Per protocol magic (eg BSD file descript= or passing) */ - abi_long msg_controllen; /* Length of cmsg list */ + abi_long msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + abi_long msg_iov; /* Data blocks */ + abi_long msg_iovlen; /* Number of blocks */ + abi_long msg_control; /* Per protocol magic (eg BSD file descri= ptor passing) */ + abi_long msg_controllen; /* Length of cmsg list */ unsigned int msg_flags; }; =20 @@ -376,10 +376,10 @@ struct target_cmsghdr { }; =20 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr = *) (cmsg) + 1)) -#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ - __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) -#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ - & (size_t) ~(sizeof (abi_long) - 1)) +#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \ + __target_cmsg_nxthdr(mhdr, cmsg, cmsg_start) +#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \ + & (size_t) ~(sizeof (abi_long) - 1)) #define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \ TARGET_CMSG_ALIGN(len)) #define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len)) @@ -389,16 +389,16 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg, struct target_cmsghdr *__cmsg_start) { - struct target_cmsghdr *__ptr; + struct target_cmsghdr *__ptr; =20 - __ptr =3D (struct target_cmsghdr *)((unsigned char *) __cmsg - + TARGET_CMSG_ALIGN (tswapal(__cmsg->c= msg_len))); - if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) - > tswapal(__mhdr->msg_controllen)) { - /* No more entries. */ - return (struct target_cmsghdr *)0; - } - return __ptr; + __ptr =3D (struct target_cmsghdr *)((unsigned char *) __cmsg + + TARGET_CMSG_ALIGN (tswapal(__cmsg-= >cmsg_len))); + if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start) + > tswapal(__mhdr->msg_controllen)) { + /* No more entries. */ + return (struct target_cmsghdr *)0; + } + return __ptr; } =20 struct target_mmsghdr { @@ -407,55 +407,55 @@ struct target_mmsghdr { }; =20 struct target_rusage { - struct target_timeval ru_utime; /* user time used */ - struct target_timeval ru_stime; /* system time used */ - abi_long ru_maxrss; /* maximum resident set siz= e */ - abi_long ru_ixrss; /* integral shared memory s= ize */ - abi_long ru_idrss; /* integral unshared data s= ize */ - abi_long ru_isrss; /* integral unshared stack = size */ - abi_long ru_minflt; /* page reclaims */ - abi_long ru_majflt; /* page faults */ - abi_long ru_nswap; /* swaps */ - abi_long ru_inblock; /* block input operations */ - abi_long ru_oublock; /* block output operations = */ - abi_long ru_msgsnd; /* messages sent */ - abi_long ru_msgrcv; /* messages received */ - abi_long ru_nsignals; /* signals received */ - abi_long ru_nvcsw; /* voluntary context switch= es */ - abi_long ru_nivcsw; /* involuntary " */ + struct target_timeval ru_utime; /* user time used */ + struct target_timeval ru_stime; /* system time used */ + abi_long ru_maxrss; /* maximum resident set size */ + abi_long ru_ixrss; /* integral shared memory size = */ + abi_long ru_idrss; /* integral unshared data size = */ + abi_long ru_isrss; /* integral unshared stack size= */ + abi_long ru_minflt; /* page reclaims */ + abi_long ru_majflt; /* page faults */ + abi_long ru_nswap; /* swaps */ + abi_long ru_inblock; /* block input operations */ + abi_long ru_oublock; /* block output operations */ + abi_long ru_msgsnd; /* messages sent */ + abi_long ru_msgrcv; /* messages received */ + abi_long ru_nsignals; /* signals received */ + abi_long ru_nvcsw; /* voluntary context switches */ + abi_long ru_nivcsw; /* involuntary " */ }; =20 typedef struct { - int val[2]; + int val[2]; } kernel_fsid_t; =20 struct target_dirent { - abi_long d_ino; - abi_long d_off; - unsigned short d_reclen; - char d_name[]; + abi_long d_ino; + abi_long d_off; + unsigned short d_reclen; + char d_name[]; }; =20 struct target_dirent64 { - abi_ullong d_ino; - abi_llong d_off; - abi_ushort d_reclen; - unsigned char d_type; - char d_name[]; + abi_ullong d_ino; + abi_llong d_off; + abi_ushort d_reclen; + unsigned char d_type; + char d_name[]; }; =20 =20 /* mostly generic signal stuff */ -#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ -#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ -#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ +#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */ +#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */ +#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */ =20 #ifdef TARGET_MIPS -#define TARGET_NSIG 128 +#define TARGET_NSIG 128 #else -#define TARGET_NSIG 64 +#define TARGET_NSIG 64 #endif -#define TARGET_NSIG_BPW TARGET_ABI_BITS +#define TARGET_NSIG_BPW TARGET_ABI_BITS #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) =20 typedef struct { @@ -508,71 +508,71 @@ typedef abi_ulong target_old_sa_flags; =20 #if defined(TARGET_MIPS) struct target_sigaction { - uint32_t sa_flags; + uint32_t sa_flags; #if defined(TARGET_ABI_MIPSN32) - uint32_t _sa_handler; + uint32_t _sa_handler; #else - abi_ulong _sa_handler; + abi_ulong _sa_handler; #endif - target_sigset_t sa_mask; + target_sigset_t sa_mask; #ifdef TARGET_ARCH_HAS_SA_RESTORER - /* ??? This is always present, but ignored unless O32. */ - abi_ulong sa_restorer; + /* ??? This is always present, but ignored unless O32. */ + abi_ulong sa_restorer; #endif }; #else struct target_old_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_mask; - target_old_sa_flags sa_flags; + abi_ulong _sa_handler; + abi_ulong sa_mask; + target_old_sa_flags sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER - abi_ulong sa_restorer; + abi_ulong sa_restorer; #endif }; =20 struct target_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; + abi_ulong _sa_handler; + abi_ulong sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER - abi_ulong sa_restorer; + abi_ulong sa_restorer; #endif - target_sigset_t sa_mask; + target_sigset_t sa_mask; #ifdef TARGET_ARCH_HAS_KA_RESTORER - abi_ulong ka_restorer; + abi_ulong ka_restorer; #endif }; #endif =20 typedef union target_sigval { - int sival_int; - abi_ulong sival_ptr; + int sival_int; + abi_ulong sival_ptr; } target_sigval_t; #if 0 #if defined (TARGET_SPARC) typedef struct { - struct { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; /* globals and ins */ - } si_regs; - int si_mask; + struct { + abi_ulong psr; + abi_ulong pc; + abi_ulong npc; + abi_ulong y; + abi_ulong u_regs[16]; /* globals and ins */ + } si_regs; + int si_mask; } __siginfo_t; =20 typedef struct { - unsigned long si_float_regs [32]; - unsigned long si_fsr; - unsigned long si_fpqdepth; - struct { - unsigned long *insn_addr; - unsigned long insn; - } si_fpqueue [16]; + unsigned long si_float_regs [32]; + unsigned long si_fsr; + unsigned long si_fpqdepth; + struct { + unsigned long *insn_addr; + unsigned long insn; + } si_fpqueue [16]; } __siginfo_fpu_t; #endif #endif =20 -#define TARGET_SI_MAX_SIZE 128 +#define TARGET_SI_MAX_SIZE 128 =20 #if TARGET_ABI_BITS =3D=3D 32 #define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int)) @@ -599,82 +599,82 @@ typedef struct { =20 typedef struct target_siginfo { #ifdef TARGET_MIPS - int si_signo; - int si_code; - int si_errno; + int si_signo; + int si_code; + int si_errno; #else - int si_signo; - int si_errno; - int si_code; + int si_signo; + int si_errno; + int si_code; #endif =20 - union { - int _pad[TARGET_SI_PAD_SIZE]; + union { + int _pad[TARGET_SI_PAD_SIZE]; =20 - /* kill() */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - } _kill; + /* kill() */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + } _kill; =20 - /* POSIX.1b timers */ - struct { - unsigned int _timer1; - unsigned int _timer2; - } _timer; + /* POSIX.1b timers */ + struct { + unsigned int _timer1; + unsigned int _timer2; + } _timer; =20 - /* POSIX.1b signals */ - struct { - pid_t _pid; /* sender's pid */ - uid_t _uid; /* sender's uid */ - target_sigval_t _sigval; - } _rt; + /* POSIX.1b signals */ + struct { + pid_t _pid; /* sender's pid */ + uid_t _uid; /* sender's uid */ + target_sigval_t _sigval; + } _rt; =20 - /* SIGCHLD */ - struct { - pid_t _pid; /* which child */ - uid_t _uid; /* sender's uid */ - int _status; /* exit code */ - target_clock_t _utime; - target_clock_t _stime; - } _sigchld; + /* SIGCHLD */ + struct { + pid_t _pid; /* which child */ + uid_t _uid; /* sender's uid */ + int _status; /* exit code */ + target_clock_t _utime; + target_clock_t _stime; + } _sigchld; =20 - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ - struct { - abi_ulong _addr; /* faulting insn/memory ref. */ - } _sigfault; + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ + struct { + abi_ulong _addr; /* faulting insn/memory ref. */ + } _sigfault; =20 - /* SIGPOLL */ - struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; - } _sigpoll; - } _sifields; + /* SIGPOLL */ + struct { + int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + int _fd; + } _sigpoll; + } _sifields; } target_siginfo_t; =20 /* * si_code values * Digital reserves positive values for kernel-generated signals. */ -#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ -#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ -#define TARGET_SI_QUEUE -1 /* sent by sigqueue */ +#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ +#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhe= re */ +#define TARGET_SI_QUEUE -1 /* sent by sigqueue */ #define TARGET_SI_TIMER -2 /* sent by timer expiration */ -#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ -#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ -#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ +#define TARGET_SI_MESGQ -3 /* sent by real time mesq state ch= ange */ +#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ +#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ =20 /* * SIGILL si_codes */ -#define TARGET_ILL_ILLOPC (1) /* illegal opcode */ -#define TARGET_ILL_ILLOPN (2) /* illegal operand */ -#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ -#define TARGET_ILL_ILLTRP (4) /* illegal trap */ -#define TARGET_ILL_PRVOPC (5) /* privileged opcode */ -#define TARGET_ILL_PRVREG (6) /* privileged register */ -#define TARGET_ILL_COPROC (7) /* coprocessor error */ -#define TARGET_ILL_BADSTK (8) /* internal stack error */ +#define TARGET_ILL_ILLOPC (1) /* illegal opcode */ +#define TARGET_ILL_ILLOPN (2) /* illegal operand */ +#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ +#define TARGET_ILL_ILLTRP (4) /* illegal trap */ +#define TARGET_ILL_PRVOPC (5) /* privileged opcode */ +#define TARGET_ILL_PRVREG (6) /* privileged register */ +#define TARGET_ILL_COPROC (7) /* coprocessor error */ +#define TARGET_ILL_BADSTK (8) /* internal stack error */ =20 /* * SIGFPE si_codes @@ -700,9 +700,9 @@ typedef struct target_siginfo { /* * SIGBUS si_codes */ -#define TARGET_BUS_ADRALN (1) /* invalid address alignment */ -#define TARGET_BUS_ADRERR (2) /* non-existent physical address */ -#define TARGET_BUS_OBJERR (3) /* object specific hardware error */ +#define TARGET_BUS_ADRALN (1) /* invalid address alignment */ +#define TARGET_BUS_ADRERR (2) /* non-existent physical address */ +#define TARGET_BUS_OBJERR (3) /* object specific hardware error = */ /* hardware memory error consumed on a machine check: action required */ #define TARGET_BUS_MCEERR_AR (4) /* hardware memory error detected in process but not consumed: action opti= onal*/ @@ -711,8 +711,8 @@ typedef struct target_siginfo { /* * SIGTRAP si_codes */ -#define TARGET_TRAP_BRKPT (1) /* process breakpoint */ -#define TARGET_TRAP_TRACE (2) /* process trace trap */ +#define TARGET_TRAP_BRKPT (1) /* process breakpoint */ +#define TARGET_TRAP_TRACE (2) /* process trace trap */ #define TARGET_TRAP_BRANCH (3) /* process taken branch trap */ #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint = */ #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ @@ -731,18 +731,18 @@ struct target_pollfd { }; =20 /* virtual terminal ioctls */ -#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off= ) */ -#define TARGET_KDMKTONE 0x4B30 /* generate tone */ +#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for o= ff) */ +#define TARGET_KDMKTONE 0x4B30 /* generate tone */ #define TARGET_KDGKBTYPE 0x4b33 #define TARGET_KDSETMODE 0x4b3a #define TARGET_KDGKBMODE 0x4b44 #define TARGET_KDSKBMODE 0x4b45 -#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation tab= le */ -#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entr= y */ -#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ -#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ -#define TARGET_KDGETLED 0x4B31 /* return current led state */ -#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags]= */ +#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation t= able */ +#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string en= try */ +#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */ +#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */ +#define TARGET_KDGETLED 0x4B31 /* return current led state */ +#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flag= s] */ #define TARGET_KDSIGACCEPT 0x4B4E =20 struct target_rtc_pll_info { @@ -774,15 +774,15 @@ struct target_rtc_pll_info { #define TARGET_RTC_EPOCH_SET TARGET_IOW('p', 0x0e, abi_ulong) #define TARGET_RTC_WKALM_RD TARGET_IOR('p', 0x10, struct rtc_wkalr= m) #define TARGET_RTC_WKALM_SET TARGET_IOW('p', 0x0f, struct rtc_wkalr= m) -#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, = \ +#define TARGET_RTC_PLL_GET TARGET_IOR('p', 0x11, \ struct target_rtc_pll_info) -#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, = \ +#define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info) #define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) =20 -#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ - defined(TARGET_XTENSA) +#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ + defined(TARGET_XTENSA) #define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) #define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) #define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) @@ -932,8 +932,8 @@ struct target_rtc_pll_info { #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong) #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong) #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong) - /* return device size in bytes - (u64 *arg) */ +/* return device size in bytes + (u64 *arg) */ =20 #define TARGET_BLKDISCARD TARGET_IO(0x12, 119) #define TARGET_BLKIOMIN TARGET_IO(0x12, 120) @@ -991,11 +991,11 @@ struct target_rtc_pll_info { #define TARGET_BTRFS_IOC_SUBVOL_CREATE TARGET_IOWU(BTRFS_IOCTL_MA= GIC, 14) #define TARGET_BTRFS_IOC_SNAP_DESTROY TARGET_IOWU(BTRFS_IOCTL_MA= GIC, 15) #define TARGET_BTRFS_IOC_INO_LOOKUP TARGET_IOWRU(BTRFS_IOCTL_M= AGIC, 18) -#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAG= IC, 19,\ +#define TARGET_BTRFS_IOC_DEFAULT_SUBVOL TARGET_IOW(BTRFS_IOCTL_MAG= IC, 19, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAG= IC, 25,\ +#define TARGET_BTRFS_IOC_SUBVOL_GETFLAGS TARGET_IOR(BTRFS_IOCTL_MAG= IC, 25, \ abi_ullong) -#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAG= IC, 26,\ +#define TARGET_BTRFS_IOC_SUBVOL_SETFLAGS TARGET_IOW(BTRFS_IOCTL_MAG= IC, 26, \ abi_ullong) #define TARGET_BTRFS_IOC_SCRUB TARGET_IOWRU(BTRFS_IOCTL_M= AGIC, 27) #define TARGET_BTRFS_IOC_SCRUB_CANCEL TARGET_IO(BTRFS_IOCTL_MAGI= C, 28) @@ -1049,56 +1049,56 @@ struct target_rtc_pll_info { #define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) =20 /* cdrom commands */ -#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ -#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ -#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ -#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index - (struct cdrom_ti) */ -#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header - (struct cdrom_tochdr) */ -#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry - (struct cdrom_tocentry) */ -#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ -#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ -#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ -#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume - (struct cdrom_volctrl) */ -#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data - (struct cdrom_subchnl) */ -#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (23= 36 Bytes) - (struct cdrom_read) */ -#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (20= 48 Bytes) - (struct cdrom_read) */ -#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ -#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting= */ -#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session - address of multi session disks - (struct cdrom_multisession) */ -#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" - if available (struct cdrom_mcn)= */ -#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depreca= ted, - but here anyway for compatibilit= y */ -#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ -#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting - (struct cdrom_volctrl) */ -#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) - (struct cdrom_read) */ +#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ +#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Oper= ation */ +#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct c= drom_msf) */ +#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index + (struct cdrom_ti) */ +#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header + (struct cdrom_tochdr) */ +#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry + (struct cdrom_tocentry) = */ +#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ +#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ +#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ +#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume + (struct cdrom_volctrl) */ +#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data + (struct cdrom_subchnl) */ +#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2= data (2336 Bytes) + (struct cdrom_read) */ +#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1= data (2048 Bytes) + (struct cdrom_read) */ +#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio= ) */ +#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) aut= o-ejecting */ +#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last= -session + address of multi session= disks + (struct cdrom_multisessi= on) */ +#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Pr= oduct Code" + if available (struct cdr= om_mcn) */ +#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one = is deprecated, + but here = anyway for compatibility */ +#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ +#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume s= etting + (struct cdrom_volctrl) */ +#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (= 2352 Bytes) + (struct cdrom_read) */ /* * These ioctls are used only used in aztcd.c and optcd.c */ -#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ -#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ +#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mod= e */ +#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ =20 /* * This ioctl is only used by the scsi-cd driver. - It is for playing audio in logical block addressing mode. - */ -#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ + It is for playing audio in logical block addressing mode. +*/ +#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ =20 /* * These ioctls are only used in optcd.c */ -#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ +#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ =20 /* * These ioctls are (now) only in ide-cd.c for controlling @@ -1115,35 +1115,35 @@ struct target_rtc_pll_info { * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM * drivers are eventually ported to the uniform CD-ROM driver interface. */ -#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ -#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ -#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ -#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ -#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ -#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ -#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ -#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ +#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ +#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ +#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options = */ +#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ +#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-b= oxes) */ +#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed = */ +#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc.= */ +#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ -#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ -#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ -#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ +#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ +#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/= off */ +#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ =20 /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386. * Future CDROM ioctls should be kept below 0x537F */ =20 /* This ioctl is only used by sbpcd at the moment */ -#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size= */ - /* conflict with SCSI_IOCTL_GET_IDLUN */ +#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer si= ze */ +/* conflict with SCSI_IOCTL_GET_IDLUN */ =20 /* DVD-ROM Specific ioctls */ -#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ -#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ -#define TARGET_DVD_AUTH 0x5392 /* Authentication */ +#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ +#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ +#define TARGET_DVD_AUTH 0x5392 /* Authentication */ =20 -#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ -#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ -#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc= */ +#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the dr= ive */ +#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block= */ +#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written = on disc */ =20 /* HD commands */ =20 @@ -1234,19 +1234,19 @@ struct target_rtc_pll_info { =20 #define TARGET_NCC 8 struct target_termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[TARGET_NCC]; /* control characters */ + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[TARGET_NCC]; /* control characters */ }; =20 struct target_winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; }; =20 #include "termbits.h" @@ -1263,115 +1263,115 @@ struct target_winsize { #endif =20 /* Common */ -#define TARGET_MAP_SHARED 0x01 /* Share changes */ -#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ +#define TARGET_MAP_SHARED 0x01 /* Share changes */ +#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ #if defined(TARGET_HPPA) -#define TARGET_MAP_TYPE 0x03 /* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x03 /* Mask for type of mappin= g */ #else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ +#define TARGET_MAP_TYPE 0x0f /* Mask for type of mappin= g */ #endif =20 /* Target specific */ #if defined(TARGET_MIPS) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ +#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ #define TARGET_MAP_STACK 0x40000 /* ignored */ #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapp= ing */ #elif defined(TARGET_PPC) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ +#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ +#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ #define TARGET_MAP_STACK 0x20000 /* ignored */ #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapp= ing */ #elif defined(TARGET_ALPHA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ +#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly = */ +#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservatio= ns */ +#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetabl= es */ +#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ #define TARGET_MAP_STACK 0x80000 /* ignored */ #define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapp= ing */ #elif defined(TARGET_HPPA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ -#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ +#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly = */ +#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ +#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservatio= ns */ +#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetabl= es */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ #define TARGET_MAP_STACK 0x40000 /* ignored */ #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapp= ing */ #elif defined(TARGET_XTENSA) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ +#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ +#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x40000 #define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping = */ #else -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ +#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ +#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executabl= e */ +#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ +#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reserva= tions */ +#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ +#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ #define TARGET_MAP_STACK 0x20000 /* ignored */ #define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapp= ing */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory c= ould be uninitialized */ +#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, mem= ory could be uninitialized */ #endif =20 -#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ - || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ +#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ + || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ || defined(TARGET_CRIS) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned short st_dev; + unsigned short __pad1; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; =20 /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1379,239 +1379,239 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned short st_dev; - unsigned char __pad0[10]; + unsigned short st_dev; + unsigned char __pad0[10]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned short st_rdev; - unsigned char __pad3[10]; + unsigned short st_rdev; + unsigned char __pad3[10]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ - abi_ulong __pad4; /* future possible st_blocks high bits */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits= */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; =20 #ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { - unsigned long long st_dev; - unsigned int __pad1; - abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + unsigned long long st_dev; + unsigned int __pad1; + abi_ulong __st_ino; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned int __pad2[2]; + unsigned long long st_rdev; + unsigned int __pad2[2]; =20 - long long st_size; - abi_ulong st_blksize; - unsigned int __pad3; - unsigned long long st_blocks; + long long st_size; + abi_ulong st_blksize; + unsigned int __pad3; + unsigned long long st_blocks; =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; #endif =20 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { - unsigned int st_dev; - abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - abi_long st_size; - abi_long target_st_atime; - abi_long target_st_mtime; - abi_long target_st_ctime; - abi_long st_blksize; - abi_long st_blocks; - abi_ulong __unused4[2]; + unsigned int st_dev; + abi_ulong st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + abi_long st_size; + abi_long target_st_atime; + abi_long target_st_mtime; + abi_long target_st_ctime; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused4[2]; }; =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; =20 - uint64_t st_ino; - uint64_t st_nlink; + uint64_t st_ino; + uint64_t st_nlink; =20 - unsigned int st_mode; + unsigned int st_mode; =20 - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; =20 - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; =20 - int64_t st_size; - int64_t st_blksize; + int64_t st_size; + int64_t st_blksize; =20 - unsigned char __pad4[4]; - unsigned int st_blocks; + unsigned char __pad4[4]; + unsigned int st_blocks; =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - abi_ulong __unused4[3]; + abi_ulong __unused4[3]; }; =20 #elif defined(TARGET_SPARC) =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - abi_ulong st_ino; - unsigned short st_mode; - short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - abi_long st_size; - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_long st_blksize; - abi_long st_blocks; - abi_ulong __unused1[2]; + unsigned short st_dev; + abi_ulong st_ino; + unsigned short st_mode; + short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + abi_long st_size; + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_long st_blksize; + abi_long st_blocks; + abi_ulong __unused1[2]; }; =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; + unsigned char __pad0[6]; + unsigned short st_dev; =20 - uint64_t st_ino; + uint64_t st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - unsigned int st_uid; - unsigned int st_gid; + unsigned int st_uid; + unsigned int st_gid; =20 - unsigned char __pad2[6]; - unsigned short st_rdev; + unsigned char __pad2[6]; + unsigned short st_rdev; =20 - unsigned char __pad3[8]; + unsigned char __pad3[8]; =20 - int64_t st_size; - unsigned int st_blksize; + int64_t st_size; + unsigned int st_blksize; =20 - unsigned char __pad4[8]; - unsigned int st_blocks; + unsigned char __pad4[8]; + unsigned int st_blocks; =20 - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + unsigned int target_st_atime; + unsigned int target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; =20 - unsigned int __unused1; - unsigned int __unused2; + unsigned int __unused1; + unsigned int __unused2; }; =20 #elif defined(TARGET_PPC) =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; + abi_ulong st_dev; + abi_ulong st_ino; #if defined(TARGET_PPC64) - abi_ulong st_nlink; - unsigned int st_mode; + abi_ulong st_nlink; + unsigned int st_mode; #else - unsigned int st_mode; - unsigned short st_nlink; + unsigned int st_mode; + unsigned short st_nlink; #endif - unsigned int st_uid; - unsigned int st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned int st_uid; + unsigned int st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; #if defined(TARGET_PPC64) - abi_ulong __unused6; + abi_ulong __unused6; #endif }; =20 #if !defined(TARGET_PPC64) #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned long long st_rdev; - unsigned long long __pad0; - long long st_size; - int st_blksize; - unsigned int __pad1; - long long st_blocks; /* Number 512-byte blocks allocated. */ - int target_st_atime; - unsigned int target_st_atime_nsec; - int target_st_mtime; - unsigned int target_st_mtime_nsec; - int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + unsigned long long st_dev; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned long long __pad0; + long long st_size; + int st_blksize; + unsigned int __pad1; + long long st_blocks; /* Number 512-byte blocks allocated. */ + int target_st_atime; + unsigned int target_st_atime_nsec; + int target_st_mtime; + unsigned int target_st_mtime_nsec; + int target_st_ctime; + unsigned int target_st_ctime_nsec; + unsigned int __unused4; + unsigned int __unused5; }; #endif =20 @@ -1619,78 +1619,78 @@ struct QEMU_PACKED target_stat64 { =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - unsigned int st_mode; - unsigned short st_nlink; - unsigned int st_uid; - unsigned int st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + abi_ulong st_dev; + abi_ulong st_ino; + unsigned int st_mode; + unsigned short st_nlink; + unsigned int st_uid; + unsigned int st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; =20 /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... = */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - uint64_t st_dev; + uint64_t st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - uint32_t pad0; - uint32_t __st_ino; + uint32_t pad0; + uint32_t __st_ino; =20 - uint32_t st_mode; - uint32_t st_nlink; - uint32_t st_uid; - uint32_t st_gid; - uint64_t st_rdev; - uint64_t __pad1; + uint32_t st_mode; + uint32_t st_nlink; + uint32_t st_uid; + uint32_t st_gid; + uint64_t st_rdev; + uint64_t __pad1; =20 - int64_t st_size; - int32_t st_blksize; - uint32_t __pad2; - int64_t st_blocks; /* Number 512-byte blocks allocated. */ + int64_t st_size; + int32_t st_blksize; + uint32_t __pad2; + int64_t st_blocks; /* Number 512-byte blocks allocated. */ =20 - int target_st_atime; - unsigned int target_st_atime_nsec; - int target_st_mtime; - unsigned int target_st_mtime_nsec; - int target_st_ctime; - unsigned int target_st_ctime_nsec; - uint64_t st_ino; + int target_st_atime; + unsigned int target_st_atime_nsec; + int target_st_mtime; + unsigned int target_st_mtime_nsec; + int target_st_ctime; + unsigned int target_st_ctime_nsec; + uint64_t st_ino; }; =20 #elif defined(TARGET_M68K) =20 struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong __unused1; - abi_ulong target_st_mtime; - abi_ulong __unused2; - abi_ulong target_st_ctime; - abi_ulong __unused3; - abi_ulong __unused4; - abi_ulong __unused5; + unsigned short st_dev; + unsigned short __pad1; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong __unused1; + abi_ulong target_st_mtime; + abi_ulong __unused2; + abi_ulong target_st_ctime; + abi_ulong __unused3; + abi_ulong __unused4; + abi_ulong __unused5; }; =20 /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1698,37 +1698,37 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned long long st_dev; - unsigned char __pad1[2]; + unsigned long long st_dev; + unsigned char __pad1[2]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned char __pad3[2]; + unsigned long long st_rdev; + unsigned char __pad3[2]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - abi_ulong __pad4; /* future possible st_blocks high bits */ - abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ + abi_ulong __pad4; /* future possible st_blocks high bits= */ + abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; } QEMU_PACKED; =20 #elif defined(TARGET_ABI_MIPSN64) @@ -1736,94 +1736,94 @@ struct target_stat64 { #define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel.= */ struct target_stat { - unsigned int st_dev; - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + unsigned int st_dev; + unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ =20 - abi_ulong st_ino; + abi_ulong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - int st_uid; - int st_gid; + int st_uid; + int st_gid; =20 - unsigned int st_rdev; - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ + unsigned int st_rdev; + unsigned int st_pad1[3]; /* Reserved for st_rdev expansion = */ =20 - abi_ulong st_size; + abi_ulong st_size; =20 - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + unsigned int target_st_atime; + unsigned int target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + unsigned int target_st_mtime; + unsigned int target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + unsigned int target_st_ctime; + unsigned int target_st_ctime_nsec; =20 - unsigned int st_blksize; - unsigned int st_pad2; + unsigned int st_blksize; + unsigned int st_pad2; =20 - abi_ulong st_blocks; + abi_ulong st_blocks; }; =20 #elif defined(TARGET_ABI_MIPSN32) =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; - unsigned int st_mode; - unsigned int st_nlink; - int st_uid; - int st_gid; - abi_ulong st_rdev; - abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; /* Reserved for st_atime expans= ion */ - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expans= ion */ - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expans= ion */ - abi_ulong st_blksize; - abi_ulong st_pad2; - int64_t st_blocks; + abi_ulong st_dev; + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ + uint64_t st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + abi_ulong st_rdev; + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ + int64_t st_size; + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion = */ + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion = */ + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion = */ + abi_ulong st_blksize; + abi_ulong st_pad2; + int64_t st_blocks; }; =20 #elif defined(TARGET_ABI_MIPSO32) =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned st_dev; - abi_long st_pad1[3]; /* Reserved for network id */ - abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - int st_uid; - int st_gid; - unsigned st_rdev; - abi_long st_pad2[2]; - abi_long st_size; - abi_long st_pad3; - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - abi_long target_st_atime; - abi_long target_st_atime_nsec; - abi_long target_st_mtime; - abi_long target_st_mtime_nsec; - abi_long target_st_ctime; - abi_long target_st_ctime_nsec; - abi_long st_blksize; - abi_long st_blocks; - abi_long st_pad4[14]; + unsigned st_dev; + abi_long st_pad1[3]; /* Reserved for network id */ + abi_ulong st_ino; + unsigned int st_mode; + unsigned int st_nlink; + int st_uid; + int st_gid; + unsigned st_rdev; + abi_long st_pad2[2]; + abi_long st_size; + abi_long st_pad3; + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + abi_long target_st_atime; + abi_long target_st_atime_nsec; + abi_long target_st_mtime; + abi_long target_st_mtime_nsec; + abi_long target_st_ctime; + abi_long target_st_ctime_nsec; + abi_long st_blksize; + abi_long st_blocks; + abi_long st_pad4[14]; }; =20 /* @@ -1834,107 +1834,107 @@ struct target_stat { =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - abi_ulong st_dev; - abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ + abi_ulong st_dev; + abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ =20 - uint64_t st_ino; + uint64_t st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - int st_uid; - int st_gid; + int st_uid; + int st_gid; =20 - abi_ulong st_rdev; - abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ + abi_ulong st_rdev; + abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ =20 - int64_t st_size; + int64_t st_size; =20 - /* - * Actually this should be timestruc_t st_atime, st_mtime and st_ctime - * but we don't have it under Linux. - */ - abi_long target_st_atime; - abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */ + /* + * Actually this should be timestruc_t st_atime, st_mtime and st_ctime + * but we don't have it under Linux. + */ + abi_long target_st_atime; + abi_ulong target_st_atime_nsec; /* Reserved for st_atime expan= sion */ =20 - abi_long target_st_mtime; - abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */ + abi_long target_st_mtime; + abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expan= sion */ =20 - abi_long target_st_ctime; - abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */ + abi_long target_st_ctime; + abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expan= sion */ =20 - abi_ulong st_blksize; - abi_ulong st_pad2; + abi_ulong st_blksize; + abi_ulong st_pad2; =20 - int64_t st_blocks; + int64_t st_blocks; }; =20 #elif defined(TARGET_ALPHA) =20 struct target_stat { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; - abi_long st_size; - abi_ulong target_st_atime; - abi_ulong target_st_mtime; - abi_ulong target_st_ctime; - unsigned int st_blksize; - unsigned int st_blocks; - unsigned int st_flags; - unsigned int st_gen; + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + abi_long st_size; + abi_ulong target_st_atime; + abi_ulong target_st_mtime; + abi_ulong target_st_ctime; + unsigned int st_blksize; + unsigned int st_blocks; + unsigned int st_flags; + unsigned int st_gen; }; =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - abi_ulong st_dev; - abi_ulong st_ino; - abi_ulong st_rdev; - abi_long st_size; - abi_ulong st_blocks; + abi_ulong st_dev; + abi_ulong st_ino; + abi_ulong st_rdev; + abi_long st_size; + abi_ulong st_blocks; =20 - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_long __unused[3]; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_long __unused[3]; }; =20 #elif defined(TARGET_SH4) =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - abi_ulong st_rdev; - abi_ulong st_size; - abi_ulong st_blksize; - abi_ulong st_blocks; - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; - abi_ulong __unused4; - abi_ulong __unused5; + abi_ulong st_dev; + abi_ulong st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + abi_ulong st_rdev; + abi_ulong st_size; + abi_ulong st_blksize; + abi_ulong st_blocks; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; + abi_ulong __unused4; + abi_ulong __unused5; }; =20 /* This matches struct stat64 in glibc2.1, hence the absolutely @@ -1942,62 +1942,62 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; + unsigned long long st_dev; + unsigned char __pad0[4]; =20 -#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - abi_ulong __st_ino; +#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 + abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + unsigned int st_mode; + unsigned int st_nlink; =20 - abi_ulong st_uid; - abi_ulong st_gid; + abi_ulong st_uid; + abi_ulong st_gid; =20 - unsigned long long st_rdev; - unsigned char __pad3[4]; + unsigned long long st_rdev; + unsigned char __pad3[4]; =20 - long long st_size; - abi_ulong st_blksize; + long long st_size; + abi_ulong st_blksize; =20 - unsigned long long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long long st_blocks; /* Number 512-byte blocks allo= cated. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; =20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; =20 - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + unsigned long long st_ino; }; =20 #elif defined(TARGET_I386) && !defined(TARGET_ABI32) #define TARGET_STAT_HAVE_NSEC struct target_stat { - abi_ulong st_dev; - abi_ulong st_ino; - abi_ulong st_nlink; + abi_ulong st_dev; + abi_ulong st_ino; + abi_ulong st_nlink; =20 - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; - abi_ulong st_rdev; - abi_long st_size; - abi_long st_blksize; - abi_long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + abi_ulong st_rdev; + abi_long st_size; + abi_long st_blksize; + abi_long st_blocks; /* Number 512-byte blocks allocated. */ =20 - abi_ulong target_st_atime; - abi_ulong target_st_atime_nsec;=20 - abi_ulong target_st_mtime; - abi_ulong target_st_mtime_nsec; - abi_ulong target_st_ctime; - abi_ulong target_st_ctime_nsec; + abi_ulong target_st_atime; + abi_ulong target_st_atime_nsec; + abi_ulong target_st_mtime; + abi_ulong target_st_mtime_nsec; + abi_ulong target_st_ctime; + abi_ulong target_st_ctime_nsec; =20 - abi_long __unused[3]; + abi_long __unused[3]; }; #elif defined(TARGET_S390X) struct target_stat { @@ -2090,7 +2090,7 @@ struct target_stat64 { }; =20 #elif defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) \ - || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) + || defined(TARGET_RISCV) || defined(TARGET_HEXAGON) =20 /* These are the asm-generic versions of the stat and stat64 structures */ =20 @@ -2210,93 +2210,93 @@ struct target_stat64 { #endif =20 typedef struct { - int val[2]; + int val[2]; } target_fsid_t; =20 #ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { - int32_t f_type; - int32_t f_bsize; - int32_t f_frsize; /* Fragment size - unsupported */ - int32_t f_blocks; - int32_t f_bfree; - int32_t f_files; - int32_t f_ffree; - int32_t f_bavail; + int32_t f_type; + int32_t f_bsize; + int32_t f_frsize; /* Fragment size - unsupported= */ + int32_t f_blocks; + int32_t f_bfree; + int32_t f_files; + int32_t f_ffree; + int32_t f_bavail; =20 - /* Linux specials */ - target_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_flags; - int32_t f_spare[5]; + /* Linux specials */ + target_fsid_t f_fsid; + int32_t f_namelen; + int32_t f_flags; + int32_t f_spare[5]; }; #else struct target_statfs { - abi_long f_type; - abi_long f_bsize; - abi_long f_frsize; /* Fragment size - unsupported */ - abi_long f_blocks; - abi_long f_bfree; - abi_long f_files; - abi_long f_ffree; - abi_long f_bavail; + abi_long f_type; + abi_long f_bsize; + abi_long f_frsize; /* Fragment size - unsupported= */ + abi_long f_blocks; + abi_long f_bfree; + abi_long f_files; + abi_long f_ffree; + abi_long f_bavail; =20 - /* Linux specials */ - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_flags; - abi_long f_spare[5]; + /* Linux specials */ + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_flags; + abi_long f_spare[5]; }; #endif =20 struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_frsize; /* Fragment size - unsupported */ - uint32_t __pad; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_bavail; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_flags; - uint32_t f_spare[5]; + uint32_t f_type; + uint32_t f_bsize; + uint32_t f_frsize; /* Fragment size - unsupported */ + uint32_t __pad; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_files; + uint64_t f_ffree; + uint64_t f_bavail; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_flags; + uint32_t f_spare[5]; }; -#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ - defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ +#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ + defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ defined(TARGET_RISCV) || defined(TARGET_LOONGARCH64)) && \ - !defined(TARGET_ABI32) + !defined(TARGET_ABI32) struct target_statfs { - abi_long f_type; - abi_long f_bsize; - abi_long f_blocks; - abi_long f_bfree; - abi_long f_bavail; - abi_long f_files; - abi_long f_ffree; - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_frsize; - abi_long f_flags; - abi_long f_spare[4]; + abi_long f_type; + abi_long f_bsize; + abi_long f_blocks; + abi_long f_bfree; + abi_long f_bavail; + abi_long f_files; + abi_long f_ffree; + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_frsize; + abi_long f_flags; + abi_long f_spare[4]; }; =20 struct target_statfs64 { - abi_long f_type; - abi_long f_bsize; - abi_long f_blocks; - abi_long f_bfree; - abi_long f_bavail; - abi_long f_files; - abi_long f_ffree; - target_fsid_t f_fsid; - abi_long f_namelen; - abi_long f_frsize; - abi_long f_flags; - abi_long f_spare[4]; + abi_long f_type; + abi_long f_bsize; + abi_long f_blocks; + abi_long f_bfree; + abi_long f_bavail; + abi_long f_files; + abi_long f_ffree; + target_fsid_t f_fsid; + abi_long f_namelen; + abi_long f_frsize; + abi_long f_flags; + abi_long f_spare[4]; }; #elif defined(TARGET_S390X) struct target_statfs { @@ -2331,33 +2331,33 @@ struct target_statfs64 { }; #else struct target_statfs { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_blocks; - uint32_t f_bfree; - uint32_t f_bavail; - uint32_t f_files; - uint32_t f_ffree; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + uint32_t f_type; + uint32_t f_bsize; + uint32_t f_blocks; + uint32_t f_bfree; + uint32_t f_bavail; + uint32_t f_files; + uint32_t f_ffree; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_flags; + uint32_t f_spare[4]; }; =20 struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + uint32_t f_type; + uint32_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + target_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_flags; + uint32_t f_spare[4]; }; #endif =20 @@ -2454,63 +2454,63 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) =20 -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) =20 -#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLU= ME) -#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREB= LE) -#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH) -#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MI= XER_SPEAKER) -#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTP= CM) -#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECL= EV) -#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN) -#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN) -#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1) -#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2) -#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3) +#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MI= XER_VOLUME) +#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MI= XER_BASS) +#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MI= XER_TREBLE) +#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MI= XER_SYNTH) +#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MI= XER_PCM) +#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MI= XER_SPEAKER) +#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MI= XER_LINE) +#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MI= XER_MIC) +#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MI= XER_CD) +#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MI= XER_IMIX) +#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MI= XER_ALTPCM) +#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MI= XER_RECLEV) +#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MI= XER_IGAIN) +#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MI= XER_OGAIN) +#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MI= XER_LINE1) +#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MI= XER_LINE2) +#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MI= XER_LINE3) =20 /* Obsolete macros */ -#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MI= XER_ENHANCE) -#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MI= XER_MUTE) +#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MI= XER_ENHANCE) +#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MI= XER_LOUD) =20 -#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECS= RC) -#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MI= XER_DEVMASK) -#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MI= XER_RECMASK) -#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_S= TEREODEVS) -#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS) +#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MI= XER_RECSRC) +#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MI= XER_DEVMASK) +#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MI= XER_RECMASK) +#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MI= XER_STEREODEVS) +#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MI= XER_CAPS) =20 -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) =20 -#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) -#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS) -#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TRE= BLE) -#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYN= TH) -#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM) -#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SP= EAKER) -#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE) -#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC) -#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD) -#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX) -#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALT= PCM) -#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_REC= LEV) -#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGA= IN) -#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGA= IN) -#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E1) -#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E2) -#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LIN= E3) +#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) +#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_M= IXER_BASS) +#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TRE= BLE) +#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_M= IXER_SYNTH) +#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_M= IXER_PCM) +#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_M= IXER_SPEAKER) +#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_M= IXER_LINE) +#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_M= IXER_MIC) +#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_M= IXER_CD) +#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_M= IXER_IMIX) +#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALT= PCM) +#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_REC= LEV) +#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_M= IXER_IGAIN) +#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_M= IXER_OGAIN) +#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE1) +#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE2) +#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_M= IXER_LINE3) =20 /* Obsolete macros */ -#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE) -#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_EN= HANCE) -#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD) +#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_M= IXER_MUTE) +#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_M= IXER_ENHANCE) +#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_M= IXER_LOUD) =20 -#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) +#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) =20 struct target_snd_timer_id { int dev_class; @@ -2575,22 +2575,22 @@ struct target_snd_timer_status { =20 /* alsa timer ioctls */ #define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) -#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, = \ - struct snd_timer_id) -#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, = \ - struct target_snd_timer_gi= nfo) -#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, = \ - struct target_snd_timer_gp= arams) -#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, = \ - struct target_snd_timer_gs= tatus) -#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, = \ - struct target_snd_timer_se= lect) -#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, = \ - struct target_snd_timer_in= fo) -#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, = \ - struct snd_timer_params) -#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, = \ - struct target_snd_timer_st= atus) +#define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ + struct snd_timer= _id) +#define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ + struct target_sn= d_timer_ginfo) +#define TARGET_SNDRV_TIMER_IOCTL_GPARAMS TARGET_IOW('T', 0x04, \ + struct target_snd= _timer_gparams) +#define TARGET_SNDRV_TIMER_IOCTL_GSTATUS TARGET_IOWR('T', 0x05, \ + struct target_sn= d_timer_gstatus) +#define TARGET_SNDRV_TIMER_IOCTL_SELECT TARGET_IOW('T', 0x10, \ + struct target_snd= _timer_select) +#define TARGET_SNDRV_TIMER_IOCTL_INFO TARGET_IOR('T', 0x11, \ + struct target_snd= _timer_info) +#define TARGET_SNDRV_TIMER_IOCTL_PARAMS TARGET_IOW('T', 0x12, \ + struct snd_timer_= params) +#define TARGET_SNDRV_TIMER_IOCTL_STATUS TARGET_IOR('T', 0x14, \ + struct target_snd= _timer_status) #define TARGET_SNDRV_TIMER_IOCTL_START TARGET_IO('T', 0xa0) #define TARGET_SNDRV_TIMER_IOCTL_STOP TARGET_IO('T', 0xa1) #define TARGET_SNDRV_TIMER_IOCTL_CONTINUE TARGET_IO('T', 0xa2) @@ -2750,12 +2750,12 @@ typedef int32_t target_timer_t; #ifdef TARGET_MIPS #define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) #else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ + sizeof(target_sigval_t)) #endif =20 -#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - - TARGET_SIGEV_PREAMBLE_SIZE) \ +#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ + - TARGET_SIGEV_PREAMBLE_SIZE) \ / sizeof(int32_t)) =20 struct target_sigevent { @@ -2814,40 +2814,40 @@ struct target_user_cap_data { #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 =20 struct target_statx_timestamp { - int64_t tv_sec; - uint32_t tv_nsec; - int32_t __reserved; + int64_t tv_sec; + uint32_t tv_nsec; + int32_t __reserved; }; =20 struct target_statx { - /* 0x00 */ - uint32_t stx_mask; /* What results were written [uncond] */ - uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ - uint64_t stx_attributes; /* Flags conveying information about the file = */ - /* 0x10 */ - uint32_t stx_nlink; /* Number of hard links */ - uint32_t stx_uid; /* User ID of owner */ - uint32_t stx_gid; /* Group ID of owner */ - uint16_t stx_mode; /* File mode */ - uint16_t __spare0[1]; - /* 0x20 */ - uint64_t stx_ino; /* Inode number */ - uint64_t stx_size; /* File size */ - uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ - uint64_t stx_attributes_mask; /* Mask to show what is supported */ - /* 0x40 */ - struct target_statx_timestamp stx_atime; /* Last access time */ - struct target_statx_timestamp stx_btime; /* File creation time */ - struct target_statx_timestamp stx_ctime; /* Last attribute change tim= e */ - struct target_statx_timestamp stx_mtime; /* Last data modification ti= me */ - /* 0x80 */ - uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev] = */ - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; /* ID of device containing file [uncond] */ - uint32_t stx_dev_minor; - /* 0x90 */ - uint64_t __spare2[14]; /* Spare space for future expansion */ - /* 0x100 */ + /* 0x00 */ + uint32_t stx_mask; /* What results were written [uncond] */ + uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ + uint64_t stx_attributes; /* Flags conveying information about the file= */ + /* 0x10 */ + uint32_t stx_nlink; /* Number of hard links */ + uint32_t stx_uid; /* User ID of owner */ + uint32_t stx_gid; /* Group ID of owner */ + uint16_t stx_mode; /* File mode */ + uint16_t __spare0[1]; + /* 0x20 */ + uint64_t stx_ino; /* Inode number */ + uint64_t stx_size; /* File size */ + uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ + uint64_t stx_attributes_mask; /* Mask to show what is supported */ + /* 0x40 */ + struct target_statx_timestamp stx_atime; /* Last access time */ + struct target_statx_timestamp stx_btime; /* File creation time */ + struct target_statx_timestamp stx_ctime; /* Last attribute change ti= me */ + struct target_statx_timestamp stx_mtime; /* Last data modification t= ime */ + /* 0x80 */ + uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev]= */ + uint32_t stx_rdev_minor; + uint32_t stx_dev_major; /* ID of device containing file [uncond] */ + uint32_t stx_dev_minor; + /* 0x90 */ + uint64_t __spare2[14]; /* Spare space for future expansion */ + /* 0x100 */ }; =20 /* from kernel's include/linux/sched/types.h */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927529; cv=none; d=zohomail.com; s=zohoarc; b=K/kpo/OAJIJGs8MNbKBHiqPWIP7Qo0kbtLJfTEk5rAK21xmtwzLqLZa9B3v99rY2AvcdtLj48T7n70g8iMcN/afDSqA0wlBqvgA8RRqY4D9csMipkvzVYpq/lX5ipE9+TwjqEkbWlvcBxRntytsr/01YfgzFPxQc5av1wdOIQtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927529; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PHrPJPS+mlRVkDvCLAEYdPQN/uxz8IaF+SaQf2EtYVY=; b=dbhclvPsbSgv5B6+16iMkgYQgWIbVfpyMWeSIg5fVsrfTmgl87KuFb9XLi95Squ58HWRNq2QUuMRiDnX4WVmMtCzwCv+5XGzMm28foiF4xCVFhuFVBAdDH1UwmQC2nO1YQYgZIzOgubokn30KuATDQflpkoclZFHDPcQuETGuXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927529797805.3539669592002; Sun, 9 Jul 2023 11:32:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAQ-0008Gg-IL; Sun, 09 Jul 2023 14:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAI-0008E4-Qw for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:48 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAE-0000Dm-CR for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:46 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so38080605e9.0 for ; Sun, 09 Jul 2023 11:29:41 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927380; x=1691519380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PHrPJPS+mlRVkDvCLAEYdPQN/uxz8IaF+SaQf2EtYVY=; b=bgzpLL7B7STqInrIzATJhAlMdqyW4Oyvw2wzg4kr9wqNzfmetoiwCVoVx1/Jh9eiak fHgDY77nj77mgrN2O8GaBl1tPSGySKsZK5VyGju3fQstXZepxlHUcL13Pm9O/oaeEQEW wZ85XklPURb45cvgXOm8JVwSPCYbPF54X9XQT3J3jOE8XaVHbHGwWs9IkldVBjOQQUPk BcPiMpYOQkfo7a4EN6zTPINuRaA5seU44tbMoFsNEXwK5h+ECHsylpWV0FzoA+7LccG7 8soQzIQ7r+dSjD5QVcvyHR0aEvE/W5IFpRa+jNvT4eHO7c6OfX6Bi55CG6uFokgnmSlK L7DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927380; x=1691519380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PHrPJPS+mlRVkDvCLAEYdPQN/uxz8IaF+SaQf2EtYVY=; b=NbwVIbR2dMglTgj6euQLINoVGhRa6fOTKPRhSa4rGwwXp7IKxW0jKFkhk6XLD1egbk KIKiVd2Y4U8H5FTJlhHgpJoqpirXUj8FjAB8McxXIJV8JYmCQR9eCrGhrIn7fHML01tp Spy+6cDhgyYO2N30EWdhAQa1V2aWfXsUT7bb3b9WXkPW6S/+JMZRpOTVabKLs7RhQcUn B2q4Eefko/FAfInBH/00AtgpNTk+XAvsoxDvRC+pUApBilO/PV9KSaYReg5UaOxirOaw o8nzUGmoZjUOSjWK79m8H/K/ba52hiVKk4epLu9OhrxYIOXiqIO2/gEtlrgmu8IqBsN+ 7beg== X-Gm-Message-State: ABy/qLbCY49ccExaNsRC6/OzpgSEKLaC1GA2SRwCtw0dFj45apZILZEl Nu5M2XzQ7fD5qZAWWzDYZLs6ToCO0OoQ5RnpSlR88g== X-Google-Smtp-Source: APBJJlEm79hOG47QYYmBW6MohfDseC5oVXZFVKKTjVMYIdWCkMcQhMOHrzytxb85DFxe3fc0YhgAIw== X-Received: by 2002:a05:600c:ad8:b0:3fb:fa61:a4ed with SMTP id c24-20020a05600c0ad800b003fbfa61a4edmr6154799wmr.26.1688927379960; Sun, 09 Jul 2023 11:29:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 02/37] tests/multiarch: Add test-aes Date: Sun, 9 Jul 2023 19:28:16 +0100 Message-Id: <20230709182934.309468-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927531355100002 Use a shared driver and backends for i386, aarch64, ppc64, riscv64. Acked-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson --- tests/tcg/aarch64/test-aes.c | 58 ++++++++ tests/tcg/i386/test-aes.c | 68 +++++++++ tests/tcg/ppc64/test-aes.c | 116 +++++++++++++++ tests/tcg/riscv64/test-aes.c | 81 +++++++++++ tests/tcg/multiarch/test-aes-main.c.inc | 183 ++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 4 + tests/tcg/i386/Makefile.target | 4 + tests/tcg/ppc64/Makefile.target | 1 + tests/tcg/riscv64/Makefile.target | 3 + 9 files changed, 518 insertions(+) create mode 100644 tests/tcg/aarch64/test-aes.c create mode 100644 tests/tcg/i386/test-aes.c create mode 100644 tests/tcg/ppc64/test-aes.c create mode 100644 tests/tcg/riscv64/test-aes.c create mode 100644 tests/tcg/multiarch/test-aes-main.c.inc diff --git a/tests/tcg/aarch64/test-aes.c b/tests/tcg/aarch64/test-aes.c new file mode 100644 index 0000000000..2cd324f09b --- /dev/null +++ b/tests/tcg/aarch64/test-aes.c @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "../multiarch/test-aes-main.c.inc" + +bool test_SB_SR(uint8_t *o, const uint8_t *i) +{ + /* aese also adds round key, so supply zero. */ + asm("ld1 { v0.16b }, [%1]\n\t" + "movi v1.16b, #0\n\t" + "aese v0.16b, v1.16b\n\t" + "st1 { v0.16b }, [%0]" + : : "r"(o), "r"(i) : "v0", "v1", "memory"); + return true; +} + +bool test_MC(uint8_t *o, const uint8_t *i) +{ + asm("ld1 { v0.16b }, [%1]\n\t" + "aesmc v0.16b, v0.16b\n\t" + "st1 { v0.16b }, [%0]" + : : "r"(o), "r"(i) : "v0", "memory"); + return true; +} + +bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + return false; +} + +bool test_ISB_ISR(uint8_t *o, const uint8_t *i) +{ + /* aesd also adds round key, so supply zero. */ + asm("ld1 { v0.16b }, [%1]\n\t" + "movi v1.16b, #0\n\t" + "aesd v0.16b, v1.16b\n\t" + "st1 { v0.16b }, [%0]" + : : "r"(o), "r"(i) : "v0", "v1", "memory"); + return true; +} + +bool test_IMC(uint8_t *o, const uint8_t *i) +{ + asm("ld1 { v0.16b }, [%1]\n\t" + "aesimc v0.16b, v0.16b\n\t" + "st1 { v0.16b }, [%0]" + : : "r"(o), "r"(i) : "v0", "memory"); + return true; +} + +bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + return false; +} + +bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + return false; +} diff --git a/tests/tcg/i386/test-aes.c b/tests/tcg/i386/test-aes.c new file mode 100644 index 0000000000..199395e6cc --- /dev/null +++ b/tests/tcg/i386/test-aes.c @@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "../multiarch/test-aes-main.c.inc" +#include + +static bool test_SB_SR(uint8_t *o, const uint8_t *i) +{ + __m128i vi =3D _mm_loadu_si128((const __m128i_u *)i); + + /* aesenclast also adds round key, so supply zero. */ + vi =3D _mm_aesenclast_si128(vi, _mm_setzero_si128()); + + _mm_storeu_si128((__m128i_u *)o, vi); + return true; +} + +static bool test_MC(uint8_t *o, const uint8_t *i) +{ + return false; +} + +static bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *= k) +{ + __m128i vi =3D _mm_loadu_si128((const __m128i_u *)i); + __m128i vk =3D _mm_loadu_si128((const __m128i_u *)k); + + vi =3D _mm_aesenc_si128(vi, vk); + + _mm_storeu_si128((__m128i_u *)o, vi); + return true; +} + +static bool test_ISB_ISR(uint8_t *o, const uint8_t *i) +{ + __m128i vi =3D _mm_loadu_si128((const __m128i_u *)i); + + /* aesdeclast also adds round key, so supply zero. */ + vi =3D _mm_aesdeclast_si128(vi, _mm_setzero_si128()); + + _mm_storeu_si128((__m128i_u *)o, vi); + return true; +} + +static bool test_IMC(uint8_t *o, const uint8_t *i) +{ + __m128i vi =3D _mm_loadu_si128((const __m128i_u *)i); + + vi =3D _mm_aesimc_si128(vi); + + _mm_storeu_si128((__m128i_u *)o, vi); + return true; +} + +static bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_= t *k) +{ + return false; +} + +static bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_= t *k) +{ + __m128i vi =3D _mm_loadu_si128((const __m128i_u *)i); + __m128i vk =3D _mm_loadu_si128((const __m128i_u *)k); + + vi =3D _mm_aesdec_si128(vi, vk); + + _mm_storeu_si128((__m128i_u *)o, vi); + return true; +} diff --git a/tests/tcg/ppc64/test-aes.c b/tests/tcg/ppc64/test-aes.c new file mode 100644 index 0000000000..1d2be488e9 --- /dev/null +++ b/tests/tcg/ppc64/test-aes.c @@ -0,0 +1,116 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "../multiarch/test-aes-main.c.inc" + +#undef BIG_ENDIAN +#define BIG_ENDIAN (__BYTE_ORDER__ =3D=3D __ORDER_BIG_ENDIAN__) + +static unsigned char bswap_le[16] __attribute__((aligned(16))) =3D { + 8,9,10,11,12,13,14,15, + 0,1,2,3,4,5,6,7 +}; + +bool test_SB_SR(uint8_t *o, const uint8_t *i) +{ + /* vcipherlast also adds round key, so supply zero. */ + if (BIG_ENDIAN) { + asm("lxvd2x 32,0,%1\n\t" + "vspltisb 1,0\n\t" + "vcipherlast 0,0,1\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i) : "memory", "v0", "v1"); + } else { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 34,0,%2\n\t" + "vspltisb 1,0\n\t" + "vperm 0,0,0,2\n\t" + "vcipherlast 0,0,1\n\t" + "vperm 0,0,0,2\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(bswap_le) : "memory", "v0", "v1", "v2"= ); + } + return true; +} + +bool test_MC(uint8_t *o, const uint8_t *i) +{ + return false; +} + +bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + if (BIG_ENDIAN) { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 33,0,%2\n\t" + "vcipher 0,0,1\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(k) : "memory", "v0", "v1"); + } else { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 33,0,%2\n\t" + "lxvd2x 34,0,%3\n\t" + "vperm 0,0,0,2\n\t" + "vperm 1,1,1,2\n\t" + "vcipher 0,0,1\n\t" + "vperm 0,0,0,2\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(k), "r"(bswap_le) + : "memory", "v0", "v1", "v2"); + } + return true; +} + +bool test_ISB_ISR(uint8_t *o, const uint8_t *i) +{ + /* vcipherlast also adds round key, so supply zero. */ + if (BIG_ENDIAN) { + asm("lxvd2x 32,0,%1\n\t" + "vspltisb 1,0\n\t" + "vncipherlast 0,0,1\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i) : "memory", "v0", "v1"); + } else { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 34,0,%2\n\t" + "vspltisb 1,0\n\t" + "vperm 0,0,0,2\n\t" + "vncipherlast 0,0,1\n\t" + "vperm 0,0,0,2\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(bswap_le) : "memory", "v0", "v1", "v2"= ); + } + return true; +} + +bool test_IMC(uint8_t *o, const uint8_t *i) +{ + return false; +} + +bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + if (BIG_ENDIAN) { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 33,0,%2\n\t" + "vncipher 0,0,1\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(k) : "memory", "v0", "v1"); + } else { + asm("lxvd2x 32,0,%1\n\t" + "lxvd2x 33,0,%2\n\t" + "lxvd2x 34,0,%3\n\t" + "vperm 0,0,0,2\n\t" + "vperm 1,1,1,2\n\t" + "vncipher 0,0,1\n\t" + "vperm 0,0,0,2\n\t" + "stxvd2x 32,0,%0" + : : "r"(o), "r"(i), "r"(k), "r"(bswap_le) + : "memory", "v0", "v1", "v2"); + } + return true; +} + +bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + return false; +} diff --git a/tests/tcg/riscv64/test-aes.c b/tests/tcg/riscv64/test-aes.c new file mode 100644 index 0000000000..6a0ef77e7b --- /dev/null +++ b/tests/tcg/riscv64/test-aes.c @@ -0,0 +1,81 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "../multiarch/test-aes-main.c.inc" + +bool test_SB_SR(uint8_t *o, const uint8_t *i) +{ + uint64_t *o8 =3D (uint64_t *)o; + const uint64_t *i8 =3D (const uint64_t *)i; + + /* aes64es rd, rs1, rs2 =3D 0011001 rs2 rs1 000 rd 0110011 */ + asm(".insn r 0x33, 0x0, 0x19, %0, %2, %3\n\t" + ".insn r 0x33, 0x0, 0x19, %1, %3, %2" + : "=3D&r"(o8[0]), "=3D&r"(o8[1]) : "r"(i8[0]), "r"(i8[1])); + return true; +} + +bool test_MC(uint8_t *o, const uint8_t *i) +{ + return false; +} + +bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + uint64_t *o8 =3D (uint64_t *)o; + const uint64_t *i8 =3D (const uint64_t *)i; + const uint64_t *k8 =3D (const uint64_t *)k; + + /* aesesm rd, rs1, rs2 =3D 0011011 rs2 rs1 000 rd 0110011 */ + asm(".insn r 0x33, 0x0, 0x1b, %0, %2, %3\n\t" + ".insn r 0x33, 0x0, 0x1b, %1, %3, %2\n\t" + "xor %0,%0,%4\n\t" + "xor %1,%1,%5" + : "=3D&r"(o8[0]), "=3D&r"(o8[1]) + : "r"(i8[0]), "r"(i8[1]), "r"(k8[0]), "r"(k8[1])); + return true; +} + +bool test_ISB_ISR(uint8_t *o, const uint8_t *i) +{ + uint64_t *o8 =3D (uint64_t *)o; + const uint64_t *i8 =3D (const uint64_t *)i; + + /* aes64ds rd, rs1, rs2 =3D 0011101 rs2 rs1 000 rd 0110011 */ + asm(".insn r 0x33, 0x0, 0x1d, %0, %2, %3\n\t" + ".insn r 0x33, 0x0, 0x1d, %1, %3, %2" + : "=3D&r"(o8[0]), "=3D&r"(o8[1]) : "r"(i8[0]), "r"(i8[1])); + return true; +} + +bool test_IMC(uint8_t *o, const uint8_t *i) +{ + uint64_t *o8 =3D (uint64_t *)o; + const uint64_t *i8 =3D (const uint64_t *)i; + + /* aes64im rd, rs1 =3D 0011000 00000 rs1 001 rd 0010011 */ + asm(".insn r 0x13, 0x1, 0x18, %0, %0, x0\n\t" + ".insn r 0x13, 0x1, 0x18, %1, %1, x0" + : "=3Dr"(o8[0]), "=3Dr"(o8[1]) : "0"(i8[0]), "1"(i8[1])); + return true; +} + +bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + return false; +} + +bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k) +{ + uint64_t *o8 =3D (uint64_t *)o; + const uint64_t *i8 =3D (const uint64_t *)i; + const uint64_t *k8 =3D (const uint64_t *)k; + + /* aes64dsm rd, rs1, rs2 =3D 0011111 rs2 rs1 000 rd 0110011 */ + asm(".insn r 0x33, 0x0, 0x1f, %0, %2, %3\n\t" + ".insn r 0x33, 0x0, 0x1f, %1, %3, %2\n\t" + "xor %0,%0,%4\n\t" + "xor %1,%1,%5" + : "=3D&r"(o8[0]), "=3D&r"(o8[1]) + : "r"(i8[0]), "r"(i8[1]), "r"(k8[0]), "r"(k8[1])); + return true; +} diff --git a/tests/tcg/multiarch/test-aes-main.c.inc b/tests/tcg/multiarch/= test-aes-main.c.inc new file mode 100644 index 0000000000..4b5f7f98aa --- /dev/null +++ b/tests/tcg/multiarch/test-aes-main.c.inc @@ -0,0 +1,183 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +static bool test_SB_SR(uint8_t *o, const uint8_t *i); +static bool test_MC(uint8_t *o, const uint8_t *i); +static bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *= k); + +static bool test_ISB_ISR(uint8_t *o, const uint8_t *i); +static bool test_IMC(uint8_t *o, const uint8_t *i); +static bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_= t *k); +static bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_= t *k); + +/* + * From https://doi.org/10.6028/NIST.FIPS.197-upd1, + * Appendix B -- Cipher Example + * + * Note that the formatting of the 4x4 matrices in the document is + * column-major, whereas C is row-major. Therefore to get the bytes + * in the same order as the text, the matrices are transposed. + * + * Note that we are not going to test SubBytes or ShiftRows separately, + * so the "After SubBytes" column is omitted, using only the combined + * result "After ShiftRows" column. + */ + +/* Ease the inline assembly by aligning everything. */ +typedef struct { + uint8_t b[16] __attribute__((aligned(16))); +} State; + +typedef struct { + State start, after_sr, after_mc, round_key; +} Round; + +static const Round rounds[] =3D { + /* Round 1 */ + { { { 0x19, 0x3d, 0xe3, 0xbe, /* start */ + 0xa0, 0xf4, 0xe2, 0x2b, + 0x9a, 0xc6, 0x8d, 0x2a, + 0xe9, 0xf8, 0x48, 0x08, } }, + + { { 0xd4, 0xbf, 0x5d, 0x30, /* after shiftrows */ + 0xe0, 0xb4, 0x52, 0xae, + 0xb8, 0x41, 0x11, 0xf1, + 0x1e, 0x27, 0x98, 0xe5, } }, + + { { 0x04, 0x66, 0x81, 0xe5, /* after mixcolumns */ + 0xe0, 0xcb, 0x19, 0x9a, + 0x48, 0xf8, 0xd3, 0x7a, + 0x28, 0x06, 0x26, 0x4c, } }, + + { { 0xa0, 0xfa, 0xfe, 0x17, /* round key */ + 0x88, 0x54, 0x2c, 0xb1, + 0x23, 0xa3, 0x39, 0x39, + 0x2a, 0x6c, 0x76, 0x05, } } }, + + /* Round 2 */ + { { { 0xa4, 0x9c, 0x7f, 0xf2, /* start */ + 0x68, 0x9f, 0x35, 0x2b, + 0x6b, 0x5b, 0xea, 0x43, + 0x02, 0x6a, 0x50, 0x49, } }, + + { { 0x49, 0xdb, 0x87, 0x3b, /* after shiftrows */ + 0x45, 0x39, 0x53, 0x89, + 0x7f, 0x02, 0xd2, 0xf1, + 0x77, 0xde, 0x96, 0x1a, } }, + + { { 0x58, 0x4d, 0xca, 0xf1, /* after mixcolumns */ + 0x1b, 0x4b, 0x5a, 0xac, + 0xdb, 0xe7, 0xca, 0xa8, + 0x1b, 0x6b, 0xb0, 0xe5, } }, + + { { 0xf2, 0xc2, 0x95, 0xf2, /* round key */ + 0x7a, 0x96, 0xb9, 0x43, + 0x59, 0x35, 0x80, 0x7a, + 0x73, 0x59, 0xf6, 0x7f, } } }, + + /* Round 3 */ + { { { 0xaa, 0x8f, 0x5f, 0x03, /* start */ + 0x61, 0xdd, 0xe3, 0xef, + 0x82, 0xd2, 0x4a, 0xd2, + 0x68, 0x32, 0x46, 0x9a, } }, + + { { 0xac, 0xc1, 0xd6, 0xb8, /* after shiftrows */ + 0xef, 0xb5, 0x5a, 0x7b, + 0x13, 0x23, 0xcf, 0xdf, + 0x45, 0x73, 0x11, 0xb5, } }, + + { { 0x75, 0xec, 0x09, 0x93, /* after mixcolumns */ + 0x20, 0x0b, 0x63, 0x33, + 0x53, 0xc0, 0xcf, 0x7c, + 0xbb, 0x25, 0xd0, 0xdc, } }, + + { { 0x3d, 0x80, 0x47, 0x7d, /* round key */ + 0x47, 0x16, 0xfe, 0x3e, + 0x1e, 0x23, 0x7e, 0x44, + 0x6d, 0x7a, 0x88, 0x3b, } } }, +}; + +static void verify_log(const char *prefix, const State *s) +{ + printf("%s:", prefix); + for (int i =3D 0; i < sizeof(State); ++i) { + printf(" %02x", s->b[i]); + } + printf("\n"); +} + +static void verify(const State *ref, const State *tst, const char *which) +{ + if (!memcmp(ref, tst, sizeof(State))) { + return; + } + + printf("Mismatch on %s\n", which); + verify_log("ref", ref); + verify_log("tst", tst); + exit(EXIT_FAILURE); +} + +int main() +{ + int i, n =3D sizeof(rounds) / sizeof(Round); + State t; + + for (i =3D 0; i < n; ++i) { + if (test_SB_SR(t.b, rounds[i].start.b)) { + verify(&rounds[i].after_sr, &t, "SB+SR"); + } + } + + for (i =3D 0; i < n; ++i) { + if (test_MC(t.b, rounds[i].after_sr.b)) { + verify(&rounds[i].after_mc, &t, "MC"); + } + } + + /* The kernel of Cipher(). */ + for (i =3D 0; i < n - 1; ++i) { + if (test_SB_SR_MC_AK(t.b, rounds[i].start.b, rounds[i].round_key.b= )) { + verify(&rounds[i + 1].start, &t, "SB+SR+MC+AK"); + } + } + + for (i =3D 0; i < n; ++i) { + if (test_ISB_ISR(t.b, rounds[i].after_sr.b)) { + verify(&rounds[i].start, &t, "ISB+ISR"); + } + } + + for (i =3D 0; i < n; ++i) { + if (test_IMC(t.b, rounds[i].after_mc.b)) { + verify(&rounds[i].after_sr, &t, "IMC"); + } + } + + /* The kernel of InvCipher(). */ + for (i =3D n - 1; i > 0; --i) { + if (test_ISB_ISR_AK_IMC(t.b, rounds[i].after_sr.b, + rounds[i - 1].round_key.b)) { + verify(&rounds[i - 1].after_sr, &t, "ISB+ISR+AK+IMC"); + } + } + + /* + * The kernel of EqInvCipher(). + * We must compute a different round key: apply InvMixColumns to + * the standard round key, per KeyExpansion vs KeyExpansionEIC. + */ + for (i =3D 1; i < n; ++i) { + if (test_IMC(t.b, rounds[i - 1].round_key.b) && + test_ISB_ISR_IMC_AK(t.b, rounds[i].after_sr.b, t.b)) { + verify(&rounds[i - 1].after_sr, &t, "ISB+ISR+IMC+AK"); + } + } + + return EXIT_SUCCESS; +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 0606dec118..617f821613 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -74,6 +74,10 @@ ifneq ($(CROSS_CC_HAS_SVE),) AARCH64_TESTS +=3D sve-ioctls sve-ioctls: CFLAGS+=3D-march=3Darmv8.1-a+sve =20 +AARCH64_TESTS +=3D test-aes +test-aes: CFLAGS +=3D -O -march=3Darmv8-a+aes +test-aes: test-aes-main.c.inc + # Vector SHA1 sha1-vector: CFLAGS=3D-O3 sha1-vector: sha1.c diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index f2ee7a4db7..fdf757c6ce 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -28,6 +28,10 @@ run-test-i386-bmi2: QEMU_OPTS +=3D -cpu max test-i386-adcox: CFLAGS=3D-O2 run-test-i386-adcox: QEMU_OPTS +=3D -cpu max =20 +test-aes: CFLAGS +=3D -O -msse2 -maes +test-aes: test-aes-main.c.inc +run-test-aes: QEMU_OPTS +=3D -cpu max + # # hello-i386 is a barebones app # diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.tar= get index b084963b9a..5721c159f2 100644 --- a/tests/tcg/ppc64/Makefile.target +++ b/tests/tcg/ppc64/Makefile.target @@ -36,5 +36,6 @@ run-vector: QEMU_OPTS +=3D -cpu POWER10 =20 PPC64_TESTS +=3D signal_save_restore_xer PPC64_TESTS +=3D xxspltw +PPC64_TESTS +=3D test-aes =20 TESTS +=3D $(PPC64_TESTS) diff --git a/tests/tcg/riscv64/Makefile.target b/tests/tcg/riscv64/Makefile= .target index 9973ba3b5f..42993549cb 100644 --- a/tests/tcg/riscv64/Makefile.target +++ b/tests/tcg/riscv64/Makefile.target @@ -9,3 +9,6 @@ TESTS +=3D noexec TESTS +=3D test-noc test-noc: LDFLAGS =3D -nostdlib -static run-test-noc: QEMU_OPTS +=3D -cpu rv64,c=3Dfalse + +TESTS +=3D test-aes +run-test-aes: QEMU_OPTS +=3D -cpu rv64,zk=3Don --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928269; cv=none; d=zohomail.com; s=zohoarc; b=RTUhF8q6XWmx4MZWvJgX7XyOmXIXsKcDlAUnT17RH7Kz9IGxfE7IcwuB8RkHj2kpuwFZleu28vdpdQJ6jkfTq/Xweqp0u2J9EO8QtwRwy81jqS3FNww2Kt2Nu/PdVm+Skx7CUxrGeNMjBrzkcDMVR0iKhgQP51EzNgcrctEUqGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928269; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=jwQGH1UkOBP14m22lhl+vO142FSmqbX3mPeulmCZlyQ4QoWOo8yG0Vguk6ErhfyHg2YI5h2+tUNDPuVoHGsqYrwHWCe8wmoKkmf3jWIgfkbfTJd+y19NKL3Y/r9B/z6mpYOKiFvzmd4jUVOlb5otO7MT0rPcHiIRMlRoS6VsSSA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168892826930110.996922759803283; Sun, 9 Jul 2023 11:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAO-0008F8-Sl; Sun, 09 Jul 2023 14:29:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAH-0008Da-03 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:45 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAE-0000Dc-CH for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:44 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-307d58b3efbso3573381f8f.0 for ; Sun, 09 Jul 2023 11:29:40 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927379; x=1691519379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=jZp9P/D7o8LMgaIDj3ChheEh4NqrXh3fZGeczL8bTU0DnFsgAF5aAWwjY+gfNxbfj5 7tSVtBmE5kzhDBNTCeMYmn8kzCKNXIWqrtrNFWrnyUiCi8yxjqMP+U9KUl/Ue2QVBT6o Sw+3Pyphmh3mlhc0ZLU1iffP+1BklmzzUNz0+7ciKLeBBIOjtS4kpn06pGNkUSBVES8V om/93YdEZZBv3Zh3kDEV0EeMBunOCEmnFVan36RLtw/yk8wNEAkL18oI3jmnR6hhPiLr aBejoYeUJKK+pnohZsHP6blF7p3aordd/1VKZ/X4N6KitSgl/KyjUwOXUHCa4UatH22a qIkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927379; x=1691519379; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dfPcEEmBTn/D8MUOuhUDyuANxxowzTkGOvS1jQDZcxE=; b=E95twGP3RFaW3vKbqrLS7qSWY9kr5GGMF+Cm08Nk9w/Iqe90kB+EHe6JbkvkeyHcHD kTm1DirMIfYsbSwXmkdRVf8UVTxFojbe7D14LhijtvpNIeZqUIqfWbytfJM10FbRlhab G+SQvtpw9PWJoaiJJxtDEh7rdDZTdUREvpHPGYtJv/25SVxggjYA1JIfNLH0bI/E2h+o Acdi9+pButiZnIddc5ACWH570d94z3K7tKIdn0VRmE1Z4AcL8g3XFmafSpi1xhn1+Xyo RK9KCfFeCLrTLtI3ZTNYfwgZU7x9nOr+pkwghIv1rTUj8twb+YLiwk2q5mNs3J2zqbe4 OZUA== X-Gm-Message-State: ABy/qLYrFC1v60ah+OX39NzHf7Z+yxnK1C6+qPUwHkkNRWUvoyBHGCRT 6D0r5fWWEgFEDMlHIinBlIOgJuAsbhxWjmj/XNd1lQ== X-Google-Smtp-Source: APBJJlHCtbiBy9cThBQKLFZ3fXIffmD1SCj9+uvRE2NscSXTkRJpohJK0x7DBHUN2QXGHuDCLKBAVA== X-Received: by 2002:a5d:4f0c:0:b0:314:1fd7:188b with SMTP id c12-20020a5d4f0c000000b003141fd7188bmr8037074wru.17.1688927379157; Sun, 09 Jul 2023 11:29:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 02/45] linux-user: Remove #if 0 block in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:15 +0100 Message-Id: <20230709182934.309468-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928269728100001 These definitions are in sparc/signal.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e80d54780b..a4e4df8d3e 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -547,30 +547,6 @@ typedef union target_sigval { int sival_int; abi_ulong sival_ptr; } target_sigval_t; -#if 0 -#if defined (TARGET_SPARC) -typedef struct { - struct { - abi_ulong psr; - abi_ulong pc; - abi_ulong npc; - abi_ulong y; - abi_ulong u_regs[16]; /* globals and ins */ - } si_regs; - int si_mask; -} __siginfo_t; - -typedef struct { - unsigned long si_float_regs [32]; - unsigned long si_fsr; - unsigned long si_fpqdepth; - struct { - unsigned long *insn_addr; - unsigned long insn; - } si_fpqueue [16]; -} __siginfo_fpu_t; -#endif -#endif =20 #define TARGET_SI_MAX_SIZE 128 =20 --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927630; cv=none; d=zohomail.com; s=zohoarc; b=Dl4PrDKGCDqtCUpSVWkA1MsEJdxl5CuCWxwOm9sBUUfEmCSpzORDJz9nVaZZYtVQciEN7z89budcGDfzFSSehG8qeSGNlVEsV3lCaGu7cj4Mq8lCD0XytWSHI8cqD10uWXleEL+Yfzn6EvSYHjTLMKauB3klMkAEvEsIunjhwEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927630; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oDegPUeqJ78xBO4pGFYHur8C+Wi6RpRKy5K2/MXINzU=; b=dXvN7IQRQmsVeS04N5q8eBP3RGrxx6gt0ZPpXL+ZjYLamjN3nHI19EeM71Bp73RLC3MqciTCUz97K/oX4m4kpJO3qYxDBFYOXz2co7dU4Qry/esDIzb2fb0FiJh4RX6o3Nk2pdicQ8I+JlDGIPVfZdesprA238meRhCT4BJY7zQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927630848809.0714681924009; Sun, 9 Jul 2023 11:33:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008JR-58; Sun, 09 Jul 2023 14:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAJ-0008ER-RS for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:49 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAF-0000Dt-9S for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:47 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fbea14700bso37624655e9.3 for ; Sun, 09 Jul 2023 11:29:42 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927381; x=1691519381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oDegPUeqJ78xBO4pGFYHur8C+Wi6RpRKy5K2/MXINzU=; b=VWSuGaZ/IizcHUe5j5GyxFuxzgcCRlwFFbB2hyKcl8pTfua1MVoBaA9HaQbWLVcavf 1uUiqpBXSppuapmOrWssOqnrN7Iu9tLFXr7BcTiXl0cF2/wHlJOGa7BapWEaUQI1tuT1 0R0CGlFaJNqKeTHMk0xgvN3BEDAs8lrbAG1VNCEWBo05pMgZS2n2++ZJZyyMGt78DUib oXol6vx9Kn8kj/ScdWTM3r9aqbLLl5XhuM54T46zwD1OnWR5VLcyWx4kZruPiCoEONUe WU3A07kaW1V2vz+YPConIMqlrGaCrRe+BF7mX5XkvOGvGURu3X3myP1L9/cvRqrDrNki ADqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927381; x=1691519381; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oDegPUeqJ78xBO4pGFYHur8C+Wi6RpRKy5K2/MXINzU=; b=U2yvTWuMZ4620A3rykjbE0V1F6quQpjp6webpKa8SIJN4HFQGGO++7R4U9hsWxDkMw OyhUEeSVdjdnf4KZlGQ9v7LkuaTtNigFG7VC3njAXGjJuz7n5DZ7eyNd1A3C0LOS2Yyr LLqxCVGg5WsuKYz7HexDeC01VJGg/HHgjRm0ZXojJbrKi963gyYpls2gp/ujXldOZIwg 91iv57lOutOLwfyLjpFLBaQUPvkhNHTIDC6T1+ZPOYEintVuhZoe3eZZKi6lxG/y5dl2 rxr8O6kn+3w44vGPBLyfz+CKOVv1hgjcWVrhKhpTlRzETTpHimqS7Snc1cTZ5RgqSBOf B+VQ== X-Gm-Message-State: ABy/qLaEoUsqfj7zuZhpcdnqiGSvjlh+/CpButPM7RTKOAwUzuPot90g ggm3GMfayvD7XvhRkhhm9DEq8hx+muwOqXu8EJQSww== X-Google-Smtp-Source: APBJJlENk762lkuhyVI+OMe7DlzhmksDfZuC+dj+p+DXZmmnypdj438nF9rmIH1qwi12RjGDRpraTg== X-Received: by 2002:a05:600c:204:b0:3f7:a552:2ec7 with SMTP id 4-20020a05600c020400b003f7a5522ec7mr8417626wmi.33.1688927381595; Sun, 09 Jul 2023 11:29:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 03/37] target/arm: Move aesmc and aesimc tables to crypto/aes.c Date: Sun, 9 Jul 2023 19:28:18 +0100 Message-Id: <20230709182934.309468-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927632364100023 We do not currently have a table in crypto/ for just MixColumns. Move both tables for consistency. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/crypto/aes.h | 6 ++ crypto/aes.c | 140 ++++++++++++++++++++++++++++++++ target/arm/tcg/crypto_helper.c | 143 ++------------------------------- 3 files changed, 151 insertions(+), 138 deletions(-) diff --git a/include/crypto/aes.h b/include/crypto/aes.h index 822d64588c..24b073d569 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -34,6 +34,12 @@ extern const uint8_t AES_isbox[256]; extern const uint8_t AES_shifts[16]; extern const uint8_t AES_ishifts[16]; =20 +/* AES MixColumns, for use with rot32. */ +extern const uint32_t AES_mc_rot[256]; + +/* AES InvMixColumns, for use with rot32. */ +extern const uint32_t AES_imc_rot[256]; + /* AES InvMixColumns */ /* AES_imc[x][0] =3D [x].[0e, 09, 0d, 0b]; */ /* AES_imc[x][1] =3D [x].[0b, 0e, 09, 0d]; */ diff --git a/crypto/aes.c b/crypto/aes.c index af72ff7779..67bb74b8e3 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -116,6 +116,146 @@ const uint8_t AES_ishifts[16] =3D { 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3 }; =20 +/* + * MixColumns lookup table, for use with rot32. + */ +const uint32_t AES_mc_rot[256] =3D { + 0x00000000, 0x03010102, 0x06020204, 0x05030306, + 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, + 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, + 0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e, + 0x30101020, 0x33111122, 0x36121224, 0x35131326, + 0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e, + 0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36, + 0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e, + 0x60202040, 0x63212142, 0x66222244, 0x65232346, + 0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e, + 0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56, + 0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e, + 0x50303060, 0x53313162, 0x56323264, 0x55333366, + 0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e, + 0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76, + 0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e, + 0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386, + 0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e, + 0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96, + 0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e, + 0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6, + 0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae, + 0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6, + 0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe, + 0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6, + 0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce, + 0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6, + 0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde, + 0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6, + 0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee, + 0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6, + 0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe, + 0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d, + 0x97848413, 0x94858511, 0x91868617, 0x92878715, + 0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d, + 0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05, + 0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d, + 0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735, + 0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d, + 0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25, + 0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d, + 0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755, + 0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d, + 0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45, + 0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d, + 0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775, + 0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d, + 0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65, + 0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d, + 0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795, + 0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d, + 0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85, + 0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd, + 0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5, + 0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad, + 0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5, + 0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd, + 0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5, + 0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd, + 0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5, + 0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd, + 0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5, + 0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed, + 0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5, +}; + +/* + * Inverse MixColumns lookup table, for use with rot32. + */ +const uint32_t AES_imc_rot[256] =3D { + 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, + 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, + 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, + 0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a, + 0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2, + 0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca, + 0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382, + 0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba, + 0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9, + 0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1, + 0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9, + 0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81, + 0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029, + 0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411, + 0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859, + 0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61, + 0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf, + 0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987, + 0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf, + 0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7, + 0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f, + 0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967, + 0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f, + 0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117, + 0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664, + 0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c, + 0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14, + 0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c, + 0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684, + 0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc, + 0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4, + 0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc, + 0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753, + 0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b, + 0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23, + 0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b, + 0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3, + 0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b, + 0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3, + 0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb, + 0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88, + 0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0, + 0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8, + 0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0, + 0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68, + 0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850, + 0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418, + 0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020, + 0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe, + 0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6, + 0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e, + 0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6, + 0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e, + 0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526, + 0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e, + 0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56, + 0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25, + 0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d, + 0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255, + 0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d, + 0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5, + 0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd, + 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, + 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, +}; + /* AES_imc[x][0] =3D [x].[0e, 09, 0d, 0b]; */ /* AES_imc[x][1] =3D [x].[0b, 0e, 09, 0d]; */ /* AES_imc[x][2] =3D [x].[0d, 0b, 0e, 09]; */ diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index d28690321f..06254939d2 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -80,149 +80,16 @@ void HELPER(crypto_aese)(void *vd, void *vn, void *vm,= uint32_t desc) =20 static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm, bool decrypt) { - static uint32_t const mc[][256] =3D { { - /* MixColumns lookup table */ - 0x00000000, 0x03010102, 0x06020204, 0x05030306, - 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, - 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, - 0x140c0c18, 0x170d0d1a, 0x120e0e1c, 0x110f0f1e, - 0x30101020, 0x33111122, 0x36121224, 0x35131326, - 0x3c141428, 0x3f15152a, 0x3a16162c, 0x3917172e, - 0x28181830, 0x2b191932, 0x2e1a1a34, 0x2d1b1b36, - 0x241c1c38, 0x271d1d3a, 0x221e1e3c, 0x211f1f3e, - 0x60202040, 0x63212142, 0x66222244, 0x65232346, - 0x6c242448, 0x6f25254a, 0x6a26264c, 0x6927274e, - 0x78282850, 0x7b292952, 0x7e2a2a54, 0x7d2b2b56, - 0x742c2c58, 0x772d2d5a, 0x722e2e5c, 0x712f2f5e, - 0x50303060, 0x53313162, 0x56323264, 0x55333366, - 0x5c343468, 0x5f35356a, 0x5a36366c, 0x5937376e, - 0x48383870, 0x4b393972, 0x4e3a3a74, 0x4d3b3b76, - 0x443c3c78, 0x473d3d7a, 0x423e3e7c, 0x413f3f7e, - 0xc0404080, 0xc3414182, 0xc6424284, 0xc5434386, - 0xcc444488, 0xcf45458a, 0xca46468c, 0xc947478e, - 0xd8484890, 0xdb494992, 0xde4a4a94, 0xdd4b4b96, - 0xd44c4c98, 0xd74d4d9a, 0xd24e4e9c, 0xd14f4f9e, - 0xf05050a0, 0xf35151a2, 0xf65252a4, 0xf55353a6, - 0xfc5454a8, 0xff5555aa, 0xfa5656ac, 0xf95757ae, - 0xe85858b0, 0xeb5959b2, 0xee5a5ab4, 0xed5b5bb6, - 0xe45c5cb8, 0xe75d5dba, 0xe25e5ebc, 0xe15f5fbe, - 0xa06060c0, 0xa36161c2, 0xa66262c4, 0xa56363c6, - 0xac6464c8, 0xaf6565ca, 0xaa6666cc, 0xa96767ce, - 0xb86868d0, 0xbb6969d2, 0xbe6a6ad4, 0xbd6b6bd6, - 0xb46c6cd8, 0xb76d6dda, 0xb26e6edc, 0xb16f6fde, - 0x907070e0, 0x937171e2, 0x967272e4, 0x957373e6, - 0x9c7474e8, 0x9f7575ea, 0x9a7676ec, 0x997777ee, - 0x887878f0, 0x8b7979f2, 0x8e7a7af4, 0x8d7b7bf6, - 0x847c7cf8, 0x877d7dfa, 0x827e7efc, 0x817f7ffe, - 0x9b80801b, 0x98818119, 0x9d82821f, 0x9e83831d, - 0x97848413, 0x94858511, 0x91868617, 0x92878715, - 0x8388880b, 0x80898909, 0x858a8a0f, 0x868b8b0d, - 0x8f8c8c03, 0x8c8d8d01, 0x898e8e07, 0x8a8f8f05, - 0xab90903b, 0xa8919139, 0xad92923f, 0xae93933d, - 0xa7949433, 0xa4959531, 0xa1969637, 0xa2979735, - 0xb398982b, 0xb0999929, 0xb59a9a2f, 0xb69b9b2d, - 0xbf9c9c23, 0xbc9d9d21, 0xb99e9e27, 0xba9f9f25, - 0xfba0a05b, 0xf8a1a159, 0xfda2a25f, 0xfea3a35d, - 0xf7a4a453, 0xf4a5a551, 0xf1a6a657, 0xf2a7a755, - 0xe3a8a84b, 0xe0a9a949, 0xe5aaaa4f, 0xe6abab4d, - 0xefacac43, 0xecadad41, 0xe9aeae47, 0xeaafaf45, - 0xcbb0b07b, 0xc8b1b179, 0xcdb2b27f, 0xceb3b37d, - 0xc7b4b473, 0xc4b5b571, 0xc1b6b677, 0xc2b7b775, - 0xd3b8b86b, 0xd0b9b969, 0xd5baba6f, 0xd6bbbb6d, - 0xdfbcbc63, 0xdcbdbd61, 0xd9bebe67, 0xdabfbf65, - 0x5bc0c09b, 0x58c1c199, 0x5dc2c29f, 0x5ec3c39d, - 0x57c4c493, 0x54c5c591, 0x51c6c697, 0x52c7c795, - 0x43c8c88b, 0x40c9c989, 0x45caca8f, 0x46cbcb8d, - 0x4fcccc83, 0x4ccdcd81, 0x49cece87, 0x4acfcf85, - 0x6bd0d0bb, 0x68d1d1b9, 0x6dd2d2bf, 0x6ed3d3bd, - 0x67d4d4b3, 0x64d5d5b1, 0x61d6d6b7, 0x62d7d7b5, - 0x73d8d8ab, 0x70d9d9a9, 0x75dadaaf, 0x76dbdbad, - 0x7fdcdca3, 0x7cdddda1, 0x79dedea7, 0x7adfdfa5, - 0x3be0e0db, 0x38e1e1d9, 0x3de2e2df, 0x3ee3e3dd, - 0x37e4e4d3, 0x34e5e5d1, 0x31e6e6d7, 0x32e7e7d5, - 0x23e8e8cb, 0x20e9e9c9, 0x25eaeacf, 0x26ebebcd, - 0x2fececc3, 0x2cededc1, 0x29eeeec7, 0x2aefefc5, - 0x0bf0f0fb, 0x08f1f1f9, 0x0df2f2ff, 0x0ef3f3fd, - 0x07f4f4f3, 0x04f5f5f1, 0x01f6f6f7, 0x02f7f7f5, - 0x13f8f8eb, 0x10f9f9e9, 0x15fafaef, 0x16fbfbed, - 0x1ffcfce3, 0x1cfdfde1, 0x19fefee7, 0x1affffe5, - }, { - /* Inverse MixColumns lookup table */ - 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, - 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, - 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, - 0x745c6c48, 0x7f516546, 0x62467e54, 0x694b775a, - 0xb0d090e0, 0xbbdd99ee, 0xa6ca82fc, 0xadc78bf2, - 0x9ce4b4d8, 0x97e9bdd6, 0x8afea6c4, 0x81f3afca, - 0xe8b8d890, 0xe3b5d19e, 0xfea2ca8c, 0xf5afc382, - 0xc48cfca8, 0xcf81f5a6, 0xd296eeb4, 0xd99be7ba, - 0x7bbb3bdb, 0x70b632d5, 0x6da129c7, 0x66ac20c9, - 0x578f1fe3, 0x5c8216ed, 0x41950dff, 0x4a9804f1, - 0x23d373ab, 0x28de7aa5, 0x35c961b7, 0x3ec468b9, - 0x0fe75793, 0x04ea5e9d, 0x19fd458f, 0x12f04c81, - 0xcb6bab3b, 0xc066a235, 0xdd71b927, 0xd67cb029, - 0xe75f8f03, 0xec52860d, 0xf1459d1f, 0xfa489411, - 0x9303e34b, 0x980eea45, 0x8519f157, 0x8e14f859, - 0xbf37c773, 0xb43ace7d, 0xa92dd56f, 0xa220dc61, - 0xf66d76ad, 0xfd607fa3, 0xe07764b1, 0xeb7a6dbf, - 0xda595295, 0xd1545b9b, 0xcc434089, 0xc74e4987, - 0xae053edd, 0xa50837d3, 0xb81f2cc1, 0xb31225cf, - 0x82311ae5, 0x893c13eb, 0x942b08f9, 0x9f2601f7, - 0x46bde64d, 0x4db0ef43, 0x50a7f451, 0x5baafd5f, - 0x6a89c275, 0x6184cb7b, 0x7c93d069, 0x779ed967, - 0x1ed5ae3d, 0x15d8a733, 0x08cfbc21, 0x03c2b52f, - 0x32e18a05, 0x39ec830b, 0x24fb9819, 0x2ff69117, - 0x8dd64d76, 0x86db4478, 0x9bcc5f6a, 0x90c15664, - 0xa1e2694e, 0xaaef6040, 0xb7f87b52, 0xbcf5725c, - 0xd5be0506, 0xdeb30c08, 0xc3a4171a, 0xc8a91e14, - 0xf98a213e, 0xf2872830, 0xef903322, 0xe49d3a2c, - 0x3d06dd96, 0x360bd498, 0x2b1ccf8a, 0x2011c684, - 0x1132f9ae, 0x1a3ff0a0, 0x0728ebb2, 0x0c25e2bc, - 0x656e95e6, 0x6e639ce8, 0x737487fa, 0x78798ef4, - 0x495ab1de, 0x4257b8d0, 0x5f40a3c2, 0x544daacc, - 0xf7daec41, 0xfcd7e54f, 0xe1c0fe5d, 0xeacdf753, - 0xdbeec879, 0xd0e3c177, 0xcdf4da65, 0xc6f9d36b, - 0xafb2a431, 0xa4bfad3f, 0xb9a8b62d, 0xb2a5bf23, - 0x83868009, 0x888b8907, 0x959c9215, 0x9e919b1b, - 0x470a7ca1, 0x4c0775af, 0x51106ebd, 0x5a1d67b3, - 0x6b3e5899, 0x60335197, 0x7d244a85, 0x7629438b, - 0x1f6234d1, 0x146f3ddf, 0x097826cd, 0x02752fc3, - 0x335610e9, 0x385b19e7, 0x254c02f5, 0x2e410bfb, - 0x8c61d79a, 0x876cde94, 0x9a7bc586, 0x9176cc88, - 0xa055f3a2, 0xab58faac, 0xb64fe1be, 0xbd42e8b0, - 0xd4099fea, 0xdf0496e4, 0xc2138df6, 0xc91e84f8, - 0xf83dbbd2, 0xf330b2dc, 0xee27a9ce, 0xe52aa0c0, - 0x3cb1477a, 0x37bc4e74, 0x2aab5566, 0x21a65c68, - 0x10856342, 0x1b886a4c, 0x069f715e, 0x0d927850, - 0x64d90f0a, 0x6fd40604, 0x72c31d16, 0x79ce1418, - 0x48ed2b32, 0x43e0223c, 0x5ef7392e, 0x55fa3020, - 0x01b79aec, 0x0aba93e2, 0x17ad88f0, 0x1ca081fe, - 0x2d83bed4, 0x268eb7da, 0x3b99acc8, 0x3094a5c6, - 0x59dfd29c, 0x52d2db92, 0x4fc5c080, 0x44c8c98e, - 0x75ebf6a4, 0x7ee6ffaa, 0x63f1e4b8, 0x68fcedb6, - 0xb1670a0c, 0xba6a0302, 0xa77d1810, 0xac70111e, - 0x9d532e34, 0x965e273a, 0x8b493c28, 0x80443526, - 0xe90f427c, 0xe2024b72, 0xff155060, 0xf418596e, - 0xc53b6644, 0xce366f4a, 0xd3217458, 0xd82c7d56, - 0x7a0ca137, 0x7101a839, 0x6c16b32b, 0x671bba25, - 0x5638850f, 0x5d358c01, 0x40229713, 0x4b2f9e1d, - 0x2264e947, 0x2969e049, 0x347efb5b, 0x3f73f255, - 0x0e50cd7f, 0x055dc471, 0x184adf63, 0x1347d66d, - 0xcadc31d7, 0xc1d138d9, 0xdcc623cb, 0xd7cb2ac5, - 0xe6e815ef, 0xede51ce1, 0xf0f207f3, 0xfbff0efd, - 0x92b479a7, 0x99b970a9, 0x84ae6bbb, 0x8fa362b5, - 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, - } }; - union CRYPTO_STATE st =3D { .l =3D { rm[0], rm[1] } }; + const uint32_t *mc =3D decrypt ? AES_imc_rot : AES_mc_rot; int i; =20 for (i =3D 0; i < 16; i +=3D 4) { CR_ST_WORD(st, i >> 2) =3D - mc[decrypt][CR_ST_BYTE(st, i)] ^ - rol32(mc[decrypt][CR_ST_BYTE(st, i + 1)], 8) ^ - rol32(mc[decrypt][CR_ST_BYTE(st, i + 2)], 16) ^ - rol32(mc[decrypt][CR_ST_BYTE(st, i + 3)], 24); + mc[CR_ST_BYTE(st, i)] ^ + rol32(mc[CR_ST_BYTE(st, i + 1)], 8) ^ + rol32(mc[CR_ST_BYTE(st, i + 2)], 16) ^ + rol32(mc[CR_ST_BYTE(st, i + 3)], 24); } =20 rd[0] =3D st.l[0]; --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927664; cv=none; d=zohomail.com; s=zohoarc; b=WomZNOO743IGVaUK5h+1g/1mBTrmqhHNvzL6H/ZCJmGHwk8ZajVAh4o/owURuAZ2/su3gMNHKunQY5PqEeeLKLlThzV4M9cd+OSN79FiMZI6XaM+keqzmnaCYEXPWsydlQJZKR3OFIoNgHf4nFo/CCO0QSUfkF4vpVkdJcCBw1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927664; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Gprdh5JFhJiNf9jBtciBrHxd9pk0SgL59a9DOZblX40=; b=oEIHlgLaPICX6Ilxli3jYLbG8ZsbxTCI/Ocf0MMkqDZd903md7/CgtE2KMuhTSQoUz4Vme1y+3jYjeLxvsJ9ESwaekCXuqkXIjRre18BFPpZiKr2MvU7DrTJ7HJwTID9eJIKwxsArw+XrlOh5eKIBpnl7w4LawddC8xWV8wvOJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927664220410.1741022578832; Sun, 9 Jul 2023 11:34:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAP-0008Fz-63; Sun, 09 Jul 2023 14:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAH-0008Df-NT for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:46 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAE-0000Do-Cc for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:45 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-314313f127fso3822043f8f.1 for ; Sun, 09 Jul 2023 11:29:41 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927380; x=1691519380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Gprdh5JFhJiNf9jBtciBrHxd9pk0SgL59a9DOZblX40=; b=g5JUdxGZHpXQNtmG6PSUxe1Pq6Pg73DysxYZ2eUFm7NB+PA5GCrY9m0Sm8+MfSQlNH 66S2EnBguCqeguLCgySVvNAQvOJG9XZL8Am59SHpSZE5uKF9JXn++3tMbTgqdBGWU16s I0RW5DxCPGvld2yO506H7URSgH/5GiyKpsvHryZV5vQ9hVgHsHDeSkgoDmafIm07o2rr jojUjBKz2FblFDnRS7JISdq9X5KOVml5Vqj31b8hctkQiSx8+Wk2SvYGS/D0SD4j+Yfr weCTN+a3NS98l942cuoTbyCB+jeQtQ6IeX0PK4w5A3CtJfOGh6zZE+vFZ3n8k19wZCo1 dM2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927380; x=1691519380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gprdh5JFhJiNf9jBtciBrHxd9pk0SgL59a9DOZblX40=; b=FQx5fQFHW/pI+lSS6rkjnk0gtLTySnJwLfBrwyAlBTgy7p5xwEgXWOr4qyMmWcM6OH kOSC/uVNfwknJJJtr8pSlDxGffs4nc5Qf8rcA9VZiezgIEPpXtUo4X21Xb8WGvos5Cqk rtifuJ4WEUmJOy3Z2EvhQCsQeSgOsaL5gMWOzIv/07rhG9wpWQ5UbMlJA/h1a36Eq1Sy V/iSiybkcVN67ZIwHws8plQzThJr4yNwRqJo//NK+Z9oLtKCkKfhfcYPjEUKYz/gGd/Y gPmJuQYsiF8SxHqAWqzglxQSkE1WFX11T7yyvgb9B7ZK7sRT+u7ogzioHesMlOo2DHb1 iAnQ== X-Gm-Message-State: ABy/qLY3OBixiyH6KsJntzcljye+SAikOZbQnxVJKm4JRtuWtP2BZphI As8EgcqI74Z8RdwYbEd76iWviKfW6GPNd7ak+6sjFA== X-Google-Smtp-Source: APBJJlH6ZmSJIQ+iAjoYyvc9f56XRcbQ41Iz/Pkq+qIc1/DTxE3K+mq4i1HNh562IfJzz8GHasw93A== X-Received: by 2002:adf:e241:0:b0:314:14ea:e2db with SMTP id bl1-20020adfe241000000b0031414eae2dbmr8266048wrb.0.1688927380741; Sun, 09 Jul 2023 11:29:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 03/45] linux-user: Use abi_uint not uint32_t in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:17 +0100 Message-Id: <20230709182934.309468-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927666347100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall_defs.h | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index a4e4df8d3e..414d88a9ec 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -67,7 +67,7 @@ #define USE_UID16 #define target_id uint16_t #else -#define target_id uint32_t +#define target_id abi_uint #endif =20 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \ @@ -215,9 +215,9 @@ struct target_ip_mreqn { =20 struct target_ip_mreq_source { /* big endian */ - uint32_t imr_multiaddr; - uint32_t imr_interface; - uint32_t imr_sourceaddr; + abi_uint imr_multiaddr; + abi_uint imr_interface; + abi_uint imr_sourceaddr; }; =20 struct target_linger { @@ -508,9 +508,9 @@ typedef abi_ulong target_old_sa_flags; =20 #if defined(TARGET_MIPS) struct target_sigaction { - uint32_t sa_flags; + abi_uint sa_flags; #if defined(TARGET_ABI_MIPSN32) - uint32_t _sa_handler; + abi_uint _sa_handler; #else abi_ulong _sa_handler; #endif @@ -1620,19 +1620,19 @@ struct target_stat { struct QEMU_PACKED target_stat64 { uint64_t st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 - uint32_t pad0; - uint32_t __st_ino; + abi_uint pad0; + abi_uint __st_ino; =20 - uint32_t st_mode; - uint32_t st_nlink; - uint32_t st_uid; - uint32_t st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; uint64_t st_rdev; uint64_t __pad1; =20 int64_t st_size; int32_t st_blksize; - uint32_t __pad2; + abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ =20 int target_st_atime; @@ -2227,19 +2227,19 @@ struct target_statfs { #endif =20 struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_frsize; /* Fragment size - unsupported */ - uint32_t __pad; + abi_uint f_type; + abi_uint f_bsize; + abi_uint f_frsize; /* Fragment size - unsupported */ + abi_uint __pad; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_files; uint64_t f_ffree; uint64_t f_bavail; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_flags; - uint32_t f_spare[5]; + abi_uint f_namelen; + abi_uint f_flags; + abi_uint f_spare[5]; }; #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \ defined(TARGET_SPARC64) || defined(TARGET_AARCH64) || \ @@ -2307,33 +2307,33 @@ struct target_statfs64 { }; #else struct target_statfs { - uint32_t f_type; - uint32_t f_bsize; - uint32_t f_blocks; - uint32_t f_bfree; - uint32_t f_bavail; - uint32_t f_files; - uint32_t f_ffree; + abi_uint f_type; + abi_uint f_bsize; + abi_uint f_blocks; + abi_uint f_bfree; + abi_uint f_bavail; + abi_uint f_files; + abi_uint f_ffree; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + abi_uint f_namelen; + abi_uint f_frsize; + abi_uint f_flags; + abi_uint f_spare[4]; }; =20 struct target_statfs64 { - uint32_t f_type; - uint32_t f_bsize; + abi_uint f_type; + abi_uint f_bsize; uint64_t f_blocks; uint64_t f_bfree; uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; target_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_flags; - uint32_t f_spare[4]; + abi_uint f_namelen; + abi_uint f_frsize; + abi_uint f_flags; + abi_uint f_spare[4]; }; #endif =20 @@ -2713,9 +2713,9 @@ struct target_epoll_event { #endif =20 struct target_ucred { - uint32_t pid; - uint32_t uid; - uint32_t gid; + abi_uint pid; + abi_uint uid; + abi_uint gid; }; =20 typedef int32_t target_timer_t; @@ -2754,14 +2754,14 @@ struct target_sigevent { }; =20 struct target_user_cap_header { - uint32_t version; + abi_uint version; int pid; }; =20 struct target_user_cap_data { - uint32_t effective; - uint32_t permitted; - uint32_t inheritable; + abi_uint effective; + abi_uint permitted; + abi_uint inheritable; }; =20 /* from kernel's include/linux/syslog.h */ @@ -2791,19 +2791,19 @@ struct target_user_cap_data { =20 struct target_statx_timestamp { int64_t tv_sec; - uint32_t tv_nsec; + abi_uint tv_nsec; int32_t __reserved; }; =20 struct target_statx { /* 0x00 */ - uint32_t stx_mask; /* What results were written [uncond] */ - uint32_t stx_blksize; /* Preferred general I/O size [uncond] */ + abi_uint stx_mask; /* What results were written [uncond] */ + abi_uint stx_blksize; /* Preferred general I/O size [uncond] */ uint64_t stx_attributes; /* Flags conveying information about the file= */ /* 0x10 */ - uint32_t stx_nlink; /* Number of hard links */ - uint32_t stx_uid; /* User ID of owner */ - uint32_t stx_gid; /* Group ID of owner */ + abi_uint stx_nlink; /* Number of hard links */ + abi_uint stx_uid; /* User ID of owner */ + abi_uint stx_gid; /* Group ID of owner */ uint16_t stx_mode; /* File mode */ uint16_t __spare0[1]; /* 0x20 */ @@ -2817,10 +2817,10 @@ struct target_statx { struct target_statx_timestamp stx_ctime; /* Last attribute change ti= me */ struct target_statx_timestamp stx_mtime; /* Last data modification t= ime */ /* 0x80 */ - uint32_t stx_rdev_major; /* Device ID of special file [if bdev/cdev]= */ - uint32_t stx_rdev_minor; - uint32_t stx_dev_major; /* ID of device containing file [uncond] */ - uint32_t stx_dev_minor; + abi_uint stx_rdev_major; /* Device ID of special file [if bdev/cdev]= */ + abi_uint stx_rdev_minor; + abi_uint stx_dev_major; /* ID of device containing file [uncond] */ + abi_uint stx_dev_minor; /* 0x90 */ uint64_t __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927518; cv=none; d=zohomail.com; s=zohoarc; b=n9BWzLWmIYEFHs2J4Edcm5NfyBkFYVwuqFQ/qwHKmmm7VbM5Je7HEKRgnH9VvWK6lRIVP89XbbnjvYc4g0G/oaDXGENF6d/n7dx3+ysKjyd5ZLNY9Ni5FwYXpi3OLHsgFNxwqOFYiTntKbLNoxnJz5q78DHzCZaVzvOPRTGv/pQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927518; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gLgfXZyf9aATX9TfQItUdKukGg6cdQDyWQ8EagJh33A=; b=GU87nSJn3H9CD5KBSthFoAogEw7n6HUrMYF+7HPndmtF0038a/44xtdgb8UAWRJxbPwSja1wq31a9n2l0vghcoRL+7Zxd3aH4hZNilj2W1GdCLIaen+kkDJlsts/Moz3CnugY6dAMvbRfDaI8NYm8WwsGxy0Sl+IYsyyiOZFK50= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927518912101.50146415108918; Sun, 9 Jul 2023 11:31:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAU-0008JE-6x; Sun, 09 Jul 2023 14:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAJ-0008EP-9q for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:48 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAG-0000E0-PC for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:47 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-307d58b3efbso3573397f8f.0 for ; Sun, 09 Jul 2023 11:29:43 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927382; x=1691519382; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gLgfXZyf9aATX9TfQItUdKukGg6cdQDyWQ8EagJh33A=; b=iAUj9O7+LFwt3Zf+ETwt8UG82wsavqE/EP9S3iITcm5ub39DVylbXA/wARxo1Le897 BtyzUn3DcgjPfqCwm2dkSj4zTWwdk7V0UJ8WzF1T0Xdmkp/VUKEyORUfBPGJY4B++v2a M2SmjClicyQfkAORq33hNNTGiKZWsTJ9xHowVjC2fZft1W7iJL9aLVvRFYmvfYBFb0pT Xk+BCa9LHmOkjeTCDj4LUaWlm5O4+crXZOVg4qRxIxbL8YbXju/arAL6OJJXvoTVczc1 netakwK5hgyTq3M2u/5BzTC7cueX+4Agvr/92h7P+/rYI7Iy4OZlFOVOFWW0D7DEtVzl Q0/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927382; x=1691519382; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gLgfXZyf9aATX9TfQItUdKukGg6cdQDyWQ8EagJh33A=; b=i6TbulDW38I4ZSnFQQm0o3pZFeMHr3IahvjB9niyJU4g9iz3dV/ufoU0pZYTENQA8I V1Tz1NTBRfLAFysHQVB8DC0WWmZf6Dp4OYFHLA+JTOOLeMXBxb8BH75S5XUnzgVeP+n9 qT7QPdKxp8AXkfamdfUWugrh7V+RDmeN+dfoVLDfUiHOmTSFrWL0IpxjgvrlgdkptSR6 ko1CdR6ehkovBs6qsr23xF/F6FsmDLANE3DbGpQlbutMTvt3k7WpefVu173jEP9O5siN R1kElUpLkFGxlB3ft4gnLnPVBjEeT0BhnfEJNhAnVm9zXXlb27sOPnEliBYDBjetPqEZ 04Dw== X-Gm-Message-State: ABy/qLboUC69hUbyfJfb6A4aFX26cSXkl5Hepu65jPhjnlTXMjmVcFAx rBrH4+mggOVRl2vffFpD6DnuYHpm+5U6xkwCpVqavg== X-Google-Smtp-Source: APBJJlGNWaL3NELHZbgkp8Wjkz2qm/gdppxjnsHiOJNBPhdZQjtQ34VplyT+gDG96l0Tur+dGOYRKw== X-Received: by 2002:a5d:5303:0:b0:313:deda:c444 with SMTP id e3-20020a5d5303000000b00313dedac444mr7925547wrv.24.1688927382497; Sun, 09 Jul 2023 11:29:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 04/37] crypto/aes: Add AES_SH, AES_ISH macros Date: Sun, 9 Jul 2023 19:28:19 +0100 Message-Id: <20230709182934.309468-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927519979100003 These macros will constant fold and avoid the indirection through memory when fully unrolling some new primitives. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- crypto/aes.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/crypto/aes.c b/crypto/aes.c index 67bb74b8e3..e65c97e0c1 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -108,12 +108,24 @@ const uint8_t AES_isbox[256] =3D { 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D, }; =20 +/* AES ShiftRows, for complete unrolling. */ +#define AES_SH(X) (((X) * 5) & 15) + const uint8_t AES_shifts[16] =3D { - 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11 + AES_SH(0x0), AES_SH(0x1), AES_SH(0x2), AES_SH(0x3), + AES_SH(0x4), AES_SH(0x5), AES_SH(0x6), AES_SH(0x7), + AES_SH(0x8), AES_SH(0x9), AES_SH(0xA), AES_SH(0xB), + AES_SH(0xC), AES_SH(0xD), AES_SH(0xE), AES_SH(0xF), }; =20 +/* AES InvShiftRows, for complete unrolling. */ +#define AES_ISH(X) (((X) * 13) & 15) + const uint8_t AES_ishifts[16] =3D { - 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3 + AES_ISH(0x0), AES_ISH(0x1), AES_ISH(0x2), AES_ISH(0x3), + AES_ISH(0x4), AES_ISH(0x5), AES_ISH(0x6), AES_ISH(0x7), + AES_ISH(0x8), AES_ISH(0x9), AES_ISH(0xA), AES_ISH(0xB), + AES_ISH(0xC), AES_ISH(0xD), AES_ISH(0xE), AES_ISH(0xF), }; =20 /* --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927620; cv=none; d=zohomail.com; s=zohoarc; b=hM4heJP5EnDwFduUdWGHi7Qqde7fT71M8HlStVPwHB1dxwTeIh1ADFf54nhHLMcupcuXy4YWT1A/iOVnnU8WxLcZw2+Sb2bYtKGXlgnWlZkJRaLF2ELMGWmMPU42osOU+Ynz7TrDx+3AQcergdNe9f9zRQrZM5js89rqWG/+c7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927620; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=Q5Mrue49ByHLmai4ojnQTv2cfAy1IWaBi4xRVDOjSoGQMDbRqQ7oTZRDIdXnv8rKYs8InC5GIw1O9UyPXFqlisxIPdVP7J3Qv7xOsJv0V3ABi6lhsBTz7x2UABc2093kNU8JPZnj0xaXd5jKowMTdsV7kVc7IirBTjxAx5sIPKE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927620235925.1710645713069; Sun, 9 Jul 2023 11:33:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAP-0008Fy-4x; Sun, 09 Jul 2023 14:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAJ-0008EQ-Qu for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:49 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAG-0000E7-PL for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:47 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbf1b82de7so27946985e9.1 for ; Sun, 09 Jul 2023 11:29:44 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927383; x=1691519383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=jeFjwKcjjLrlgUlqcVFFT5VdgStte53SosdndOt4tIjZNCNBCq4r5ZCsPz+/droFnY RtoWL1rlIF03MQQi8LCZILp8rwTRCr1ls5VeIFnJTGnVomsj8KhAua4As9DPvgDjXT6y 7JJ46fs8jbtvkjZ8ftYU9RPOHFgRMwqfy7aC3tDEPJuYm7sG1QLWpIrqPKJ0l1paoOJ3 +0kb5KiFOs4bKRY37V8NigfmJjObySFfmzCvMpKn09veOiufjqHJ8vd25WgN4EaQbZRV iirGvtJJvektQsjv3VO7dt7J1eHNnVQK9Lz9BvYp9jesXAEIJbCsliMLdh2lOS4p2JLr wKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927383; x=1691519383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aow7z7inlkO3pr/eTAXJ2bbplOH1xZ+KdEP0VBoCQXI=; b=HwwhTowYxmB1oKvDXCwErYF2tELUQYT1nJIwgJ55JoDhNV4bHYNX/pkQcYZr8jtuGT 4K/aLJsx7MdY9x0UO03dM9s9JIS0MYz4ACG5J+jdGksE03BQLc7QEG2c05vTe8mCy7J+ c7VTHhkjLnjL1O5TR7MMgIp69Brp+tlvmRrkHGglr7zn53gv+mo/gPYQxLQwuPzFEeiO FDAq33weZePp05vXABinzoXzgd14A7K7w7hUtRde6hCQjC3kGjERXyVUhu7JC4wEfepo pF0GTpmrYNvxPvYKxhNlwp2oa8SzHlDjNoOvj92Ta/xdejkyoqmF8chxksXL2DtHqoRD t8UQ== X-Gm-Message-State: ABy/qLY6TcQQxGVyBUK2Dl8+CeLpYYdo+k34vbL6eBoexOUFJVLNjsTe 6afCwvGJqcu8fuNAkIQdOOBBedN1ei64ixh8Oh9nEw== X-Google-Smtp-Source: APBJJlG5ijU1R3I8FKq1QA1xQdNcnGoOPoW/i6qUcOBU6izHLa9UmYT2mKYV51Pm/TMlxi5y+uEAdw== X-Received: by 2002:a1c:cc02:0:b0:3fb:4064:7e22 with SMTP id h2-20020a1ccc02000000b003fb40647e22mr3597986wmb.19.1688927383364; Sun, 09 Jul 2023 11:29:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 04/45] linux-user: Use abi_int not int32_t in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:20 +0100 Message-Id: <20230709182934.309468-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927621863100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 60 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 414d88a9ec..caaa895bec 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -501,7 +501,7 @@ int do_sigaction(int sig, const struct target_sigaction= *act, #endif =20 #if defined(TARGET_ALPHA) -typedef int32_t target_old_sa_flags; +typedef abi_int target_old_sa_flags; #else typedef abi_ulong target_old_sa_flags; #endif @@ -1631,7 +1631,7 @@ struct QEMU_PACKED target_stat64 { uint64_t __pad1; =20 int64_t st_size; - int32_t st_blksize; + abi_int st_blksize; abi_uint __pad2; int64_t st_blocks; /* Number 512-byte blocks allocated. */ =20 @@ -2192,20 +2192,20 @@ typedef struct { #ifdef TARGET_MIPS #ifdef TARGET_ABI_MIPSN32 struct target_statfs { - int32_t f_type; - int32_t f_bsize; - int32_t f_frsize; /* Fragment size - unsupported= */ - int32_t f_blocks; - int32_t f_bfree; - int32_t f_files; - int32_t f_ffree; - int32_t f_bavail; + abi_int f_type; + abi_int f_bsize; + abi_int f_frsize; /* Fragment size - unsupported= */ + abi_int f_blocks; + abi_int f_bfree; + abi_int f_files; + abi_int f_ffree; + abi_int f_bavail; =20 /* Linux specials */ target_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_flags; - int32_t f_spare[5]; + abi_int f_namelen; + abi_int f_flags; + abi_int f_spare[5]; }; #else struct target_statfs { @@ -2276,34 +2276,34 @@ struct target_statfs64 { }; #elif defined(TARGET_S390X) struct target_statfs { - int32_t f_type; - int32_t f_bsize; + abi_int f_type; + abi_int f_bsize; abi_long f_blocks; abi_long f_bfree; abi_long f_bavail; abi_long f_files; abi_long f_ffree; kernel_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_frsize; - int32_t f_flags; - int32_t f_spare[4]; + abi_int f_namelen; + abi_int f_frsize; + abi_int f_flags; + abi_int f_spare[4]; =20 }; =20 struct target_statfs64 { - int32_t f_type; - int32_t f_bsize; + abi_int f_type; + abi_int f_bsize; abi_long f_blocks; abi_long f_bfree; abi_long f_bavail; abi_long f_files; abi_long f_ffree; kernel_fsid_t f_fsid; - int32_t f_namelen; - int32_t f_frsize; - int32_t f_flags; - int32_t f_spare[4]; + abi_int f_namelen; + abi_int f_frsize; + abi_int f_flags; + abi_int f_spare[4]; }; #else struct target_statfs { @@ -2718,21 +2718,21 @@ struct target_ucred { abi_uint gid; }; =20 -typedef int32_t target_timer_t; +typedef abi_int target_timer_t; =20 #define TARGET_SIGEV_MAX_SIZE 64 =20 /* This is architecture-specific but most architectures use the default */ #ifdef TARGET_MIPS -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 + sizeof(abi_long)) #else -#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(abi_int) * 2 \ + sizeof(target_sigval_t)) #endif =20 #define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ - TARGET_SIGEV_PREAMBLE_SIZE) \ - / sizeof(int32_t)) + / sizeof(abi_int)) =20 struct target_sigevent { target_sigval_t sigev_value; @@ -2792,7 +2792,7 @@ struct target_user_cap_data { struct target_statx_timestamp { int64_t tv_sec; abi_uint tv_nsec; - int32_t __reserved; + abi_int __reserved; }; =20 struct target_statx { --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928348; cv=none; d=zohomail.com; s=zohoarc; b=LhIowBsr3dps1y+cE0Ez4b826osgbbJhPstIF27qoSkO4OI8StxMoBHpmw2PXO42wp9is9Sc5FK/vRSL0znRuWDE/1cAXRjyX0ZZ9yupxJq23PT4ppZril2CctPhTq6OohwpCiYS6yrMzDYaTKUyAZvzOmYDZ3BDWkRBRMRb3Qk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928348; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+2eq+Rqw2tfVQv+qv2fSzwIl0ZvbKdHuhOb40v3Ga3s=; b=NPbsgmFzsFQCkb9TwTUtlmIwgnDPrdVYfYSLTrMy2+wY3QlKc4FWGw936hlO28r9lQx3r81EOAGz7pTFqykek4z0Lcdcs3QJdiHMSIhhqu7CrrYHUjSgzkhP+kRBGl3nsWI0+r9QIKgiBEUmin+rSPuOHYoA9EiVogXgcS6sLas= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928348425173.7252831673436; Sun, 9 Jul 2023 11:45:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAR-0008HO-Sg; Sun, 09 Jul 2023 14:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAK-0008ES-86 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:49 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAH-0000EF-Hz for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:47 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fb4146e8deso49381985e9.0 for ; Sun, 09 Jul 2023 11:29:45 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927384; x=1691519384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+2eq+Rqw2tfVQv+qv2fSzwIl0ZvbKdHuhOb40v3Ga3s=; b=o8uyLtBxem/VrQcJrlPgF8c6HE795+WqaHNlBksfMcs4BuUTKhYsEqDhOLDcn66Rzm nD8NxeKUQdhb0uVUZX+LTxaDlBKsrlnBp/GijMnDb9wLtRtsDDcooYZiF59uZ9klR6tn 4wN9ZfLgzquPHogODDviwDKMsPAX3Je1IRj8ucWRZNaCizXKFRkaFS9FotQZvn+v2n8S o7+WY6wzr6hfc8O7BIgZMuAENCwfiDb3INWwBMk1IRMww2Z3SOpx0ILmWsq4nux2kSho QJTP8DFHiwLKKqNKDEpXl0ufmfPt73WfTEeZGpZOeTW1RyBt5IVnBpe8NSZ+h3159Rfo QuRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927384; x=1691519384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+2eq+Rqw2tfVQv+qv2fSzwIl0ZvbKdHuhOb40v3Ga3s=; b=ldBrZN5/NX/41pMwhr3sUovqJjlxE/dvosH6elJoPQ7XRyqZ6oaO8qy2zzJhnoQy3E cznoDnVkKwhdbt/vRgPS2M1KGWd6fiifBCNtPEl+hD9kq40ZtaHshrf0pvRfwskKedkK u1+MCJdpAbJlKMd6YcIEoEzsVdyaS6YmX7j+SVK3/wPzPSScq8EGdUvPzFm2aS0DYbAN tS7MT/QKF4y4eJkfBqlAIO1tRjL3r0xDp2y7qEy6d4Rzr45GoT9Dlv91lolQGmYflyfT tDICXUAsJb/rW8jhLoJ6Bwl7gSK6ArdpSWt0Mcv98UHVgVCva28df8GkqsYRwH3A+WuM XAvA== X-Gm-Message-State: ABy/qLYPz5lMcGvzWCAKRXW7M7CY9wHfbS8eQU/n3bDts0q1n4x8bHD+ 0RAC2vsEFY0AA3bSDAqtZx4WILDc0dx+Si1d4NE7jw== X-Google-Smtp-Source: APBJJlH1bB7ShD9al+x7MtvBX2bcq9DY6QMhXuDVP5wX6bH1pRrAYXhANCiX3CNcixsOaUuYDyRHZg== X-Received: by 2002:a05:600c:2193:b0:3fb:ff8f:2db0 with SMTP id e19-20020a05600c219300b003fbff8f2db0mr9241054wme.39.1688927384198; Sun, 09 Jul 2023 11:29:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 05/37] crypto: Add aesenc_SB_SR_AK Date: Sun, 9 Jul 2023 19:28:21 +0100 Message-Id: <20230709182934.309468-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928349657100003 Start adding infrastructure for accelerating guest AES. Begin with a SubBytes + ShiftRows + AddRoundKey primitive. Acked-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- MAINTAINERS | 1 + host/include/generic/host/crypto/aes-round.h | 16 +++++++ include/crypto/aes-round.h | 44 +++++++++++++++++++ crypto/aes.c | 46 ++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 host/include/generic/host/crypto/aes-round.h create mode 100644 include/crypto/aes-round.h diff --git a/MAINTAINERS b/MAINTAINERS index d422ce50e3..1817cfc62f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3224,6 +3224,7 @@ M: Daniel P. Berrange S: Maintained F: crypto/ F: include/crypto/ +F: host/include/*/host/crypto/ F: qapi/crypto.json F: tests/unit/test-crypto-* F: tests/bench/benchmark-crypto-* diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h new file mode 100644 index 0000000000..c5d8066179 --- /dev/null +++ b/host/include/generic/host/crypto/aes-round.h @@ -0,0 +1,16 @@ +/* + * No host specific aes acceleration. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef GENERIC_HOST_CRYPTO_AES_ROUND_H +#define GENERIC_HOST_CRYPTO_AES_ROUND_H + +#define HAVE_AES_ACCEL false +#define ATTR_AES_ACCEL + +void aesenc_SB_SR_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); + +#endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */ diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h new file mode 100644 index 0000000000..b85db1a30e --- /dev/null +++ b/include/crypto/aes-round.h @@ -0,0 +1,44 @@ +/* + * AES round fragments, generic version + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Copyright (C) 2023 Linaro, Ltd. + */ + +#ifndef CRYPTO_AES_ROUND_H +#define CRYPTO_AES_ROUND_H + +/* Hosts with acceleration will usually need a 16-byte vector type. */ +typedef uint8_t AESStateVec __attribute__((vector_size(16))); + +typedef union { + uint8_t b[16]; + uint32_t w[4]; + uint64_t d[2]; + AESStateVec v; +} AESState; + +#include "host/crypto/aes-round.h" + +/* + * Perform SubBytes + ShiftRows + AddRoundKey. + */ + +void aesenc_SB_SR_AK_gen(AESState *ret, const AESState *st, + const AESState *rk); +void aesenc_SB_SR_AK_genrev(AESState *ret, const AESState *st, + const AESState *rk); + +static inline void aesenc_SB_SR_AK(AESState *r, const AESState *st, + const AESState *rk, bool be) +{ + if (HAVE_AES_ACCEL) { + aesenc_SB_SR_AK_accel(r, st, rk, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesenc_SB_SR_AK_gen(r, st, rk); + } else { + aesenc_SB_SR_AK_genrev(r, st, rk); + } +} + +#endif /* CRYPTO_AES_ROUND_H */ diff --git a/crypto/aes.c b/crypto/aes.c index e65c97e0c1..408d92b81f 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" =20 typedef uint32_t u32; typedef uint8_t u8; @@ -1215,6 +1216,51 @@ static const u32 rcon[] =3D { 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses= more than 10 rcon values */ }; =20 +/* + * Perform SubBytes + ShiftRows + AddRoundKey. + */ +static inline void +aesenc_SB_SR_AK_swap(AESState *ret, const AESState *st, + const AESState *rk, bool swap) +{ + const int swap_b =3D swap ? 15 : 0; + AESState t; + + t.b[swap_b ^ 0x0] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x0)]]; + t.b[swap_b ^ 0x1] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x1)]]; + t.b[swap_b ^ 0x2] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x2)]]; + t.b[swap_b ^ 0x3] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x3)]]; + t.b[swap_b ^ 0x4] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x4)]]; + t.b[swap_b ^ 0x5] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x5)]]; + t.b[swap_b ^ 0x6] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x6)]]; + t.b[swap_b ^ 0x7] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x7)]]; + t.b[swap_b ^ 0x8] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x8)]]; + t.b[swap_b ^ 0x9] =3D AES_sbox[st->b[swap_b ^ AES_SH(0x9)]]; + t.b[swap_b ^ 0xa] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xA)]]; + t.b[swap_b ^ 0xb] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xB)]]; + t.b[swap_b ^ 0xc] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xC)]]; + t.b[swap_b ^ 0xd] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xD)]]; + t.b[swap_b ^ 0xe] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xE)]]; + t.b[swap_b ^ 0xf] =3D AES_sbox[st->b[swap_b ^ AES_SH(0xF)]]; + + /* + * Perform the AddRoundKey with generic vectors. + * This may be expanded to either host integer or host vector code. + * The key and output endianness match, so no bswap required. + */ + ret->v =3D t.v ^ rk->v; +} + +void aesenc_SB_SR_AK_gen(AESState *r, const AESState *s, const AESState *k) +{ + aesenc_SB_SR_AK_swap(r, s, k, false); +} + +void aesenc_SB_SR_AK_genrev(AESState *r, const AESState *s, const AESState= *k) +{ + aesenc_SB_SR_AK_swap(r, s, k, true); +} + /** * Expand the cipher key into the encryption key schedule. */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927901; cv=none; d=zohomail.com; s=zohoarc; b=Rfyp35AuFwKhjWQP1/hGu3MsUPlZ005aculPkBS2bImw9lpuNNewo74P44NXA9F5xpCzFfOLgLiH6stB5Ss3tOz0HxucgP/eNmMtjEqKdBfTPGcBWgcscsN/sRPAvfUMRoOvEE4kVaD8bWM6ulLwiaz+d6kKEc8Jy51QQyMp9vI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927901; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=Mt/Uih6ctUL5kUgN1atTWPL5tPFc/LjMyQxvWjQE+ErerdDx4Z+q5P609a8KAbCAnDfR3iZ7sAqjzR4dtNKGi1186lEtdulkbfJzX9CEdbpyS8JkUKWzviryReT40Z9Oj1T4hVrJpAyJyuUGd+MylngwLNnbzY2zdaL12rCT3XE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927901915538.1440363212033; Sun, 9 Jul 2023 11:38:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAP-0008GQ-Pw; Sun, 09 Jul 2023 14:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAK-0008ET-T8 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:50 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAI-0000EO-8I for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:48 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742bso41758125e9.2 for ; Sun, 09 Jul 2023 11:29:45 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927385; x=1691519385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=UuwapAyzwGqXFa/V/y7gjb+mDezUyPb+DxGQAC/ul/nQ4yScL4ekJv8YsBNoDWa5JX e4GdfpJqsh0HUaIBCcTzkpPA0WYcn89SvbDPPHCLcXtSqvpjRUDiDqFc8wFf0ETRXo9I yVTvW1BHkg0BdG9VHcdWhh/UTWG8k5c5qSLE/Rg+TJQ+pO2fMovHxh/eedjTATHghMrG wkydZoexNNwrOdPukNTQMuIYveOeJMFqNo9BLL1arHylnxykrwmUOmyXtqj8j9ibmGFu GmwN3v1l5PpCVIlbuZF1d7TD5T4RO77fc3RYO7hU3DeY9dre08E1P755c/QUiaONFMmT P2yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927385; x=1691519385; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LO73AWeIHAR2oL9a8MGDntKx1EKSzMSEdZSpHf3WsVU=; b=TeXuEGmtDPRh9oIPIM+5eqp4LqIZxli42YXu5sq8CAF+Uncsir5+JcbteIATpP1Esi 3btSjNJWWtHKfXevkQYYA1cKthlxfiua++cEVs8paNYFZLTt67Kir8vO1AURbvXNWf7U UFQyQnGmD+UXxZJUqMihR0M7q3rJfPyi5xHSIgOkcPczmqQWvr7tnAe7ctsX9W9WvNvI acRdNdgDMEsjpQ/2fbbUCjtr2QK152pYTN0xNsljNo3IzKTFwtTOJKi5F5B9nhk9HX/m HDYGZtH3hIvLVscHMlZg/vi3Eeer4ROo813/snoFYtCRnVuCOIYd/92eTenphrOjJMX8 UmPg== X-Gm-Message-State: ABy/qLZqTcoMwot6ewE/1CUf7z78HZke5gkkC9RG7USRdOxbWCFlw+tn w2Ah0E8xyWMdHQBMLO2g7MOOKb2JyArIXrvr0oHUfg== X-Google-Smtp-Source: APBJJlH95ByHo8DO2+hE4VPg5DLTIfz0N99B9J3QYduOfpcyrajoiM386R6Iw+1v6WhSvEuxt45tCA== X-Received: by 2002:a05:600c:3785:b0:3fb:a0fc:1ba1 with SMTP id o5-20020a05600c378500b003fba0fc1ba1mr11048130wmr.35.1688927385044; Sun, 09 Jul 2023 11:29:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 05/45] linux-user: Use abi_ullong not uint64_t in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:22 +0100 Message-Id: <20230709182934.309468-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927903163100001 Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index caaa895bec..0af7249330 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1444,8 +1444,8 @@ struct target_stat64 { unsigned char __pad0[6]; unsigned short st_dev; =20 - uint64_t st_ino; - uint64_t st_nlink; + abi_ullong st_ino; + abi_ullong st_nlink; =20 unsigned int st_mode; =20 @@ -1501,7 +1501,7 @@ struct target_stat64 { unsigned char __pad0[6]; unsigned short st_dev; =20 - uint64_t st_ino; + abi_ullong st_ino; =20 unsigned int st_mode; unsigned int st_nlink; @@ -1618,7 +1618,7 @@ struct target_stat { /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... = */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - uint64_t st_dev; + abi_ullong st_dev; #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_uint pad0; abi_uint __st_ino; @@ -1627,8 +1627,8 @@ struct QEMU_PACKED target_stat64 { abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - uint64_t st_rdev; - uint64_t __pad1; + abi_ullong st_rdev; + abi_ullong __pad1; =20 int64_t st_size; abi_int st_blksize; @@ -1641,7 +1641,7 @@ struct QEMU_PACKED target_stat64 { unsigned int target_st_mtime_nsec; int target_st_ctime; unsigned int target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; }; =20 #elif defined(TARGET_M68K) @@ -1753,7 +1753,7 @@ struct target_stat { struct target_stat { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ - uint64_t st_ino; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; int st_uid; @@ -1813,7 +1813,7 @@ struct target_stat64 { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ =20 - uint64_t st_ino; + abi_ullong st_ino; =20 unsigned int st_mode; unsigned int st_nlink; @@ -2044,17 +2044,17 @@ struct target_stat { =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; /* Device */ - uint64_t st_ino; /* File serial number */ + abi_ullong st_dev; /* Device */ + abi_ullong st_ino; /* File serial number */ unsigned int st_mode; /* File mode. */ unsigned int st_nlink; /* Link count. */ unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ - uint64_t st_rdev; /* Device number, if device. */ + abi_ullong st_rdev; /* Device number, if device. */ int64_t st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ abi_ulong __unused2; - uint64_t st_blocks; /* Number 512-byte blocks allocated. */ + abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong target_st_atime; /* Time of last access. */ abi_ulong target_st_atime_nsec; abi_ulong target_st_mtime; /* Time of last modification. */ @@ -2097,14 +2097,14 @@ struct target_stat { #if !defined(TARGET_RISCV64) #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; - uint64_t st_ino; + abi_ullong st_dev; + abi_ullong st_ino; unsigned int st_mode; unsigned int st_nlink; unsigned int st_uid; unsigned int st_gid; - uint64_t st_rdev; - uint64_t __pad1; + abi_ullong st_rdev; + abi_ullong __pad1; int64_t st_size; int st_blksize; int __pad2; @@ -2156,14 +2156,14 @@ struct target_stat { =20 #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - uint64_t st_dev; + abi_ullong st_dev; abi_uint _pad1; abi_uint _res1; abi_uint st_mode; abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - uint64_t st_rdev; + abi_ullong st_rdev; abi_uint _pad2; int64_t st_size; abi_int st_blksize; @@ -2174,7 +2174,7 @@ struct target_stat64 { abi_uint target_st_mtime_nsec; abi_int target_st_ctime; abi_uint target_st_ctime_nsec; - uint64_t st_ino; + abi_ullong st_ino; }; =20 #elif defined(TARGET_LOONGARCH64) @@ -2231,11 +2231,11 @@ struct target_statfs64 { abi_uint f_bsize; abi_uint f_frsize; /* Fragment size - unsupported */ abi_uint __pad; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_files; - uint64_t f_ffree; - uint64_t f_bavail; + abi_ullong f_blocks; + abi_ullong f_bfree; + abi_ullong f_files; + abi_ullong f_ffree; + abi_ullong f_bavail; target_fsid_t f_fsid; abi_uint f_namelen; abi_uint f_flags; @@ -2324,11 +2324,11 @@ struct target_statfs { struct target_statfs64 { abi_uint f_type; abi_uint f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; + abi_ullong f_blocks; + abi_ullong f_bfree; + abi_ullong f_bavail; + abi_ullong f_files; + abi_ullong f_ffree; target_fsid_t f_fsid; abi_uint f_namelen; abi_uint f_frsize; @@ -2799,7 +2799,7 @@ struct target_statx { /* 0x00 */ abi_uint stx_mask; /* What results were written [uncond] */ abi_uint stx_blksize; /* Preferred general I/O size [uncond] */ - uint64_t stx_attributes; /* Flags conveying information about the file= */ + abi_ullong stx_attributes; /* Flags conveying information about the fi= le */ /* 0x10 */ abi_uint stx_nlink; /* Number of hard links */ abi_uint stx_uid; /* User ID of owner */ @@ -2807,10 +2807,10 @@ struct target_statx { uint16_t stx_mode; /* File mode */ uint16_t __spare0[1]; /* 0x20 */ - uint64_t stx_ino; /* Inode number */ - uint64_t stx_size; /* File size */ - uint64_t stx_blocks; /* Number of 512-byte blocks allocated */ - uint64_t stx_attributes_mask; /* Mask to show what is supported */ + abi_ullong stx_ino; /* Inode number */ + abi_ullong stx_size; /* File size */ + abi_ullong stx_blocks; /* Number of 512-byte blocks allocated */ + abi_ullong stx_attributes_mask; /* Mask to show what is supported */ /* 0x40 */ struct target_statx_timestamp stx_atime; /* Last access time */ struct target_statx_timestamp stx_btime; /* File creation time */ @@ -2822,7 +2822,7 @@ struct target_statx { abi_uint stx_dev_major; /* ID of device containing file [uncond] */ abi_uint stx_dev_minor; /* 0x90 */ - uint64_t __spare2[14]; /* Spare space for future expansion */ + abi_ullong __spare2[14]; /* Spare space for future expansion */ /* 0x100 */ }; =20 --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928204; cv=none; d=zohomail.com; s=zohoarc; b=QNx2ROMfJylROFi2a1xIFF+HwQnzmRLf75cNGi3Ivl6qDm9Mz20QG8RXQQtnUR30iSOk49N6QdGdzSFfpdEK0DIyrGbcE/37FC1Zi3TrPmZYbNwIyYSyxe0w4N3pEXmsqIwOvboG2fOKxClBsP1QOA7fnyt9necE9KWe3+W5U6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928204; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TOF0YX3biOvYXBmYgvIyMISz7K/doCgseRX4BopoSYk=; b=Iiqoi9JivD6sT7k8g7oJr3CwLHT/GAIG5O6gFlLo0ViHkOSsm3IGjDdQAB5ZtpnHPiiCKNp7ThhBTOULvOd/YRhfHCBRgYmrbdbONQHHbjeb/U9WOenljmBDoMUS/Wn8BrdrpoBbAUnsn2mhyxRwTX42KUswuxDsiOcb2EysUog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928204610952.2421267032247; Sun, 9 Jul 2023 11:43:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAR-0008HL-ID; Sun, 09 Jul 2023 14:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAL-0008EU-70 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:50 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAJ-0000Eg-7m for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:48 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbca8935bfso37951145e9.3 for ; Sun, 09 Jul 2023 11:29:46 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927386; x=1691519386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TOF0YX3biOvYXBmYgvIyMISz7K/doCgseRX4BopoSYk=; b=C8c+TPkvwoOc6IxQxhJJd22hAFoIMqMQ2JK+8U+yB8jypXMIlF7UfenadYGuPqEUm7 5xFXcMxz/qHefWVrGk5Ry0FVNBYhd2WkUM1V0xhVa9QQFXy7Hy/ZMhtcF9BiPgWvFlpd Ho3GLOtzFJZpN1zVlF5bpC5kIjfbMtCf+tyxu8PhxCSCJ+FtteqbSPTkO5qA41b/R1hs +5iB2n6k0zRMcUCexykJkqQoYGFRG4QHJD9UkT/QpU5W2JT4AGcDEr1rqDW2TG0d3vp5 1U1Vll/Yyqwp3Z6sQgpvUYrtc2BG0jQpAo4pvoImt4v7inJtN8aWsxBvR+uNy2aM1g63 tXng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927386; x=1691519386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TOF0YX3biOvYXBmYgvIyMISz7K/doCgseRX4BopoSYk=; b=NJbkrdjkaAqvXLVZ0rPJHPd8ucS8Kz2WPCxsns83kfIYP0hPqWqE56fl1bumkUaY+z cv6VI09/4ecG7sGf/XlhHKxCn0kn4DWCyB16HmfoVM8Hd0+7AaCWdd6JAx9DQ6RQHl2G W0YO9QWWJaI0Tr5IZz3CMyFem29R3oyNlv/4izUUxaBfnLmHuDzk1vzK96EbX9ldjtxV 4a+4L30LapYxuknK/d7QZYRICOFpiCbSHJvF+VlVBtjm9xWlt4uHgiEhQxNs95UuWWx5 7eGE7G4FzMcyCj0H3G6gFz5kmO8utvKFX1vHS5TPNeRiFVNZD2zzSCcdDdbcjQsvb+Ji pgXA== X-Gm-Message-State: ABy/qLad79/tYC15NK/3IXQdbTTd/vLlOJN47wa8HNWXPScwX1yJxX9z DmJiQMoXxBq1LN7LdWV7bx9aQl26ekza/szxD/4F/Q== X-Google-Smtp-Source: APBJJlFoHe4Cs3Ph4eb4QhYnUWQJqG+AqCIlaeaoX4Ueh+QMGX/Lk4qRBc5TY5wu+Q2jcblFCj7fbA== X-Received: by 2002:a7b:c7d1:0:b0:3fa:9590:a365 with SMTP id z17-20020a7bc7d1000000b003fa9590a365mr7777430wmk.17.1688927385858; Sun, 09 Jul 2023 11:29:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 06/37] crypto: Add aesdec_ISB_ISR_AK Date: Sun, 9 Jul 2023 19:28:23 +0100 Message-Id: <20230709182934.309468-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928205612100005 Add a primitive for InvSubBytes + InvShiftRows + AddRoundKey. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 4 ++ include/crypto/aes-round.h | 21 +++++++++ crypto/aes.c | 45 ++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index c5d8066179..c9b9d732f0 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -13,4 +13,8 @@ void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); =20 +void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); + #endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */ diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index b85db1a30e..dcf098b97b 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -41,4 +41,25 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AE= SState *st, } } =20 +/* + * Perform InvSubBytes + InvShiftRows + AddRoundKey. + */ + +void aesdec_ISB_ISR_AK_gen(AESState *ret, const AESState *st, + const AESState *rk); +void aesdec_ISB_ISR_AK_genrev(AESState *ret, const AESState *st, + const AESState *rk); + +static inline void aesdec_ISB_ISR_AK(AESState *r, const AESState *st, + const AESState *rk, bool be) +{ + if (HAVE_AES_ACCEL) { + aesdec_ISB_ISR_AK_accel(r, st, rk, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesdec_ISB_ISR_AK_gen(r, st, rk); + } else { + aesdec_ISB_ISR_AK_genrev(r, st, rk); + } +} + #endif /* CRYPTO_AES_ROUND_H */ diff --git a/crypto/aes.c b/crypto/aes.c index 408d92b81f..90274c3706 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1261,6 +1261,51 @@ void aesenc_SB_SR_AK_genrev(AESState *r, const AESSt= ate *s, const AESState *k) aesenc_SB_SR_AK_swap(r, s, k, true); } =20 +/* + * Perform InvSubBytes + InvShiftRows + AddRoundKey. + */ +static inline void +aesdec_ISB_ISR_AK_swap(AESState *ret, const AESState *st, + const AESState *rk, bool swap) +{ + const int swap_b =3D swap ? 15 : 0; + AESState t; + + t.b[swap_b ^ 0x0] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x0)]]; + t.b[swap_b ^ 0x1] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x1)]]; + t.b[swap_b ^ 0x2] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x2)]]; + t.b[swap_b ^ 0x3] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x3)]]; + t.b[swap_b ^ 0x4] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x4)]]; + t.b[swap_b ^ 0x5] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x5)]]; + t.b[swap_b ^ 0x6] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x6)]]; + t.b[swap_b ^ 0x7] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x7)]]; + t.b[swap_b ^ 0x8] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x8)]]; + t.b[swap_b ^ 0x9] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0x9)]]; + t.b[swap_b ^ 0xa] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xA)]]; + t.b[swap_b ^ 0xb] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xB)]]; + t.b[swap_b ^ 0xc] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xC)]]; + t.b[swap_b ^ 0xd] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xD)]]; + t.b[swap_b ^ 0xe] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xE)]]; + t.b[swap_b ^ 0xf] =3D AES_isbox[st->b[swap_b ^ AES_ISH(0xF)]]; + + /* + * Perform the AddRoundKey with generic vectors. + * This may be expanded to either host integer or host vector code. + * The key and output endianness match, so no bswap required. + */ + ret->v =3D t.v ^ rk->v; +} + +void aesdec_ISB_ISR_AK_gen(AESState *r, const AESState *s, const AESState = *k) +{ + aesdec_ISB_ISR_AK_swap(r, s, k, false); +} + +void aesdec_ISB_ISR_AK_genrev(AESState *r, const AESState *s, const AESSta= te *k) +{ + aesdec_ISB_ISR_AK_swap(r, s, k, true); +} + /** * Expand the cipher key into the encryption key schedule. */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927521; cv=none; d=zohomail.com; s=zohoarc; b=eBr7WOes/hnICfIuglZelVpf0wK4BcQlZUDcv5kaYNA7tY86iGIjWF064Sr5aA//UxVd1ik9bGzscfmIF1oapHjsXuoo/2x6RzUAvMAWjV3gB0RvGgBbFHb/cqfwpBhr4ZN+IFTNKjvsi+kL695+F0O92KxqgVkNeeHcTuaKNLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927521; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=PlE3QuZcXYPfp+9leon0XPdKG3TreSWTpBxKTk+SjF5nqsQynSZne58ZCGZNnRbhTJs0HC/dY8vZs8rfA5dBREwPAqDzuQ94B+2AIEdmPwSmp/1Goc2FFiUlnQbVN2BT3oht5XDu5kjiVdkSAKJX+yG1J6taIo2e8dRB8g67HGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927521758104.80176510966453; Sun, 9 Jul 2023 11:32:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAW-0008Km-D9; Sun, 09 Jul 2023 14:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAL-0008EV-MH for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:50 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAK-0000Ey-4E for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:49 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbca8935bfso37951225e9.3 for ; Sun, 09 Jul 2023 11:29:47 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927386; x=1691519386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=TnEVosVyugd9dHHVAysxpaDfm1vWsUP8Z4gQzRDB9aTTEJnBEN+8vrGJEvk5W7x2TE QAcJ8TGT9pPxPYQv4Ly0u51XZL/OsTlgZJ3HNgm/RpfTEwDZ6pCkws6Mspcy9xZxiZGt /44g5Uoe1bB8NUmI8ZDQtQsTzIj4LbhGELyJuCnJ1hjViRIfAMQDHz37+0tEYVycBMn/ NQR9wt584vyue4CAvajnUL3qch9+c9eb9rz+S0VLamGq4KtRDi1nQa+LbuTy2iTBhAUt YI82y94HB/EadW1kbBlaDbytEC+SBEWhzwGqE+a9fP8O+qbB+VdkZgV7gTXtUCB9o3aJ St8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927386; x=1691519386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IDhKHcH/mNT2yQDdOveHYCYG5DGoM6IQc0ARd1bSGIA=; b=JIYBOOkx2bhlwNQFmgCwPGcf6YC+Dl0n9FI+LKG+2y3oFJg3uB+cYeBzq+ErZssCtB 1utG3UFfiw5uQGgm2/HL2HSFACvbdqlp9Kc78XCqpmct6yTJBUg6qn01r2jNb4m/iN7i aIH6O0XNpXq69syqYreg+QriGJR103qnfzIExyYRncZ2Kv0FZ+1V5cBbB+0GIGd7sZ/q 8y/s0KlHBqSd622V01ZZ0+ViCiwVnqtyQjocj20tP9HAmU0Vc/nN+CV6FxaLhjDLkKno mrXOcwnFUp5KRsBEfKpFCnKJ60MKGwni1cmd3dz0+9l/d3N0GkkiTyWLeBcjSpcuD8UY Jrtw== X-Gm-Message-State: ABy/qLYXTprrsRJopc+LeWCvifx6ZShc1iBhq4vghXtO3311K28oBwca YVw7txjB8igec00Dyr/WAeZmEvAj9uzhxn/2J3gnqQ== X-Google-Smtp-Source: APBJJlHoAPhOPur0KQuoOhA+1plcWTdJHo7d0DxV2ATiDlg38cMsaSRm0o4R6bqX+K9jCEC8ld7pFw== X-Received: by 2002:a1c:f211:0:b0:3fc:5d2:9286 with SMTP id s17-20020a1cf211000000b003fc05d29286mr3368016wmc.2.1688927386707; Sun, 09 Jul 2023 11:29:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 06/45] linux-user: Use abi_llong not int64_t in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:24 +0100 Message-Id: <20230709182934.309468-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927522039100005 Be careful not to change linux_dirent64, which is a host structure. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 0af7249330..2846a8cfa5 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1455,8 +1455,8 @@ struct target_stat64 { unsigned char __pad2[6]; unsigned short st_rdev; =20 - int64_t st_size; - int64_t st_blksize; + abi_llong st_size; + abi_llong st_blksize; =20 unsigned char __pad4[4]; unsigned int st_blocks; @@ -1514,7 +1514,7 @@ struct target_stat64 { =20 unsigned char __pad3[8]; =20 - int64_t st_size; + abi_llong st_size; unsigned int st_blksize; =20 unsigned char __pad4[8]; @@ -1630,10 +1630,10 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; abi_ullong __pad1; =20 - int64_t st_size; + abi_llong st_size; abi_int st_blksize; abi_uint __pad2; - int64_t st_blocks; /* Number 512-byte blocks allocated. */ + abi_llong st_blocks; =20 int target_st_atime; unsigned int target_st_atime_nsec; @@ -1760,7 +1760,7 @@ struct target_stat { int st_gid; abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ - int64_t st_size; + abi_llong st_size; abi_long target_st_atime; abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion = */ abi_long target_st_mtime; @@ -1769,7 +1769,7 @@ struct target_stat { abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion = */ abi_ulong st_blksize; abi_ulong st_pad2; - int64_t st_blocks; + abi_llong st_blocks; }; =20 #elif defined(TARGET_ABI_MIPSO32) @@ -1824,7 +1824,7 @@ struct target_stat64 { abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ =20 - int64_t st_size; + abi_llong st_size; =20 /* * Actually this should be timestruc_t st_atime, st_mtime and st_ctime @@ -1842,7 +1842,7 @@ struct target_stat64 { abi_ulong st_blksize; abi_ulong st_pad2; =20 - int64_t st_blocks; + abi_llong st_blocks; }; =20 #elif defined(TARGET_ALPHA) @@ -2051,7 +2051,7 @@ struct target_stat64 { unsigned int st_uid; /* User ID of the file's owner. */ unsigned int st_gid; /* Group ID of the file's group. */ abi_ullong st_rdev; /* Device number, if device. */ - int64_t st_size; /* Size of file, in bytes. */ + abi_llong st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ abi_ulong __unused2; abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ @@ -2105,10 +2105,10 @@ struct target_stat64 { unsigned int st_gid; abi_ullong st_rdev; abi_ullong __pad1; - int64_t st_size; + abi_llong st_size; int st_blksize; int __pad2; - int64_t st_blocks; + abi_llong st_blocks; int target_st_atime; unsigned int target_st_atime_nsec; int target_st_mtime; @@ -2165,9 +2165,9 @@ struct target_stat64 { abi_uint st_gid; abi_ullong st_rdev; abi_uint _pad2; - int64_t st_size; + abi_llong st_size; abi_int st_blksize; - int64_t st_blocks; + abi_llong st_blocks; abi_int target_st_atime; abi_uint target_st_atime_nsec; abi_int target_st_mtime; @@ -2790,7 +2790,7 @@ struct target_user_cap_data { #define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10 =20 struct target_statx_timestamp { - int64_t tv_sec; + abi_llong tv_sec; abi_uint tv_nsec; abi_int __reserved; }; --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927529; cv=none; d=zohomail.com; s=zohoarc; b=lk959A6WY2gr40IHNIPL7Rrz+XLf3zXa4tMz7v/G01ZIHFTOiMIA2glcJTLJKRMA3BOw02MYJIp19n/f5HwQOIh9X/AUU0bqsOCluC9/pKWsVzSyaYkE8H+nx4WBpwnZhguz9UA3TynnNn4tbeCL+Og7KAH9+ncFyoThdsOZiAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927529; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=Zy7S2noeywtxTNGaGaUT797VUKMtPrr8aAPRndLrbo1jxGtUCsMP1iOZaT5ar46kZ2+cN1K1VjFVv5oB1dfpeEQJ3QaN1P7c3/rXw+LjAA+riMZDhy7O+hFby4hGNH2E5VhPCmjAh8XXiOE2lwbv7wBzf/FlslKSkBOdhozG6hE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927529400987.8165106412634; Sun, 9 Jul 2023 11:32:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAS-0008I4-Ft; Sun, 09 Jul 2023 14:29:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAO-0008FL-H3 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:52 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAL-0000Fo-TA for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:52 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso39245025e9.2 for ; Sun, 09 Jul 2023 11:29:49 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927388; x=1691519388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=MOvYnW5e1suGnFAHhS/xybBjtI5aw7Sqf74e8pT7LTfqjkEISNn4uMgXjWI+G0LrLZ BELzcneaIjZdRFAepURgVZhr9r2xBsFEVeD8F1/F0KsrseHvUWFRdjTOfqR8FM6rGDbe izNQYyRKYZOcTyUQecelp5rb2qs+Sv5xpCP7Pyy3ZyqoCSkopv8Nz/fhLzKTvYecp64r pX/LJYLpJUJ11ZZNeRh68gcBv2Q7+yyox1SrZHwBOy4oM0UJeqBg+uCqP9QX4Qu/2sl5 w6MrqiR6i0Omunfm4/jHeZ3SQXDGEWXGZ8cQ0TcDJKyVLSmEvF9VqK9/8TOUEqwvCayb KIQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927388; x=1691519388; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WZowV46RDd4UZGFRJaWN3kYV5vNiK42zQttdiJYmLHk=; b=AErLhq/mBKveKU5bmpS9uACIHa5PUfXWo43B94/Xo2TAqHgRieynI0Gzh4GbbWh/Ni +Dy3cgZSsJ+v0zmSC+FR7c2RE8KDLg5ZOlPSbUSZHx9TChdNV/Uq7EzPzqZmJ4tq65Wb qJDRrBrdoNMfeoYzM7beNgBwwa8RGc5mUyM/7UA5JI07coKoFKhUVRV2YEJ+1TI0jLSy tv/XhyLWhfe+fYHpFL/df/wc9cz03HRCsBIGJz+DaxrQiKmcRZBHN7KsDSCWNrPO3H24 yLHlU8mZljQec20p2NzO5/pjHHGdizBNp7oIdtmdct9+iAW5dXoiclVZalpna6ylzXKd ZmrA== X-Gm-Message-State: ABy/qLa37Efucfm4zyayJpjISKCd0fKXazzQqS2zbLn1v1L/oPuBh0Zp 4mHKEjKzEk1fjHtx+N+0Z7Vm5gKZKElq87aiVUwdyA== X-Google-Smtp-Source: APBJJlFnVgDV3+Z+qET6OJYYrxEXWWp6gm5jeG/+XvU+f6mpOqaW6NBM0/o0Q59vXr7rul8yOWaTrA== X-Received: by 2002:a1c:7904:0:b0:3fc:a8:dc3c with SMTP id l4-20020a1c7904000000b003fc00a8dc3cmr6258873wme.37.1688927388242; Sun, 09 Jul 2023 11:29:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 07/45] linux-user: Use abi_uint not unsigned int in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:26 +0100 Message-Id: <20230709182934.309468-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927531333100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 290 +++++++++++++++++++------------------- 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 2846a8cfa5..20986bd1d3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -366,7 +366,7 @@ struct target_msghdr { abi_long msg_iovlen; /* Number of blocks */ abi_long msg_control; /* Per protocol magic (eg BSD file descri= ptor passing) */ abi_long msg_controllen; /* Length of cmsg list */ - unsigned int msg_flags; + abi_uint msg_flags; }; =20 struct target_cmsghdr { @@ -403,7 +403,7 @@ __target_cmsg_nxthdr(struct target_msghdr *__mhdr, =20 struct target_mmsghdr { struct target_msghdr msg_hdr; /* Message header */ - unsigned int msg_len; /* Number of bytes transmit= ted */ + abi_uint msg_len; /* Number of bytes transmit= ted */ }; =20 struct target_rusage { @@ -595,8 +595,8 @@ typedef struct target_siginfo { =20 /* POSIX.1b timers */ struct { - unsigned int _timer1; - unsigned int _timer2; + abi_uint _timer1; + abi_uint _timer2; } _timer; =20 /* POSIX.1b signals */ @@ -857,10 +857,10 @@ struct target_rtc_pll_info { #define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) #define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) #define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) -#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, unsigned int) -#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, unsigned int) -#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, unsigned int) -#define TARGET_TUNGETIFF TARGET_IOR('T', 210, unsigned int) +#define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) +#define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) +#define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) +#define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) #define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) #define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) /* @@ -870,7 +870,7 @@ struct target_rtc_pll_info { #define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) #define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) #define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) -#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, unsigned int) +#define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint) /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ #define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) #define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) @@ -1361,8 +1361,8 @@ struct target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 abi_ulong st_uid; abi_ulong st_gid; @@ -1392,20 +1392,20 @@ struct target_stat64 { #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { unsigned long long st_dev; - unsigned int __pad1; + abi_uint __pad1; abi_ulong __st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 abi_ulong st_uid; abi_ulong st_gid; =20 unsigned long long st_rdev; - unsigned int __pad2[2]; + abi_uint __pad2[2]; =20 long long st_size; abi_ulong st_blksize; - unsigned int __pad3; + abi_uint __pad3; unsigned long long st_blocks; =20 abi_ulong target_st_atime; @@ -1423,13 +1423,13 @@ struct target_eabi_stat64 { =20 #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32) struct target_stat { - unsigned int st_dev; + abi_uint st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_rdev; abi_long st_size; abi_long target_st_atime; abi_long target_st_mtime; @@ -1447,10 +1447,10 @@ struct target_stat64 { abi_ullong st_ino; abi_ullong st_nlink; =20 - unsigned int st_mode; + abi_uint st_mode; =20 - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; =20 unsigned char __pad2[6]; unsigned short st_rdev; @@ -1459,7 +1459,7 @@ struct target_stat64 { abi_llong st_blksize; =20 unsigned char __pad4[4]; - unsigned int st_blocks; + abi_uint st_blocks; =20 abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1503,11 +1503,11 @@ struct target_stat64 { =20 abi_ullong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; =20 unsigned char __pad2[6]; unsigned short st_rdev; @@ -1515,22 +1515,22 @@ struct target_stat64 { unsigned char __pad3[8]; =20 abi_llong st_size; - unsigned int st_blksize; + abi_uint st_blksize; =20 unsigned char __pad4[8]; - unsigned int st_blocks; + abi_uint st_blocks; =20 - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime; + abi_uint target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; =20 - unsigned int __unused1; - unsigned int __unused2; + abi_uint __unused1; + abi_uint __unused2; }; =20 #elif defined(TARGET_PPC) @@ -1541,13 +1541,13 @@ struct target_stat { abi_ulong st_ino; #if defined(TARGET_PPC64) abi_ulong st_nlink; - unsigned int st_mode; + abi_uint st_mode; #else - unsigned int st_mode; + abi_uint st_mode; unsigned short st_nlink; #endif - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -1570,24 +1570,24 @@ struct target_stat { struct QEMU_PACKED target_stat64 { unsigned long long st_dev; unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; unsigned long long st_rdev; unsigned long long __pad0; long long st_size; int st_blksize; - unsigned int __pad1; + abi_uint __pad1; long long st_blocks; /* Number 512-byte blocks allocated. */ int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint target_st_ctime_nsec; + abi_uint __unused4; + abi_uint __unused5; }; #endif =20 @@ -1597,10 +1597,10 @@ struct QEMU_PACKED target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; + abi_uint st_mode; unsigned short st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -1636,11 +1636,11 @@ struct QEMU_PACKED target_stat64 { abi_llong st_blocks; =20 int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime_nsec; abi_ullong st_ino; }; =20 @@ -1680,8 +1680,8 @@ struct target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 abi_ulong st_uid; abi_ulong st_gid; @@ -1712,19 +1712,19 @@ struct target_stat64 { #define TARGET_STAT_HAVE_NSEC /* The memory layout is the same as of struct stat64 of the 32-bit kernel.= */ struct target_stat { - unsigned int st_dev; - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + abi_uint st_dev; + abi_uint st_pad0[3]; /* Reserved for st_dev expansion */ =20 abi_ulong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 int st_uid; int st_gid; =20 - unsigned int st_rdev; - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion = */ + abi_uint st_rdev; + abi_uint st_pad1[3]; /* Reserved for st_rdev expansion = */ =20 abi_ulong st_size; =20 @@ -1732,17 +1732,17 @@ struct target_stat { * Actually this should be timestruc_t st_atime, st_mtime and st_ctime * but we don't have it under Linux. */ - unsigned int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime; + abi_uint target_st_atime_nsec; =20 - unsigned int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime; + abi_uint target_st_mtime_nsec; =20 - unsigned int target_st_ctime; - unsigned int target_st_ctime_nsec; + abi_uint target_st_ctime; + abi_uint target_st_ctime_nsec; =20 - unsigned int st_blksize; - unsigned int st_pad2; + abi_uint st_blksize; + abi_uint st_pad2; =20 abi_ulong st_blocks; }; @@ -1754,8 +1754,8 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */ abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; abi_ulong st_rdev; @@ -1779,8 +1779,8 @@ struct target_stat { unsigned st_dev; abi_long st_pad1[3]; /* Reserved for network id */ abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; int st_uid; int st_gid; unsigned st_rdev; @@ -1815,8 +1815,8 @@ struct target_stat64 { =20 abi_ullong st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 int st_uid; int st_gid; @@ -1848,21 +1848,21 @@ struct target_stat64 { #elif defined(TARGET_ALPHA) =20 struct target_stat { - unsigned int st_dev; - unsigned int st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_rdev; + abi_uint st_dev; + abi_uint st_ino; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_rdev; abi_long st_size; abi_ulong target_st_atime; abi_ulong target_st_mtime; abi_ulong target_st_ctime; - unsigned int st_blksize; - unsigned int st_blocks; - unsigned int st_flags; - unsigned int st_gen; + abi_uint st_blksize; + abi_uint st_blocks; + abi_uint st_flags; + abi_uint st_gen; }; =20 #define TARGET_HAS_STRUCT_STAT64 @@ -1873,12 +1873,12 @@ struct target_stat64 { abi_long st_size; abi_ulong st_blocks; =20 - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint st_blksize; + abi_uint st_nlink; + abi_uint __pad0; =20 abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1924,8 +1924,8 @@ struct QEMU_PACKED target_stat64 { #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 abi_ulong __st_ino; =20 - unsigned int st_mode; - unsigned int st_nlink; + abi_uint st_mode; + abi_uint st_nlink; =20 abi_ulong st_uid; abi_ulong st_gid; @@ -1957,10 +1957,10 @@ struct target_stat { abi_ulong st_ino; abi_ulong st_nlink; =20 - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint __pad0; abi_ulong st_rdev; abi_long st_size; abi_long st_blksize; @@ -1980,10 +1980,10 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_ino; abi_ulong st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad1; + abi_uint st_mode; + abi_uint st_uid; + abi_uint st_gid; + abi_uint __pad1; abi_ulong st_rdev; abi_ulong st_size; abi_ulong target_st_atime; @@ -2001,10 +2001,10 @@ struct target_stat { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong _pad1; abi_long st_size; @@ -2017,17 +2017,17 @@ struct target_stat { abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned int __unused[2]; + abi_uint __unused[2]; }; #elif defined(TARGET_XTENSA) #define TARGET_STAT_HAVE_NSEC struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_long st_size; abi_ulong st_blksize; @@ -2046,10 +2046,10 @@ struct target_stat { struct target_stat64 { abi_ullong st_dev; /* Device */ abi_ullong st_ino; /* File serial number */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ + abi_uint st_mode; /* File mode. */ + abi_uint st_nlink; /* Link count. */ + abi_uint st_uid; /* User ID of the file's owner. */ + abi_uint st_gid; /* Group ID of the file's group. */ abi_ullong st_rdev; /* Device number, if device. */ abi_llong st_size; /* Size of file, in bytes. */ abi_ulong st_blksize; /* Optimal block size for I/O. */ @@ -2074,10 +2074,10 @@ struct target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ulong st_rdev; abi_ulong __pad1; abi_long st_size; @@ -2090,8 +2090,8 @@ struct target_stat { abi_ulong target_st_mtime_nsec; abi_long target_st_ctime; abi_ulong target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint __unused4; + abi_uint __unused5; }; =20 #if !defined(TARGET_RISCV64) @@ -2099,10 +2099,10 @@ struct target_stat { struct target_stat64 { abi_ullong st_dev; abi_ullong st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; + abi_uint st_mode; + abi_uint st_nlink; + abi_uint st_uid; + abi_uint st_gid; abi_ullong st_rdev; abi_ullong __pad1; abi_llong st_size; @@ -2110,13 +2110,13 @@ struct target_stat64 { int __pad2; abi_llong st_blocks; int target_st_atime; - unsigned int target_st_atime_nsec; + abi_uint target_st_atime_nsec; int target_st_mtime; - unsigned int target_st_mtime_nsec; + abi_uint target_st_mtime_nsec; int target_st_ctime; - unsigned int target_st_ctime_nsec; - unsigned int __unused4; - unsigned int __unused5; + abi_uint target_st_ctime_nsec; + abi_uint __unused4; + abi_uint __unused5; }; #endif =20 @@ -2498,7 +2498,7 @@ struct target_snd_timer_id { =20 struct target_snd_timer_ginfo { struct target_snd_timer_id tid; - unsigned int flags; + abi_uint flags; int card; unsigned char id[64]; unsigned char name[80]; @@ -2506,7 +2506,7 @@ struct target_snd_timer_ginfo { abi_ulong resolution; abi_ulong resolution_min; abi_ulong resolution_max; - unsigned int clients; + abi_uint clients; unsigned char reserved[32]; }; =20 @@ -2531,7 +2531,7 @@ struct target_snd_timer_select { }; =20 struct target_snd_timer_info { - unsigned int flags; + abi_uint flags; int card; unsigned char id[64]; unsigned char name[80]; @@ -2542,10 +2542,10 @@ struct target_snd_timer_info { =20 struct target_snd_timer_status { struct target_timespec tstamp; - unsigned int resolution; - unsigned int lost; - unsigned int overrun; - unsigned int queue; + abi_uint resolution; + abi_uint lost; + abi_uint overrun; + abi_uint queue; unsigned char reserved[64]; }; =20 @@ -2623,7 +2623,7 @@ struct target_sysinfo { unsigned short pad; /* explicit padding for m68k */ abi_ulong totalhigh; /* Total high memory size */ abi_ulong freehigh; /* Available high memory size */ - unsigned int mem_unit; /* Memory unit size in bytes */ + abi_uint mem_unit; /* Memory unit size in bytes */ char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses thi= s.. */ }; =20 --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927556; cv=none; d=zohomail.com; s=zohoarc; b=XlSHiSHcCiwwFiKQc/5913XtnXRObA/Sx+RaVVt/MOQUvneXppEc00PQD4XdJ9CvCjWHphbLitdE2UuKd/TkqkbOB/GV+IjiEhV+dEOtDDEnSaiFT2cRsXB0675kjwP+RuqPUdUFJH+Z0Lmov/1BIWT77VbFeRv5kpO5R8S2Goc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OqJ8/74xslZqAPWuseMNlVx/dmpNm7/AQh+6yi6QQ/Q=; b=lOGZ+L6sY/hONAINMhWyqSC7g8PzSHjL6kQs1Pj0FBChL8H2NkLTCLBrZg2rOxgURp7q3+qfpwEoQu7yBSYrFfPfH42g8TRpgT3X3qYH3AuE+zF6EF+Tf3U7Y3eXXMOgTa/HsYuKpdJLx5hr/SrPTzJLjc/ZfqjTxX5uNXpXEGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927556890779.3687808871366; Sun, 9 Jul 2023 11:32:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008K8-OW; Sun, 09 Jul 2023 14:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAM-0008Eb-BM for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:50 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAK-0000FM-Mi for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:50 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fc0aecf107so8717405e9.2 for ; Sun, 09 Jul 2023 11:29:48 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927387; x=1691519387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OqJ8/74xslZqAPWuseMNlVx/dmpNm7/AQh+6yi6QQ/Q=; b=V/P2wlGRO3lkq9UgxT3dvLYBXiAAtX2DPrQcfrYM/pAOGwTJuYbsKH14P2DT3g2lNR r5KXqUK7WdVqJ37lcnL1PqMyvAk8JZ3UJAyPRALvxSaKz8gzCKu3BMa5ESTjOw+iGnAf gDHPbMlPe59JfxL6dGeAoolfhnXbo3P3e1+jOENjaaoIVRQXpccKTX02nfCu1S//EF9+ wZvKsJuESt68R2MkxO8evgirFNq5uk/EISwEpkgdlgOplupmc9xXBtvdsAb/gv/ksFoo huNx7k++tVvzbW1ekbbdBEwjYR2q9rb2GN/wLzAau1mW16kr5laydaBfSoMchcLLgwjx Q4UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927387; x=1691519387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OqJ8/74xslZqAPWuseMNlVx/dmpNm7/AQh+6yi6QQ/Q=; b=I6MeUm1VpdmtfeQq1a0ueEGp9eKt92IhXE69iYnkF3Kj0U/Jp0RLLDDfsfQRM/4YVw 3aKPmkg/zDxA9lSVk/etm6NfWoPon1YhDqpHhh6ZR8xDKhZ76LDoJ84SgRWQRy8SDpCR r5yP0EQZnV0XR5R2zEcY0OY/3jNt0LOYMgmvA7ig6U21D25au8iaIzLnhkN1TKaHD/AP LcgyFuUd+njsm8eRsfC0VFPl3vPCUJ7+nDXyFHwnAoNKAvXdMT06IhIVbk5+riXQqZzd L2xDrd0R6Vvzemyy9djwzr4cmNGEeGmqMg9vUW6BeigMiScsnXlGDBFT5VS/iUu1ttFc HIAA== X-Gm-Message-State: ABy/qLYEIGHQRr1w8mB4pIAoqSvP1ayhcuqBGMWYafAn1n3wH3SyRZnG 8oiVoXfwT9obJ8KfwLvUhn149NVwkGQAlEzhbCgQgQ== X-Google-Smtp-Source: APBJJlEUrfH3L9wdP8TaPh4b79Bhq2acZwdU6Ww6BvIeQrBNwb9Jr/656pRRfAJTeKWwUm3569SnKg== X-Received: by 2002:a05:600c:2409:b0:3fc:4e0:caf8 with SMTP id 9-20020a05600c240900b003fc04e0caf8mr4204000wmp.34.1688927387473; Sun, 09 Jul 2023 11:29:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 07/37] crypto: Add aesenc_MC Date: Sun, 9 Jul 2023 19:28:25 +0100 Message-Id: <20230709182934.309468-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927557159100001 Add a primitive for MixColumns. Acked-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 2 + include/crypto/aes-round.h | 18 ++++++ crypto/aes.c | 61 ++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index c9b9d732f0..1b82afc629 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -9,6 +9,8 @@ #define HAVE_AES_ACCEL false #define ATTR_AES_ACCEL =20 +void aesenc_MC_accel(AESState *, const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index dcf098b97b..7d2be40a67 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -20,6 +20,24 @@ typedef union { =20 #include "host/crypto/aes-round.h" =20 +/* + * Perform MixColumns. + */ + +void aesenc_MC_gen(AESState *ret, const AESState *st); +void aesenc_MC_genrev(AESState *ret, const AESState *st); + +static inline void aesenc_MC(AESState *r, const AESState *st, bool be) +{ + if (HAVE_AES_ACCEL) { + aesenc_MC_accel(r, st, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesenc_MC_gen(r, st); + } else { + aesenc_MC_genrev(r, st); + } +} + /* * Perform SubBytes + ShiftRows + AddRoundKey. */ diff --git a/crypto/aes.c b/crypto/aes.c index 90274c3706..ec300cda0c 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -28,6 +28,8 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "qemu/osdep.h" +#include "qemu/bswap.h" +#include "qemu/bitops.h" #include "crypto/aes.h" #include "crypto/aes-round.h" =20 @@ -1216,6 +1218,65 @@ static const u32 rcon[] =3D { 0x1B000000, 0x36000000, /* for 128-bit blocks, Rijndael never uses= more than 10 rcon values */ }; =20 +/* + * Perform MixColumns. + */ +static inline void +aesenc_MC_swap(AESState *r, const AESState *st, bool swap) +{ + int swap_b =3D swap * 0xf; + int swap_w =3D swap * 0x3; + bool be =3D HOST_BIG_ENDIAN ^ swap; + uint32_t t; + + /* Note that AES_mc_rot is encoded for little-endian. */ + t =3D ( AES_mc_rot[st->b[swap_b ^ 0x0]] ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x1]], 8) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x2]], 16) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x3]], 24)); + if (be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 0] =3D t; + + t =3D ( AES_mc_rot[st->b[swap_b ^ 0x4]] ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x5]], 8) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x6]], 16) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x7]], 24)); + if (be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 1] =3D t; + + t =3D ( AES_mc_rot[st->b[swap_b ^ 0x8]] ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0x9]], 8) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0xA]], 16) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0xB]], 24)); + if (be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 2] =3D t; + + t =3D ( AES_mc_rot[st->b[swap_b ^ 0xC]] ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0xD]], 8) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0xE]], 16) ^ + rol32(AES_mc_rot[st->b[swap_b ^ 0xF]], 24)); + if (be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 3] =3D t; +} + +void aesenc_MC_gen(AESState *r, const AESState *st) +{ + aesenc_MC_swap(r, st, false); +} + +void aesenc_MC_genrev(AESState *r, const AESState *st) +{ + aesenc_MC_swap(r, st, true); +} + /* * Perform SubBytes + ShiftRows + AddRoundKey. */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927469; cv=none; d=zohomail.com; s=zohoarc; b=SlnTZTpExTj9xQt+yLffz3LeGzsHg7AcL9RkehAio8a6qVzsjCGjii9hW/FZntuROvxdXDCIvwWX/UB2WTF9QWkOtc11Uk/C7jIVqUvDjLYQFoIO+/r02EJhwGUC0Dh1QMeg24TJH8VDHgSpZ2xG8KpP5b/XCGTjkjjWteVadlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927469; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1lNVmzIrZ20vaRM4z3bBKO9neuQ8i1reH4ftvygdvPI=; b=MVSIVrUp20NZvENsLDfIRziNYc3T9oF/6zQvngE1ifa4G0ncsfgsh7C5xosNVKwclsxQ8dYtS/lXQUNTi1V0FzZUy4tLbKB7j5bG6xwUeu4rsvz6W5JNJrYUuVnTA49Dkau3oDVURKeFcLWS+rOuvYEytjW/ep2PQvXKyYbXEno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927469409838.0449948586819; Sun, 9 Jul 2023 11:31:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAU-0008JI-L4; Sun, 09 Jul 2023 14:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAO-0008FD-Cf for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:52 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAM-0000GJ-PB for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:52 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-313fb7f0f80so3703647f8f.2 for ; Sun, 09 Jul 2023 11:29:50 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927389; x=1691519389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1lNVmzIrZ20vaRM4z3bBKO9neuQ8i1reH4ftvygdvPI=; b=hwKhR2u4ZPO+LHJAJwZIEUHdQcXLyQZCxBfL5arSBucmL5FRyxbLxE8zZrU/xXuSpR 7Woiyhizdydk8HVElaquorPk7tAoOyERKEwIzaGXLP/HEXbzA2GoqbIECRIppG5AY1Lt BF5g+Z+gX/B1QNqHGBW4Z3RcDKOX2uni3BlzPxL0rKziybtjIjInruP1PGyq3GL3G+uA uYE4s0J+yx15y37a63NmbedeuiKYOXz8YJU7JDJXcBNegvjuf/tMqWfLp4JlZuxa1eM7 GWWVQi2uzvcQ7qAW1JFVUAIftPGGfQHv0eE9CygKystNLXVkVCOL8JoxR7zqeBcMxqX/ v7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927389; x=1691519389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1lNVmzIrZ20vaRM4z3bBKO9neuQ8i1reH4ftvygdvPI=; b=dcJapRDLqhx06S/DWMPzUFnkkvkbp0JrL7W2SVVDMLYINW4GCoDUGjsYJuRC0G9Rl5 rFGqDtnMcZDiG7VVinHqg7QaqTDPiYXl5ZBgi8Uw7RRwovVcOPuBKlINeoUnWAK+laLU da1xXSgGzSQLWgJmP1aLEUMUXL7r6QaTDhGWDiv6iwwIBBfIfoupSAG50izNS+QZ/8my nGv5lY3iT0/YNAXR9G3quowQ73b31akAK8R0gIz8qsr4ZGlpSgVmLTvSxIC4RjlcMNRS QLTwFaWT6/LD5ACIJBKwz9oa+9AOzlmSVzEipp15AQBjUAsHObpJub5IJZMxnQLc4kZ4 27lw== X-Gm-Message-State: ABy/qLYv2aIA4BCD7CiLj36/xIUHj5ZJ7fDWjHRd7kTgQBu0SGVrlsvo AsLR3Y5ZhLOvkIIVyaA72A3/ioloFEaHjdKHAA6x0w== X-Google-Smtp-Source: APBJJlEj5fFzIOyPy79prb4Nwgiks94uCU8fz/S9AWYRYgWERfeOanLe6CqSVUhKtYrqHDh/XbRReA== X-Received: by 2002:adf:eb09:0:b0:314:4914:3421 with SMTP id s9-20020adfeb09000000b0031449143421mr8296836wrn.12.1688927389094; Sun, 09 Jul 2023 11:29:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 08/37] crypto: Add aesdec_IMC Date: Sun, 9 Jul 2023 19:28:27 +0100 Message-Id: <20230709182934.309468-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927470803100001 Add a primitive for InvMixColumns. Acked-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 2 + include/crypto/aes-round.h | 18 ++++++ crypto/aes.c | 59 ++++++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index 1b82afc629..335ec3f11e 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -15,6 +15,8 @@ void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); =20 +void aesdec_IMC_accel(AESState *, const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index 7d2be40a67..7be2cc0d8e 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -59,6 +59,24 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AE= SState *st, } } =20 +/* + * Perform InvMixColumns. + */ + +void aesdec_IMC_gen(AESState *ret, const AESState *st); +void aesdec_IMC_genrev(AESState *ret, const AESState *st); + +static inline void aesdec_IMC(AESState *r, const AESState *st, bool be) +{ + if (HAVE_AES_ACCEL) { + aesdec_IMC_accel(r, st, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesdec_IMC_gen(r, st); + } else { + aesdec_IMC_genrev(r, st); + } +} + /* * Perform InvSubBytes + InvShiftRows + AddRoundKey. */ diff --git a/crypto/aes.c b/crypto/aes.c index ec300cda0c..6c05d731f4 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1322,6 +1322,65 @@ void aesenc_SB_SR_AK_genrev(AESState *r, const AESSt= ate *s, const AESState *k) aesenc_SB_SR_AK_swap(r, s, k, true); } =20 +/* + * Perform InvMixColumns. + */ +static inline void +aesdec_IMC_swap(AESState *r, const AESState *st, bool swap) +{ + int swap_b =3D swap * 0xf; + int swap_w =3D swap * 0x3; + bool be =3D HOST_BIG_ENDIAN ^ swap; + uint32_t t; + + /* Note that AES_imc is encoded for big-endian. */ + t =3D (AES_imc[st->b[swap_b ^ 0x0]][0] ^ + AES_imc[st->b[swap_b ^ 0x1]][1] ^ + AES_imc[st->b[swap_b ^ 0x2]][2] ^ + AES_imc[st->b[swap_b ^ 0x3]][3]); + if (!be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 0] =3D t; + + t =3D (AES_imc[st->b[swap_b ^ 0x4]][0] ^ + AES_imc[st->b[swap_b ^ 0x5]][1] ^ + AES_imc[st->b[swap_b ^ 0x6]][2] ^ + AES_imc[st->b[swap_b ^ 0x7]][3]); + if (!be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 1] =3D t; + + t =3D (AES_imc[st->b[swap_b ^ 0x8]][0] ^ + AES_imc[st->b[swap_b ^ 0x9]][1] ^ + AES_imc[st->b[swap_b ^ 0xA]][2] ^ + AES_imc[st->b[swap_b ^ 0xB]][3]); + if (!be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 2] =3D t; + + t =3D (AES_imc[st->b[swap_b ^ 0xC]][0] ^ + AES_imc[st->b[swap_b ^ 0xD]][1] ^ + AES_imc[st->b[swap_b ^ 0xE]][2] ^ + AES_imc[st->b[swap_b ^ 0xF]][3]); + if (!be) { + t =3D bswap32(t); + } + r->w[swap_w ^ 3] =3D t; +} + +void aesdec_IMC_gen(AESState *r, const AESState *st) +{ + aesdec_IMC_swap(r, st, false); +} + +void aesdec_IMC_genrev(AESState *r, const AESState *st) +{ + aesdec_IMC_swap(r, st, true); +} + /* * Perform InvSubBytes + InvShiftRows + AddRoundKey. */ --=20 2.34.1 From nobody Mon Feb 9 21:39:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928339; cv=none; d=zohomail.com; s=zohoarc; b=YT+0sZf3E5ZU7VfRwoIHmnS0fSWVB+1TIcvMi2DMCUAw7Xdv6X2dxGN9Sj0mkPCXjxzZHQAtplgZS/38q6/bBjaQjcEEUN+65BvuqtNaBd99PUPVT+h/Tsh/T8wMqI0KN6kL0Uv7I2YzebY/wWkkprl2QG81oOssbRfKD+6+RzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928339; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=DV/kN2q3sap1mT4pCl+FILYrp8BBw9q0cbg6P7ieBDcKlQvXxfYVlA2qwAVxIIStf1p/bFbnfKM8Hd0r3GSPb6b3EmlDJo71LoMboeu53Mu08ZHCuBWSI7IWNM5biYEDS6KVSPX8leruXDXLzpPptC0Ky2izJwT75aD6vJU3RM4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928339219145.51545076811817; Sun, 9 Jul 2023 11:45:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAR-0008H5-5F; Sun, 09 Jul 2023 14:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAP-0008G2-Dy for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:53 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAN-0000Gj-LN for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:53 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbf7fbe722so43505445e9.3 for ; Sun, 09 Jul 2023 11:29:51 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927390; x=1691519390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=qxSjdrwC5/G+wEy90Vp9NXusAs7GBg4+7qoI850nT3+Kx/2b5Hb7HsFe/f6TJO/CA+ zVMc4bKBvYWK+e907D9H9NDEu+R7gZs3D5KMQELmgMwyIC8Z0rMW4ksnj7tj1WkCVsTw 0aNG72nriNhH6irds/WsjnoNFEqo+av/duxaGUvh1iWOAk3cm3AjqcKbHFj5NynOqkp+ 8DhY0HdTO7M3hE4/rLdKBt8V1bNdfjx/DduBkX10ZFAu31y6xqMEGej1GzTwTj203Dig 7o9sm3AGXDHFBb+DT7YlLPhZWdsPVocH9W44uPYNxWGoB6/IITPioO+Y6VTf5XgQ8QWQ onLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927390; x=1691519390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bny+QrSk9kOHXY9n7JH/neknIRvMmyCuxL4ghWqdlbg=; b=AlSJWqSwPM7OixssIat8hxfilZckL76ToZQj9XQgXUr9z0k6S9eZrLUe7wS4jy0Q9u wFWZL0Z+xNPkj5BTyHGsv70hFxbM3uWLIynv4yJn6aLaLDTj69XoWgNoWRXnPi7x4EGQ oHiZ74wyVhkEar5s9hQfbHKMM9+/IDaxuiq67Cn/Ni1NcCXtOpNcgesJ3zLOLJ1u1MDI tXszNvb/ijsKPjxUqTsFeYwXfIJbJWzfsVmh4CUL6aYDVyhfVUwefvlL+h6mMsSwNekM pJjRdHj/629ZTrNQGAHWFAHwgh2wzoF2PR7H3hwSYhQTW5FLWgtev1XsGJmT2bppva4V iYXQ== X-Gm-Message-State: ABy/qLY2c8p2QbGUVgxoJY2Se8o32WmyvA5GMw24fS55JK8N1irWfqKD 5cRggFrUhTOK4Ju9j7koPFRGDNZNbobmTbF9yGngeA== X-Google-Smtp-Source: APBJJlGP2+JeATZqUaiWrSWm28TxDRdQKBv6zIurH2rAhYbKUxrPJj9EyDTNnwWRVSqkQ+/Uurzi1Q== X-Received: by 2002:a1c:7404:0:b0:3fb:424b:ef6e with SMTP id p4-20020a1c7404000000b003fb424bef6emr11928434wmc.23.1688927390379; Sun, 09 Jul 2023 11:29:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 08/45] linux-user: Use abi_ullong not unsigned long long in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:28 +0100 Message-Id: <20230709182934.309468-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928340493100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 20986bd1d3..45ebacd4b4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1385,13 +1385,13 @@ struct target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; =20 #ifdef TARGET_ARM #define TARGET_HAS_STRUCT_STAT64 struct target_eabi_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; abi_uint __pad1; abi_ulong __st_ino; abi_uint st_mode; @@ -1400,13 +1400,13 @@ struct target_eabi_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; abi_uint __pad2[2]; =20 long long st_size; abi_ulong st_blksize; abi_uint __pad3; - unsigned long long st_blocks; + abi_ullong st_blocks; =20 abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1417,7 +1417,7 @@ struct target_eabi_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; #endif =20 @@ -1568,14 +1568,14 @@ struct target_stat { #if !defined(TARGET_PPC64) #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; - unsigned long long st_ino; + abi_ullong st_dev; + abi_ullong st_ino; abi_uint st_mode; abi_uint st_nlink; abi_uint st_uid; abi_uint st_gid; - unsigned long long st_rdev; - unsigned long long __pad0; + abi_ullong st_rdev; + abi_ullong __pad0; long long st_size; int st_blksize; abi_uint __pad1; @@ -1674,7 +1674,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; unsigned char __pad1[2]; =20 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1686,7 +1686,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[2]; =20 long long st_size; @@ -1704,7 +1704,7 @@ struct target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + abi_ullong st_ino; } QEMU_PACKED; =20 #elif defined(TARGET_ABI_MIPSN64) @@ -1918,7 +1918,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct QEMU_PACKED target_stat64 { - unsigned long long st_dev; + abi_ullong st_dev; unsigned char __pad0[4]; =20 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1930,13 +1930,13 @@ struct QEMU_PACKED target_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned long long st_rdev; + abi_ullong st_rdev; unsigned char __pad3[4]; =20 long long st_size; abi_ulong st_blksize; =20 - unsigned long long st_blocks; /* Number 512-byte blocks allo= cated. */ + abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ =20 abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1947,7 +1947,7 @@ struct QEMU_PACKED target_stat64 { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; =20 - unsigned long long st_ino; + abi_ullong st_ino; }; =20 #elif defined(TARGET_I386) && !defined(TARGET_ABI32) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927663; cv=none; d=zohomail.com; s=zohoarc; b=Z5e9yHdeV+J84U/3O/vFe15+UgeOx5ug4+sIO5X81ZJaSq9PleMXcrpGNijpKq2XfbM0U0+djOQ1iITX2MOx7W5grC6ZMNUXkvdvzetmQesAyJFyTvHRZMXJJyCiUZPfgC8+cUoBWP70lozQOYwSISOicyMdUGlov8VqH/PpWSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927663; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=DqQsJ63MGgI91tCOYPxEtsQb0wQpisgMCspQXhXY7mjC9NklHszlyiy7IpcSJyGBesCu8EIpkNKG/ZPHfJPE0HqOpSwqMqMHlQdNXbBuOd+EZE0OqSVs5bshxks2L6Q83v+IVz2PscZ1JVu/NWK714bO/jsvf0sDzCByiXHhuo8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927663983730.4644342212988; Sun, 9 Jul 2023 11:34:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAW-0008Kz-Hp; Sun, 09 Jul 2023 14:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAR-0008HP-U0 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:55 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAQ-0000HM-Bq for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:55 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so38081695e9.0 for ; Sun, 09 Jul 2023 11:29:53 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927392; x=1691519392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=l4rfDr3MjK4RE7wEClaQrlzP3TCQBQ6giKIlb7sWPZqLf6eV16xw59LsNjb2kWDGCQ 3Jd2IiF0f9OiyxhKSrixBPTetc7RwTqZsDhTCBnP87w/YE0XcjZRphfspoB8yGT2kboc 8RBHfH5LAxJhqjzAQF6QUUsfUXW7oL0n+P2pVmqhjWakUmyUoHehrb3lNFgIBbggZru7 amduiybTpfQM4lQ4OcMBktvG9RIaenBaggj3da6FX8ilPJhUQR4P50nooGv5qs0wSoOk qkTJv4xVbU/6xSAy6KJ3T7NPfS5VFJuQYAqd45khSXGs66AzoOEC14HF+MIy5AW3X6DH oFKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927392; x=1691519392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtm9LlPfPfRyjkKrgBvN2xo7wsnPpDSqZNVUjufgcPA=; b=ZkKRKMm82Wk065NjsfSRc7WPM6jnqFhU2xFwUQRqZ+JyMyEgyh1FBjMDNN3W7ZzGhu EpGXYlvD+z4/uh/akY7gEdtS2c9PWy9BTwUgbFqGsorRSG8Qz+wHK02i3OSxKQoSzW5+ GYFuYDQkLed6Q+RBFxnHjyLmHEI6855jwseVV/k/tTq0ImOneEuigp+jdM17yjJTLcxV L/9F+l/JigAMvo67V1YPCMhrIqTf4RawAfx/UfXy68gMbjUpfjjXNSn8/MCCZevJlT6c 9CEJoTShVP7PVgxeNqfLyvCQzXBJbt4Ov4SHog8ZXhJPIZs1M5H9oswfTl3bonvA6iUT E08w== X-Gm-Message-State: ABy/qLb8uJTGJ1MDDoirL1Nig3U6lIEd9pabtcKXZdkd6maKSEAhkwSu z2s8IFvM/TBMm7/qMOwnRP4BA8sQNCczZBxb9U7Mpg== X-Google-Smtp-Source: APBJJlHOrE2LXwgu/8eWbryzPDQvQd101IfAH1wpA1E7EdoucS+WqZjEPgyfXyy7F4TyA2/CSYfq2g== X-Received: by 2002:a05:600c:452:b0:3fc:7d2:e0c0 with SMTP id s18-20020a05600c045200b003fc07d2e0c0mr3359044wmb.27.1688927392099; Sun, 09 Jul 2023 11:29:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 09/45] linux-user: Use abi_llong not long long in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:30 +0100 Message-Id: <20230709182934.309468-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927666113100005 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 45ebacd4b4..e4fcbd16d2 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1370,7 +1370,7 @@ struct target_stat64 { unsigned short st_rdev; unsigned char __pad3[10]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */ @@ -1403,7 +1403,7 @@ struct target_eabi_stat64 { abi_ullong st_rdev; abi_uint __pad2[2]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; abi_uint __pad3; abi_ullong st_blocks; @@ -1576,10 +1576,10 @@ struct QEMU_PACKED target_stat64 { abi_uint st_gid; abi_ullong st_rdev; abi_ullong __pad0; - long long st_size; + abi_llong st_size; int st_blksize; abi_uint __pad1; - long long st_blocks; /* Number 512-byte blocks allocated. */ + abi_llong st_blocks; /* Number 512-byte blocks allocated. */ int target_st_atime; abi_uint target_st_atime_nsec; int target_st_mtime; @@ -1689,7 +1689,7 @@ struct target_stat64 { abi_ullong st_rdev; unsigned char __pad3[2]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 abi_ulong __pad4; /* future possible st_blocks high bits= */ @@ -1933,7 +1933,7 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; unsigned char __pad3[4]; =20 - long long st_size; + abi_llong st_size; abi_ulong st_blksize; =20 abi_ullong st_blocks; /* Number 512-byte blocks allocated. */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927628; cv=none; d=zohomail.com; s=zohoarc; b=HsopJJPl64SVLhfCU0P4Kbr3iNB35QA5qdr1CY9oJSjPbur4VXO6VmV683mU4vD54RJDZ5S4JqvVNsukjetVlPa+xNKEwjga1Q2v/tfbM3udygHJCuHp4YIcjDM+BK1PipZsWLCyiQJcWLgiGwF0GJWVhxr8ZOhxJ4kgp4MYTCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927628; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ne/prNzqsLfpjp4V0V8cndvcCHzJQtvFp1sqS4i2NnA=; b=cQ33+Tc6XVv4Rkzc41/YkyeLjBFeN47fRGFOcvL7tbl7ceeSrgyRXLe+UWAPwscY5xWoIfwJ7LC3+lABra9Tnzf6mLH1OjEfFyXAul5mgX4PY08x1B7Mtd0KoSBb1wrYJaMeXpQHnriNdLCHpi+VEx35EwhlzmUPTSAIhZcbNmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927628043797.3600460915628; Sun, 9 Jul 2023 11:33:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAW-0008KS-0P; Sun, 09 Jul 2023 14:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAQ-0008Gf-Gx for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:54 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAO-0000Gn-PG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:54 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbc0609cd6so37233505e9.1 for ; Sun, 09 Jul 2023 11:29:52 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927391; x=1691519391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ne/prNzqsLfpjp4V0V8cndvcCHzJQtvFp1sqS4i2NnA=; b=UenPH1rMrHzbXae5oZydAy4inhsvKksXnkCNF/s5omq4pjjAof0Q1Y34AzGSX+eKaz zqdcb6vtF9y1nzZazlO76sRK9Rf/0sLJrytwFGAVsia0/D/m0dRx/uYdVS6Z6SZzixAi 9lOOBTVeS1XZK/L5fAdx8eF9bZJaU/1mbFYYc3BmCaHcvffchheFGZtnSH2K7BU9nZoH LFTZIrNafWPmFIBD89FCj98jKz8rqxmBNH127xwVjIwqJCIZ9eVPCJtkNQxk3lrnraFC GvFb+ZQYpJMZt01PZmPeHsp4OR932CVavMpObyh0/652BvBK/6KB7Sm66Lhs3wx3jH4w nhcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927391; x=1691519391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ne/prNzqsLfpjp4V0V8cndvcCHzJQtvFp1sqS4i2NnA=; b=h8oIGowUsafbmFXHEjp9csv8gaoXUowOJfqVodrQMd7mDOCQ8pVol3x7T5uNIFDt+f g00nB3QQ9iKsUIHUfxOMcKEe0nfkZzwgfuSJbzlui/dNy482j2qxIwoTpH1nVlaJ4njQ jQX9NTbWUCl3Xfqqb597iAKSNR3rHpGc37L7t8OIRjADsq2woEkNIRrFX2OttDfuXAKA 4d+dX/zPxxwhnnf49zN4wWCoSWSwW4lMj1ohWxpTSimEjE5kik+i3JAsJSlzpOQF2P2o 661xxQ0pvqHdSFgAZV1EYMoOOgZEKD3r99nCRUsuzuYk6CX08JDuGvMfNPQb+8p5n2xj 3rOw== X-Gm-Message-State: ABy/qLY8//Fbd4ATTvU1kwPIuTBZozahuOJLwL840QpYlHRIgk1TZzqd Nq9eqdKZmdd0d2HlhD6sFrIWMSA9kfI6Rn99YjQuNw== X-Google-Smtp-Source: APBJJlEDdQ1QK3OgNSlKpI/Ex16XrjLbN6nTzEuYEysCfxz0xbEPBB7gEG15nKNKEMtvy0ibPQJi7A== X-Received: by 2002:a05:600c:22c1:b0:3f7:f45d:5e44 with SMTP id 1-20020a05600c22c100b003f7f45d5e44mr8188722wmg.32.1688927391250; Sun, 09 Jul 2023 11:29:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 09/37] crypto: Add aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:28:29 +0100 Message-Id: <20230709182934.309468-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927629937100012 Add a primitive for SubBytes + ShiftRows + MixColumns + AddRoundKey. Acked-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 3 + include/crypto/aes-round.h | 21 +++++++ crypto/aes.c | 58 ++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index 335ec3f11e..9886e81e50 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -14,6 +14,9 @@ void aesenc_MC_accel(AESState *, const AESState *, bool) void aesenc_SB_SR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesenc_SB_SR_MC_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); =20 void aesdec_IMC_accel(AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index 7be2cc0d8e..03688c8640 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -59,6 +59,27 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AE= SState *st, } } =20 +/* + * Perform SubBytes + ShiftRows + MixColumns + AddRoundKey. + */ + +void aesenc_SB_SR_MC_AK_gen(AESState *ret, const AESState *st, + const AESState *rk); +void aesenc_SB_SR_MC_AK_genrev(AESState *ret, const AESState *st, + const AESState *rk); + +static inline void aesenc_SB_SR_MC_AK(AESState *r, const AESState *st, + const AESState *rk, bool be) +{ + if (HAVE_AES_ACCEL) { + aesenc_SB_SR_MC_AK_accel(r, st, rk, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesenc_SB_SR_MC_AK_gen(r, st, rk); + } else { + aesenc_SB_SR_MC_AK_genrev(r, st, rk); + } +} + /* * Perform InvMixColumns. */ diff --git a/crypto/aes.c b/crypto/aes.c index 6c05d731f4..a193d98d54 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1322,6 +1322,64 @@ void aesenc_SB_SR_AK_genrev(AESState *r, const AESSt= ate *s, const AESState *k) aesenc_SB_SR_AK_swap(r, s, k, true); } =20 +/* + * Perform SubBytes + ShiftRows + MixColumns + AddRoundKey. + */ +static inline void +aesenc_SB_SR_MC_AK_swap(AESState *r, const AESState *st, + const AESState *rk, bool swap) +{ + int swap_b =3D swap * 0xf; + int swap_w =3D swap * 0x3; + bool be =3D HOST_BIG_ENDIAN ^ swap; + uint32_t w0, w1, w2, w3; + + w0 =3D (AES_Te0[st->b[swap_b ^ AES_SH(0x0)]] ^ + AES_Te1[st->b[swap_b ^ AES_SH(0x1)]] ^ + AES_Te2[st->b[swap_b ^ AES_SH(0x2)]] ^ + AES_Te3[st->b[swap_b ^ AES_SH(0x3)]]); + + w1 =3D (AES_Te0[st->b[swap_b ^ AES_SH(0x4)]] ^ + AES_Te1[st->b[swap_b ^ AES_SH(0x5)]] ^ + AES_Te2[st->b[swap_b ^ AES_SH(0x6)]] ^ + AES_Te3[st->b[swap_b ^ AES_SH(0x7)]]); + + w2 =3D (AES_Te0[st->b[swap_b ^ AES_SH(0x8)]] ^ + AES_Te1[st->b[swap_b ^ AES_SH(0x9)]] ^ + AES_Te2[st->b[swap_b ^ AES_SH(0xA)]] ^ + AES_Te3[st->b[swap_b ^ AES_SH(0xB)]]); + + w3 =3D (AES_Te0[st->b[swap_b ^ AES_SH(0xC)]] ^ + AES_Te1[st->b[swap_b ^ AES_SH(0xD)]] ^ + AES_Te2[st->b[swap_b ^ AES_SH(0xE)]] ^ + AES_Te3[st->b[swap_b ^ AES_SH(0xF)]]); + + /* Note that AES_TeX is encoded for big-endian. */ + if (!be) { + w0 =3D bswap32(w0); + w1 =3D bswap32(w1); + w2 =3D bswap32(w2); + w3 =3D bswap32(w3); + } + + r->w[swap_w ^ 0] =3D rk->w[swap_w ^ 0] ^ w0; + r->w[swap_w ^ 1] =3D rk->w[swap_w ^ 1] ^ w1; + r->w[swap_w ^ 2] =3D rk->w[swap_w ^ 2] ^ w2; + r->w[swap_w ^ 3] =3D rk->w[swap_w ^ 3] ^ w3; +} + +void aesenc_SB_SR_MC_AK_gen(AESState *r, const AESState *st, + const AESState *rk) +{ + aesenc_SB_SR_MC_AK_swap(r, st, rk, false); +} + +void aesenc_SB_SR_MC_AK_genrev(AESState *r, const AESState *st, + const AESState *rk) +{ + aesenc_SB_SR_MC_AK_swap(r, st, rk, true); +} + /* * Perform InvMixColumns. */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927509; cv=none; d=zohomail.com; s=zohoarc; b=VrK7Si8dDsLKisLwWpF/7EuUrz/f4du5I22zFejvqPxQQB5pXeMk5ePdUI7/MThS16NEn3jvQJSPufC8Jh/RC52laeiWyvPgBAyX3YEUDbxVkXLL3QKvx0PWoK6WT3YEc4aX4pxchiJueo+SYuwesxQU3IluWRq6j1W+PA7xCYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927509; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bjel77SnKNWNctLdWi3qeIHBWb+IXzPkj8iWkSio4Cw=; b=VWVAd6XW54qNBFQbV/fbPACUiqygYWGI9JPvyeCk+cI3Zf0GjIWxj6/WdYG64QUa64IR9lJEavg4ZNQkCD1jfZZ2W9067cCvaH8kdnddcvmHnawAoR70d+dn7nERXnfS94M5M3xoCrovj8l6g3E/GFd1MYBrKzfGS2T5chsR5HE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927509640623.0339939380273; Sun, 9 Jul 2023 11:31:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAW-0008L1-UM; Sun, 09 Jul 2023 14:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAR-0008HN-RY for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:55 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAQ-0000HH-4q for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:55 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so38081755e9.0 for ; Sun, 09 Jul 2023 11:29:53 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927393; x=1691519393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bjel77SnKNWNctLdWi3qeIHBWb+IXzPkj8iWkSio4Cw=; b=z2AcgigWyJgFm1tUG1xzDL7CS9a2LyzJzFS4KxiQPEv65MlsRwfQ2ir6OgVdQ22Jp4 MF0X9uPpVKj7l6q6aQmQnTaNROM3TwE8qIO//5qS/XF9/QbMQFyQ3zQqUWWg+713Mtkk F4fl91NFQEOzNTTMqZrxV38+HvNTcx7pbg2/p2FY6tHx5WEZkRJ0WBXUKmOYYZXHu+8Y QfVS/YKIu6uexsMRT96olFD0r2llVM9UBmrexmAmHIjDcjAGxCQhBeWxky/oOxCroI5H lI16wKrg9geknkLD45HmHKWG6UE/Hf2KWJMrLKizLhz+YTexNzFJ3zf+vqpjhmvqFrci JiIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927393; x=1691519393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bjel77SnKNWNctLdWi3qeIHBWb+IXzPkj8iWkSio4Cw=; b=Lky6ue+tnko+tNM8jJzSFDx0ofTsUJHsFf1lgTRyyMwQmO0QlNX2fDHu3WSveh3Iei n8mxZxiMCLdJmDcCKWBZe4tnfb6CSTmHFEXI0UMknxJahE9o6VtUsAdY/BIHF3BWCLlE kL9Cbc3BkzbJgYUJ7e5/smYPXSnJTqcjsqEb9U1/ngBnpFFrSlARTidchTKKqe/mdS4y cZ7uBHLul8/XPq2yx17HamECDPymmr3DvG9sjhcQgh00PH7lmP5pvweMINCarloJ9u6u Zv8Zrb2qV1YTbm+ZmWXkOPIC+PYWxA0oSGmZYRY5q35lM8d1i9qhqzWj9s+3+wH8S1Jw BQrg== X-Gm-Message-State: ABy/qLb0B/KD+N5N0RKJUkUbCs+uZSL390OA9lyVAEfuWR4wD7s1CW01 RYe1MG3LXD+l5BHqIUKScf7Vgpn1DfoPX5a9zsjvhA== X-Google-Smtp-Source: APBJJlGdNCeLI2wsc7jnsLMKZatqfs1UqueLj4GXakgseoalmoW1+M2E3d9z6tNKvcFExnSGtg4k6A== X-Received: by 2002:a05:600c:20cb:b0:3fc:f9c:a3e2 with SMTP id y11-20020a05600c20cb00b003fc0f9ca3e2mr1632065wmm.6.1688927392911; Sun, 09 Jul 2023 11:29:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 10/37] crypto: Add aesdec_ISB_ISR_IMC_AK Date: Sun, 9 Jul 2023 19:28:31 +0100 Message-Id: <20230709182934.309468-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927510963100001 Add a primitive for InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. Acked-by: Daniel P. Berrang=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 3 + include/crypto/aes-round.h | 21 +++++++ crypto/aes.c | 58 ++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index 9886e81e50..db8cfe17eb 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -23,5 +23,8 @@ void aesdec_IMC_accel(AESState *, const AESState *, bool) void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_ISB_ISR_IMC_AK_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); =20 #endif /* GENERIC_HOST_CRYPTO_AES_ROUND_H */ diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index 03688c8640..9996f1c219 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -119,4 +119,25 @@ static inline void aesdec_ISB_ISR_AK(AESState *r, cons= t AESState *st, } } =20 +/* + * Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. + */ + +void aesdec_ISB_ISR_IMC_AK_gen(AESState *ret, const AESState *st, + const AESState *rk); +void aesdec_ISB_ISR_IMC_AK_genrev(AESState *ret, const AESState *st, + const AESState *rk); + +static inline void aesdec_ISB_ISR_IMC_AK(AESState *r, const AESState *st, + const AESState *rk, bool be) +{ + if (HAVE_AES_ACCEL) { + aesdec_ISB_ISR_IMC_AK_accel(r, st, rk, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesdec_ISB_ISR_IMC_AK_gen(r, st, rk); + } else { + aesdec_ISB_ISR_IMC_AK_genrev(r, st, rk); + } +} + #endif /* CRYPTO_AES_ROUND_H */ diff --git a/crypto/aes.c b/crypto/aes.c index a193d98d54..c2546ef12e 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1484,6 +1484,64 @@ void aesdec_ISB_ISR_AK_genrev(AESState *r, const AES= State *s, const AESState *k) aesdec_ISB_ISR_AK_swap(r, s, k, true); } =20 +/* + * Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. + */ +static inline void +aesdec_ISB_ISR_IMC_AK_swap(AESState *r, const AESState *st, + const AESState *rk, bool swap) +{ + int swap_b =3D swap * 0xf; + int swap_w =3D swap * 0x3; + bool be =3D HOST_BIG_ENDIAN ^ swap; + uint32_t w0, w1, w2, w3; + + w0 =3D (AES_Td0[st->b[swap_b ^ AES_ISH(0x0)]] ^ + AES_Td1[st->b[swap_b ^ AES_ISH(0x1)]] ^ + AES_Td2[st->b[swap_b ^ AES_ISH(0x2)]] ^ + AES_Td3[st->b[swap_b ^ AES_ISH(0x3)]]); + + w1 =3D (AES_Td0[st->b[swap_b ^ AES_ISH(0x4)]] ^ + AES_Td1[st->b[swap_b ^ AES_ISH(0x5)]] ^ + AES_Td2[st->b[swap_b ^ AES_ISH(0x6)]] ^ + AES_Td3[st->b[swap_b ^ AES_ISH(0x7)]]); + + w2 =3D (AES_Td0[st->b[swap_b ^ AES_ISH(0x8)]] ^ + AES_Td1[st->b[swap_b ^ AES_ISH(0x9)]] ^ + AES_Td2[st->b[swap_b ^ AES_ISH(0xA)]] ^ + AES_Td3[st->b[swap_b ^ AES_ISH(0xB)]]); + + w3 =3D (AES_Td0[st->b[swap_b ^ AES_ISH(0xC)]] ^ + AES_Td1[st->b[swap_b ^ AES_ISH(0xD)]] ^ + AES_Td2[st->b[swap_b ^ AES_ISH(0xE)]] ^ + AES_Td3[st->b[swap_b ^ AES_ISH(0xF)]]); + + /* Note that AES_TdX is encoded for big-endian. */ + if (!be) { + w0 =3D bswap32(w0); + w1 =3D bswap32(w1); + w2 =3D bswap32(w2); + w3 =3D bswap32(w3); + } + + r->w[swap_w ^ 0] =3D rk->w[swap_w ^ 0] ^ w0; + r->w[swap_w ^ 1] =3D rk->w[swap_w ^ 1] ^ w1; + r->w[swap_w ^ 2] =3D rk->w[swap_w ^ 2] ^ w2; + r->w[swap_w ^ 3] =3D rk->w[swap_w ^ 3] ^ w3; +} + +void aesdec_ISB_ISR_IMC_AK_gen(AESState *r, const AESState *st, + const AESState *rk) +{ + aesdec_ISB_ISR_IMC_AK_swap(r, st, rk, false); +} + +void aesdec_ISB_ISR_IMC_AK_genrev(AESState *r, const AESState *st, + const AESState *rk) +{ + aesdec_ISB_ISR_IMC_AK_swap(r, st, rk, true); +} + /** * Expand the cipher key into the encryption key schedule. */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927653; cv=none; d=zohomail.com; s=zohoarc; b=XAZzrG0UiwypnW1ow8WYY6kSi/EKBUarpbjP6HPREtKyP8JqQdR8hLeEWt1O066KQip9xbo0vCWRTFypxO6W6Ij0aBOXYZGo4b5qm5Mq/NZ2XTkrIlbJ2xL3mAkkrCO8E7EVyCz+H9urLaekJ8OThzaftTGXXPYPoRi9eoMwoRA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927653; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qqaRx6w8s1BHOWt7m2WQSS8nvFGbCNmvKUaaDRikQOU=; b=nwdecoEf22kODQsogg1apz+k1jgwJpTwDcvjCh/LafUcwH69dlpMhwFolbd5mvpp9jGKEWWF2RlztWNeSPXbsT4mvsiDTSPiHevbdacyINFyq7cnJnFpY0vrj0y4ZC5DV//eSJP/M8sxPAcAeR16dV2egH73McsQkCPKErnMZWo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927653477929.9828731891217; Sun, 9 Jul 2023 11:34:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008JW-9T; Sun, 09 Jul 2023 14:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAT-0008J5-T9 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:57 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAR-0000HT-2m for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:57 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31297125334so2802058f8f.0 for ; Sun, 09 Jul 2023 11:29:54 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927394; x=1691519394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qqaRx6w8s1BHOWt7m2WQSS8nvFGbCNmvKUaaDRikQOU=; b=iexbbODY1GjwzOiZi7Zgc5eyX7cbplk4SQwjs16QcqT97C1nhte/Un7a1wPiDAoLy3 euiXI5mvf4LQVOMVIBF1sil4Lc5hPS3Ugg+g6Q8HrGq0ay5ci6fg50RmyD5SRwG7ndTN 4gb2fENQphyqlTZIQa+qvY8rgarYzRUpne6Fen9HPge9dbPIpBY4ZuSMR8u0NjUoupvp JngJFbyTyQQuYHSObArdfhPG+thOMK5yIJunX9on+flKACj4l/Orm/WGlVUENjy4nUkV Rtnrj3kJOkoCVNwpP+Ut4/NHmKMNDGQ/GsbKossXmYDIodNWJRghpY2ZeNOj/AcAifFI DArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927394; x=1691519394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qqaRx6w8s1BHOWt7m2WQSS8nvFGbCNmvKUaaDRikQOU=; b=J+kibS9Ug44UUbboQNMri7IigmBgXEcZD5g1hqvOpRuyFk2QgTCdHmLDTlf26E5xE5 cGMlnlHR2m+SsErbv856mBfQ/F2A6Q7BFXT8GcoShFFnZbM0PLVZ5RaWm/yiFPR7KgSY Es/FcZ2SGzqLneKphwAGYHqaRsb69LMOGNfsfq/uOgqDcBbzJSXVNlCfT2/qK3+1FX+S P/tYdI0vbhm1lRYr1QN9/jAOtXZhTvZYzL8A5ESte1O8iWcRqpZl4/RrJzABijBYLoM0 mzmvxYIPbiWHTIxf272BP0g4078uCBedNWZQbZ6/ct91o757qSMZcDposXwpSd4owdxV b9Jg== X-Gm-Message-State: ABy/qLbAY/hdiEOfS0KHBDuvKkh0aLYRPkAYQ19Z5z3dns/4SPUEoTID uhZSF8mm0wx58D0mabujwI5PDwnmH4FReB2FqXZQnA== X-Google-Smtp-Source: APBJJlFRhilRQVWGd53SKGDlunDmHB5I1d12O7ZXo0yCk+MZGmmw1d5e7bnV5Vce0q+9HInwNDhtNQ== X-Received: by 2002:a5d:590f:0:b0:313:ed10:7f52 with SMTP id v15-20020a5d590f000000b00313ed107f52mr13066210wrd.18.1688927393678; Sun, 09 Jul 2023 11:29:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 10/45] linux-user: Use abi_int not int in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:32 +0100 Message-Id: <20230709182934.309468-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927654051100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall_defs.h | 216 +++++++++++++++++++------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index e4fcbd16d2..442a8aefe3 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -361,7 +361,7 @@ struct target_iovec { =20 struct target_msghdr { abi_long msg_name; /* Socket name */ - int msg_namelen; /* Length of name */ + abi_int msg_namelen; /* Length of name */ abi_long msg_iov; /* Data blocks */ abi_long msg_iovlen; /* Number of blocks */ abi_long msg_control; /* Per protocol magic (eg BSD file descri= ptor passing) */ @@ -371,8 +371,8 @@ struct target_msghdr { =20 struct target_cmsghdr { abi_long cmsg_len; - int cmsg_level; - int cmsg_type; + abi_int cmsg_level; + abi_int cmsg_type; }; =20 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr = *) (cmsg) + 1)) @@ -426,7 +426,7 @@ struct target_rusage { }; =20 typedef struct { - int val[2]; + abi_int val[2]; } kernel_fsid_t; =20 struct target_dirent { @@ -544,7 +544,7 @@ struct target_sigaction { #endif =20 typedef union target_sigval { - int sival_int; + abi_int sival_int; abi_ulong sival_ptr; } target_sigval_t; =20 @@ -575,17 +575,17 @@ typedef union target_sigval { =20 typedef struct target_siginfo { #ifdef TARGET_MIPS - int si_signo; - int si_code; - int si_errno; + abi_int si_signo; + abi_int si_code; + abi_int si_errno; #else - int si_signo; - int si_errno; - int si_code; + abi_int si_signo; + abi_int si_errno; + abi_int si_code; #endif =20 union { - int _pad[TARGET_SI_PAD_SIZE]; + abi_int _pad[TARGET_SI_PAD_SIZE]; =20 /* kill() */ struct { @@ -610,7 +610,7 @@ typedef struct target_siginfo { struct { pid_t _pid; /* which child */ uid_t _uid; /* sender's uid */ - int _status; /* exit code */ + abi_int _status; /* exit code */ target_clock_t _utime; target_clock_t _stime; } _sigchld; @@ -622,8 +622,8 @@ typedef struct target_siginfo { =20 /* SIGPOLL */ struct { - int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ - int _fd; + abi_int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + abi_int _fd; } _sigpoll; } _sifields; } target_siginfo_t; @@ -701,7 +701,7 @@ typedef struct target_siginfo { #include "target_resource.h" =20 struct target_pollfd { - int fd; /* file descriptor */ + abi_int fd; /* file descriptor */ short events; /* requested events */ short revents; /* returned events */ }; @@ -722,12 +722,12 @@ struct target_pollfd { #define TARGET_KDSIGACCEPT 0x4B4E =20 struct target_rtc_pll_info { - int pll_ctrl; - int pll_value; - int pll_max; - int pll_min; - int pll_posmult; - int pll_negmult; + abi_int pll_ctrl; + abi_int pll_value; + abi_int pll_max; + abi_int pll_min; + abi_int pll_posmult; + abi_int pll_negmult; abi_long pll_clock; }; =20 @@ -754,14 +754,14 @@ struct target_rtc_pll_info { struct target_rtc_pll_info) #define TARGET_RTC_PLL_SET TARGET_IOW('p', 0x12, \ struct target_rtc_pll_info) -#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, int) +#define TARGET_RTC_VL_READ TARGET_IOR('p', 0x13, abi_int) #define TARGET_RTC_VL_CLR TARGET_IO('p', 0x14) =20 #if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) |= | \ defined(TARGET_XTENSA) -#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) -#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) -#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, abi_int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, abi_int) +#define TARGET_SIOCATMARK TARGET_IOR('s', 7, abi_int) #define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t) #define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t) #else @@ -851,40 +851,40 @@ struct target_rtc_pll_info { =20 /* From */ =20 -#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, int) -#define TARGET_TUNSETIFF TARGET_IOW('T', 202, int) -#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, int) -#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, int) -#define TARGET_TUNSETLINK TARGET_IOW('T', 205, int) -#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, int) +#define TARGET_TUNSETDEBUG TARGET_IOW('T', 201, abi_int) +#define TARGET_TUNSETIFF TARGET_IOW('T', 202, abi_int) +#define TARGET_TUNSETPERSIST TARGET_IOW('T', 203, abi_int) +#define TARGET_TUNSETOWNER TARGET_IOW('T', 204, abi_int) +#define TARGET_TUNSETLINK TARGET_IOW('T', 205, abi_int) +#define TARGET_TUNSETGROUP TARGET_IOW('T', 206, abi_int) #define TARGET_TUNGETFEATURES TARGET_IOR('T', 207, abi_uint) #define TARGET_TUNSETOFFLOAD TARGET_IOW('T', 208, abi_uint) #define TARGET_TUNSETTXFILTER TARGET_IOW('T', 209, abi_uint) #define TARGET_TUNGETIFF TARGET_IOR('T', 210, abi_uint) -#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, int) -#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, int) +#define TARGET_TUNGETSNDBUF TARGET_IOR('T', 211, abi_int) +#define TARGET_TUNSETSNDBUF TARGET_IOW('T', 212, abi_int) /* * TUNATTACHFILTER and TUNDETACHFILTER are not supported. Linux kernel kee= ps a * user pointer in TUNATTACHFILTER, which we are not able to correctly han= dle. */ -#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, int) -#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, int) -#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, int) +#define TARGET_TUNGETVNETHDRSZ TARGET_IOR('T', 215, abi_int) +#define TARGET_TUNSETVNETHDRSZ TARGET_IOW('T', 216, abi_int) +#define TARGET_TUNSETQUEUE TARGET_IOW('T', 217, abi_int) #define TARGET_TUNSETIFINDEX TARGET_IOW('T', 218, abi_uint) /* TUNGETFILTER is not supported: see TUNATTACHFILTER. */ -#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, int) -#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, int) -#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, int) -#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, int) -#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, int) -#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, int) -#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, int) +#define TARGET_TUNSETVNETLE TARGET_IOW('T', 220, abi_int) +#define TARGET_TUNGETVNETLE TARGET_IOR('T', 221, abi_int) +#define TARGET_TUNSETVNETBE TARGET_IOW('T', 222, abi_int) +#define TARGET_TUNGETVNETBE TARGET_IOR('T', 223, abi_int) +#define TARGET_TUNSETSTEERINGEBPF TARGET_IOR('T', 224, abi_int) +#define TARGET_TUNSETFILTEREBPF TARGET_IOR('T', 225, abi_int) +#define TARGET_TUNSETCARRIER TARGET_IOW('T', 226, abi_int) #define TARGET_TUNGETDEVNETNS TARGET_IO('T', 227) =20 /* From */ =20 -#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int) -#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int) +#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, abi_int) +#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, abi_int) #define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04) #define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06) #define TARGET_RNDRESEEDCRNG TARGET_IO('R', 0x07) @@ -940,7 +940,7 @@ struct target_rtc_pll_info { #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used fo= r bmap */ =20 -#define TARGET_FICLONE TARGET_IOW(0x94, 9, int) +#define TARGET_FICLONE TARGET_IOW(0x94, 9, abi_int) #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range) =20 /* @@ -952,10 +952,10 @@ struct target_rtc_pll_info { #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long) #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long) #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) -#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int) -#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int) -#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int) -#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int) +#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, abi_int) +#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, abi_int) +#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, abi_int) +#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, abi_int) =20 /* btrfs ioctls */ #ifdef HAVE_BTRFS_H @@ -1577,14 +1577,14 @@ struct QEMU_PACKED target_stat64 { abi_ullong st_rdev; abi_ullong __pad0; abi_llong st_size; - int st_blksize; + abi_int st_blksize; abi_uint __pad1; abi_llong st_blocks; /* Number 512-byte blocks allocated. */ - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_uint __unused4; abi_uint __unused5; @@ -1635,11 +1635,11 @@ struct QEMU_PACKED target_stat64 { abi_uint __pad2; abi_llong st_blocks; =20 - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_ullong st_ino; }; @@ -1720,8 +1720,8 @@ struct target_stat { abi_uint st_mode; abi_uint st_nlink; =20 - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; =20 abi_uint st_rdev; abi_uint st_pad1[3]; /* Reserved for st_rdev expansion = */ @@ -1756,8 +1756,8 @@ struct target_stat { abi_ullong st_ino; abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ abi_llong st_size; @@ -1781,8 +1781,8 @@ struct target_stat { abi_ulong st_ino; abi_uint st_mode; abi_uint st_nlink; - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; unsigned st_rdev; abi_long st_pad2[2]; abi_long st_size; @@ -1818,8 +1818,8 @@ struct target_stat64 { abi_uint st_mode; abi_uint st_nlink; =20 - int st_uid; - int st_gid; + abi_int st_uid; + abi_int st_gid; =20 abi_ulong st_rdev; abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ @@ -2008,8 +2008,8 @@ struct target_stat { abi_ulong st_rdev; abi_ulong _pad1; abi_long st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_long st_blocks; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -2081,8 +2081,8 @@ struct target_stat { abi_ulong st_rdev; abi_ulong __pad1; abi_long st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_long st_blocks; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -2106,14 +2106,14 @@ struct target_stat64 { abi_ullong st_rdev; abi_ullong __pad1; abi_llong st_size; - int st_blksize; - int __pad2; + abi_int st_blksize; + abi_int __pad2; abi_llong st_blocks; - int target_st_atime; + abi_int target_st_atime; abi_uint target_st_atime_nsec; - int target_st_mtime; + abi_int target_st_mtime; abi_uint target_st_mtime_nsec; - int target_st_ctime; + abi_int target_st_ctime; abi_uint target_st_ctime_nsec; abi_uint __unused4; abi_uint __unused5; @@ -2186,7 +2186,7 @@ struct target_stat64 { #endif =20 typedef struct { - int val[2]; + abi_int val[2]; } target_fsid_t; =20 #ifdef TARGET_MIPS @@ -2351,7 +2351,7 @@ struct target_statfs64 { =20 /* soundcard defines */ /* XXX: convert them all to arch independent entries */ -#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); +#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, abi_int); #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 #define TARGET_SNDCTL_COPR_RCODE 0xc0144303 #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 @@ -2363,20 +2363,20 @@ struct target_statfs64 { #define TARGET_SNDCTL_COPR_WDATA 0x40144304 #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) -#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) -#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) -#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) -#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) -#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) -#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) +#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, abi_int) +#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, abi_int) +#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, abi_int) +#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, abi_int) +#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, abi_int) +#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, abi_int) #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) -#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) -#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) -#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) +#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, abi_int) +#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, abi_int) +#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, abi_int) #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) -#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) -#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) +#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, abi_int) +#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, abi_int) #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19) @@ -2424,13 +2424,13 @@ struct target_statfs64 { #define TARGET_SOUND_PCM_READ_FILTER 0x80045007 #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 -#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) -#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) -#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) -#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) -#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) +#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, abi_int) +#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, abi_int) =20 -#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) +#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, abi_int) =20 #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MI= XER_VOLUME) #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MI= XER_BASS) @@ -2461,7 +2461,7 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MI= XER_STEREODEVS) #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MI= XER_CAPS) =20 -#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) +#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, abi_int) =20 #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOL= UME) #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_M= IXER_BASS) @@ -2489,17 +2489,17 @@ struct target_statfs64 { #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_REC= SRC) =20 struct target_snd_timer_id { - int dev_class; - int dev_sclass; - int card; - int device; - int subdevice; + abi_int dev_class; + abi_int dev_sclass; + abi_int card; + abi_int device; + abi_int subdevice; }; =20 struct target_snd_timer_ginfo { struct target_snd_timer_id tid; abi_uint flags; - int card; + abi_int card; unsigned char id[64]; unsigned char name[80]; abi_ulong reserved0; @@ -2532,7 +2532,7 @@ struct target_snd_timer_select { =20 struct target_snd_timer_info { abi_uint flags; - int card; + abi_int card; unsigned char id[64]; unsigned char name[80]; abi_ulong reserved0; @@ -2550,7 +2550,7 @@ struct target_snd_timer_status { }; =20 /* alsa timer ioctls */ -#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, int) +#define TARGET_SNDRV_TIMER_IOCTL_PVERSION TARGET_IOR('T', 0x00, abi_in= t) #define TARGET_SNDRV_TIMER_IOCTL_NEXT_DEVICE TARGET_IOWR('T', 0x01, \ struct snd_timer= _id) #define TARGET_SNDRV_TIMER_IOCTL_GINFO TARGET_IOWR('T', 0x03, \ @@ -2650,9 +2650,9 @@ struct target_mq_attr { }; =20 struct target_drm_version { - int version_major; - int version_minor; - int version_patchlevel; + abi_int version_major; + abi_int version_minor; + abi_int version_patchlevel; abi_ulong name_len; abi_ulong name; abi_ulong date_len; @@ -2662,7 +2662,7 @@ struct target_drm_version { }; =20 struct target_drm_i915_getparam { - int param; + abi_int param; abi_ulong value; }; =20 @@ -2755,7 +2755,7 @@ struct target_sigevent { =20 struct target_user_cap_header { abi_uint version; - int pid; + abi_int pid; }; =20 struct target_user_cap_data { --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927696; cv=none; d=zohomail.com; s=zohoarc; b=Iv7FI/9Zz8wOlX12lVlPcxhcoYIQiUvRpSi6BKcuY1O36hO2HbNo56OS7h4rnhpH/GOjyREY0oeOS1GQ+YcV7KozGedXRY1CcYY9MA1FskYl7Njtn/F6kHdbek3Fwx/0G8SRIqcJipwH7ZQ93nk+zAWu8t+1pCcpR90Ljylsqk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927696; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=WDRYuMQLTkzxnxPiL8R4I8Y9WO2rOC8iZiAnqezVirdY9KJaDEw5567z9BHBUiVHtSSm7lnvOnscK/Bglmc0lvuwBIdnv7HvqOBtTyZnq48NXVTSuuC31Uhtzuz0FFwz3AqNGCXy1hm9Ht8ezy+kkhrfjfKhSyM5CR7lb7eRjeA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927696952699.2657582191426; Sun, 9 Jul 2023 11:34:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAY-0008Lx-RE; Sun, 09 Jul 2023 14:30:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAU-0008JH-H1 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:58 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAS-0000Hw-Mz for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:58 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so39208555e9.3 for ; Sun, 09 Jul 2023 11:29:56 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927395; x=1691519395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=xRRB06FtD4dX9UYW61/EiF+x3XZccrB4nR0mUY4/GTc2Em1uhXoMEafud47lIltII2 mgKIvJDGnyDRd7RjT6AJDGpvnSmd4/wDAevPuyQ8LnZ8jOGnH/1RLZsoh3D4Hj76aqqb 4SKIA9Ez/Ui34dCedvDVNOWndGHERTfqyk4aJmpFFudMcexACYyx8vLXLyBPiDCAyCXg D4Mu9mPyHzhRSINSlGBLojQMFZi1FkLdlI4nifluhukHRj9m03FRcXcSAC8i/hLNTvT0 2Z1ERamLjyw4Y0XQTIGBS708gMuw4V/k1MFNfMrYa5wmgLo6KhRhK+TC7bbQRfcy+Smv 1x7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927395; x=1691519395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0axJfNA+Z363BLcyj9VA5KZ1tFbJa96aH9vwiYFI9Ic=; b=hZkU7/yVuv7iN3silGcGkGaccvlVb9SHcSr0NqrpSH4tRfuJ9UdGZ/PIuBnShwxj96 5QC8lgyhZxwgNFUsAPnS8W0gFJUciX8Y8TTJJsB4NRzuFQHJQyszHTCxQ45ObR5KUEyd VLovaTV7Xj6qcs3bj/27crU81mNCGkNGCSBVrM/yHDQuESnTLjgkeIgnCwTfOhc3P/xE UMFaBEKrRFPXmE6jIED3elc6iY+hMEYltBFtSal61gyfN9+rkurf5+Aa/+1KniiX+PlZ k3HwdCcsvSkEhdniJpfAtTGv2lTMbH0OLzplzsL4LkzzUVHCbgfz345+XaZ2ZeduWzYK IGog== X-Gm-Message-State: ABy/qLZPD3+UndPg/+XzPmfom6vDia6S77B1dou1EvmGJr1XoWG2S0bN HRfgUwuSfuhIZbTqtrwgvU1HTa0PV4QaRRY0K0ZmuA== X-Google-Smtp-Source: APBJJlHDeXQgcEDF+VnKE9YNqRpbsLdr8qjLoppbX9UN99tjrZCXa6bMhcmDLIjVZ+x3hYUN6E3/kA== X-Received: by 2002:a7b:c8c9:0:b0:3fc:80a:9948 with SMTP id f9-20020a7bc8c9000000b003fc080a9948mr4513052wml.19.1688927395442; Sun, 09 Jul 2023 11:29:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 11/45] linux-user: Use abi_ushort not unsigned short in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:34 +0100 Message-Id: <20230709182934.309468-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927698191100002 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 90 +++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 442a8aefe3..21ca03b0f4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -432,7 +432,7 @@ typedef struct { struct target_dirent { abi_long d_ino; abi_long d_off; - unsigned short d_reclen; + abi_ushort d_reclen; char d_name[]; }; =20 @@ -1210,19 +1210,19 @@ struct target_rtc_pll_info { =20 #define TARGET_NCC 8 struct target_termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ + abi_ushort c_iflag; /* input mode flags */ + abi_ushort c_oflag; /* output mode flags */ + abi_ushort c_cflag; /* control mode flags */ + abi_ushort c_lflag; /* local mode flags */ unsigned char c_line; /* line discipline */ unsigned char c_cc[TARGET_NCC]; /* control characters */ }; =20 struct target_winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; + abi_ushort ws_row; + abi_ushort ws_col; + abi_ushort ws_xpixel; + abi_ushort ws_ypixel; }; =20 #include "termbits.h" @@ -1328,15 +1328,15 @@ struct target_winsize { || defined(TARGET_CRIS) #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; - unsigned short __pad1; + abi_ushort st_dev; + abi_ushort __pad1; abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; + abi_ushort __pad2; abi_ulong st_size; abi_ulong st_blksize; abi_ulong st_blocks; @@ -1355,7 +1355,7 @@ struct target_stat { */ #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { - unsigned short st_dev; + abi_ushort st_dev; unsigned char __pad0[10]; =20 #define TARGET_STAT64_HAS_BROKEN_ST_INO 1 @@ -1367,7 +1367,7 @@ struct target_stat64 { abi_ulong st_uid; abi_ulong st_gid; =20 - unsigned short st_rdev; + abi_ushort st_rdev; unsigned char __pad3[10]; =20 abi_llong st_size; @@ -1442,7 +1442,7 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { unsigned char __pad0[6]; - unsigned short st_dev; + abi_ushort st_dev; =20 abi_ullong st_ino; abi_ullong st_nlink; @@ -1453,7 +1453,7 @@ struct target_stat64 { abi_uint st_gid; =20 unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; =20 abi_llong st_size; abi_llong st_blksize; @@ -1477,13 +1477,13 @@ struct target_stat64 { =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned short st_dev; + abi_ushort st_dev; abi_ulong st_ino; - unsigned short st_mode; + abi_ushort st_mode; short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; abi_long st_size; abi_long target_st_atime; abi_ulong target_st_atime_nsec; @@ -1499,7 +1499,7 @@ struct target_stat { #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { unsigned char __pad0[6]; - unsigned short st_dev; + abi_ushort st_dev; =20 abi_ullong st_ino; =20 @@ -1510,7 +1510,7 @@ struct target_stat64 { abi_uint st_gid; =20 unsigned char __pad2[6]; - unsigned short st_rdev; + abi_ushort st_rdev; =20 unsigned char __pad3[8]; =20 @@ -1544,7 +1544,7 @@ struct target_stat { abi_uint st_mode; #else abi_uint st_mode; - unsigned short st_nlink; + abi_ushort st_nlink; #endif abi_uint st_uid; abi_uint st_gid; @@ -1598,7 +1598,7 @@ struct target_stat { abi_ulong st_dev; abi_ulong st_ino; abi_uint st_mode; - unsigned short st_nlink; + abi_ushort st_nlink; abi_uint st_uid; abi_uint st_gid; abi_ulong st_rdev; @@ -1647,15 +1647,15 @@ struct QEMU_PACKED target_stat64 { #elif defined(TARGET_M68K) =20 struct target_stat { - unsigned short st_dev; - unsigned short __pad1; - abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; + abi_ushort st_dev; + abi_ushort __pad1; + abi_ulong st_ino; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; + abi_ushort st_rdev; + abi_ushort __pad2; abi_ulong st_size; abi_ulong st_blksize; abi_ulong st_blocks; @@ -1895,10 +1895,10 @@ struct target_stat64 { struct target_stat { abi_ulong st_dev; abi_ulong st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; + abi_ushort st_mode; + abi_ushort st_nlink; + abi_ushort st_uid; + abi_ushort st_gid; abi_ulong st_rdev; abi_ulong st_size; abi_ulong st_blksize; @@ -2619,8 +2619,8 @@ struct target_sysinfo { abi_ulong bufferram; /* Memory used by buffers */ abi_ulong totalswap; /* Total swap space size */ abi_ulong freeswap; /* swap space still available */ - unsigned short procs; /* Number of current processes */ - unsigned short pad; /* explicit padding for m68k */ + abi_ushort procs; /* Number of current processes */ + abi_ushort pad; /* explicit padding for m68k */ abi_ulong totalhigh; /* Total high memory size */ abi_ulong freehigh; /* Available high memory size */ abi_uint mem_unit; /* Memory unit size in bytes */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927645; cv=none; d=zohomail.com; s=zohoarc; b=mGhNKGgvbzchPpJ6NfoOU3aOl5oqHh+7UKi3V1tGYR4miiYs/bBePvXlStDUmGWKuNGqz2ZFtH8wLwD2kvuPSNWfYNnSFG5z2k59OAG5EpgUgtDXyLq3X8ZV1djiOlsB0do6EXF2KNZYG3fJ2aYx7l5CuoK3I/MvfcFfQ1LMgpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927645; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/QBtvBQSI1Tt7HA/Hos/l3dVZOAq+hVRSg1lIqyT39k=; b=c4ATG525T1NTDdLNzxkqPDXfUBdKGzIN8YqHuKsI51IXxNTIfDrkr6maKwWBd0NKp2+bGOuisKGMErGKcWuHC6yd5M/zqZ+LoTNNHMfEJX+Cx5Qon9z2P7AbhpeJst+P/koOzsnUJrX2YCSmzL40bDejDL+ngPmVA32mnO6BoEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927645057236.99867330082986; Sun, 9 Jul 2023 11:34:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008JT-7b; Sun, 09 Jul 2023 14:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAT-0008Iy-HH for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:57 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAR-0000Hg-TP for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:57 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso37891745e9.2 for ; Sun, 09 Jul 2023 11:29:55 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927394; x=1691519394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/QBtvBQSI1Tt7HA/Hos/l3dVZOAq+hVRSg1lIqyT39k=; b=LPVTtHy8rS0l+ARnT9UwhpqFth+8dMEaFGITPAGTXV4iU/+GU903B+EplpYbjnpfMb pCNOpXlSVX3CKecuXOheldX1fxwIZl+91nR6enZjgkcpkX+OcrTx4oAPBmrcHJncJZdw k5565BT8poZE1j+4mJC8NpndqouedIAZ63Zo0KZtgMTkp6QzAdgwReCEw1Q57Y0GKuKM Y9HROJMr1godTBObRmKd4T4jwGikCm/i9C+6AUzsUHc+zaps11457Vlu2iJdlTvR/Wip Dqd1s4vsfpvNHxy98TiiPlnS2p+/SDc4PvHv5fG6zEnq30T5JZPzqxZYqsuJUJuHPbGf XJTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927394; x=1691519394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/QBtvBQSI1Tt7HA/Hos/l3dVZOAq+hVRSg1lIqyT39k=; b=LfEkOFwGIP+VwKnc8NrgG6cGfZ8l0a4BXcMYX+3biuZNSZH5gLw2PqS0kto9GYkKUV WIjolqwfbUeoSuW/9wZFBcc6K/r+YnAVYbX2o/OCWuXAM0w30fmNwOf7+zz/gbhTlbm6 P/c7kWa1qQzyJY23mei6w454INgpMEPo3x6e/9tzECYedBd3KNPIoZZtu1KcvpMn0JAl 1dty8ERU+ucJ4t8rZCTTeDNBsoAIhR3ZHdP9DlYVSovwA+Uo/ykZ6w469KP42XpR6mhx qkqzDUnJh3x0ZUMk0KbheRW8WNDlJ3FffbJbpMZKCgCoUShNbovZAsLxbZ3RLbcot3pF jFVQ== X-Gm-Message-State: ABy/qLYMGB+SPPm2gMaHKvt6u/kmrWcC+KIZLrzzmS0ZrnWhce2YSQR3 INaubJwoE597kEjV2GPANmdYu5jM8THRLhf5S/YVzA== X-Google-Smtp-Source: APBJJlHGkO2QN5AyRqwxpMxuq8D49l/ev76BPn3MmtgW41BjPWfqjt2FDfH2Om82lRWBUV8d58SgKw== X-Received: by 2002:a05:600c:234b:b0:3fc:dd9:91fd with SMTP id 11-20020a05600c234b00b003fc0dd991fdmr1707665wmq.40.1688927394581; Sun, 09 Jul 2023 11:29:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/37] crypto: Add aesdec_ISB_ISR_AK_IMC Date: Sun, 9 Jul 2023 19:28:33 +0100 Message-Id: <20230709182934.309468-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927645961100003 Add a primitive for InvSubBytes + InvShiftRows + AddRoundKey + InvMixColumns. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- host/include/generic/host/crypto/aes-round.h | 3 +++ include/crypto/aes-round.h | 21 ++++++++++++++++++++ crypto/aes.c | 14 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/host/include/generic/host/crypto/aes-round.h b/host/include/ge= neric/host/crypto/aes-round.h index db8cfe17eb..1b9720f917 100644 --- a/host/include/generic/host/crypto/aes-round.h +++ b/host/include/generic/host/crypto/aes-round.h @@ -23,6 +23,9 @@ void aesdec_IMC_accel(AESState *, const AESState *, bool) void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); +void aesdec_ISB_ISR_AK_IMC_accel(AESState *, const AESState *, + const AESState *, bool) + QEMU_ERROR("unsupported accel"); void aesdec_ISB_ISR_IMC_AK_accel(AESState *, const AESState *, const AESState *, bool) QEMU_ERROR("unsupported accel"); diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h index 9996f1c219..854fb0966a 100644 --- a/include/crypto/aes-round.h +++ b/include/crypto/aes-round.h @@ -119,6 +119,27 @@ static inline void aesdec_ISB_ISR_AK(AESState *r, cons= t AESState *st, } } =20 +/* + * Perform InvSubBytes + InvShiftRows + AddRoundKey + InvMixColumns. + */ + +void aesdec_ISB_ISR_AK_IMC_gen(AESState *ret, const AESState *st, + const AESState *rk); +void aesdec_ISB_ISR_AK_IMC_genrev(AESState *ret, const AESState *st, + const AESState *rk); + +static inline void aesdec_ISB_ISR_AK_IMC(AESState *r, const AESState *st, + const AESState *rk, bool be) +{ + if (HAVE_AES_ACCEL) { + aesdec_ISB_ISR_AK_IMC_accel(r, st, rk, be); + } else if (HOST_BIG_ENDIAN =3D=3D be) { + aesdec_ISB_ISR_AK_IMC_gen(r, st, rk); + } else { + aesdec_ISB_ISR_AK_IMC_genrev(r, st, rk); + } +} + /* * Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey. */ diff --git a/crypto/aes.c b/crypto/aes.c index c2546ef12e..c765f11c1e 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1542,6 +1542,20 @@ void aesdec_ISB_ISR_IMC_AK_genrev(AESState *r, const= AESState *st, aesdec_ISB_ISR_IMC_AK_swap(r, st, rk, true); } =20 +void aesdec_ISB_ISR_AK_IMC_gen(AESState *ret, const AESState *st, + const AESState *rk) +{ + aesdec_ISB_ISR_AK_gen(ret, st, rk); + aesdec_IMC_gen(ret, ret); +} + +void aesdec_ISB_ISR_AK_IMC_genrev(AESState *ret, const AESState *st, + const AESState *rk) +{ + aesdec_ISB_ISR_AK_genrev(ret, st, rk); + aesdec_IMC_genrev(ret, ret); +} + /** * Expand the cipher key into the encryption key schedule. */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927864; cv=none; d=zohomail.com; s=zohoarc; b=cTnYlFsVySRBsfVmSIc0pGaBYLmD2QJvER6znu1z9b613Qy/C8qKDiHgW/2BpGX2mSM98PpUcR/WVoFA3ymnxGUyZGqWBTfzvq7R92lTYXNhU3SlMr8+YJ0Ze8E6An1Xn4OqndYsUaDIvWIsUUbV2dqAIZRdTHwbbTdIEhKviwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927864; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jsF8E0JGJalzWmrX5g2tSojnQQtbBHl3guSmbqu5fKQ=; b=SZcjg1JHX/5zlLkheMp5cFLy1iWR1MUFvuCrwJGD46T30y6RanaJmDIq7vrH/Ac5R8jgTuNzB5OMMQ69ziUBeGNQ6vNn0MZQvt13YBhG8hA3BiMMHH9JP4AQmxpW7YL1KDAWDU/9g+8XJ2k/43sPwjhY5Y+vx7KTpenu/eEy+dQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927864413964.9438833397782; Sun, 9 Jul 2023 11:37:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAY-0008Ly-QR; Sun, 09 Jul 2023 14:30:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008Ji-EG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:59 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAT-0000I8-Kt for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:59 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbd33a57b6so49168455e9.2 for ; Sun, 09 Jul 2023 11:29:57 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927396; x=1691519396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jsF8E0JGJalzWmrX5g2tSojnQQtbBHl3guSmbqu5fKQ=; b=p0HCxIqqViaAJC42f1cxHFCv/wCggEGjE3e+ca0w/+RhOg/tIYAO5IWHL21xupdva5 9dZlMGNzldLUmJ8FWq3BtQN4wnvn7z0YVpFl65sfN7HJgf0q2c7z2APmklRsRVMTVbR8 q5p+i+PEyUIMqBHRMCaRoKsSlcL4U+ENjtrynqIIUStSkW+C3NGghc/TEUCnlpM/LDC7 CaP+834MpY7r6XHz/U5+UirRVhLiQTqsascGqd4VbBb6H0wp6J65WivhsuTmJ7lTUuwI 43RxFllMqMdu2+EYFUxCPYMJxLjVw2BvUB6OBaVYGdrpZ0yzmtMLxCLXBSqkC2CGFTDg kNIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927396; x=1691519396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jsF8E0JGJalzWmrX5g2tSojnQQtbBHl3guSmbqu5fKQ=; b=ETxnvQgk2UlRpfpwABTpqlepflMaF+NiyhxuwROn5Hab6IlTmO9p8rY32WTYcHyhFp grvk8hs96WsxrXaPTPOAHIrzFnWoeRI/kidRZbmS36IUALxpDCySe3tjxe33y2uKFZLh TYQCE6jCUci1VnqbgOw8XcK9ntv+eunC1l3LWpPobel+u5M8hQTE//jtCPGY+55nHbXb nCd9u/Wqj2izcW901trLmFibp0gfRXXdJTCxOKmdXXtrjky2fA1ppzMoc5BIHO/He9Ke K3W9bDBLAtAzJO4inPIjX6yQjILZpWoXyz3ZujuGF87GddhjZlIIi4SEypoRauscIkSy 3BDA== X-Gm-Message-State: ABy/qLYbhc1XwrpMBRrL8WpGDcMRC5CbJCQoEdb8IRQF6WurBscONCef hJ+f5jgBk3ACLkXG1SU2zHlkxNntncs7Ins7gtcIKw== X-Google-Smtp-Source: APBJJlElQiQYYM5uk2mS+u5TJZRCj7wtsa6gAfcy21Yrqk56JfvLxUxG3HLr3vs/Wx+onfY6CCHHnA== X-Received: by 2002:a7b:ce18:0:b0:3fb:b280:f548 with SMTP id m24-20020a7bce18000000b003fbb280f548mr12641117wmc.0.1688927396131; Sun, 09 Jul 2023 11:29:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PULL 12/37] host/include/i386: Implement aes-round.h Date: Sun, 9 Jul 2023 19:28:35 +0100 Message-Id: <20230709182934.309468-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927866514100009 Content-Type: text/plain; charset="utf-8" Detect AES in cpuinfo; implement the accel hooks. Signed-off-by: Richard Henderson --- host/include/i386/host/cpuinfo.h | 1 + host/include/i386/host/crypto/aes-round.h | 152 ++++++++++++++++++++ host/include/x86_64/host/crypto/aes-round.h | 1 + util/cpuinfo-i386.c | 3 + 4 files changed, 157 insertions(+) create mode 100644 host/include/i386/host/crypto/aes-round.h create mode 100644 host/include/x86_64/host/crypto/aes-round.h diff --git a/host/include/i386/host/cpuinfo.h b/host/include/i386/host/cpui= nfo.h index a6537123cf..073d0a426f 100644 --- a/host/include/i386/host/cpuinfo.h +++ b/host/include/i386/host/cpuinfo.h @@ -26,6 +26,7 @@ #define CPUINFO_AVX512VBMI2 (1u << 15) #define CPUINFO_ATOMIC_VMOVDQA (1u << 16) #define CPUINFO_ATOMIC_VMOVDQU (1u << 17) +#define CPUINFO_AES (1u << 18) =20 /* Initialized with a constructor. */ extern unsigned cpuinfo; diff --git a/host/include/i386/host/crypto/aes-round.h b/host/include/i386/= host/crypto/aes-round.h new file mode 100644 index 0000000000..59a64130f7 --- /dev/null +++ b/host/include/i386/host/crypto/aes-round.h @@ -0,0 +1,152 @@ +/* + * x86 specific aes acceleration. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef X86_HOST_CRYPTO_AES_ROUND_H +#define X86_HOST_CRYPTO_AES_ROUND_H + +#include "host/cpuinfo.h" +#include + +#if defined(__AES__) && defined(__SSSE3__) +# define HAVE_AES_ACCEL true +# define ATTR_AES_ACCEL +#else +# define HAVE_AES_ACCEL likely(cpuinfo & CPUINFO_AES) +# define ATTR_AES_ACCEL __attribute__((target("aes,ssse3"))) +#endif + +static inline __m128i ATTR_AES_ACCEL +aes_accel_bswap(__m128i x) +{ + return _mm_shuffle_epi8(x, _mm_set_epi8(0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15)); +} + +static inline void ATTR_AES_ACCEL +aesenc_MC_accel(AESState *ret, const AESState *st, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i z =3D _mm_setzero_si128(); + + if (be) { + t =3D aes_accel_bswap(t); + t =3D _mm_aesdeclast_si128(t, z); + t =3D _mm_aesenc_si128(t, z); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesdeclast_si128(t, z); + t =3D _mm_aesenc_si128(t, z); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesenc_SB_SR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i k =3D (__m128i)rk->v; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D _mm_aesenclast_si128(t, k); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesenclast_si128(t, k); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesenc_SB_SR_MC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i k =3D (__m128i)rk->v; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D _mm_aesenc_si128(t, k); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesenc_si128(t, k); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_IMC_accel(AESState *ret, const AESState *st, bool be) +{ + __m128i t =3D (__m128i)st->v; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D _mm_aesimc_si128(t); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesimc_si128(t); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i k =3D (__m128i)rk->v; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D _mm_aesdeclast_si128(t, k); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesdeclast_si128(t, k); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_AK_IMC_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i k =3D (__m128i)rk->v; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D _mm_aesdeclast_si128(t, k); + t =3D _mm_aesimc_si128(t); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesdeclast_si128(t, k); + t =3D _mm_aesimc_si128(t); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_IMC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + __m128i t =3D (__m128i)st->v; + __m128i k =3D (__m128i)rk->v; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D _mm_aesdec_si128(t, k); + t =3D aes_accel_bswap(t); + } else { + t =3D _mm_aesdec_si128(t, k); + } + ret->v =3D (AESStateVec)t; +} + +#endif /* X86_HOST_CRYPTO_AES_ROUND_H */ diff --git a/host/include/x86_64/host/crypto/aes-round.h b/host/include/x86= _64/host/crypto/aes-round.h new file mode 100644 index 0000000000..2773cc9f10 --- /dev/null +++ b/host/include/x86_64/host/crypto/aes-round.h @@ -0,0 +1 @@ +#include "host/include/i386/host/crypto/aes-round.h" diff --git a/util/cpuinfo-i386.c b/util/cpuinfo-i386.c index ab6143d9e7..3a7b7e0ad1 100644 --- a/util/cpuinfo-i386.c +++ b/util/cpuinfo-i386.c @@ -40,6 +40,9 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) info |=3D (c & bit_MOVBE ? CPUINFO_MOVBE : 0); info |=3D (c & bit_POPCNT ? CPUINFO_POPCNT : 0); =20 + /* Our AES support requires PSHUFB as well. */ + info |=3D ((c & bit_AES) && (c & bit_SSSE3) ? CPUINFO_AES : 0); + /* For AVX features, we must check available and usable. */ if ((c & bit_AVX) && (c & bit_OSXSAVE)) { unsigned bv =3D xgetbv_low(0); --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927556; cv=none; d=zohomail.com; s=zohoarc; b=jZ+v1FW9v9d/iY4zUgcPE5Lqo54WcwGQ5jJCcbgOnTvF00POaMyK+2F0yJXFOR5jbVX5s1uAhBbnWr/+LrjjlwIsS7oErDOrO215DgACq5LItwb4HcQkxnO6HxqTt5io3VejvKG2pyH4fdZUqxQYO289SUKvgBA1nYPVQIibYBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=DSsDkUGqyp/kjMhO5h8E0rZM/CVkY4Y1+FTu2yERoFu/ku89ZqqKLJJRciuvGCqKjOfYF7gTKKnroMPoM8qxPtRmPwpupvkFCgGTHqF80jjVCgsiGvXFzt+GBryqIgrPiAYGwjNrfaQ/vZ+DrzwmL5VWxvPHgeKjg4mZBUaJ7Pc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927556988673.2541793453679; Sun, 9 Jul 2023 11:32:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAZ-0008MY-IN; Sun, 09 Jul 2023 14:30:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAV-0008K1-LG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:59 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAU-0000II-6E for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:29:59 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbc12181b6so42003415e9.2 for ; Sun, 09 Jul 2023 11:29:57 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927397; x=1691519397; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=G7JVMXGbVm27XstsdKY88WV2VaZmw1oClLJbvPs0pIT5I5VXUNVcRCeGkYnSEtJP4y 624IzqfGLv1tZqrqwVjHnSRk0gM5FaivT8bL/V4CIO8bY74jz4geJeqvF9Zf7AFdvWpJ myOnzv26bbZJPIVYLqq79i3JD0Vr9ehuRWDRM7T3xEsUTYlE9Yh/+s4f83BqRkeG9VME ZtP9FsKf/paqyj4lJLn09CpXuUfmBnEwCL+KOwm5HvgI/naMYohxcY8ZwAiLsXa4j7xc Np8Y9JD+AyjbiUqe/BZRljW9mgNQuqUQ6GMZ85abnJi1hKmfy/sxHbNyAjLt2R9Witbt JQNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927397; x=1691519397; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gQ2Bxu/rilowTJXaihrKCWkhFlHMy8pQmQA827CvuAY=; b=ehcRJ8BO7lJQ66IjlGMZZE14J+Wf+tpl/+JBci6F4l83xTZe2u/5psgFM6/Gc+bI3V vOWWYIrSrvq3Wau+t43SN/+UkYOOGAiDxCCsjzIEVGw2GsORmc1NV8Z1ftLjEtjR049v yIWwZJW9LUKHPbKPLwy8m4KmFwiduiwcEissacs9+zZy64tpX/3eIB8L+48cT0aQmcRf W8T0Ekymp/i7FJn70OqFdHSn96ylHPIx7+B6lYfTzpXzYx2+iuJiRi9R5UJ0YrpEM73X Qbh3J2tevkvYYDQTcjKOSPuo1TQvxb/sbgqJ7b4QSIZJfQfbsY/sT/49xEs1rw9km5BN PmHQ== X-Gm-Message-State: ABy/qLYKP9f4AQ1+NGYywpJ/aVPUcOqISSKBU+TZNRP1384SVaPMpHIs E9TdGLf3Qk+i9Z5kyzp+tGkIR354K45TdoMfj4fMoA== X-Google-Smtp-Source: APBJJlEFeqzaYXjM0zV7G6kWhLfNZE0Py74Yk82rEOCZ6f2hI2d+HXyvrUsO27C4dsLeItbw7SpeIw== X-Received: by 2002:a05:600c:2143:b0:3fb:e58c:7758 with SMTP id v3-20020a05600c214300b003fbe58c7758mr9039174wml.3.1688927397007; Sun, 09 Jul 2023 11:29:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 12/45] linux-user: Use abi_short not short in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:36 +0100 Message-Id: <20230709182934.309468-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927557611100005 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 21ca03b0f4..9dc41828cf 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -702,8 +702,8 @@ typedef struct target_siginfo { =20 struct target_pollfd { abi_int fd; /* file descriptor */ - short events; /* requested events */ - short revents; /* returned events */ + abi_short events; /* requested events */ + abi_short revents; /* returned events */ }; =20 /* virtual terminal ioctls */ @@ -1480,7 +1480,7 @@ struct target_stat { abi_ushort st_dev; abi_ulong st_ino; abi_ushort st_mode; - short st_nlink; + abi_short st_nlink; abi_ushort st_uid; abi_ushort st_gid; abi_ushort st_rdev; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927583; cv=none; d=zohomail.com; s=zohoarc; b=BMKW/WHrbnsAmOwj0UnkZ9u3Uz4thqQrnjYxKQb3+aWva8+atTZra2vdILwXOeYe0zTDqPjFN/6QeFle2NqsrraFgu+oGdipJAzjywsvWczXLJGGO9fW0aJJBotrMq7MMcqcs2v4//mA1HeY8mfh4DfGOhXYsZm5HGkKtvvRAVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927583; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=T07lnkgPtO9LjVpTniL2XBYaIS0AHGlP6Q/4SWLnEXt4g8BbR4MBGXDaowHgBQJYn89nLKEY9IGpaogt7kS5pwV/5hrQ9v34KXno7+Lu0yomqMftf3/OMyXKiRfHj3F1S6D4gsUFAor68fGub4s+IP38IoN1SKp2pBqSQSgmg5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927583789396.7150259853082; Sun, 9 Jul 2023 11:33:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAc-0008OY-5l; Sun, 09 Jul 2023 14:30:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAX-0008LD-EP for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:01 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAV-0000Ik-Tj for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:01 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fc03aa6e04so16329525e9.2 for ; Sun, 09 Jul 2023 11:29:59 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927398; x=1691519398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=XSHy+Ohal8jIDY3VO1YwT5GP9nQOkhLf07/YqI14GALszfjELoi/tHKdegFdwRzctb rgylzwE+w35s7HjyLt1+zGbEOqRjDZayUBeawtcKJAtjVORY7KQ1MD5aeA4LkXuz6iwy Bf2+WG7dc44pBVxZqwU/u3TLbyAHhQi7FoQTaCiYxpk7fPB/ZAOD55y/COlI+4lpDMxp sTJHHi5CZigeIMNPEGdY3h4H30xXy0b0du2kWpJFYuPJZa33BnHOXN3Pbvln6enFpnac rJTkv47zWvV93ZLUhdbeYkIpn5FwvICvA4v3CwuYMzyhRYyhZPjhSxhL29cPVE/VHL03 7Rmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927398; x=1691519398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NM1xXL81EtFD9ExbvPk3EQKQbkl//TA55SFLIHfjSWw=; b=D0roCjD41P4/7UggHYKY/eT7/lGLQpXCZrkwZpudkNqRfWu7qwWhWrrs5543D8E4Uu iWTBxf3PlSwntGuCoad4aatgwIeQRCIFxMTWREUvfvZQOxOd+UTgpd3q85hHIx4VLSR/ aLLeSTdAmmz+pPbvILizEhbTaOwNO0qK1+Tp1VMCsH20cVvIKOVoj/gRbZKc7xl7zQmW XGLWnxD8TNnfN2cer/SQzAczXWTGv0jdpmZ0OxZumZm0uXWaxnLepMWbvIIBzrmlDxa1 DzCzGWyIpqKoSOW8JOUxhD3LHgBgNe1pDGEo4i8nWHa9v8fStUNFCffx0p/w9bezvLRv 5WSw== X-Gm-Message-State: ABy/qLZTnSo1m4biJ67EWJn0tvTAyaDL2Woji6Ga0kn+guvQQFPce1S0 w206t2enUgjyNCAGw9aI7vuzaoQ70DDCVpBblTv6eA== X-Google-Smtp-Source: APBJJlE3ArNpOTNHCUKyDNSu1LN36Ly7RJMcCxFxASHiPcB+aQeCB5d1JgmP4EsIcUEFqBz+l5IzFQ== X-Received: by 2002:a05:600c:3786:b0:3fb:b890:128b with SMTP id o6-20020a05600c378600b003fbb890128bmr8767337wmr.27.1688927398570; Sun, 09 Jul 2023 11:29:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 13/45] linux-user: Use abi_uint not unsigned in syscall_defs.h Date: Sun, 9 Jul 2023 19:28:38 +0100 Message-Id: <20230709182934.309468-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927585710100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- linux-user/syscall_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 9dc41828cf..c8ffb4f785 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1776,14 +1776,14 @@ struct target_stat { =20 #define TARGET_STAT_HAVE_NSEC struct target_stat { - unsigned st_dev; + abi_uint st_dev; abi_long st_pad1[3]; /* Reserved for network id */ abi_ulong st_ino; abi_uint st_mode; abi_uint st_nlink; abi_int st_uid; abi_int st_gid; - unsigned st_rdev; + abi_uint st_rdev; abi_long st_pad2[2]; abi_long st_size; abi_long st_pad3; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927629; cv=none; d=zohomail.com; s=zohoarc; b=DU9HZwS/4E54592tgIfuF9pGjCSudJYhr3TZ5wUOLbiWPQBWI3yvYw9uAdnKQFMaIhnFoKSDERDR+tOf3C1H3wBQiYVUCzJk1LvITpkaFITKkG9drKdmwKe4sFOnmYa0UevnbjjYi5oAug9fE8PyRTOUpY0BMpKV++A19OSS81g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927629; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rQM76z4rVFfGd1Monlw4rqjrIeX1bgxOaNzHCQOg/vo=; b=iWudeqiX6pwbkRP3CPZwZOf7DoZZ73rDVI/ADYD6ZEp1LX2nAVbCGhircQCOQetNndyTpd9xs+6kqwfB3ILkSXE5KVbC7tLpkakBfXJ1BOV60pgesFxefeA0MoHMfmHAhmBv1TCvf3l/E9RGvZiAmg3iU2ALEGeKWNQvpplI1QA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927629676861.3275146920743; Sun, 9 Jul 2023 11:33:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAX-0008Lm-UT; Sun, 09 Jul 2023 14:30:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAW-0008L2-UF for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAV-0000IX-04 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:00 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-31441bc0092so3559496f8f.1 for ; Sun, 09 Jul 2023 11:29:58 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927398; x=1691519398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rQM76z4rVFfGd1Monlw4rqjrIeX1bgxOaNzHCQOg/vo=; b=z0dqgVEmhoBXv7TkTVeLPRUg/0oi9X/kPBMurf16nVj5zCNu9IIYlswS5pf/e58sgh qYJW7/+f1dEmMbaiN587XgdloQC8yNZ3JqFhIs77UsQ/2EnDQJWgomjJWJk7vhPcZPiT iKlEYS/DSSg5kBBbQt7GW6hN0wgohXN0yitEa+KnFTbyuX6kDIJuvI8zhEaIGXGuleHY EFJ+GxWHktDJ6INHSBPzGJ1OhXG0m+yWh1jNudsN8tUXcuEAkB421dSEmauagaUB+r/R UYlEa4H+wFIPMOucLxPIJ9wtcrShU+xa60hBeQLZmNAz2JrBa3NBqTnw0tw9wn9vbRfg c3lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927398; x=1691519398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rQM76z4rVFfGd1Monlw4rqjrIeX1bgxOaNzHCQOg/vo=; b=EeW/xF/wK/AbuWFABzvELG3u3gtkTjq0QA5uAIuNQQko672sjLtlaDi3cV5Cyolut/ H7L7rTcHnhn0ztaF69abSLCEx/OWjqYvw2hWVcH141gMYRY0s+pmd1smkv/rYiqQzTaQ QlNSliqGoOa4jnrFkqnTPxSNDchuJuDzbMMutZh47WChuTEtVu3hk4HQ+whxeYigZ/q1 rXZT502tcZCJqKMZsJzaPljObBGZjpV5rKnBercAsDBK5SET5WiOuBFoc/4JXHOy7cl6 SinihAGjLUKf8NS+HgFryL7wJQcA0LYpaKN8NHhTf50TdBW7qi2QV/CPqD+pxFrVKXGi C6mQ== X-Gm-Message-State: ABy/qLa30ktLwFkxxMd7ylYRZaqgukqJv4cA6NVuzgxcKe4vRgvqamSW pHWfEurtpGGs7+J4sUyjM3S4NgvEaEmRSkbBPqr9Sg== X-Google-Smtp-Source: APBJJlHLfNi6hgNAdSICVW6dOUyzj9i1NVDNi40+IjvWQXYJI7li3I150G9Sd/DWwRlDYV+rPDvb9g== X-Received: by 2002:adf:f108:0:b0:313:eaf5:515 with SMTP id r8-20020adff108000000b00313eaf50515mr7578018wro.6.1688927397720; Sun, 09 Jul 2023 11:29:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PULL 13/37] host/include/aarch64: Implement aes-round.h Date: Sun, 9 Jul 2023 19:28:37 +0100 Message-Id: <20230709182934.309468-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927629885100009 Content-Type: text/plain; charset="utf-8" Detect AES in cpuinfo; implement the accel hooks. Signed-off-by: Richard Henderson --- meson.build | 9 + host/include/aarch64/host/cpuinfo.h | 1 + host/include/aarch64/host/crypto/aes-round.h | 205 +++++++++++++++++++ util/cpuinfo-aarch64.c | 2 + 4 files changed, 217 insertions(+) create mode 100644 host/include/aarch64/host/crypto/aes-round.h diff --git a/meson.build b/meson.build index c77faa0b6e..58413d44a5 100644 --- a/meson.build +++ b/meson.build @@ -2665,6 +2665,15 @@ config_host_data.set('CONFIG_AVX512BW_OPT', get_opti= on('avx512bw') \ int main(int argc, char *argv[]) { return bar(argv[0]); } '''), error_message: 'AVX512BW not available').allowed()) =20 +# For both AArch64 and AArch32, detect if builtins are available. +config_host_data.set('CONFIG_ARM_AES_BUILTIN', cc.compiles(''' + #include + #ifndef __ARM_FEATURE_AES + __attribute__((target("+crypto"))) + #endif + void foo(uint8x16_t *p) { *p =3D vaesmcq_u8(*p); } + ''')) + have_pvrdma =3D get_option('pvrdma') \ .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics libra= ries') \ .require(cc.compiles(gnu_source_prefix + ''' diff --git a/host/include/aarch64/host/cpuinfo.h b/host/include/aarch64/hos= t/cpuinfo.h index 82227890b4..05feeb4f43 100644 --- a/host/include/aarch64/host/cpuinfo.h +++ b/host/include/aarch64/host/cpuinfo.h @@ -9,6 +9,7 @@ #define CPUINFO_ALWAYS (1u << 0) /* so cpuinfo is nonzero */ #define CPUINFO_LSE (1u << 1) #define CPUINFO_LSE2 (1u << 2) +#define CPUINFO_AES (1u << 3) =20 /* Initialized with a constructor. */ extern unsigned cpuinfo; diff --git a/host/include/aarch64/host/crypto/aes-round.h b/host/include/aa= rch64/host/crypto/aes-round.h new file mode 100644 index 0000000000..8b5f88d50c --- /dev/null +++ b/host/include/aarch64/host/crypto/aes-round.h @@ -0,0 +1,205 @@ +/* + * AArch64 specific aes acceleration. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef AARCH64_HOST_CRYPTO_AES_ROUND_H +#define AARCH64_HOST_CRYPTO_AES_ROUND_H + +#include "host/cpuinfo.h" +#include + +#ifdef __ARM_FEATURE_AES +# define HAVE_AES_ACCEL true +#else +# define HAVE_AES_ACCEL likely(cpuinfo & CPUINFO_AES) +#endif +#if !defined(__ARM_FEATURE_AES) && defined(CONFIG_ARM_AES_BUILTIN) +# define ATTR_AES_ACCEL __attribute__((target("+crypto"))) +#else +# define ATTR_AES_ACCEL +#endif + +static inline uint8x16_t aes_accel_bswap(uint8x16_t x) +{ + return vqtbl1q_u8(x, (uint8x16_t){ 15, 14, 13, 12, 11, 10, 9, 8, + 7, 6, 5, 4, 3, 2, 1, 0, }); +} + +#ifdef CONFIG_ARM_AES_BUILTIN +# define aes_accel_aesd vaesdq_u8 +# define aes_accel_aese vaeseq_u8 +# define aes_accel_aesmc vaesmcq_u8 +# define aes_accel_aesimc vaesimcq_u8 +# define aes_accel_aesd_imc(S, K) vaesimcq_u8(vaesdq_u8(S, K)) +# define aes_accel_aese_mc(S, K) vaesmcq_u8(vaeseq_u8(S, K)) +#else +static inline uint8x16_t aes_accel_aesd(uint8x16_t d, uint8x16_t k) +{ + asm(".arch_extension aes\n\t" + "aesd %0.16b, %1.16b" : "+w"(d) : "w"(k)); + return d; +} + +static inline uint8x16_t aes_accel_aese(uint8x16_t d, uint8x16_t k) +{ + asm(".arch_extension aes\n\t" + "aese %0.16b, %1.16b" : "+w"(d) : "w"(k)); + return d; +} + +static inline uint8x16_t aes_accel_aesmc(uint8x16_t d) +{ + asm(".arch_extension aes\n\t" + "aesmc %0.16b, %1.16b" : "=3Dw"(d) : "w"(d)); + return d; +} + +static inline uint8x16_t aes_accel_aesimc(uint8x16_t d) +{ + asm(".arch_extension aes\n\t" + "aesimc %0.16b, %1.16b" : "=3Dw"(d) : "w"(d)); + return d; +} + +/* Most CPUs fuse AESD+AESIMC in the execution pipeline. */ +static inline uint8x16_t aes_accel_aesd_imc(uint8x16_t d, uint8x16_t k) +{ + asm(".arch_extension aes\n\t" + "aesd %0.16b, %1.16b\n\t" + "aesimc %0.16b, %0.16b" : "+w"(d) : "w"(k)); + return d; +} + +/* Most CPUs fuse AESE+AESMC in the execution pipeline. */ +static inline uint8x16_t aes_accel_aese_mc(uint8x16_t d, uint8x16_t k) +{ + asm(".arch_extension aes\n\t" + "aese %0.16b, %1.16b\n\t" + "aesmc %0.16b, %0.16b" : "+w"(d) : "w"(k)); + return d; +} +#endif /* CONFIG_ARM_AES_BUILTIN */ + +static inline void ATTR_AES_ACCEL +aesenc_MC_accel(AESState *ret, const AESState *st, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aesmc(t); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aesmc(t); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesenc_SB_SR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + uint8x16_t z =3D { }; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aese(t, z); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aese(t, z); + } + ret->v =3D (AESStateVec)t ^ rk->v; +} + +static inline void ATTR_AES_ACCEL +aesenc_SB_SR_MC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + uint8x16_t z =3D { }; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aese_mc(t, z); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aese_mc(t, z); + } + ret->v =3D (AESStateVec)t ^ rk->v; +} + +static inline void ATTR_AES_ACCEL +aesdec_IMC_accel(AESState *ret, const AESState *st, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aesimc(t); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aesimc(t); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + uint8x16_t z =3D { }; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aesd(t, z); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aesd(t, z); + } + ret->v =3D (AESStateVec)t ^ rk->v; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_AK_IMC_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + uint8x16_t k =3D (uint8x16_t)rk->v; + uint8x16_t z =3D { }; + + if (be) { + t =3D aes_accel_bswap(t); + k =3D aes_accel_bswap(k); + t =3D aes_accel_aesd(t, z); + t ^=3D k; + t =3D aes_accel_aesimc(t); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aesd(t, z); + t ^=3D k; + t =3D aes_accel_aesimc(t); + } + ret->v =3D (AESStateVec)t; +} + +static inline void ATTR_AES_ACCEL +aesdec_ISB_ISR_IMC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + uint8x16_t t =3D (uint8x16_t)st->v; + uint8x16_t z =3D { }; + + if (be) { + t =3D aes_accel_bswap(t); + t =3D aes_accel_aesd_imc(t, z); + t =3D aes_accel_bswap(t); + } else { + t =3D aes_accel_aesd_imc(t, z); + } + ret->v =3D (AESStateVec)t ^ rk->v; +} + +#endif /* AARCH64_HOST_CRYPTO_AES_ROUND_H */ diff --git a/util/cpuinfo-aarch64.c b/util/cpuinfo-aarch64.c index f99acb7884..ababc39550 100644 --- a/util/cpuinfo-aarch64.c +++ b/util/cpuinfo-aarch64.c @@ -56,10 +56,12 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) unsigned long hwcap =3D qemu_getauxval(AT_HWCAP); info |=3D (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0); info |=3D (hwcap & HWCAP_USCAT ? CPUINFO_LSE2 : 0); + info |=3D (hwcap & HWCAP_AES ? CPUINFO_AES: 0); #endif #ifdef CONFIG_DARWIN info |=3D sysctl_for_bool("hw.optional.arm.FEAT_LSE") * CPUINFO_LSE; info |=3D sysctl_for_bool("hw.optional.arm.FEAT_LSE2") * CPUINFO_LSE2; + info |=3D sysctl_for_bool("hw.optional.arm.FEAT_AES") * CPUINFO_AES; #endif =20 cpuinfo =3D info; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927529; cv=none; d=zohomail.com; s=zohoarc; b=AG0Cj7+n8JyKFvgO3XqSWoeL0tjYAl+JDRt8bGFsjzd5pGASMH1U47OcpDYQw0HoqhSX5QUoz2pUaQ5XOsaFlut/5OW/T8XlDEkL7FLtRhFOd6poU5M11v8ZanxLgbgZwTfrvu1DkKd7TfdPFu+6VGiXwf1eavyFRnWq7QFSNtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927529; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=XpJD99uPq5ufid7CUk4amSc3Yzio6Sb0seqRBfU+t22ApHWXUnlBwX/rKjlrBLwe5Vlts+OMFa0mNNZjiWQ59uyj8my1gpT5QeQ3elijzw6Wj2oK+O42npGqnFPCROk6TMTY4dtsAsJsX7cNFsKNm3K7fUWn/s9jDap/DihnQiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927529903615.7809611095538; Sun, 9 Jul 2023 11:32:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAf-0008Qp-KL; Sun, 09 Jul 2023 14:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAc-0008Ol-1W for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:06 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAX-0000JC-AU for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:05 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso43742245e9.2 for ; Sun, 09 Jul 2023 11:30:00 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927400; x=1691519400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=RqvWPhZswLWUrpEQGmY7oJWN9eiH5da86YPgh1OZXD4H6go/r+/GGnofRVrrE0jHlz tYq42UkMFZ9qWTybgSr2PO+8aySdpQNBwaHQZNlKkC/zWJtXvHai85xCVXuqKseh18yp T8VYVmF4GbkFruL4+5qcna8QsiUeJqfV72JkocjSbjnC2nUJDx+gPNWY2rqS31l6vFqP WvsoQ3C8Qciwlp1DvNPwTNn+z1Ekn1yBlVvpf6mJ+hQjUFVHAX//K3AivhOW1D1AOMBV vdHovHt0Jvu8uqAlgNRO4mQsX8FpWXupUmakU3/hPaDf/qbLndWIUmSQdixYhLzuhNP3 RiUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927400; x=1691519400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TsEvG+VWvCxR8wzqDIyWaXPHqC8uQbp4ZRAeyYSrQhw=; b=D/XdSSdOoWsHepmKn/gI5FiYswavKlLdf7sTW1Ze2k6MI8dQkKxX6NoZxKENL3RmSS jMVnNug7e6IhrAmMkFhefOeBMezihnb0N5vm3YrzP5pFE8oKiJ1yB+YRrXJJnMKTXMkq Ib0OhAHca3zxkPlPnJyQ1qCCg0Yy8vvwoywngP9G+l8DxNfXSYndSkuHoH9yZkIn75Hb cnDpkr4q0EIxHqWAsTiWSjPthNQm9ixnJlefhRn3slaZy/UYdNNXlOvHn9O+yBq1FTly M3JRGRzDgjuGd8qugxlCmUtW8dynbjag1KFLiJadkD2YOKpkoztE+cMEJp8Mtv6Ey+Ik 6EBA== X-Gm-Message-State: ABy/qLYr166DLkPOEIwnOayuFVRXLQBfaDCL7rtXIwIPpAnviqp1pmHJ PlpWWDAYUwB+EBghtEJDrrcDZ/ZVJ77j2lrKDeCEPg== X-Google-Smtp-Source: APBJJlEuShfZlLevnT+ST3DTQuaL+ait8buR+3rq5JRbCmjeEWFiQvhEJ0XkPpqAuwCzALsGqLUWXA== X-Received: by 2002:a05:600c:29a:b0:3f9:b8df:26ae with SMTP id 26-20020a05600c029a00b003f9b8df26aemr9850639wmk.34.1688927400052; Sun, 09 Jul 2023 11:30:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 14/45] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze Date: Sun, 9 Jul 2023 19:28:40 +0100 Message-Id: <20230709182934.309468-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927531366100003 Content-Type: text/plain; charset="utf-8" Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits. Signed-off-by: Richard Henderson --- include/exec/user/abitypes.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h index 743b8bb9ea..beba0a48c7 100644 --- a/include/exec/user/abitypes.h +++ b/include/exec/user/abitypes.h @@ -15,7 +15,9 @@ #define ABI_LLONG_ALIGNMENT 2 #endif =20 -#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH= 4) +#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ + || defined(TARGET_SH4) \ + || defined(TARGET_MICROBLAZE) #define ABI_LLONG_ALIGNMENT 4 #endif =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927867; cv=none; d=zohomail.com; s=zohoarc; b=PTqVGZpKyK+MXJO+Aed6UBRw3+e/x1X85Zm61oNQw79jgpfKpfvvbKXN6zJLdpA2oLqUpzea/FvfrjrQG/y7lU1aX0kLS+2K1jMECFBt0c+QsCNM3g/RG7yeEfbgT1r95H5Nbtt8G3LGnLlAY6MmMTZMDbvhmt2Wu+a9oyFSJPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927867; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tquFfTdtw0sVSZbN7ZybV+/6BBhwf96oST0EwHIj8d8=; b=l276wICg2YaO0O35QUG5ljWhUQj3HRiK1I2dz8Y+2HudYG/WkkkRy7puXgAWiaIrB5kUMxVVTA/T7/G+MhNO0q09nUPkHEwoh1PN+mnSK6MNZuAEjOD9+Hc9ckG2YpNqOfWX23s3Y7YEk8Fp4jHkbexq/kmbXzgPTE/DDUlRNww= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927867986832.3110667937378; Sun, 9 Jul 2023 11:37:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAd-0008QZ-RW; Sun, 09 Jul 2023 14:30:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAZ-0008Me-MC for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:03 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAW-0000J5-NO for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:03 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3141fa31c2bso3774541f8f.2 for ; Sun, 09 Jul 2023 11:30:00 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927399; x=1691519399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tquFfTdtw0sVSZbN7ZybV+/6BBhwf96oST0EwHIj8d8=; b=Ty1GJeCnXoWbk24HmHQ3kaOHMjdo/TqGuBcMtQma2lUSj4vOnlxA49QOqzg6R7HKkH RIwTSNbopnXPwKRNa4NoxoFyJKP46wuz+ATKZ1ScGK7ckM58nMBKzeqaVZGGssnmN6Oa VW+3E5OML0DZrdz3XrDTSul2pRMhigDqxF4a0OHCiuBGLvgiTu59ZdYO+J1L9Wscli4v d3q6MfoxU7DCaDtrYfX7c8wRlmpiftqy67yUj+M4WQcHndOA30B7yT8aZMYI/JwAeY+E spmSFKzmOe4jnDzZEGxAnOgbp4LS1lHkvtXGd2jSZROL3o0ZTPYP6Tplt5WOrZu7Q7BB NGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927399; x=1691519399; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tquFfTdtw0sVSZbN7ZybV+/6BBhwf96oST0EwHIj8d8=; b=OVs0MswPmfWf9d/Eec+SVFVjD2OxnCulBmhS2H78kdHSxbmIuYYR+lcwFgO8DgFxeO nmGOraLw0sW107XiOsSbmDAnzcRvjIgzLG9tJmgJY6V/+oMyZqTkTJrNK1Ou/ZRqhqnN fLk+FSYJoRTGgSZCiKUeSbwTFZAmoPab0z3eH1eylYQICsoPxlxnpZsEswQdjWlBJhiD mE7DhW8ygTmU01sizPSYkeL1PsMkiIPkZ3kx8YdZqB4hUdwTtG62SrgIUbMH9QicCkdf NyJIhlhkoLd0JgnJ/mhYKfOU52OA4N7Ra1gkNRdyH3/41dy2iW3TaheCS4fccn5PN08W ykUQ== X-Gm-Message-State: ABy/qLY9xne+6iaQHS7O2Khby1IQ8DHEjlXO1kvKKuDcFTuP44svOvkr qsNuq9p2+Z3THpeRnM9G+/O2D+rCOpI7DwaAvJ32/A== X-Google-Smtp-Source: APBJJlEebitohvqVoYA/940ALM7N+0vGanTrOYe+GXQ4csDpO1HGj2yIiPCtPCO4EtkM6UZ7KbruvA== X-Received: by 2002:adf:f40e:0:b0:313:ec5d:95b5 with SMTP id g14-20020adff40e000000b00313ec5d95b5mr9850171wro.60.1688927399363; Sun, 09 Jul 2023 11:29:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Daniel Henrique Barboza Subject: [PULL 14/37] host/include/ppc: Implement aes-round.h Date: Sun, 9 Jul 2023 19:28:39 +0100 Message-Id: <20230709182934.309468-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927869337100001 Content-Type: text/plain; charset="utf-8" Detect CRYPTO in cpuinfo; implement the accel hooks. Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- host/include/ppc/host/cpuinfo.h | 1 + host/include/ppc/host/crypto/aes-round.h | 182 +++++++++++++++++++++ host/include/ppc64/host/crypto/aes-round.h | 1 + util/cpuinfo-ppc.c | 8 + 4 files changed, 192 insertions(+) create mode 100644 host/include/ppc/host/crypto/aes-round.h create mode 100644 host/include/ppc64/host/crypto/aes-round.h diff --git a/host/include/ppc/host/cpuinfo.h b/host/include/ppc/host/cpuinf= o.h index df11e8d417..29ee7f9ef8 100644 --- a/host/include/ppc/host/cpuinfo.h +++ b/host/include/ppc/host/cpuinfo.h @@ -16,6 +16,7 @@ #define CPUINFO_ISEL (1u << 5) #define CPUINFO_ALTIVEC (1u << 6) #define CPUINFO_VSX (1u << 7) +#define CPUINFO_CRYPTO (1u << 8) =20 /* Initialized with a constructor. */ extern unsigned cpuinfo; diff --git a/host/include/ppc/host/crypto/aes-round.h b/host/include/ppc/ho= st/crypto/aes-round.h new file mode 100644 index 0000000000..8062d2a537 --- /dev/null +++ b/host/include/ppc/host/crypto/aes-round.h @@ -0,0 +1,182 @@ +/* + * Power v2.07 specific aes acceleration. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PPC_HOST_CRYPTO_AES_ROUND_H +#define PPC_HOST_CRYPTO_AES_ROUND_H + +#ifdef __ALTIVEC__ +#include "host/cpuinfo.h" + +#ifdef __CRYPTO__ +# define HAVE_AES_ACCEL true +#else +# define HAVE_AES_ACCEL likely(cpuinfo & CPUINFO_CRYPTO) +#endif +#define ATTR_AES_ACCEL + +/* + * While there is , both gcc and clang "aid" with the + * endianness issues in different ways. Just use inline asm instead. + */ + +/* Bytes in memory are host-endian; bytes in register are @be. */ +static inline AESStateVec aes_accel_ld(const AESState *p, bool be) +{ + AESStateVec r; + + if (be) { + asm("lvx %0, 0, %1" : "=3Dv"(r) : "r"(p), "m"(*p)); + } else if (HOST_BIG_ENDIAN) { + AESStateVec rev =3D { + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, + }; + asm("lvx %0, 0, %1\n\t" + "vperm %0, %0, %0, %2" + : "=3Dv"(r) : "r"(p), "v"(rev), "m"(*p)); + } else { +#ifdef __POWER9_VECTOR__ + asm("lxvb16x %x0, 0, %1" : "=3Dv"(r) : "r"(p), "m"(*p)); +#else + asm("lxvd2x %x0, 0, %1\n\t" + "xxpermdi %x0, %x0, %x0, 2" + : "=3Dv"(r) : "r"(p), "m"(*p)); +#endif + } + return r; +} + +static void aes_accel_st(AESState *p, AESStateVec r, bool be) +{ + if (be) { + asm("stvx %1, 0, %2" : "=3Dm"(*p) : "v"(r), "r"(p)); + } else if (HOST_BIG_ENDIAN) { + AESStateVec rev =3D { + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, + }; + asm("vperm %1, %1, %1, %2\n\t" + "stvx %1, 0, %3" + : "=3Dm"(*p), "+v"(r) : "v"(rev), "r"(p)); + } else { +#ifdef __POWER9_VECTOR__ + asm("stxvb16x %x1, 0, %2" : "=3Dm"(*p) : "v"(r), "r"(p)); +#else + asm("xxpermdi %x1, %x1, %x1, 2\n\t" + "stxvd2x %x1, 0, %2" + : "=3Dm"(*p), "+v"(r) : "r"(p)); +#endif + } +} + +static inline AESStateVec aes_accel_vcipher(AESStateVec d, AESStateVec k) +{ + asm("vcipher %0, %0, %1" : "+v"(d) : "v"(k)); + return d; +} + +static inline AESStateVec aes_accel_vncipher(AESStateVec d, AESStateVec k) +{ + asm("vncipher %0, %0, %1" : "+v"(d) : "v"(k)); + return d; +} + +static inline AESStateVec aes_accel_vcipherlast(AESStateVec d, AESStateVec= k) +{ + asm("vcipherlast %0, %0, %1" : "+v"(d) : "v"(k)); + return d; +} + +static inline AESStateVec aes_accel_vncipherlast(AESStateVec d, AESStateVe= c k) +{ + asm("vncipherlast %0, %0, %1" : "+v"(d) : "v"(k)); + return d; +} + +static inline void +aesenc_MC_accel(AESState *ret, const AESState *st, bool be) +{ + AESStateVec t, z =3D { }; + + t =3D aes_accel_ld(st, be); + t =3D aes_accel_vncipherlast(t, z); + t =3D aes_accel_vcipher(t, z); + aes_accel_st(ret, t, be); +} + +static inline void +aesenc_SB_SR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + AESStateVec t, k; + + t =3D aes_accel_ld(st, be); + k =3D aes_accel_ld(rk, be); + t =3D aes_accel_vcipherlast(t, k); + aes_accel_st(ret, t, be); +} + +static inline void +aesenc_SB_SR_MC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + AESStateVec t, k; + + t =3D aes_accel_ld(st, be); + k =3D aes_accel_ld(rk, be); + t =3D aes_accel_vcipher(t, k); + aes_accel_st(ret, t, be); +} + +static inline void +aesdec_IMC_accel(AESState *ret, const AESState *st, bool be) +{ + AESStateVec t, z =3D { }; + + t =3D aes_accel_ld(st, be); + t =3D aes_accel_vcipherlast(t, z); + t =3D aes_accel_vncipher(t, z); + aes_accel_st(ret, t, be); +} + +static inline void +aesdec_ISB_ISR_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + AESStateVec t, k; + + t =3D aes_accel_ld(st, be); + k =3D aes_accel_ld(rk, be); + t =3D aes_accel_vncipherlast(t, k); + aes_accel_st(ret, t, be); +} + +static inline void +aesdec_ISB_ISR_AK_IMC_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + AESStateVec t, k; + + t =3D aes_accel_ld(st, be); + k =3D aes_accel_ld(rk, be); + t =3D aes_accel_vncipher(t, k); + aes_accel_st(ret, t, be); +} + +static inline void +aesdec_ISB_ISR_IMC_AK_accel(AESState *ret, const AESState *st, + const AESState *rk, bool be) +{ + AESStateVec t, k, z =3D { }; + + t =3D aes_accel_ld(st, be); + k =3D aes_accel_ld(rk, be); + t =3D aes_accel_vncipher(t, z); + aes_accel_st(ret, t ^ k, be); +} +#else +/* Without ALTIVEC, we can't even write inline assembly. */ +#include "host/include/generic/host/crypto/aes-round.h" +#endif + +#endif /* PPC_HOST_CRYPTO_AES_ROUND_H */ diff --git a/host/include/ppc64/host/crypto/aes-round.h b/host/include/ppc6= 4/host/crypto/aes-round.h new file mode 100644 index 0000000000..5eeba6dcb7 --- /dev/null +++ b/host/include/ppc64/host/crypto/aes-round.h @@ -0,0 +1 @@ +#include "host/include/ppc/host/crypto/aes-round.h" diff --git a/util/cpuinfo-ppc.c b/util/cpuinfo-ppc.c index d95adc8ccd..7212afa45d 100644 --- a/util/cpuinfo-ppc.c +++ b/util/cpuinfo-ppc.c @@ -48,6 +48,14 @@ unsigned __attribute__((constructor)) cpuinfo_init(void) /* We only care about the portion of VSX that overlaps Altivec. */ if (hwcap & PPC_FEATURE_HAS_VSX) { info |=3D CPUINFO_VSX; + /* + * We use VSX especially for little-endian, but we should + * always have both anyway, since VSX came with Power7 + * and crypto came with Power8. + */ + if (hwcap2 & PPC_FEATURE2_HAS_VEC_CRYPTO) { + info |=3D CPUINFO_CRYPTO; + } } } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927885; cv=none; d=zohomail.com; s=zohoarc; b=YoPuzorAnvnalD6VEmzao+N7enD3tikxfR5dlEp2B90x/mGSVEDrx7B53UJ1LT4b4P/oByPcWihdr5HxWQnVgO1uTMTTO7Z/uu7URYv+WN8kyNZ+VLSEThOPI/sjBj+rDyZg0nnf8lgKBzJQ1+q0U0mh/ROW6YeCFVvL/Xo+Ijk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927885; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=ZAmk+aBiXH6L93IRWZqWmXq5nmIbM7fQ+wSS7Q4mRSy3Cryomv3D04J5ObZxGbhZkyqLLzBK6UsbvttEHlmPh4nHAYSuef4xCSZOy7r3Hz41NxciNIPFh5ZtKaK7/ciQe/GP5dPTuM8eAsrusXOcm4W5ptE+FTdY1f0tk2KUtNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927885361350.5765555860189; Sun, 9 Jul 2023 11:38:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAd-0008QF-KH; Sun, 09 Jul 2023 14:30:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAb-0008Nk-Cy for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:05 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAZ-0000Kn-1G for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:04 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbf7fbe722so43506305e9.3 for ; Sun, 09 Jul 2023 11:30:01 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927400; x=1691519400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=w0YSN3NvRCkvWqSIxhuUQxkgN+rpwfsbNf3p4icrfUwbdqRYIDIJqTcGGaLO45t5Er b/Mlfi9Dn34MLo2ogXBCA0gJsP7n+MiFNWIjRzE4EUT8o0Rsr3VjhEPBs4sa3lBOGj6h kCuc8aLxeygxIF2PJSr1wPy10rt5k8FKHVhR5eX8VtdXUYrXi5SWEHHxjDORAEmDxEr+ E++f7XENSD+iAL8Ld4Dv/QGgCg/zSX3GP9iozBEyqUc0wn12FfWwKEO1xJ9XNurmzxhd w6874jpMlQyTlfxCQNNICYb9KG4nUNak71xNcRo38lVeaPPjCXAhyJAN0OPNrw5lzmsH Q38g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927400; x=1691519400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HWNck64Rdzbsq9/3XcWJpVmBPzEh5+xH4mb3RyYLiec=; b=IDD190NMRP1ftY7qHui7dYewKfm+5nWF1ggdvE1t1tesFYv8CTtJyquOefy/faQBhV QThyVcf/XerodgcbRvAEPH7r+Q3fQrk/X1hLUd5/vfGfXP+0hE6Io6ux1g2VOMXjU5F3 bjXbYCC3DcMG1gJ6vpeRWwcTUBf8kUkO4KwcU4ejfrcG/fTsKs2oB2NnwNw70k4YoMha slSUUix0S9H81v2R+ZQbpNHc2llfSCA99GvXv0MRvwouUDGDiWgOl7oLsQm0w/Ltrvbm XXzAPHKTwm7AusZEmwBH5ag269XvovuPQMDiJQCyFdVtwx/OpRDOzi11Dc33Ti2nLmgD UpdQ== X-Gm-Message-State: ABy/qLax7aaEFTUlWj4LilPcaqwB9nlJNjm5yV9gWYhJ15D51bFi1pew +nRxtjAAnmsUxSjvY6aMSb3rqy7MS3FRJM7EFwpSLw== X-Google-Smtp-Source: APBJJlFyRnXxgviMMZ4zs5/ejbhMMA2qEgmO6TzGHblCfSKxoDzcm4yZR8Pz2Q6Mb5Iz5bmsMbWZcQ== X-Received: by 2002:a1c:e908:0:b0:3fa:97ad:2b9f with SMTP id q8-20020a1ce908000000b003fa97ad2b9fmr13757282wmc.16.1688927400809; Sun, 09 Jul 2023 11:30:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 15/45] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2 Date: Sun, 9 Jul 2023 19:28:41 +0100 Message-Id: <20230709182934.309468-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927887222100001 Content-Type: text/plain; charset="utf-8" Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits. Signed-off-by: Richard Henderson --- include/exec/user/abitypes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h index beba0a48c7..6191ce9f74 100644 --- a/include/exec/user/abitypes.h +++ b/include/exec/user/abitypes.h @@ -17,7 +17,8 @@ =20 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \ || defined(TARGET_SH4) \ - || defined(TARGET_MICROBLAZE) + || defined(TARGET_MICROBLAZE) \ + || defined(TARGET_NIOS2) #define ABI_LLONG_ALIGNMENT 4 #endif =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927569; cv=none; d=zohomail.com; s=zohoarc; b=Ykz8idatxIe8MWKid3mcd0/B92raQjfB2DJ+yzXuuJUBy5QV3bdqyFA42+qrI0t+pVHoQq6hsicp+pqF4x+ffKICWehVJNhV1u7e75S/IrZUCKMESEE+8Qg0r5CPdL6BfJn3JQ9dLLxuUjvwjxlVWfvXQIZ/LMNN7nDyNJTWvhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927569; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CXOtR+skbBy3g0n+KA4k0jDRJwr6870/fEeTqXEf6Vk=; b=nCWZUAS3y2iBp97ZgKBDvSytMY3Qt5jxetmQTBaTwrSo0IM4jt9IRrg5rwQ/U6na6OJG2ylewr9jnRh5IW+qpgJ/js7rYVUozKhWldbimy5ZcY7Tk80BSHOCrl/H+bLxC7IHlWgfIvehL119i1wA24Fe8jYcoxf88r+IvoM4vuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927569774584.9392898564704; Sun, 9 Jul 2023 11:32:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAh-0008R3-Ew; Sun, 09 Jul 2023 14:30:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAb-0008Nf-09 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:05 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAY-0000OI-VE for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:04 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fb4146e8ceso39577995e9.0 for ; Sun, 09 Jul 2023 11:30:02 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927401; x=1691519401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CXOtR+skbBy3g0n+KA4k0jDRJwr6870/fEeTqXEf6Vk=; b=kq5nM/8V1fbL/HGT4WA84cEPDr8adVJ1cSAFLUUXLQQzgRdNaJ7Z4FcNj8a5es0RR/ CutRueH5nIkzWor5xybOo0ZWSvpyQGzn61i6SN+/agdHhwX8adravJEZzMpuKBUZC1Mf 5mAdolmpG0xlqVkmgBh+tCdk0KiFahH5JaPdKlMyqo8fkuOQmaWaP2z3ELZmPCaBMB4u 9/l4AtnAV7dXyPL7aR59Bky6SZg78f5po88UzJxlC3tcfS6MYdlNSDvit6vS07qf5HbD jL8/QenUikd//P6YLJyxFr2lCmK/W1R8carYQ8vXE8aTCPk2qPo6bXhYFEHselJh1YN+ 4tuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927401; x=1691519401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CXOtR+skbBy3g0n+KA4k0jDRJwr6870/fEeTqXEf6Vk=; b=L4Vbcw0Xywb9wsvXO0dTN1vbLl3twBxsIIQIcMoO3ssVQNnlcovwPie/zv8i7FllVJ nbjhlWFwjkZ2vSDGGC8AopfD4KPFpHvg2lyRS2Y6xh77CNE/eN4GgkeZRPFKj+RQEbyS DLhmOKlKbW4wsMHSvaC1cIJiaZsm8dRcV+8eq6Xa4comlMAzYNLb/QpRMuWtpJO+tWaH 6IDc8+v1rW/zLFEkyh8/EB01cDzE3278ElnQGA7fkPeXBSRyzScUX5mJCKLuKUkIS0QL eLnZj50nVxI4WJcvk+kgz54wqniKgtCyNJ/eU0YzK6Mg3V6i1DbS/8u8dDPHAg5d43v0 kHmQ== X-Gm-Message-State: ABy/qLbYY00P8Gpwa6hcIZvV0AuIrIO5R2lkYoLoSdo9KYBZd+d7Bbcs +jhtJJqifdgxUVgCaW52RvYtVkNZMHE4ivZpL+ismA== X-Google-Smtp-Source: APBJJlHzJWVWku2CMUf4w0g1xDaxTiMRepIBFAwjPZdXPC1nPVozY/30v00ArUPvZlsvow3NcOlaZA== X-Received: by 2002:a7b:ce8a:0:b0:3fb:be07:5343 with SMTP id q10-20020a7bce8a000000b003fbbe075343mr8867367wmj.27.1688927401676; Sun, 09 Jul 2023 11:30:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 15/37] target/ppc: Use aesenc_SB_SR_AK Date: Sun, 9 Jul 2023 19:28:42 +0100 Message-Id: <20230709182934.309468-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927570218100001 This implements the VCIPHERLAST instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index d97a7f1f28..34257e9d76 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -25,6 +25,7 @@ #include "qemu/log.h" #include "exec/helper-proto.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "fpu/softfloat.h" #include "qapi/error.h" #include "qemu/guest-random.h" @@ -2947,13 +2948,7 @@ void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_= avr_t *b) =20 void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { - ppc_avr_t result; - int i; - - VECTOR_FOR_INORDER_I(i, u8) { - result.VsrB(i) =3D b->VsrB(i) ^ (AES_sbox[a->VsrB(AES_shifts[i])]); - } - *r =3D result; + aesenc_SB_SR_AK((AESState *)r, (AESState *)a, (AESState *)b, true); } =20 void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927629; cv=none; d=zohomail.com; s=zohoarc; b=SH3WZUH1o/16qYQnynokK9TqCFbhtZx4QGXk3huMVlmxQOS45wn80x402/3IQd9aGG8sgHItT+FOk3BM/KadqtVWD6LcKEYpt7m/jL134C31Z6FAbUBVeAHTITOqbvwKeNo2hNkHPuacHGyjrOhAcY8D4HFr0IG8FAefUcuR8ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927629; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M6hJ2cBLCXpJZWqn0v9yRV3HoMGVrJoXrdXR9GSCECU=; b=mf4SZOhIcXWh/1/zAlRaanrXDsnU9R6wx4oLPnEZgN3TxuHizhi9I/pE/N/RxlYjEkVLdxTFumLysTTE60SkogIbDN9dqnvImk6RLk4M/5AV3jc9hP991tH4tfza7QM1OL3r/VhdaLlcnlsZIuzV+CULHSKtsfh3eNshm2eQmdo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927629733367.33573413750685; Sun, 9 Jul 2023 11:33:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAj-0008SX-Ib; Sun, 09 Jul 2023 14:30:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAc-0008PH-DF for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:06 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAa-0000So-DY for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:06 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so39209095e9.3 for ; Sun, 09 Jul 2023 11:30:03 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927402; x=1691519402; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M6hJ2cBLCXpJZWqn0v9yRV3HoMGVrJoXrdXR9GSCECU=; b=nLPER94Y+i+FGuqXGwSel/YLsXT1LzhmaqVciKXmpVQFfNeui+lwZX1plKlxZ56hyF BMgli/IHSlsJS5tvz0nl9P7LimSIn5sa4y4ARM9O9RNfE5jG5MThWJhC37qg/RHv+idg r+z6asWyT1CXECOesY4BhBQ9UBKXdq5IM8vCHpd7Lor/MS1bvFJUfTPN4v80uQy49Y7U YDPINJlqmYida15xJTqXMWzYBLyX6DOCQyfQB3KF74/cPYFFUCRunryReY0GNjX770eJ yIv7lJTKtPKysh5fV7Mfpc+o4AuiH9SJpWPCUPHAtYZbKkir9J/uTOPIltPdXaB9sF6e 1jiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927402; x=1691519402; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M6hJ2cBLCXpJZWqn0v9yRV3HoMGVrJoXrdXR9GSCECU=; b=P/qHYiWW0LzH7o1mGPMLLYEqAFN0unppJ9sq/zoeS4QJcmj586bzfAAleffpSoLKyV h99fsC1Z31zEBK0+VwQ9oeQjnZbZs68NY+n6eN28FUm5+UmDrMTjWHWUjshAlRKSoCko KBFxzAUDDbUL7T6E/BsOsaSUCB2byaje5xI2WXn2K0raHVtILmAMF4ThQlFsB0ZCHUgk m2BgMjwuTaj9TFEYZLkiRoOCdTbOG9dBIkBHppr9PSjkD0d9kZxEwb4XIxSccQPRv4bT DmWyQbGkJ+Ra04EZDbpv6XzPVWX0YVR/OLnCzwrXEK1O9idE4hZ0IHs3pTN1l9xBMfhq AZLw== X-Gm-Message-State: ABy/qLbrG+7lzA+cJX5RjO/OluCazKulU66Qr//UhKLEHxj8ks7pzOk3 8H01tWW+zqS8JQ33LqCSgzmPwUTM3p8Hkf91n331Lg== X-Google-Smtp-Source: APBJJlHeW/uBvC8XehZ2mIRLtKHJb8+F1uWarobYvZjlgN/HFwFvybN0fagU92dVzOyhyEcaTKiiag== X-Received: by 2002:a7b:cd08:0:b0:3fb:b248:67c with SMTP id f8-20020a7bcd08000000b003fbb248067cmr9227054wmj.22.1688927402578; Sun, 09 Jul 2023 11:30:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Pierrick Bouvier , Michael Tokarev Subject: [PATCH 16/45] linux-user/syscall: Implement execve without execveat Date: Sun, 9 Jul 2023 19:28:43 +0100 Message-Id: <20230709182934.309468-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927629909100010 Content-Type: text/plain; charset="utf-8" From: Pierrick Bouvier Support for execveat syscall was implemented in 55bbe4 and is available since QEMU 8.0.0. It relies on host execveat, which is widely available on most of Linux kernels today. However, this change breaks qemu-user self emulation, if "host" qemu version is less than 8.0.0. Indeed, it does not implement yet execveat. This strange use case happens with most of distribution today having binfmt support. With a concrete failing example: $ qemu-x86_64-7.2 qemu-x86_64-8.0 /bin/bash -c /bin/ls /bin/bash: line 1: /bin/ls: Function not implemented -> not implemented means execve returned ENOSYS qemu-user-static 7.2 and 8.0 can be conveniently grabbed from debian packages qemu-user-static* [1]. One usage of this is running wine-arm64 from linux-x64 (details [2]). This is by updating qemu embedded in docker image that we ran into this issue. The solution to update host qemu is not always possible. Either it's complicated or ask you to recompile it, or simply is not accessible (GitLab CI, GitHub Actions). Thus, it could be worth to implement execve without relying on execveat, which is the goal of this patch. This patch was tested with example presented in this commit message. [1] http://ftp.us.debian.org/debian/pool/main/q/qemu/ [1] https://www.linaro.org/blog/emulate-windows-on-arm/ Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Reviewed-by: Michael Tokarev Message-Id: <20230705121023.973284-1-pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 08162cc966..90777c5833 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -659,6 +659,7 @@ safe_syscall4(pid_t, wait4, pid_t, pid, int *, status, = int, options, \ #endif safe_syscall5(int, waitid, idtype_t, idtype, id_t, id, siginfo_t *, infop,= \ int, options, struct rusage *, rusage) +safe_syscall3(int, execve, const char *, filename, char **, argv, char **,= envp) safe_syscall5(int, execveat, int, dirfd, const char *, filename, char **, argv, char **, envp, int, flags) #if defined(TARGET_NR_select) || defined(TARGET_NR__newselect) || \ @@ -8615,9 +8616,9 @@ ssize_t do_guest_readlink(const char *pathname, char = *buf, size_t bufsiz) return ret; } =20 -static int do_execveat(CPUArchState *cpu_env, int dirfd, - abi_long pathname, abi_long guest_argp, - abi_long guest_envp, int flags) +static int do_execv(CPUArchState *cpu_env, int dirfd, + abi_long pathname, abi_long guest_argp, + abi_long guest_envp, int flags, bool is_execveat) { int ret; char **argp, **envp; @@ -8696,11 +8697,14 @@ static int do_execveat(CPUArchState *cpu_env, int d= irfd, goto execve_efault; } =20 + const char *exe =3D p; if (is_proc_myself(p, "exe")) { - ret =3D get_errno(safe_execveat(dirfd, exec_path, argp, envp, flag= s)); - } else { - ret =3D get_errno(safe_execveat(dirfd, p, argp, envp, flags)); + exe =3D exec_path; } + ret =3D is_execveat + ? safe_execveat(dirfd, exe, argp, envp, flags) + : safe_execve(exe, argp, envp); + ret =3D get_errno(ret); =20 unlock_user(p, pathname, 0); =20 @@ -9251,9 +9255,9 @@ static abi_long do_syscall1(CPUArchState *cpu_env, in= t num, abi_long arg1, return ret; #endif case TARGET_NR_execveat: - return do_execveat(cpu_env, arg1, arg2, arg3, arg4, arg5); + return do_execv(cpu_env, arg1, arg2, arg3, arg4, arg5, true); case TARGET_NR_execve: - return do_execveat(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0); + return do_execv(cpu_env, AT_FDCWD, arg1, arg2, arg3, 0, false); case TARGET_NR_chdir: if (!(p =3D lock_user_string(arg1))) return -TARGET_EFAULT; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927617; cv=none; d=zohomail.com; s=zohoarc; b=G0ZOUz0+ekhprKT7lVdz5Lfl3zxBJ9FalvtAWimI/qtgZowx38eEPmPLPs20hIQ1l2Ox7SDyW464TNOiCDpmTA1jIfPlrk4BaC5yCad4t5NkpGvUcIvrQcaYreI9mnsYJmJ4OSPfNv8n1q5rOgChBWrRh1hI8258aTiCCp+NwFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927617; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9eRhNGGsvyXPq3UhYSn/b3L2GTywYRMcqzsZGePD5qs=; b=cpTAqWe0rU9Mizbvd+fy5BrzZJMQNSY3S81hQb7VXAzE77qNQr/QMyCi2fucamQa97I1YiEj9b8I9FznKF6rTOHPz6RBANVTmgH//61buIlQ5fGMz/ohIbwZJpqHqghwXACXTA+XpG5JOBhOq8RP9Tyder3gXHrHLfecemiP22w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927617603223.81731891451307; Sun, 9 Jul 2023 11:33:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAk-0008TB-BX; Sun, 09 Jul 2023 14:30:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAc-0008Pj-NY for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:06 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAb-0000er-5Y for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:06 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbc244d307so43911515e9.1 for ; Sun, 09 Jul 2023 11:30:04 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927403; x=1691519403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9eRhNGGsvyXPq3UhYSn/b3L2GTywYRMcqzsZGePD5qs=; b=wWoSBeyQtz2Kvn2ZT1cR7JzFjct6vWELQuyHQYdETo71nV7I9Q7Ujrdef8tMgx9kKw cqdTl5aSGNVgFw8rUL/MRMtUiioaZgviT8cB5wBWA5WCNDycHB7hSM7g3glqjSI0tXbn rHrzlA0J/rPqdx3zCDVP33rNZceJ3ncha40oE9zyP/e6+v7MjzkJ5o/WBZmOkaLVqS++ JTeMpaRHZQexwxfqXVvLxu6VBccaQpV6roaJshN34HZ2TWyBIuZLsXy2p7UfB+kmabq5 YSZ86iTYM7pnZRWn3SP7Ac3R8W/euuCUpHEHZJ9H0dDbm1kiKv+AAcuNpd1tW2MskH2Q qd8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927403; x=1691519403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9eRhNGGsvyXPq3UhYSn/b3L2GTywYRMcqzsZGePD5qs=; b=b3dCBTTJJewT4IxOPqVpH+J8PeN9HMMGft9sriPJy/y8jFALBeybvIwkAP2Z9f4QTY LlaBUp3LPTr4whPzaAjSCNfqUUI95j4Lb3qMT/P+dh6FVFxyYGy2UkWH6DJzWSS30Thr RdCaIoV/WXJ0Yg0SukAucpkIBMD2RYm05Oi0TJBu+lIeQlPF9SXp6fWrzT/MPDaVJrbN 7vQ2edhhtrMw3kSbSlrDjrTOy4I8YYDrx3X1ez1Jyn0SGHpMW0g60pAX2IsXlm3r0IF+ HIjiL+SD74PnqST97/1f+MrhH0y/VIH5yuvl4DZoEoZF9ggd6ENvPaP9Is2VJ2eikIFq Uh2g== X-Gm-Message-State: ABy/qLalTTkndn9sqPxj5CGyEjbF50r0n8FNjFus6p27cCoxbHZ6HK2I KsfB08z9bSTEGyZLcUTmBaEJkHCPQ+4jIDF2XMhRXA== X-Google-Smtp-Source: APBJJlHju/Vwb3j7S9ofGzH3uT2/Z2VmSjPGKJ0BRUw0nDk9SAV/Mof1Agxv+zAl37eugU79AsV0Dg== X-Received: by 2002:a7b:cc9a:0:b0:3fb:40ff:1cba with SMTP id p26-20020a7bcc9a000000b003fb40ff1cbamr10936308wma.6.1688927403790; Sun, 09 Jul 2023 11:30:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 16/37] target/ppc: Use aesdec_ISB_ISR_AK Date: Sun, 9 Jul 2023 19:28:44 +0100 Message-Id: <20230709182934.309468-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927617817100001 This implements the VNCIPHERLAST instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 34257e9d76..15f07fca2b 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2973,13 +2973,7 @@ void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc= _avr_t *b) =20 void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { - ppc_avr_t result; - int i; - - VECTOR_FOR_INORDER_I(i, u8) { - result.VsrB(i) =3D b->VsrB(i) ^ (AES_isbox[a->VsrB(AES_ishifts[i])= ]); - } - *r =3D result; + aesdec_ISB_ISR_AK((AESState *)r, (AESState *)a, (AESState *)b, true); } =20 void helper_vshasigmaw(ppc_avr_t *r, ppc_avr_t *a, uint32_t st_six) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927596; cv=none; d=zohomail.com; s=zohoarc; b=n0pdFTdMeB9k5V/FdKE9/VzepRcdaE32fNhENloB92aiZQ9DPi4z7s+8RfFWL8fOcGaySG08dVyS4jjUABKKs8kMN5okAzfZvVTo7uY0ssJy5+psdRICjOqU9phm+8K3d1UfC1f2E+Y3mMVAV6U/G8kcByBD0XUsqCwl9OyUQjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927596; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7wgRkP+eTRpLGmcULxLxPDzJcG5/xUKxzegn/jzfjvQ=; b=nP5ABuBW5WKA5PFEtAH+mAbpJ4Ux/JkBLvZ+70khoxbFMNftNcERTXAF22ryiSGH6YygsYHzdyavO2GoBJWJtuIP9pKqbmTMhcP40iv9P4JeZm7qIDZuZ9al0R6HCNCuVhQacY0vZ+ShjR12QR7OdL89CVmiV6gsKePnOTu7ENg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927596537726.2021393337906; Sun, 9 Jul 2023 11:33:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAk-0008TJ-Js; Sun, 09 Jul 2023 14:30:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAd-0008QE-Iy for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:07 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAb-0000jI-RT for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:07 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso39246225e9.2 for ; Sun, 09 Jul 2023 11:30:05 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927404; x=1691519404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7wgRkP+eTRpLGmcULxLxPDzJcG5/xUKxzegn/jzfjvQ=; b=BYpwpxBmTs82k5/T6au5xZFWJuFUH7T3jVewYQgZ86kR3kuz/bFDLQAMt5yUC/f+Hv S6gnfqiqa/ODqL36pAqv41mNxCXMbDJzfBkBg2KATee+v4N482nEJimST0Bgu/tbMMmq 5jUcgbataQfFN+2wa1aF6D/4OonEQI3EFGevVHdgiHppwnUQU2Axu+YqX3OHZ5fJNpzY octySGu36QuphRsoOhL1Z/2XrRlxzhUS8wCdIq/dr27D0lQS1itxjtlwoX0DFgXIaVSf Vfec7J62kPodI9rTDiwFQFY135v7U9NrNU2ORDj6fv1G3grrGfyV8e6vXnO8EXANuJsZ XJyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927404; x=1691519404; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7wgRkP+eTRpLGmcULxLxPDzJcG5/xUKxzegn/jzfjvQ=; b=NWGB5GgizkzEyum3UFQlj/4pBCPfUNMUKrnIFQGZCQZG3WmTidDJPJAlaUgm0uZNfy XMOV7JbVU+6FOz2Zw3h4iPibWqCINcxnBKo9KL5Ld78ATlBrHVRecEgp7Y9tK5a3JOD5 r5Kdlt7efI+0y80e6gi3XVgaFSwn75ERxsmmQqjfs6qEKQwwZkVhW8ee0ib9rfNIfPhM 1PYdY+vQv+RmbhMHsJulRRQxLug8uAqiP14i94+BoHoqkCzlbKP7h9T/quXCM/Dh3ssw nYMnUk7/e3G8qT11kRiEF1TDAbhJkOgrwojpgMn93zSEi+dRNGsx2FlHzhY0uYNMsUwv U0tA== X-Gm-Message-State: ABy/qLaR+4tjkz/nN+b3exrE1Po4Y4Fdq9Zu5n8G8+y/AePwj9gsNUBn a5nIVF+KIHoGubnxls1QcOLcuIhJAU6IfeZU6d75iA== X-Google-Smtp-Source: APBJJlFdAporhpCqOS0lLvGM3l5qLzm/uLKdAbYhII9K14YP7cquzsaDrEfhCG7HOGYFQXCJuQe+Pw== X-Received: by 2002:a7b:cc86:0:b0:3f9:c8b2:dfbd with SMTP id p6-20020a7bcc86000000b003f9c8b2dfbdmr7986664wma.19.1688927404614; Sun, 09 Jul 2023 11:30:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Anton Johansson Subject: [PATCH 17/45] linux-user: Fix do_shmat type errors Date: Sun, 9 Jul 2023 19:28:45 +0100 Message-Id: <20230709182934.309468-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927598263100007 The guest address, raddr, should be unsigned, aka abi_ulong. The host addresses should be cast via *intptr_t not long. Drop the inline and fix two other whitespace issues. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Anton Johansson Message-Id: <20230626140250.69572-1-richard.henderson@linaro.org> --- linux-user/syscall.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 90777c5833..8b12774fba 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4529,14 +4529,14 @@ static inline abi_ulong target_shmlba(CPUArchState = *cpu_env) } #endif =20 -static inline abi_ulong do_shmat(CPUArchState *cpu_env, - int shmid, abi_ulong shmaddr, int shmflg) +static abi_ulong do_shmat(CPUArchState *cpu_env, int shmid, + abi_ulong shmaddr, int shmflg) { CPUState *cpu =3D env_cpu(cpu_env); - abi_long raddr; + abi_ulong raddr; void *host_raddr; struct shmid_ds shm_info; - int i,ret; + int i, ret; abi_ulong shmlba; =20 /* shmat pointers are always untagged */ @@ -4592,9 +4592,9 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_en= v, =20 if (host_raddr =3D=3D (void *)-1) { mmap_unlock(); - return get_errno((long)host_raddr); + return get_errno((intptr_t)host_raddr); } - raddr=3Dh2g((unsigned long)host_raddr); + raddr =3D h2g((uintptr_t)host_raddr); =20 page_set_flags(raddr, raddr + shm_info.shm_segsz - 1, PAGE_VALID | PAGE_RESET | PAGE_READ | @@ -4611,7 +4611,6 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_en= v, =20 mmap_unlock(); return raddr; - } =20 static inline abi_long do_shmdt(abi_ulong shmaddr) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927865; cv=none; d=zohomail.com; s=zohoarc; b=FjJq2hFQLMHpQWEDErzLU4p/RaRKu851UFsIvEZMnJklAsWXpfE9Z+OUp1Lb+8dq82f2+MOuVfA4Ct1WDZNGlE4uv8eUHCAiWUdF3Dpgtj9/paBS2dqYN/rLzWYlrC9s+IVblYXZfkWhCSjWBtv6Tvc0WUH30yzKzpEIFUrQmWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+Cz1+kZjkC5u47gB2bogcl1IkIjVlfgBFhqhPCwU85Y=; b=a/vxyGlru8di3kK//X/db3pciXaPc4h0TxqOeLSQ3j+OiTm3EXHJZcQgmGh/OxItQz5ST6Tit4UkUDfjitrLX1DD4+FJNCyD2OKBwVeJYrIxEGKaCbCr82eXslCdw4RPcc7rzsQwxzWdJ5E6VAfxs2lbnceEqPsDhWeExWbvNmM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927865608536.556008163509; Sun, 9 Jul 2023 11:37:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAn-0008U6-0m; Sun, 09 Jul 2023 14:30:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAe-0008Qb-8N for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:08 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAc-0000oH-Nn for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:08 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbc5d5746cso43742745e9.2 for ; Sun, 09 Jul 2023 11:30:06 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927405; x=1691519405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Cz1+kZjkC5u47gB2bogcl1IkIjVlfgBFhqhPCwU85Y=; b=K5EDORanXq4CU4bsiHvaUgCy6IAb9ZSTWMj0TGnIKC6ZsQMm5Z8qcgMoYeGEFZt9pC c36zxGY7BlpTjdBoxM+RVFWcUPcRHkc0C2mvXXcut7nlwx7LcBBQ3ygV/UM9EAkpLr6J pt0DSZbAch9RI6+rDjq2K2FFKiJFCTBFuLRNDpiANpkxsEp6Qe6Ar7xrSHF95OAwu5lL vYVzVuWCPObJIoMLi8r9ZVHS6ZnWO3067+Syt3V7WRZj+eAVmPK4pj7m5uc7gosnuE9R PCbyyKJ6amY6O/Blb8P3WER+FT6mytZtp9VVpDFLkyCLKDTC9VizOY7eQDoVF3v737Qy 2G6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927405; x=1691519405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Cz1+kZjkC5u47gB2bogcl1IkIjVlfgBFhqhPCwU85Y=; b=a53gxacrOknQRJK00eF0Dz5RwD8bKM2YnbzdXFMTVWcD6PY3NB5UjLVqpRw6EKQ+/Z B3G7QJKrzvIUQrqgYWcrweun7rehHnxN+aH16NMQLfagN79y6WXlm1fDm+6m6DW6aqNi VhSQcCEUBU9FXnVZvgvYuyRso68IqQNwhXIuYj7H0Sop2wgEjjIb6mUY9KtmOdaq9W49 xp8SqniagRNRPJRIVQkvOW10fd3lStGfCmaiOowHLXPyVcb6gwwSIIhbgHoWorWuwObo ykEBuPid+AtYb53IRDuW2e0fx9nQ3qLd9rtIeMIChxQ+GdjBedEkjheeHP4kyshUgDBZ 1lUg== X-Gm-Message-State: ABy/qLY8qQt/KN9jA5JlWFOWRC4DfTrgOrxcFUsqyso+2NzUKYS7pPDV AMWqykypeDf2a4g117LbrF0pt9FpS8jRzVsjsMZK/A== X-Google-Smtp-Source: APBJJlEGkgr3PwYyYLZPJROwdyyZCS93QpcCiQSAU9uXH6741zw99pw1JgUplIhOg5ToehIbDn0fYg== X-Received: by 2002:a05:600c:21d0:b0:3f9:b17a:cb61 with SMTP id x16-20020a05600c21d000b003f9b17acb61mr8009311wmj.13.1688927405411; Sun, 09 Jul 2023 11:30:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 17/37] target/ppc: Use aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:28:46 +0100 Message-Id: <20230709182934.309468-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927866483100007 This implements the VCIPHER instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 15f07fca2b..1e477924b7 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2933,17 +2933,11 @@ void helper_vsbox(ppc_avr_t *r, ppc_avr_t *a) =20 void helper_vcipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { - ppc_avr_t result; - int i; + AESState *ad =3D (AESState *)r; + AESState *st =3D (AESState *)a; + AESState *rk =3D (AESState *)b; =20 - VECTOR_FOR_INORDER_I(i, u32) { - result.VsrW(i) =3D b->VsrW(i) ^ - (AES_Te0[a->VsrB(AES_shifts[4 * i + 0])] ^ - AES_Te1[a->VsrB(AES_shifts[4 * i + 1])] ^ - AES_Te2[a->VsrB(AES_shifts[4 * i + 2])] ^ - AES_Te3[a->VsrB(AES_shifts[4 * i + 3])]); - } - *r =3D result; + aesenc_SB_SR_MC_AK(ad, st, rk, true); } =20 void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927514; cv=none; d=zohomail.com; s=zohoarc; b=RFQ7fye9r7g96yI8WFbx+/K+usUiPPnJGXnkP39iHYcfTNrDKlum3rHeOnht4OpvzlkQqt//doCV4bbqj8RQJda9ghi5soDcL81hQ33paare9wW2bt1vwNDFg89leMthWQKwe0qUZKzlsiXrpgLnIS6OAnfE19oiuXaud7sdXbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927514; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NQsBpcgKVgYp7fXYDQVN06TvKGcdOIek7QQgIG6AozQ=; b=POoJqjkY0L9hYJwf3fQDrVwiIVIfKEdhAGH19EG230NvXZyJ9vngzW3e7Ii/qJ8eXuuqhPQYvkDRSdQPNN3U/RInMCiYV1ZndCkn5uRfCB9bPrdFoEIxQ7Uxu1xdOR8OecmC5g+QBkc+DfqFFn+fmEhLSOK10OCpl5kEKekQfrs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927514845510.47456465531536; Sun, 9 Jul 2023 11:31:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAo-0008UG-7g; Sun, 09 Jul 2023 14:30:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAg-0008Qz-Nc for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:11 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAe-0000zv-OC for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:10 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31438512cafso4023494f8f.2 for ; Sun, 09 Jul 2023 11:30:08 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927407; x=1691519407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NQsBpcgKVgYp7fXYDQVN06TvKGcdOIek7QQgIG6AozQ=; b=LYvQNQqKa9oQdsqMxVZReVZejXOyQ+yzk60giB6vYUv9EUi8RFB9XrlUqYedBzHdNu NcB5LW4XA0oDPVvHVZ3JlaMuH9OiPmu4M2G6ray37th2tZr+CSklbkhabeWCS8LIgBj0 /DIQTC8OsE+fuL1bHXa6l3F8eBU3XfIXAUZEbbNjBgbT6PL4CgtUzU9sOdP890svlWNu G3OQmbBzT2JkQG2x37ctLSgFR6gmb1bOR1QlqzeEFZy0jv5Co7La5Zbp9qpe+iBdCYxr Vjl7h4SmUOrDOD2Hm06RT9fmiRfxHikn978KZ6sfFymrsHFpC/2CSVKTzNC4gdqp0M6e z5mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927407; x=1691519407; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NQsBpcgKVgYp7fXYDQVN06TvKGcdOIek7QQgIG6AozQ=; b=NOzV4yF015QMTYj3DnvZxvnwXwDMLfV1Z3XhqqlrVUSXk1UDRPYrWcQ1QcQJsuJ7+f 14Ca1Btkxom5pn4gpMKG2LAJd98MP3UnbVb67+6jvfot+Gh7qWEDQ0y/xnUfQ5emUnGN +kUUH6H9SpNDtFYXlqJmaqcefOFOjxM5vALq1WjFKyBUVdLRGOOGBZABRmS+3/rrhIwT B8V1ImwZLYlXGRYrhZAh9BH8bnjoQP3Mhz+LCIiLcf9uk6kWFSoBDfJqZWgLY4mXVkbE GbHJosYv8WhWGzU2zGwvCV9pqdJQfZJa6yyYwrm92ecJ0/xfJiRSHQBTW6vkKHYtJllf FPnQ== X-Gm-Message-State: ABy/qLY5ma3NNqGjEs+mhKvt/4PNokuO4seuvDqr2qXPiQd0vk3VwF/l SzvrXixNaZ749bLJ595I4cDMd3+hZbq5SdZxDFD54Q== X-Google-Smtp-Source: APBJJlEYwHUObCMMkCEv3IZcGTE0AoCWW2+pbisjrogxi7AuzNyPjc78g85fbJTMCBjGDrNvV6a8Uw== X-Received: by 2002:a05:6000:4e4:b0:313:f61c:42ab with SMTP id cr4-20020a05600004e400b00313f61c42abmr9882143wrb.56.1688927407407; Sun, 09 Jul 2023 11:30:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 18/37] target/ppc: Use aesdec_ISB_ISR_AK_IMC Date: Sun, 9 Jul 2023 19:28:48 +0100 Message-Id: <20230709182934.309468-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927516899100003 This implements the VNCIPHER instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 1e477924b7..834da80fe3 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -2947,22 +2947,11 @@ void helper_vcipherlast(ppc_avr_t *r, ppc_avr_t *a,= ppc_avr_t *b) =20 void helper_vncipher(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { - /* This differs from what is written in ISA V2.07. The RTL is */ - /* incorrect and will be fixed in V2.07B. */ - int i; - ppc_avr_t tmp; + AESState *ad =3D (AESState *)r; + AESState *st =3D (AESState *)a; + AESState *rk =3D (AESState *)b; =20 - VECTOR_FOR_INORDER_I(i, u8) { - tmp.VsrB(i) =3D b->VsrB(i) ^ AES_isbox[a->VsrB(AES_ishifts[i])]; - } - - VECTOR_FOR_INORDER_I(i, u32) { - r->VsrW(i) =3D - AES_imc[tmp.VsrB(4 * i + 0)][0] ^ - AES_imc[tmp.VsrB(4 * i + 1)][1] ^ - AES_imc[tmp.VsrB(4 * i + 2)][2] ^ - AES_imc[tmp.VsrB(4 * i + 3)][3]; - } + aesdec_ISB_ISR_AK_IMC(ad, st, rk, true); } =20 void helper_vncipherlast(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927875; cv=none; d=zohomail.com; s=zohoarc; b=Wjzafa6LmNePjcGUKcqwfTznOe/X5W5f/hnLf6cEgrpjzO3bAgLCmh9FsKhE9WSwtb2DNbHnFkaKFDJnQBV51jLinUiISbMw3K/P9sr5tJ/Su2miOOZ1r8P6kzVsrrQPZbyn9DSW59x325D94TBkeKTH8Adf53LkyXR6xTuLQuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927875; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=JHtQEaysKLD32R1aY5QyWsUtwa6LR/vwmepj1qSiaBTwEMx881ePrWZqj3X44NY2/0FA6H+B2/9DqEZ6+XNDJwbZNd4YSfe8Qn2qzx1lracbxOggHOV/QpNRh58OD1CJjxVfT5drMtKxaq9iSkAQj5K/lgFDMjPs7jfkGSALcts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927875505249.6632249101051; Sun, 9 Jul 2023 11:37:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAl-0008Tn-QV; Sun, 09 Jul 2023 14:30:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAf-0008Qk-Bs for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:09 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAd-0000uN-Nt for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:09 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbf7fbe722so43507045e9.3 for ; Sun, 09 Jul 2023 11:30:07 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927406; x=1691519406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=H80W49X/1I3xQtKjgOvJJoRShUFaD5gTWN0M1aKZI9c1oRkqKWt+31VXZfFel7/nwK WSqYbHqe6TQBX8m3Nr1KDv885sY/ES2+RMD4rzJAXfBeaDN7nnSue6hNgsRQQUzTekb3 LHpId5tlj2N+hd2EfH8WrGbxuxBb1cWuOP90NjFQyxL+LsutqTaQ9fqPvTEP/RUG7pbI ZSqPJ1OX2widUV+XTGy2TBuHRbValKSqfZu3VU27pdHX8B27JF26BJ1YIfBPmkPYZD2r K7XrgkjAbgFNnOwjWtAVoSy9MxnaVjrjNsOKDIoK4SkZskx9wQumpnhYAk95lsubPkky 9ucA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927406; x=1691519406; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KPSt9c/ngpAMvKxksu2NUPKStpNSLJ8TjY6ZtwR8h/Q=; b=jN5QqBuR+LYHQ9X4ku24VoRVjtVlwYhHcAgCLpNcKNVgI4xWQR/NV4cm2Ftolzju7L uJzPBohmJvYU5O7S4NW3aDqV8wfk/wYYrcNIYFDlNvR7DW/zTBBFGX9mZ7RSWTL2bsGA W0QSpi+imDt4KheFyF8rxzJ97iZaTfkC5IAwGh+FosNF1D55AdEV2m3amrxoB/5lDLTG WAtSAVwU1VeQg1APtdB/5Jgl+Bls5aPqj1dwRHOe/jco1y3SNzkgLgcKhqcvgLL+DExp PJHVd60zvjA5RjBUwtyMGWFInzDKqosd8ItODTex3npCoZnGgpGdkTOvYhpZlMnkOUPV gCBA== X-Gm-Message-State: ABy/qLYzjyhpPTva+eEHJg6S/TUDwYW3raPk3PcxiGCjXhR25nDvpCuQ JkK57Ujs591rzQacjHhaQQ4pbXE5cF1j4887L7Zmcg== X-Google-Smtp-Source: APBJJlF845sYS71J8+y8CxIVykPPVRWGgfQHUljCcUWCXjXYQSDgw2nehpYc6Vp7i/8Qdg32G/XRPQ== X-Received: by 2002:a05:600c:207:b0:3fb:fef1:68b7 with SMTP id 7-20020a05600c020700b003fbfef168b7mr9610999wmi.27.1688927406441; Sun, 09 Jul 2023 11:30:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Richard W . M . Jones" Subject: [PATCH 18/45] accel/tcg: Split out cpu_exec_longjmp_cleanup Date: Sun, 9 Jul 2023 19:28:47 +0100 Message-Id: <20230709182934.309468-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927876554100005 Share the setjmp cleanup between cpu_exec_step_atomic and cpu_exec_setjmp. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard W.M. Jones Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index ba1890a373..31aa320513 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -526,6 +526,23 @@ static void cpu_exec_exit(CPUState *cpu) } } =20 +static void cpu_exec_longjmp_cleanup(CPUState *cpu) +{ + /* Non-buggy compilers preserve this; assert the correct value. */ + g_assert(cpu =3D=3D current_cpu); + +#ifdef CONFIG_USER_ONLY + clear_helper_retaddr(); + if (have_mmap_lock()) { + mmap_unlock(); + } +#endif + if (qemu_mutex_iothread_locked()) { + qemu_mutex_unlock_iothread(); + } + assert_no_pages_locked(); +} + void cpu_exec_step_atomic(CPUState *cpu) { CPUArchState *env =3D cpu->env_ptr; @@ -568,16 +585,7 @@ void cpu_exec_step_atomic(CPUState *cpu) cpu_tb_exec(cpu, tb, &tb_exit); cpu_exec_exit(cpu); } else { -#ifdef CONFIG_USER_ONLY - clear_helper_retaddr(); - if (have_mmap_lock()) { - mmap_unlock(); - } -#endif - if (qemu_mutex_iothread_locked()) { - qemu_mutex_unlock_iothread(); - } - assert_no_pages_locked(); + cpu_exec_longjmp_cleanup(cpu); } =20 /* @@ -1023,20 +1031,7 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks= *sc) { /* Prepare setjmp context for exception handling. */ if (unlikely(sigsetjmp(cpu->jmp_env, 0) !=3D 0)) { - /* Non-buggy compilers preserve this; assert the correct value. */ - g_assert(cpu =3D=3D current_cpu); - -#ifdef CONFIG_USER_ONLY - clear_helper_retaddr(); - if (have_mmap_lock()) { - mmap_unlock(); - } -#endif - if (qemu_mutex_iothread_locked()) { - qemu_mutex_unlock_iothread(); - } - - assert_no_pages_locked(); + cpu_exec_longjmp_cleanup(cpu); } =20 return cpu_exec_loop(cpu, sc); --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927959; cv=none; d=zohomail.com; s=zohoarc; b=IsePsRylSxQIg94zohQFKn9KYYoJOEVT6lIdbEh7u2yQaAskO8JjxGY4WZ7AjlBk0zVK6ZVpDor9WwlV4QFRd7iw+bVVl3daye8kLld0M165HijJhnAB3zHCA/iKeKUTYGTjqrl32m+tMnDKHzl6ZcR6RG+4kzFfAfPX/KLhMbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927959; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GmJTDSEgSrtTohr1MbVZJalsJuXSKLY93/s3bemsL1U=; b=LWm+KzlsHxsOAp69M1wv2Alqdvoq0BDv3/+3wx9mwQopQVV0IuzoUgCcDV/dFKMUX7b8uz3ySFhUBV5aCPSEAmisyI9V5CFJskOk73ybZSCSwWK/7Dopybdtcm3tUh1L7RPWSv2EGY3tZv6LTvnBLuqe0z8ArGb5bsIjcIbJlSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927959571805.2633062874683; Sun, 9 Jul 2023 11:39:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAn-0008U9-Vd; Sun, 09 Jul 2023 14:30:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAi-0008Ry-KU for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:12 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAg-00013C-Gn for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:12 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso37892875e9.2 for ; Sun, 09 Jul 2023 11:30:10 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927409; x=1691519409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GmJTDSEgSrtTohr1MbVZJalsJuXSKLY93/s3bemsL1U=; b=AfhCl+Yk3w2R2+3deLfpYUF2wrww1AVyLtpx7r30hKyeue/kX7bjY8Be+hXa6umU+V 8vfkSbZ9V+KTcoIOu4YoVuQdaTbr/GhwkQ8JH+toIRv4uE0WEiAQ+AaDh5ZYmDFvU2ph LCmJ5x5sx1yKx3O5694IAnVk/okCElzVvIzNkZQzfrVqhyYkgGiFp8HdHuACQThTFp6h 3t/3y0blv/G4nJ7/0Sf8HqhApdR/6fDtp0wFRjC8goAj/GA5Iv0CGyULXCp+dGzOOOBO v5yK1UYoNgPYob4yxiiyBZjsf1Vbx8PLTN23ocbvt3sD81RDTYMJE4iv+Ccu2EoNGksS /K5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927409; x=1691519409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GmJTDSEgSrtTohr1MbVZJalsJuXSKLY93/s3bemsL1U=; b=kM/xGapwzYpLQ1HRn2rMIf9YKEg659Evaue3+3xCtWRukG/MNCPofuGAzfMQXWXd3p flSu873sKuNMrs71MLMgNko2P+A06yWN+k4NId2IxpAjrl+4QsL0h23Z0siD/cZwKrNf tZHmfcKXxnU3ooEaPVQiMU63KnK5A98jJk8kNcbwKv+1+4VgznT8mu8PJYR92fVvDdk9 0KgTBvu8NpqpxS1pVa7b/XlH4zDYliGYrOEh02GWvSu1Nxmf7/s0AvQ8+x4PTA25Tzsu Ajf7Y8SYQdnlrDdkv75RxTyLljcuk3amM1/CX5yvHWMQPbdIdJS2e+mSLtRtwo4VoNzP XaUg== X-Gm-Message-State: ABy/qLar8PyBltuqMdui0IuabBai8z5pQIjNrd6UPgCUfj1POCD+FGdH LFkKVeDjtxGwJ1TzWu+PYDd/iQUD28AI6StKua5I3Q== X-Google-Smtp-Source: APBJJlGCLvmZfLEZ1MmFZ+Denr+ji0XfLUR5gzfmoEHr+zBXstLAVhreERvpS+y51mshLokTKxYavw== X-Received: by 2002:a1c:7404:0:b0:3f9:82f:bad5 with SMTP id p4-20020a1c7404000000b003f9082fbad5mr9589536wmc.35.1688927409224; Sun, 09 Jul 2023 11:30:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, qemu-stable@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 19/45] tcg: Fix info_in_idx increment in layout_arg_by_ref Date: Sun, 9 Jul 2023 19:28:50 +0100 Message-Id: <20230709182934.309468-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927961440100001 Off by one error, failing to take into account that layout_arg_1 already incremented info_in_idx for the first piece. We only need care for the n-1 TCG_CALL_ARG_BY_REF_N pieces here. Cc: qemu-stable@nongnu.org Fixes: 313bdea84d2 ("tcg: Add TCG_CALL_{RET,ARG}_BY_REF") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1751 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/tcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index a0628fe424..652e8ea6b9 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1083,7 +1083,7 @@ static void layout_arg_by_ref(TCGCumulativeArgs *cum,= TCGHelperInfo *info) .ref_slot =3D cum->ref_slot + i, }; } - cum->info_in_idx +=3D n; + cum->info_in_idx +=3D n - 1; /* i=3D0 accounted for in layout_arg_1 */ cum->ref_slot +=3D n; } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927597; cv=none; d=zohomail.com; s=zohoarc; b=UCD+cSjr8lXIGMzA7w7HddqS+IHbT2dRmp4NQJIZKDXFebWQ+7W19iiqV9yXBqttIKMiBoYQFHTbObt967LGOSlYS6pZ0uJHzKbpXAigLMgbriY6qO0LoNSrTeHXD3u+UVq7K4X04ulB1dysEDa94ntbTPXZlJeFVqrPOOkzGQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927597; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fCbxuyj6w2doHmBool/Ak6eLq+V5O+przb+5Ur/gE60=; b=g1cTdlPG71QDkhEjuFTATgF6NKenWYl/WGEkjzXcQavaa9GOCC1SCiH+bKpZFVSIxpfuJPd+NfGmuG4/+l5ujq1T6oA8x1MJvvzXQlrLLkE0XD8vMwF9z0oYcw7DDyrtjUaKtT3uEQA4JscQbn9NTM8wM6nGvTBkk8edLI+u/8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927597115167.10410346906576; Sun, 9 Jul 2023 11:33:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAn-0008U8-JW; Sun, 09 Jul 2023 14:30:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAh-0008R8-E6 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:11 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAf-00010A-HL for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:11 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbea14706eso37892815e9.2 for ; Sun, 09 Jul 2023 11:30:09 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927408; x=1691519408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fCbxuyj6w2doHmBool/Ak6eLq+V5O+przb+5Ur/gE60=; b=Y9Q5182sM/U0NJx95hFPNKJMI3sXAvJHxgPBZJb6BTeXzPpRxzqM374qjj++uaA/LQ BivzPcG7I7vCNWh4hbqb0YGCrzTz3KEg1jIyp0Bcmvr0iPG9r79LxnnYVUHNR9cCwq4/ uhm8TJiGmKMVsH7S6FsH4nE3HXSjOPkwWUNl96FVs2LMgu7OJADEkO8+dPPxNQHz1ZFa k/lkipAWR+hWs5f0xxigrOUjYNozdiFjkH2jtxbPyq/bi6KLi6oCMoyUiEfg6sVQMOg+ XSc6Jr3eNsbE14UR7/MJ19uidyrTVSl0MoUGvUOK4j8hLxaok9HOD7QPfl67ST0UtfPL p1Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927408; x=1691519408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fCbxuyj6w2doHmBool/Ak6eLq+V5O+przb+5Ur/gE60=; b=lPhck7Iv6WRuFwy2+OJvKyWQupWMmH/9gL8TwuTZq+jhWSB7jWWegfyP9NBnw1is7l WdcI+jhfDqclPxmdlXHGY7nGDCLUPDUFYnk7LKRvr6qL1g4m73sdvk8zVXLBFgV8D3GM dodGnzV2OqKNpmq8vb/f5lZJqNM15AvvlpOOZ1+Xov86eQ1CryWKSgJ5KIb6pnMDajmw Y2Npd2U9j74D+JOcm6eY96b3a5WCEbfHbx8OghtQYHNSKgL55gkM8hHtJm+oH+aKWBrr Knruzi8EZ/KX8gbjBAGbVWTjd3xE0x+XswoFkPIJE0z+agTAXJSnK45T2qNl7tdIj1y4 wWuQ== X-Gm-Message-State: ABy/qLaRukmXlZef1Ub5WnNtJl52lW9dut19Na1qIwF6JCyE3KqXLiQS 9b/i15RKIkz87ozPO9VuoqsCJF1e47OclDuKUuYr5w== X-Google-Smtp-Source: APBJJlEW74Z/Tx5Va1RkHJc6TgsKTPDDHeL5JY399PSzzBXglHT5crUBiMrXFn/rJikvqtACHajWxQ== X-Received: by 2002:a7b:cb0c:0:b0:3fa:97ad:2ba5 with SMTP id u12-20020a7bcb0c000000b003fa97ad2ba5mr8232132wmj.31.1688927408279; Sun, 09 Jul 2023 11:30:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 19/37] target/i386: Use aesenc_SB_SR_AK Date: Sun, 9 Jul 2023 19:28:49 +0100 Message-Id: <20230709182934.309468-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927598225100005 This implements the AESENCLAST instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index fb63af7afa..63fdecbe03 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -19,6 +19,7 @@ */ =20 #include "crypto/aes.h" +#include "crypto/aes-round.h" =20 #if SHIFT =3D=3D 0 #define Reg MMXReg @@ -2202,12 +2203,12 @@ void glue(helper_aesenc, SUFFIX)(CPUX86State *env, = Reg *d, Reg *v, Reg *s) =20 void glue(helper_aesenclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg= *s) { - int i; - Reg st =3D *v; - Reg rk =3D *s; + for (int i =3D 0; i < SHIFT; i++) { + AESState *ad =3D (AESState *)&d->ZMM_X(i); + AESState *st =3D (AESState *)&v->ZMM_X(i); + AESState *rk =3D (AESState *)&s->ZMM_X(i); =20 - for (i =3D 0; i < 8 << SHIFT; i++) { - d->B(i) =3D rk.B(i) ^ (AES_sbox[st.B(AES_shifts[i & 15] + (i & ~15= ))]); + aesenc_SB_SR_AK(ad, st, rk, false); } } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928111; cv=none; d=zohomail.com; s=zohoarc; b=oB4MpympN02A+rOxFHtlj38mdUorSpu58wAbH4sR9J3JJTSBvuMC9JGcbY1bAvAHEVeImacGHo13hoIQHvBIzi9A0Uct8HPUasNGFnmvat14VpsTuWH22pOdamKka3SlCODRbIYZ4zwT09pw4E4JaLXMJUHc4uUsLTxcOdZKeds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928111; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C1Ndh6I1tE5UeDqHZyfe4FN5fGzwUfKgv00siQ2QsL0=; b=jyfj2wrRv4flbJBrfhKWagOhaBFBgR/okDXRg1m2RVytawoDMJmYxErFWE+mcS6wvxSeIrKtJ+A+DZuHN9tS3VORRDHj94q2APYbTnIVW9i4j2De1B+vt//s0cbo2D7ALn9m8x1ItAeTEdr9vk/HnJ2RFCkQ7q9tJSN7eqbd+v0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928111930831.6889860250993; Sun, 9 Jul 2023 11:41:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZAq-0008WU-5x; Sun, 09 Jul 2023 14:30:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZAj-0008Sl-Ex for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:13 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZAh-00013z-8k for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:30:13 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbc244d307so43912185e9.1 for ; Sun, 09 Jul 2023 11:30:10 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id q15-20020a7bce8f000000b003fbe791a0e8sm8317108wmj.0.2023.07.09.11.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927410; x=1691519410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C1Ndh6I1tE5UeDqHZyfe4FN5fGzwUfKgv00siQ2QsL0=; b=jPDN9xZfxi+4wLPYpkE1ZMOamKewzhn+K9ojLubUf0gpsiVG+k70qf5dMIQsgW3XPr BsoFKzkRzMuZqFER917PrZ/I3sUhuHIOZnRVYkddyppPk1wQmCfnFoQdtk3AcLR9clWd QLJpI8KdSWQQywu3MyKxb/ggga15u6iPfrkBqdEoVY6/E+iBWTp1vneex63ZDLha8Xg+ pWwyzRkBXunSs5f3vgY0TtFtkFl0TOTo/QToUL2jiBpIqDMNtmKk4wxe22CoQUI0RG5Y 4r2lcoxp9B8GyHExTXAbtJB9/XZAczqiMw+338/mHx+TogGxRta7fMdaHi8Jiqp9pMck AOWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927410; x=1691519410; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C1Ndh6I1tE5UeDqHZyfe4FN5fGzwUfKgv00siQ2QsL0=; b=dCAxpytnzxak42GwFtGAWyhytCWihnQ7ItO5HTd9rsXvxi2/fNrdjr3PKIckwwFzz2 LbZ5fnMkGMbp62M2fgWph06h7ZnyepT1G8ow2VSg33ynRkXWO/DiwylySajJ5R+6wlNp cWqY+fZfvqZGEWDq+tEuWNh+afY1oN9YvIxmJipGSPPz5l7cVJXWNBw/i4VybOj6u4a3 amujZ7bxhoefgcQ073wJqVRq0qBNW5qHwQwmybt7Xm8LXSk6JMdWzOvIuqvsLDDWcZ1e qQ3tHwi4tZpmC2eMR8AEiDTa6QGOLznB49eCHXZKedP5hhpaSuh31ymaD3foTNFK3SWC m+TQ== X-Gm-Message-State: ABy/qLanf80IorSXUz0wsBrWKPMZHLybHXa7zoiUvkCiyeHV3/oJVAq6 99C5TKQtgQ2wyz4c7FMT2KkOv4VQCflxYABZUdMXmA== X-Google-Smtp-Source: APBJJlFhXvGQZ2GsAhGpDeWOZ4e0rJIiTcI06GYCL302ISkK2GJrN6fzTm7V8FPVMh6JU+Erydc1Sg== X-Received: by 2002:a7b:c5d3:0:b0:3fa:934c:8356 with SMTP id n19-20020a7bc5d3000000b003fa934c8356mr3151501wmk.10.1688927410002; Sun, 09 Jul 2023 11:30:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Andreas Schwab Subject: [PATCH 20/45] linux-user: Make sure initial brk(0) is page-aligned Date: Sun, 9 Jul 2023 19:28:51 +0100 Message-Id: <20230709182934.309468-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928113226100001 Content-Type: text/plain; charset="utf-8" From: Andreas Schwab Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Andreas Schwab Message-Id: Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8b12774fba..04e07cf261 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -806,7 +806,7 @@ static abi_ulong brk_page; =20 void target_set_brk(abi_ulong new_brk) { - target_brk =3D new_brk; + target_brk =3D TARGET_PAGE_ALIGN(new_brk); brk_page =3D HOST_PAGE_ALIGN(target_brk); } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928128; cv=none; d=zohomail.com; s=zohoarc; b=KNvELvq+ErKUeCA6nSDvze8EOS8sitXIQhpEzc/Ab2u+jP+Ol/aUfylANIijuThZxcGGwNruf6V6eRAvqKjj4B3QzDxbvHDX0MOX9c9WKSQOykbjd0rUIFNiqCMoiYYQCwzPxSvvdWIC2Gr8xIXdsJ+NADujRedpG6JyHTn+qzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928128; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Vdmp9g0LETEOImAoeAZ0vz3CHG5eCYIT92dyMVPeN7s=; b=f+/2UsrBsHJ2O/2dbz7SwHAsQiQXOC53pDTaTdT8tXYu5x0J1aaRsdwpXbbHGRCBT2+UCZz4QFO6p3ozr8Bf9IGBdB051HwkGMjkJWiuwk8GJd7qmpE9Shn6FC/QR/LxRjZB5/JNIbIkpFzmPiDOI3JlPRcL2ZcAJZCo8wkJzcY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928128915669.5074027399486; Sun, 9 Jul 2023 11:42:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZDs-0003RA-86; Sun, 09 Jul 2023 14:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDg-0002be-BI for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:16 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDe-00049e-Aa for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:15 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3143ccb0f75so4500776f8f.0 for ; Sun, 09 Jul 2023 11:33:12 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927591; x=1691519591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vdmp9g0LETEOImAoeAZ0vz3CHG5eCYIT92dyMVPeN7s=; b=GcDB1cwlWv8onx7DRhbKruSIPUGqxU8t2/6QJ0jA+nsc8g335q46Y75foy3clj4/2a sblvdanIRgZEsp/BTZ+2G+Tjw473RDCjTCREVzGseG6fsQmQt/9pQaPkIo8IVgUz3/FZ nMcP9H6YTVBXa9Iwwg40ddClph1v2sRQJUemrNb9ohWYS1do2b4giSUIuCM87OmCGfro nC6TGj7CySxDfspvcuusHY6zJra1BkoXKO9n0RfsKqfDRz7XxieqZ5Wbq6/4u9WrvIDe hXaabtaVRm4fymQMXvhvzrhiNY+HLzmvxcK+L8TuUlAm+nJFupr7cQWXpHDtEUXMVLNx DjFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927591; x=1691519591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vdmp9g0LETEOImAoeAZ0vz3CHG5eCYIT92dyMVPeN7s=; b=XXePY6oOMclUQLckRK5m3CHcOvs17l82rfrVafZyvdNZlzGYE9+ZINcTzQUkLOmDSk wl5rO3CgGZmo5Goae09GGOdbxF0CRj7pW+wW5LtYa/Rh8akoR6ttw7QdnE2ef7ac7/Zg JeRfADywQSD6wvsXXeY+WmiGvS3lI3lnD5MefvVmvYM6Df9J+PZeeAPqAwxbLgC4LUsB GTghCQ1i8/j214WQsvh307TLNomZFGyAbiF+KxJWjB6wq4GsSsY2EtT/iQ1Hksomtv5O C/wuTOp4igWwnuLz2IyVilJoO0Lmlt65x/TiUTmg0QNqNMgdURcaTr91V5vlccU2OsV6 CSKg== X-Gm-Message-State: ABy/qLZ4xZ3/yRaJJ23HrCvd7D6WY/IsP5dPTyiDPMz85UDqTIJLSidj CW5PASQYr6itWuf8ViBpiGh9WG8FjsWqWKqz4hLxlw== X-Google-Smtp-Source: APBJJlFlaDKUCd46y5jIqRP71apM35BnIibYqPH3F/RR50osMFYYiYQGTTnQYhnCVdjgRiE/tRFqAg== X-Received: by 2002:adf:de0a:0:b0:313:eb81:d2f6 with SMTP id b10-20020adfde0a000000b00313eb81d2f6mr13119496wrm.4.1688927591647; Sun, 09 Jul 2023 11:33:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/37] target/i386: Use aesdec_ISB_ISR_AK Date: Sun, 9 Jul 2023 19:28:52 +0100 Message-Id: <20230709182934.309468-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928129225100001 This implements the AESDECLAST instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 63fdecbe03..0a37bde595 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2177,12 +2177,12 @@ void glue(helper_aesdec, SUFFIX)(CPUX86State *env, = Reg *d, Reg *v, Reg *s) =20 void glue(helper_aesdeclast, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg= *s) { - int i; - Reg st =3D *v; - Reg rk =3D *s; + for (int i =3D 0; i < SHIFT; i++) { + AESState *ad =3D (AESState *)&d->ZMM_X(i); + AESState *st =3D (AESState *)&v->ZMM_X(i); + AESState *rk =3D (AESState *)&s->ZMM_X(i); =20 - for (i =3D 0; i < 8 << SHIFT; i++) { - d->B(i) =3D rk.B(i) ^ (AES_isbox[st.B(AES_ishifts[i & 15] + (i & ~= 15))]); + aesdec_ISB_ISR_AK(ad, st, rk, false); } } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928170; cv=none; d=zohomail.com; s=zohoarc; b=CHk20xEsaQI5AJBWARBzXVK7wM6yk3WBQWgo+gOP4fg/xWTH6erFFNGxunAL5H3P4wltHa8TnSMRmm608qXzasjJOGPXj5ab9AHFv0Sfy7erCC61/VYTNZ+YvtOZkdTcAD7Hae2uFSmmjejMukHnrajQiznvPVKrkITQ7GxxgEM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7ZmDZIvgGB2xxk9tqZEB+B+DCJxeJQyw+1f4RzekeQw=; b=BsbyBM65mTfGhXYIfHvH1ETn+y7aRjnK/PArkzNpkek+Fe3/roqFC7nlkmMNGILv9CpgeeXuQE1Cr0w1Y6zSnJ1ViLJzH+vTTUtEOIMM/qNnfJyrT5RO8o0UrnZ+Y4BU4S7MbC+bgyTqoGLD4DoDqbGcDfCYhptXiiPGPMgcGOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928170957749.2261358147152; Sun, 9 Jul 2023 11:42:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZDs-0003RZ-8B; Sun, 09 Jul 2023 14:33:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDh-0002pA-D4 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:20 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDe-00049o-Qy for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:17 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31438512cafso4025499f8f.2 for ; Sun, 09 Jul 2023 11:33:14 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927593; x=1691519593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7ZmDZIvgGB2xxk9tqZEB+B+DCJxeJQyw+1f4RzekeQw=; b=FJzvG8XuPhB2RMstkTIOAe+zm5tYULhLxGH/gdKst+DPP80gtRChlTP8Sx5P3ktljn BPmr2Kf8V6IsMB7bpAkz3S2KAHGXmi7vMv14YoBqdsFjDf6laVSjOUaV8tJVnJHB7L+a 2w0PXlof1lUBYwy2YXnkwxPnDaoLcdo5Ccr6NRc3MU/7JYKVR1rdcAHwLIvqOPRra6Xn INvGpI72SolJoxleRXOG3qELc6K34kTZBPN0LOyYLBy3Z7qmKR0u+qplkzWoH/2Adovf oM16EMkezHhhpbGlymi3rEsnEk+NrOVozLZTiXBgtUHjXBE5irVJJM5vt+gYooa5fKpe pl4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927593; x=1691519593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7ZmDZIvgGB2xxk9tqZEB+B+DCJxeJQyw+1f4RzekeQw=; b=bDjRQy8e5zfp2wdi2B7FdQqlIrQXIhp4bwJK1/PZ5nTEwvnIYIUWmmPEMyBLGbK3Vx n1B9Q0oYnCkOfaEkY98rs0vGl0pvf8IIepGQ01TG1c4x+XM/QbWDj/pgEhtZbsF0gqlh uPFAXHx98/OWn2cRFoi7tnBG2WxOwG6751StOddoqzGUntCVLcwTFU0OyMOfMGgqjpL4 7lb7HW1d78Br3A78Yq2Chu0QakRFSmexxV86e1Kqn7VTnwnaQwtcbbfNbwAmPpkHCG2Z jcEiz4hzqKnh3ddEAWDN9iZBoS2rPYLO9DMhND9AragjMBmMCWrRNG6GgtacOMgma7Ai tBOw== X-Gm-Message-State: ABy/qLbfYdfCRQd23hhqwkhu5zWEoAhEheKwA0RflwFLKCXQgwK+OzCx ErKQ5HmGxwArEnbMyTRz1VipE8ZR7PmLY0aLVKktAg== X-Google-Smtp-Source: APBJJlEDu0i7cVtG/9RWOpyWPNwkshKCp4s5SbGLyanz4l/UfhFBJ7I/SqeoosIzOFLGQX8siGa+6A== X-Received: by 2002:adf:e403:0:b0:315:8a0f:9b9b with SMTP id g3-20020adfe403000000b003158a0f9b9bmr6434234wrm.71.1688927593515; Sun, 09 Jul 2023 11:33:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 21/37] target/i386: Use aesdec_IMC Date: Sun, 9 Jul 2023 19:28:54 +0100 Message-Id: <20230709182934.309468-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928173034100019 This implements the AESIMC instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 0a37bde595..893913ebf8 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2215,15 +2215,10 @@ void glue(helper_aesenclast, SUFFIX)(CPUX86State *e= nv, Reg *d, Reg *v, Reg *s) #if SHIFT =3D=3D 1 void glue(helper_aesimc, SUFFIX)(CPUX86State *env, Reg *d, Reg *s) { - int i; - Reg tmp =3D *s; + AESState *ad =3D (AESState *)&d->ZMM_X(0); + AESState *st =3D (AESState *)&s->ZMM_X(0); =20 - for (i =3D 0 ; i < 4 ; i++) { - d->L(i) =3D bswap32(AES_imc[tmp.B(4 * i + 0)][0] ^ - AES_imc[tmp.B(4 * i + 1)][1] ^ - AES_imc[tmp.B(4 * i + 2)][2] ^ - AES_imc[tmp.B(4 * i + 3)][3]); - } + aesdec_IMC(ad, st, false); } =20 void glue(helper_aeskeygenassist, SUFFIX)(CPUX86State *env, Reg *d, Reg *s, --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927870; cv=none; d=zohomail.com; s=zohoarc; b=aTIY5VOgfk+IZUhefT9nlvSLOwRBBTdU9YPt0zCmLiD334w7q5vAC1RWNU2/OkKty7lrAolxyylp13Mp5vdJuB/shw4qQXrIBBzLpC2PfP8v9zOMhPiwKeg+RHDJ500VW3UKjHc84hbmIMuILHyR12PaNRB0BhjcgW1Nb+tixBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927870; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=P9hY9TeCxYhJnVLr/8ClwHOxdUkItKDwriHrtO9HPKWY1IpXMGcyx+R7lwZN+awmdqsWiw4y9q5+LIQae6W1NCbFWogZrmKMN9tRqL1AVVlm5N9nuRlVVZjCuIaP4Af6VHpa+x888u6dKI4t5vh+E8yTS7Sn7Ayv0Of5nlEDBqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927870778187.65966505998063; Sun, 9 Jul 2023 11:37:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZDm-0003EN-8J; Sun, 09 Jul 2023 14:33:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDl-00033b-0j for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:21 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDe-00049m-Cg for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:17 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-313f3a6db22so3764784f8f.3 for ; Sun, 09 Jul 2023 11:33:13 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927593; x=1691519593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=Pk9oLJSPF2CrU7EBPWwY5ZDvUNb97VmFJpkDfOQkNfZFRw2XTxhJqwgQ64DOGoAOSS 0rAl8BYkw2jIodbt0mS7CGuTUUQK+/FY/wGBip0sE/zRGhU3J65MP4E/IDEMQOXfxR24 cAx+mKCyCckk3gPDNs4I3v6goY5BUP5W1eN11u5HsP1xf+Y/WqIv3vAmcvsbSEeDxqxx GUXgpqdvjQD+rnC15h/plsqFvX13HEZfB1j8VkuzEBEBsRVOwgRadiDOE/pk2ml51Bf0 qcrDlK5vknqUih6gAlPSKAUvSMwyF2FQj0SCLjQZLsfrQAhBlxT/TeZKVesooB/K62F9 6vsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927593; x=1691519593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2MU6soREEIeWjjQLlmK8RHmCnAP0c3qo3FFfRalqkkk=; b=VdT9CKeK1kW+w0eA8wYcmiVU+attSmz0/odVNDSgOtlnRsWveMS+Dgsw7TDx3dN2AF g8/02y3dDekadnt0VYc5LMdwoztbBre142D6KetNB1T1TGDvrTsV2YL1wwRAXtegn8CK e5IGWdaBTi/LNIWeFESIh9Vhai2QK7MgXwxXFnACIWpn7IHRCBAz01c/rJednc2GB/oP ASZtEM0vQ123JgcfeXPITlHXO80TqyzIyhcsFMS8dbDrq2tmJYYpnM2JMCNPdBjB+B/f ucDVBjttMamrRqNa0gWMD+XefR8OLpQkM+hey5csxNrmhewnXUnAGDhKRY532xBBzH6l hevw== X-Gm-Message-State: ABy/qLZXmxUcOoVJobtp8OG4CRdoNpWkKpe8bXo1Kcbh9dHgCF2B4daW jBltHzbsy8QnEi8P3Q9aW1JPE5jOLPX8U9yay41+5g== X-Google-Smtp-Source: APBJJlHSABa4bDfPQh30HxSn62KO5eX6UtUWIh//TWyyB153C7meSDlVSokmf5sAQ+xeueAQ5w1IMQ== X-Received: by 2002:adf:efd1:0:b0:2ce:d84d:388f with SMTP id i17-20020adfefd1000000b002ced84d388fmr9753276wrp.40.1688927592630; Sun, 09 Jul 2023 11:33:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 21/45] linux-user: Fix formatting of mmap.c Date: Sun, 9 Jul 2023 19:28:53 +0100 Message-Id: <20230709182934.309468-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927871110100005 Fix all checkpatch.pl errors within mmap.c. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-5-richard.henderson@linaro.org> --- linux-user/mmap.c | 199 ++++++++++++++++++++++++++++------------------ 1 file changed, 122 insertions(+), 77 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 2692936773..639921dba0 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -56,10 +56,11 @@ void mmap_fork_start(void) =20 void mmap_fork_end(int child) { - if (child) + if (child) { pthread_mutex_init(&mmap_mutex, NULL); - else + } else { pthread_mutex_unlock(&mmap_mutex); + } } =20 /* @@ -203,40 +204,47 @@ static int mmap_frag(abi_ulong real_start, =20 /* get the protection of the target pages outside the mapping */ prot1 =3D 0; - for(addr =3D real_start; addr < real_end; addr++) { - if (addr < start || addr >=3D end) + for (addr =3D real_start; addr < real_end; addr++) { + if (addr < start || addr >=3D end) { prot1 |=3D page_get_flags(addr); + } } =20 if (prot1 =3D=3D 0) { /* no page was there, so we allocate one */ void *p =3D mmap(host_start, qemu_host_page_size, prot, flags | MAP_ANONYMOUS, -1, 0); - if (p =3D=3D MAP_FAILED) + if (p =3D=3D MAP_FAILED) { return -1; + } prot1 =3D prot; } prot1 &=3D PAGE_BITS; =20 prot_new =3D prot | prot1; if (!(flags & MAP_ANONYMOUS)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ - if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && - (prot & PROT_WRITE)) + /* + * msync() won't work here, so we return an error if write is + * possible while it is a shared mapping. + */ + if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && (prot & PROT_WRITE)) { return -1; + } =20 /* adjust protection to be able to read */ - if (!(prot1 & PROT_WRITE)) + if (!(prot1 & PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); + } =20 /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1) + if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1)= { return -1; + } =20 /* put final protection */ - if (prot_new !=3D (prot1 | PROT_WRITE)) + if (prot_new !=3D (prot1 | PROT_WRITE)) { mprotect(host_start, qemu_host_page_size, prot_new); + } } else { if (prot_new !=3D prot1) { mprotect(host_start, qemu_host_page_size, prot_new); @@ -265,8 +273,10 @@ abi_ulong mmap_next_start =3D TASK_UNMAPPED_BASE; =20 unsigned long last_brk; =20 -/* Subroutine of mmap_find_vma, used when we have pre-allocated a chunk - of guest address space. */ +/* + * Subroutine of mmap_find_vma, used when we have pre-allocated + * a chunk of guest address space. + */ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong align) { @@ -362,15 +372,17 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze, abi_ulong align) * - shmat() with SHM_REMAP flag */ ptr =3D mmap(g2h_untagged(addr), size, PROT_NONE, - MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0); + MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0); =20 /* ENOMEM, if host address space has no memory */ if (ptr =3D=3D MAP_FAILED) { return (abi_ulong)-1; } =20 - /* Count the number of sequential returns of the same address. - This is used to modify the search algorithm below. */ + /* + * Count the number of sequential returns of the same address. + * This is used to modify the search algorithm below. + */ repeat =3D (ptr =3D=3D prev ? repeat + 1 : 0); =20 if (h2g_valid(ptr + size - 1)) { @@ -387,14 +399,18 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze, abi_ulong align) /* The address is not properly aligned for the target. */ switch (repeat) { case 0: - /* Assume the result that the kernel gave us is the - first with enough free space, so start again at the - next higher target page. */ + /* + * Assume the result that the kernel gave us is the + * first with enough free space, so start again at the + * next higher target page. + */ addr =3D ROUND_UP(addr, align); break; case 1: - /* Sometimes the kernel decides to perform the allocation - at the top end of memory instead. */ + /* + * Sometimes the kernel decides to perform the allocation + * at the top end of memory instead. + */ addr &=3D -align; break; case 2: @@ -407,8 +423,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong siz= e, abi_ulong align) break; } } else { - /* Since the result the kernel gave didn't fit, start - again at low memory. If any repetition, fail. */ + /* + * Since the result the kernel gave didn't fit, start + * again at low memory. If any repetition, fail. + */ addr =3D (repeat ? -1 : 0); } =20 @@ -423,8 +441,10 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong siz= e, abi_ulong align) return (abi_ulong)-1; } wrapped =3D 1; - /* Don't actually use 0 when wrapping, instead indicate - that we'd truly like an allocation in low memory. */ + /* + * Don't actually use 0 when wrapping, instead indicate + * that we'd truly like an allocation in low memory. + */ addr =3D (mmap_min_addr > TARGET_PAGE_SIZE ? TARGET_PAGE_ALIGN(mmap_min_addr) : TARGET_PAGE_SIZE); @@ -485,8 +505,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, i= nt target_prot, real_start =3D start & qemu_host_page_mask; host_offset =3D offset & qemu_host_page_mask; =20 - /* If the user is asking for the kernel to find a location, do that - before we truncate the length for mapping files below. */ + /* + * If the user is asking for the kernel to find a location, do that + * before we truncate the length for mapping files below. + */ if (!(flags & MAP_FIXED)) { host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); @@ -497,32 +519,36 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, } } =20 - /* When mapping files into a memory area larger than the file, accesses - to pages beyond the file size will cause a SIGBUS.=20 - - For example, if mmaping a file of 100 bytes on a host with 4K pages - emulating a target with 8K pages, the target expects to be able to - access the first 8K. But the host will trap us on any access beyond - 4K. =20 - - When emulating a target with a larger page-size than the hosts, we - may need to truncate file maps at EOF and add extra anonymous pages - up to the targets page boundary. */ - + /* + * When mapping files into a memory area larger than the file, accesses + * to pages beyond the file size will cause a SIGBUS. + * + * For example, if mmaping a file of 100 bytes on a host with 4K pages + * emulating a target with 8K pages, the target expects to be able to + * access the first 8K. But the host will trap us on any access beyond + * 4K. + * + * When emulating a target with a larger page-size than the hosts, we + * may need to truncate file maps at EOF and add extra anonymous pages + * up to the targets page boundary. + */ if ((qemu_real_host_page_size() < qemu_host_page_size) && !(flags & MAP_ANONYMOUS)) { struct stat sb; =20 - if (fstat (fd, &sb) =3D=3D -1) - goto fail; + if (fstat(fd, &sb) =3D=3D -1) { + goto fail; + } =20 - /* Are we trying to create a map beyond EOF?. */ - if (offset + len > sb.st_size) { - /* If so, truncate the file map at eof aligned with=20 - the hosts real pagesize. Additional anonymous maps - will be created beyond EOF. */ - len =3D REAL_HOST_PAGE_ALIGN(sb.st_size - offset); - } + /* Are we trying to create a map beyond EOF?. */ + if (offset + len > sb.st_size) { + /* + * If so, truncate the file map at eof aligned with + * the hosts real pagesize. Additional anonymous maps + * will be created beyond EOF. + */ + len =3D REAL_HOST_PAGE_ALIGN(sb.st_size - offset); + } } =20 if (!(flags & MAP_FIXED)) { @@ -532,9 +558,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, i= nt target_prot, host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); =20 - /* Note: we prefer to control the mapping address. It is - especially important if qemu_host_page_size > - qemu_real_host_page_size */ + /* + * Note: we prefer to control the mapping address. It is + * especially important if qemu_host_page_size > + * qemu_real_host_page_size. + */ p =3D mmap(g2h_untagged(start), host_len, host_prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { @@ -572,45 +600,52 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, goto fail; } =20 - /* worst case: we cannot map the file because the offset is not - aligned, so we read it */ + /* + * worst case: we cannot map the file because the offset is not + * aligned, so we read it + */ if (!(flags & MAP_ANONYMOUS) && (offset & ~qemu_host_page_mask) !=3D (start & ~qemu_host_page_= mask)) { - /* msync() won't work here, so we return an error if write is - possible while it is a shared mapping */ - if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && - (host_prot & PROT_WRITE)) { + /* + * msync() won't work here, so we return an error if write is + * possible while it is a shared mapping + */ + if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && (host_prot & PROT_= WRITE)) { errno =3D EINVAL; goto fail; } retaddr =3D target_mmap(start, len, target_prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (retaddr =3D=3D -1) + if (retaddr =3D=3D -1) { goto fail; - if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) + } + if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) { goto fail; + } if (!(host_prot & PROT_WRITE)) { ret =3D target_mprotect(start, len, target_prot); assert(ret =3D=3D 0); } goto the_end; } - =20 + /* handle the start of the mapping */ if (start > real_start) { if (real_end =3D=3D real_start + qemu_host_page_size) { /* one single host page */ ret =3D mmap_frag(real_start, start, end, host_prot, flags, fd, offset); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } goto the_end1; } ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, host_prot, flags, fd, offset); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } real_start +=3D qemu_host_page_size; } /* handle the end of the mapping */ @@ -619,8 +654,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, real_end - qemu_host_page_size, end, host_prot, flags, fd, offset + real_end - qemu_host_page_size - star= t); - if (ret =3D=3D -1) + if (ret =3D=3D -1) { goto fail; + } real_end -=3D qemu_host_page_size; } =20 @@ -628,14 +664,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, if (real_start < real_end) { void *p; unsigned long offset1; - if (flags & MAP_ANONYMOUS) + if (flags & MAP_ANONYMOUS) { offset1 =3D 0; - else + } else { offset1 =3D offset + real_start - start; + } p =3D mmap(g2h_untagged(real_start), real_end - real_start, host_prot, flags, fd, offset1); - if (p =3D=3D MAP_FAILED) + if (p =3D=3D MAP_FAILED) { goto fail; + } passthrough_start =3D real_start; passthrough_end =3D real_end; } @@ -697,16 +735,18 @@ static void mmap_reserve(abi_ulong start, abi_ulong s= ize) } end =3D real_end; } - if (prot !=3D 0) + if (prot !=3D 0) { real_start +=3D qemu_host_page_size; + } } if (end < real_end) { prot =3D 0; for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { prot |=3D page_get_flags(addr); } - if (prot !=3D 0) + if (prot !=3D 0) { real_end -=3D qemu_host_page_size; + } } if (real_start !=3D real_end) { mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, @@ -722,8 +762,9 @@ int target_munmap(abi_ulong start, abi_ulong len) =20 trace_target_munmap(start, len); =20 - if (start & ~TARGET_PAGE_MASK) + if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; + } len =3D TARGET_PAGE_ALIGN(len); if (len =3D=3D 0 || !guest_range_valid_untagged(start, len)) { return -TARGET_EINVAL; @@ -737,25 +778,27 @@ int target_munmap(abi_ulong start, abi_ulong len) if (start > real_start) { /* handle host page containing start */ prot =3D 0; - for(addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE)= { + for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { prot |=3D page_get_flags(addr); } if (real_end =3D=3D real_start + qemu_host_page_size) { - for(addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE)= { + for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { prot |=3D page_get_flags(addr); } end =3D real_end; } - if (prot !=3D 0) + if (prot !=3D 0) { real_start +=3D qemu_host_page_size; + } } if (end < real_end) { prot =3D 0; - for(addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { + for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { prot |=3D page_get_flags(addr); } - if (prot !=3D 0) + if (prot !=3D 0) { real_end -=3D qemu_host_page_size; + } } =20 ret =3D 0; @@ -798,8 +841,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong o= ld_size, flags, g2h_untagged(new_addr)); =20 if (reserved_va && host_addr !=3D MAP_FAILED) { - /* If new and old addresses overlap then the above mremap will - already have failed with EINVAL. */ + /* + * If new and old addresses overlap then the above mremap will + * already have failed with EINVAL. + */ mmap_reserve(old_addr, old_size); } } else if (flags & MREMAP_MAYMOVE) { --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928156; cv=none; d=zohomail.com; s=zohoarc; b=HBLsZxGaQ8ymUGCzy7WGZmoiHRo+DnsbIqcr7raJN4/1ozohcH0zYBeAzqsipOUCMV4CgAt5S3Or88xPjPC4UhQa9RKdu7v6CmyOlTngUaNNicSKsAWCL8rNb2KCvud8nePtMdM6AG/HwfgEBmldkVLwE+Nmnty32K22aAEl2Vc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; b=a5ji2b4/F2vOfB6BGJUNi+3O7DX9CDBPsiIrMe8XeN16JRIZj2WqDiM/ORBgmxcmYaMqclEGeQSyyuPuXSt90i0xyCu2PUvML/3Iaycs11T4ybg+1zP4NsUqy0hf1681RK/HZpNmD9E1wLFWQRgt/TD2kG3bkjSkEHeZTgUEdco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928156456988.3115887552799; Sun, 9 Jul 2023 11:42:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZDs-0003RP-8N; Sun, 09 Jul 2023 14:33:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDl-00033c-1Z for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:21 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDg-0004A1-KT for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:18 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc656873eso49182145e9.1 for ; Sun, 09 Jul 2023 11:33:16 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927595; x=1691519595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; b=ryBrjVtCzcG5Bxe66Yg3RhXI1AJDqQ5I53JXZsqA92sGwkS2tzrfYPSy+9pyDpmb7o bLkxrUNXeDaX3Z6qgH4465ZwQYpaF6Zb9V6XDptnt7B4DCyaESvC4XHHHGnQBlsp7xmw LY/2tijGhCc1AtVkuxzsR7th7mOJtGKM86nB1YIZCkzuJm/q3xLt/U233bgmuw77p2O/ gwTzbHh0xxnRLMdJSWO46e59TV7Y6HpL7qNHF2NkdlNxotwBGFvLqjXnmBsUrOaXKg/j fd1VrPacoZLFm7MxUYSi5F6e8IeHE+J3qrNFlYzTdFWEwQu/XycC5f5SzX1AVPHf/2LK M/WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927595; x=1691519595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vBbRyJEaYCF6DplERXnYlyOqNcFvmMhKu7a8Ju7Ez3M=; b=PbqqYJQy8wEMgmSEfHxZbqN62F4Bi04D6bRWAwChrZq12roECCTB+TxMt88pQGnX1K 7W1q9Dg3RfrtSBzRsHFCPkHcKpv9PKHlc6nQLkfi1XlSEf67yf8GUIbieeaRP6cl5dQx CUp3suMPC5teYfpTF9p3GtV6Adtd2du1bTAd1aTxMhlD2caAFfSvIYhFTd6Rw0pp7Bm9 Z0zK6GiKWWvVeGwCPZeqv6jdb+BqsNVzFLz209KLItEFp0Tm3h45Bz1gJi6jkbUMqoLi IoHHuz0Xhzx62RvU6uKOYG1xw9FzEVf8yaMmw2A30eMbx9uAF9h913JKqY6p2/Q1LytN pdMA== X-Gm-Message-State: ABy/qLZhsRZC2wLX31wtaleYsabMV1FFuFos87zoJJvRBlbchewUwhsp 0fJQnHFVBifn2QuqtkrBb3CMxwqpSuwndSRoagOfEQ== X-Google-Smtp-Source: APBJJlF04K6INghEKWWJZMs1KXFNtPcBv/D51G1J5OMXv8EsIZf2ePNgu7/d3Pgxx6v31HOOoyObjA== X-Received: by 2002:a5d:6a08:0:b0:315:8a80:329e with SMTP id m8-20020a5d6a08000000b003158a80329emr8433162wru.40.1688927595095; Sun, 09 Jul 2023 11:33:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 22/37] target/i386: Use aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:28:56 +0100 Message-Id: <20230709182934.309468-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928157318100001 This implements the AESENC instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 893913ebf8..93a4e0cf16 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2188,16 +2188,12 @@ void glue(helper_aesdeclast, SUFFIX)(CPUX86State *e= nv, Reg *d, Reg *v, Reg *s) =20 void glue(helper_aesenc, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s) { - int i; - Reg st =3D *v; - Reg rk =3D *s; + for (int i =3D 0; i < SHIFT; i++) { + AESState *ad =3D (AESState *)&d->ZMM_X(i); + AESState *st =3D (AESState *)&v->ZMM_X(i); + AESState *rk =3D (AESState *)&s->ZMM_X(i); =20 - for (i =3D 0 ; i < 2 << SHIFT ; i++) { - int j =3D i & 3; - d->L(i) =3D rk.L(i) ^ bswap32(AES_Te0[st.B(AES_shifts[4 * j + 0])]= ^ - AES_Te1[st.B(AES_shifts[4 * j + 1])] ^ - AES_Te2[st.B(AES_shifts[4 * j + 2])] ^ - AES_Te3[st.B(AES_shifts[4 * j + 3])]); + aesenc_SB_SR_MC_AK(ad, st, rk, false); } } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928217; cv=none; d=zohomail.com; s=zohoarc; b=CQksMtpitDTvP7rc+IK80U9zruSvkH97G8zlV3/KN1ASojWRkoojLKPdF6QKO8rWIDuaBulaV1Q1fSzU8PWIIWzl1h8lbQYuSUttRxKMBd/7MwJf9qXFiDJ+b+xhku/ptY2/zr0IZ0mTWkT0m7rXSvzfXUUDS9IF28vq2a1v1Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928217; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pYClR0sio6rk2lfqoeXA7l3l3ZWEbz0PJoflMrr2nFA=; b=F8gz6h8LIPHHh4idb4zXIWopZJoor7fqIRO213fOijErj1jXBkv1l/1x+BhGebt7s/nyN08bvnuYrAdcaBozUByJ/Hug3U3KhhLVEoGVpFAlnVoli+yPS+4nOQYwoWs7f7wK6iL08GRjCXSPXvuDhX4cQCqMFS1hZqb9E4crD9E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928217486679.6377244723101; Sun, 9 Jul 2023 11:43:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZED-00054V-Mu; Sun, 09 Jul 2023 14:33:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDl-00033f-2o for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:21 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDg-00049w-8f for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:17 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-313e742a787so2794686f8f.1 for ; Sun, 09 Jul 2023 11:33:15 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927594; x=1691519594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pYClR0sio6rk2lfqoeXA7l3l3ZWEbz0PJoflMrr2nFA=; b=Ek84AOvZNcHIvJstxIH7nP3lru0f2WFFT8X5wY+y8Gjs2PL1vvV6B4DBESjT+aDuRV 3XTKs02RF869kYogOzc716+FH/0+oDC5DWW+BRj6WAqqENl7O5Y8qCfwaN17jl5ySW5t dlPOWUk4bXNCeGwIudaD242/p0ytmM/nVOpFnm+0Nk/aGDL1uFCn95d7Tm2tiPWiyAe2 ulVylCFZ2dppc+lx5ovIwSyiHsi3+J1FOJbdmIMd7Z6Tnyxwcbodl/iWEDTJ/kSjKbuQ CPgTD7XOTLHiEMfUaC3Fc23j1E4wtlPgsDhKk9kCWrS5sTizCw/T5Mq5YI2fnXXNn/qK 6VKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927594; x=1691519594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pYClR0sio6rk2lfqoeXA7l3l3ZWEbz0PJoflMrr2nFA=; b=FcKn0BPKWsWK9kViOe3ucJPfgaNZaIo5in/y9//PvrQICbJ7g3hZy4jxfncAhy5Rw6 kxGgmDzl+yFDQSUCEib2GVxYHNGI6MGs0nN4ih0A1X3F8Oy8yl+YXMUBaKNFFLr6Dibt nTo2oazA7Ba+HKe6oD3UkaoiJwjU4uAA9XOEt6WJXOCkNoLYsCSb47yf0kfgb3jwvbLI unX5+jIZgDJQMZ7citeUQ4smV7uuVgrt7MmMUTUlLPHaLgc94zFHd2e9sOwtI5g1h5pw bhcCkB7lhBCNzwmDojBUKwSjCeux7jX19c30iZU1Vt7JCKuJ/mIxOQTSEvwMrUqdFjey wUhQ== X-Gm-Message-State: ABy/qLbgSHgxqnjuCxf2IoQ+LAwCcGhlgbEnC8gLRDUoxouFsgFYN/Az Cd2SUKlpFfG7WZMhoxmS3FVjEzpo3sZt39jIUs5OfQ== X-Google-Smtp-Source: APBJJlEl1psj1wivmCYda/dk+Ml02qQSXzpZiJsEJXy3acd+E3Pr2qvIteiEYvAJZIH5ohTdq2D5aQ== X-Received: by 2002:adf:fd84:0:b0:314:a8d:2c9 with SMTP id d4-20020adffd84000000b003140a8d02c9mr10293152wrr.0.1688927594263; Sun, 09 Jul 2023 11:33:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 22/45] linux-user/strace: Expand struct flags to hold a mask Date: Sun, 9 Jul 2023 19:28:55 +0100 Message-Id: <20230709182934.309468-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928219619100003 A zero bit value does not make sense -- it must relate to some field in some way. Define FLAG_BASIC with a build-time sanity check. Adjust FLAG_GENERIC and FLAG_TARGET to use it. Add FLAG_GENERIC_MASK and FLAG_TARGET_MASK. Fix up the existing flag definitions for build errors. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-6-richard.henderson@linaro.org> --- linux-user/strace.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index aad2b62ca4..566396d051 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -46,15 +46,21 @@ struct syscallname { */ struct flags { abi_long f_value; /* flag */ + abi_long f_mask; /* mask */ const char *f_string; /* stringified flag */ }; =20 +/* No 'struct flags' element should have a zero mask. */ +#define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N } + /* common flags for all architectures */ -#define FLAG_GENERIC(name) { name, #name } +#define FLAG_GENERIC_MASK(V, M) FLAG_BASIC(V, M, #V) +#define FLAG_GENERIC(V) FLAG_BASIC(V, V, #V) /* target specific flags (syscall_defs.h has TARGET_) */ -#define FLAG_TARGET(name) { TARGET_ ## name, #name } +#define FLAG_TARGET_MASK(V, M) FLAG_BASIC(TARGET_##V, TARGET_##M, #V) +#define FLAG_TARGET(V) FLAG_BASIC(TARGET_##V, TARGET_##V, #V) /* end of flags array */ -#define FLAG_END { 0, NULL } +#define FLAG_END { 0, 0, NULL } =20 /* Structure used to translate enumerated values into strings */ struct enums { @@ -963,7 +969,7 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const st= ruct syscallname *name, #endif =20 UNUSED static const struct flags access_flags[] =3D { - FLAG_GENERIC(F_OK), + FLAG_GENERIC_MASK(F_OK, R_OK | W_OK | X_OK), FLAG_GENERIC(R_OK), FLAG_GENERIC(W_OK), FLAG_GENERIC(X_OK), @@ -999,9 +1005,9 @@ UNUSED static const struct flags mode_flags[] =3D { }; =20 UNUSED static const struct flags open_access_flags[] =3D { - FLAG_TARGET(O_RDONLY), - FLAG_TARGET(O_WRONLY), - FLAG_TARGET(O_RDWR), + FLAG_TARGET_MASK(O_RDONLY, O_ACCMODE), + FLAG_TARGET_MASK(O_WRONLY, O_ACCMODE), + FLAG_TARGET_MASK(O_RDWR, O_ACCMODE), FLAG_END, }; =20 @@ -1010,7 +1016,9 @@ UNUSED static const struct flags open_flags[] =3D { FLAG_TARGET(O_CREAT), FLAG_TARGET(O_DIRECTORY), FLAG_TARGET(O_EXCL), +#if TARGET_O_LARGEFILE !=3D 0 FLAG_TARGET(O_LARGEFILE), +#endif FLAG_TARGET(O_NOCTTY), FLAG_TARGET(O_NOFOLLOW), FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */ @@ -1075,7 +1083,7 @@ UNUSED static const struct flags umount2_flags[] =3D { }; =20 UNUSED static const struct flags mmap_prot_flags[] =3D { - FLAG_GENERIC(PROT_NONE), + FLAG_GENERIC_MASK(PROT_NONE, PROT_READ | PROT_WRITE | PROT_EXEC), FLAG_GENERIC(PROT_EXEC), FLAG_GENERIC(PROT_READ), FLAG_GENERIC(PROT_WRITE), @@ -1103,7 +1111,7 @@ UNUSED static const struct flags mmap_flags[] =3D { #ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE), #endif -#ifdef TARGET_MAP_UNINITIALIZED +#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED !=3D 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif FLAG_TARGET(MAP_HUGETLB), @@ -1201,13 +1209,13 @@ UNUSED static const struct flags statx_flags[] =3D { FLAG_GENERIC(AT_SYMLINK_NOFOLLOW), #endif #ifdef AT_STATX_SYNC_AS_STAT - FLAG_GENERIC(AT_STATX_SYNC_AS_STAT), + FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT, AT_STATX_SYNC_TYPE), #endif #ifdef AT_STATX_FORCE_SYNC - FLAG_GENERIC(AT_STATX_FORCE_SYNC), + FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC, AT_STATX_SYNC_TYPE), #endif #ifdef AT_STATX_DONT_SYNC - FLAG_GENERIC(AT_STATX_DONT_SYNC), + FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC, AT_STATX_SYNC_TYPE), #endif FLAG_END, }; @@ -1481,14 +1489,10 @@ print_flags(const struct flags *f, abi_long flags, = int last) const char *sep =3D ""; int n; =20 - if ((flags =3D=3D 0) && (f->f_value =3D=3D 0)) { - qemu_log("%s%s", f->f_string, get_comma(last)); - return; - } for (n =3D 0; f->f_string !=3D NULL; f++) { - if ((f->f_value !=3D 0) && ((flags & f->f_value) =3D=3D f->f_value= )) { + if ((flags & f->f_mask) =3D=3D f->f_value) { qemu_log("%s%s", sep, f->f_string); - flags &=3D ~f->f_value; + flags &=3D ~f->f_mask; sep =3D "|"; n++; } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927627; cv=none; d=zohomail.com; s=zohoarc; b=GYqSvQrJaNBp7rOyiIyS1shYpF+T94tq+w/2lpLXDL5A2aqdId7OatZnH//6z/OaepWsH2u8uTB0IH72cQycJl6SkgZNHR3ReUWXfXjDpAJF7FYI4J25mHvKMltMQfuTC5tYJvptOUyvPh68Ye2oPyIWtYTww7K79cZyKfbgRh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=ABV1SZNz8mecSaah+JW4I3LutK8PtMJfNySkgwFMKj/6BjCrSPNMKFQOI1e21Os/IKPNm3KdXWC1/v/MJormAALjag9gqNuihRcYWDXBhEiQ+0/aV6rVrQ7dGo35iXmtFqXgF1PlD0i2YEXNWmnkwqGP2V4mg1VYufs1Qm8/v3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927627178747.8338466759091; Sun, 9 Jul 2023 11:33:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE2-0003jC-IL; Sun, 09 Jul 2023 14:33:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDl-00033h-3H for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:21 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDh-0004AM-66 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:19 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so39279285e9.1 for ; Sun, 09 Jul 2023 11:33:16 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927596; x=1691519596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=nX6u4/501AaLKllQdCgFDRqJbCP3hJhwBSzfezPMfcvUh9Q6mlaVL+grIMuKIPAqk3 vj06KaN8ZBb0fAVkQyoNjp+OELTxPnU6CAAfKQBHajILAYcaGbEtalKtTGFMoDoDMG+J AuXzNiLhS11JEPYBspuu0GzPp43T/ZD9+AXjQF+ybMoTpA6h1coQSiqrN28Ia7v7xeoy rxLzhK0EVepG9jk+j7oZeQr5/um4eTb1LCmvC6ocLIaip9vmCJla51hxxZ4Z0pRwFF77 YmUziVh8KEbID7cP2SqNELev1deMshQX7AW60NMlJL/Dem+HHHYYDcBG5texgMWERwa3 jD2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927596; x=1691519596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v53BpocOSkZq13xiAuKy1Z69SsuVPyzPYM9KNeUZOtU=; b=hM6oHn1tcOsi6koQoSNrDmUY0acePCgN9kqPfgFaqnIew9n9H2RoDrxeYtV8NV68bH RHxfig7M5o7Pe1c1e5KGNEXDA1n1OTdzivLFncaGPCTF6gxLeux7EG/7NHoOcrmXb9JK 5Ps2dAWppCUZSRTWoZUJA1GHp/MHr0CxtLHWSqYQM9CgOes5/umdwXWywe09EiEHzZWg pp15R5CDJ4XhEOFl4EVYfgxZWoBLXkMOWWcRVrV16h9ddDBUqfquJjklMVBYLEJBGT2n s+vv26s+IUzEc4i1UW6h9bRfgs4oKDf+rZjIAB9Jer9Gjfjwxts0Be+GFPiuXPfj5Yqr /wOg== X-Gm-Message-State: ABy/qLY3hKJD/1njaAbC+bu/N7YaEYqNDtoGG9o/Ojpyy2v4cF+74cLN b9YllyPomERIRHTPzKCC0uIcM+TVpKUqQ/0MJT3zQA== X-Google-Smtp-Source: APBJJlHLmM6aoXBT+AbdAs1S8SkpHfg/sS6SLWtL/syCWsjUwv/BX39kcgYAN0q0i9nTDvrFJCyLKQ== X-Received: by 2002:a5d:6a4d:0:b0:314:553e:c590 with SMTP id t13-20020a5d6a4d000000b00314553ec590mr8748080wrw.5.1688927595863; Sun, 09 Jul 2023 11:33:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 23/45] linux-user: Split TARGET_MAP_* out of syscall_defs.h Date: Sun, 9 Jul 2023 19:28:57 +0100 Message-Id: <20230709182934.309468-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927628089100002 Move the values into the per-target target_mman.h headers Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-7-richard.henderson@linaro.org> --- linux-user/alpha/target_mman.h | 13 +++++ linux-user/generic/target_mman.h | 54 ++++++++++++++++++++ linux-user/hppa/target_mman.h | 10 ++++ linux-user/mips/target_mman.h | 16 ++++++ linux-user/mips64/target_mman.h | 2 +- linux-user/ppc/target_mman.h | 8 +++ linux-user/sparc/target_mman.h | 9 ++++ linux-user/syscall_defs.h | 85 +------------------------------- linux-user/xtensa/target_mman.h | 16 ++++++ 9 files changed, 128 insertions(+), 85 deletions(-) diff --git a/linux-user/alpha/target_mman.h b/linux-user/alpha/target_mman.h index 051544f5ab..6bb03e7336 100644 --- a/linux-user/alpha/target_mman.h +++ b/linux-user/alpha/target_mman.h @@ -1,6 +1,19 @@ #ifndef ALPHA_TARGET_MMAN_H #define ALPHA_TARGET_MMAN_H =20 +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_FIXED 0x100 +#define TARGET_MAP_GROWSDOWN 0x01000 +#define TARGET_MAP_DENYWRITE 0x02000 +#define TARGET_MAP_EXECUTABLE 0x04000 +#define TARGET_MAP_LOCKED 0x08000 +#define TARGET_MAP_NORESERVE 0x10000 +#define TARGET_MAP_POPULATE 0x20000 +#define TARGET_MAP_NONBLOCK 0x40000 +#define TARGET_MAP_STACK 0x80000 +#define TARGET_MAP_HUGETLB 0x100000 +#define TARGET_MAP_FIXED_NOREPLACE 0x200000 + #define TARGET_MADV_DONTNEED 6 =20 #define TARGET_MS_ASYNC 1 diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_m= man.h index 32bf1a52d0..7b888fb7f8 100644 --- a/linux-user/generic/target_mman.h +++ b/linux-user/generic/target_mman.h @@ -1,6 +1,60 @@ #ifndef LINUX_USER_TARGET_MMAN_H #define LINUX_USER_TARGET_MMAN_H =20 +/* These are defined in linux/mmap.h */ +#define TARGET_MAP_SHARED 0x01 +#define TARGET_MAP_PRIVATE 0x02 +#define TARGET_MAP_SHARED_VALIDATE 0x03 + +/* 0x0100 - 0x4000 flags are defined in asm-generic/mman.h */ +#ifndef TARGET_MAP_GROWSDOWN +#define TARGET_MAP_GROWSDOWN 0x0100 +#endif +#ifndef TARGET_MAP_DENYWRITE +#define TARGET_MAP_DENYWRITE 0x0800 +#endif +#ifndef TARGET_MAP_EXECUTABLE +#define TARGET_MAP_EXECUTABLE 0x1000 +#endif +#ifndef TARGET_MAP_LOCKED +#define TARGET_MAP_LOCKED 0x2000 +#endif +#ifndef TARGET_MAP_NORESERVE +#define TARGET_MAP_NORESERVE 0x4000 +#endif + +/* Other MAP flags are defined in asm-generic/mman-common.h */ +#ifndef TARGET_MAP_TYPE +#define TARGET_MAP_TYPE 0x0f +#endif +#ifndef TARGET_MAP_FIXED +#define TARGET_MAP_FIXED 0x10 +#endif +#ifndef TARGET_MAP_ANONYMOUS +#define TARGET_MAP_ANONYMOUS 0x20 +#endif +#ifndef TARGET_MAP_POPULATE +#define TARGET_MAP_POPULATE 0x008000 +#endif +#ifndef TARGET_MAP_NONBLOCK +#define TARGET_MAP_NONBLOCK 0x010000 +#endif +#ifndef TARGET_MAP_STACK +#define TARGET_MAP_STACK 0x020000 +#endif +#ifndef TARGET_MAP_HUGETLB +#define TARGET_MAP_HUGETLB 0x040000 +#endif +#ifndef TARGET_MAP_SYNC +#define TARGET_MAP_SYNC 0x080000 +#endif +#ifndef TARGET_MAP_FIXED_NOREPLACE +#define TARGET_MAP_FIXED_NOREPLACE 0x100000 +#endif +#ifndef TARGET_MAP_UNINITIALIZED +#define TARGET_MAP_UNINITIALIZED 0x4000000 +#endif + #ifndef TARGET_MADV_NORMAL #define TARGET_MADV_NORMAL 0 #endif diff --git a/linux-user/hppa/target_mman.h b/linux-user/hppa/target_mman.h index f9b6b97032..97f87d042a 100644 --- a/linux-user/hppa/target_mman.h +++ b/linux-user/hppa/target_mman.h @@ -1,6 +1,16 @@ #ifndef HPPA_TARGET_MMAN_H #define HPPA_TARGET_MMAN_H =20 +#define TARGET_MAP_TYPE 0x2b +#define TARGET_MAP_FIXED 0x04 +#define TARGET_MAP_ANONYMOUS 0x10 +#define TARGET_MAP_GROWSDOWN 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 +#define TARGET_MAP_UNINITIALIZED 0 + #define TARGET_MADV_MERGEABLE 65 #define TARGET_MADV_UNMERGEABLE 66 #define TARGET_MADV_HUGEPAGE 67 diff --git a/linux-user/mips/target_mman.h b/linux-user/mips/target_mman.h index e7ba6070fe..cd566c24b6 100644 --- a/linux-user/mips/target_mman.h +++ b/linux-user/mips/target_mman.h @@ -1 +1,17 @@ +#ifndef MIPS_TARGET_MMAN_H +#define MIPS_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x0400 +#define TARGET_MAP_ANONYMOUS 0x0800 +#define TARGET_MAP_GROWSDOWN 0x1000 +#define TARGET_MAP_DENYWRITE 0x2000 +#define TARGET_MAP_EXECUTABLE 0x4000 +#define TARGET_MAP_LOCKED 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/mips64/target_mman.h b/linux-user/mips64/target_mma= n.h index e7ba6070fe..7bdc47d902 100644 --- a/linux-user/mips64/target_mman.h +++ b/linux-user/mips64/target_mman.h @@ -1 +1 @@ -#include "../generic/target_mman.h" +#include "../mips/target_mman.h" diff --git a/linux-user/ppc/target_mman.h b/linux-user/ppc/target_mman.h index e7ba6070fe..67cc218f2e 100644 --- a/linux-user/ppc/target_mman.h +++ b/linux-user/ppc/target_mman.h @@ -1 +1,9 @@ +#ifndef PPC_TARGET_MMAN_H +#define PPC_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x40 +#define TARGET_MAP_LOCKED 0x80 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/sparc/target_mman.h b/linux-user/sparc/target_mman.h index e7ba6070fe..9bad99c852 100644 --- a/linux-user/sparc/target_mman.h +++ b/linux-user/sparc/target_mman.h @@ -1 +1,10 @@ +#ifndef SPARC_TARGET_MMAN_H +#define SPARC_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x40 +#define TARGET_MAP_LOCKED 0x100 +#define TARGET_MAP_GROWSDOWN 0x0200 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index c8ffb4f785..041105b7a7 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1238,90 +1238,7 @@ struct target_winsize { #define TARGET_PROT_MTE 0x20 #endif =20 -/* Common */ -#define TARGET_MAP_SHARED 0x01 /* Share changes */ -#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ -#if defined(TARGET_HPPA) -#define TARGET_MAP_TYPE 0x03 /* Mask for type of mappin= g */ -#else -#define TARGET_MAP_TYPE 0x0f /* Mask for type of mappin= g */ -#endif - -/* Target specific */ -#if defined(TARGET_MIPS) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapp= ing */ -#elif defined(TARGET_PPC) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x20000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapp= ing */ -#elif defined(TARGET_ALPHA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly = */ -#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservatio= ns */ -#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetabl= es */ -#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x80000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapp= ing */ -#elif defined(TARGET_HPPA) -#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ -#define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly = */ -#define TARGET_MAP_GROWSDOWN 0x08000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x00800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x01000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x02000 /* lock the mapping */ -#define TARGET_MAP_NORESERVE 0x04000 /* no check for reservatio= ns */ -#define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetabl= es */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapp= ing */ -#elif defined(TARGET_XTENSA) -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ -#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pag= etables */ -#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x40000 -#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping = */ -#else -#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly = */ -#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ -#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executabl= e */ -#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ -#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reserva= tions */ -#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pag= etables */ -#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ -#define TARGET_MAP_STACK 0x20000 /* ignored */ -#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapp= ing */ -#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, mem= ory could be uninitialized */ -#endif +#include "target_mman.h" =20 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \ diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mma= n.h index e7ba6070fe..3891bb5e07 100644 --- a/linux-user/xtensa/target_mman.h +++ b/linux-user/xtensa/target_mman.h @@ -1 +1,17 @@ +#ifndef XTENSA_TARGET_MMAN_H +#define XTENSA_TARGET_MMAN_H + +#define TARGET_MAP_NORESERVE 0x0400 +#define TARGET_MAP_ANONYMOUS 0x0800 +#define TARGET_MAP_GROWSDOWN 0x1000 +#define TARGET_MAP_DENYWRITE 0x2000 +#define TARGET_MAP_EXECUTABLE 0x4000 +#define TARGET_MAP_LOCKED 0x8000 +#define TARGET_MAP_POPULATE 0x10000 +#define TARGET_MAP_NONBLOCK 0x20000 +#define TARGET_MAP_STACK 0x40000 +#define TARGET_MAP_HUGETLB 0x80000 + #include "../generic/target_mman.h" + +#endif --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927863; cv=none; d=zohomail.com; s=zohoarc; b=V8k0rxj7L9EpuoufZoKYSSyDZtu4ROTJD7oTDcdU0vCLttFdZCyuAX4kJjuL+B/412cLMJ2MGYzVlZ230u4CzktQT4OLo4FwpYxJXcUD89l3VB/Jq++DCBQg3GlnZ1yLSRN0ZKBzPTxvfNV8whD7zF7Kod+oh29UQ768Cfm6QRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927863; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ineMFXHMMUsTtHLB4+TRmNQDsbNNDE8LTO9PLI3JgtY=; b=H6o+1gnw5w/5pkUI8CNCMKonX6qknB1f1o67wuIj8lbr8EX38AGJRMvpHCKO0UpJumnSp4m3hy6SUKI3JS9DN0kJFQ7eN4fHKktLagCx8TVmaFNMiatW/78jxYgtuvcy/hsvQB7YNcqdfmLo4w5mQ3M572Hk/liozBZLYVYy9zc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168892786325910.198531725566113; Sun, 9 Jul 2023 11:37:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEE-0005Cy-FS; Sun, 09 Jul 2023 14:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDn-0003LQ-QH for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:24 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDk-0004Aa-RY for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:23 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-313fb7f0f80so3705410f8f.2 for ; Sun, 09 Jul 2023 11:33:17 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927596; x=1691519596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ineMFXHMMUsTtHLB4+TRmNQDsbNNDE8LTO9PLI3JgtY=; b=yloPZVoeXW1Y9dub8O+N9Q6oI+EOzm/c2NDF5tOIq+sy/vqhSSkItj4XMVMPTQCY0b wCt9RPxUoT152hjYGWnWyC09UoewpAvvEKMhvRbYGmfw5maG+xPBdC5wog/v8F9MCmbu XsYS/8nLv0w3a+tf+KNu+wej3A1bbiFMb4mX/I1TLvaCTFN9aTe6f/pIInIY2twC7s2c WBP9ooE5wAMaSYEzUvFdThV9K/wGzVBKqwISlGV/GQlfk7IY6RbNLiCiyXKoFfO/xhqB KtMflNtKTYdOskb80REn0UaOJl+em8lNOO65++vU8ZIOc1juWG6qSWid+zfbqR/7WS4k wMxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927596; x=1691519596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ineMFXHMMUsTtHLB4+TRmNQDsbNNDE8LTO9PLI3JgtY=; b=fq9a7nAEuWa+pLHk47j9xIRNvP2yJnCfKHaj9TbGN6meDlg4aMkyPE3JtncL//OLyK HB9fcXatnCtGCXWToglrS2rOtVCPEWLv86vmSPoEmpIhvTh0l3w7hokXZ2mjAev4IR5S sCgOi4txIyrYe+KwuaJx1rCAUxeFLld9sjG3uUDdGamPS8ztx3k5Fw4DWZajIy8MrAAE VCttuArrss7GfRGUhoMgwY0NWU12GpFfQOCd3CaOt6NgADRovrzL6Kk9KHt+AGs6bF// cl3mjEtaKrRLj4aXsZgmxyNEBayuJ8qhYmSXuRdUxSmIiKDa2w67+EwAuoYTL1sBvQbV sWrA== X-Gm-Message-State: ABy/qLarBSoIEWYweGq9rlvIlcKQ5YdxPHqi5fC5v3yLOj7lNRhERXD4 Pqn4bIT7gjX+HAx4fxZEb0u4ZcOlUq+FCqVTuNT2JA== X-Google-Smtp-Source: APBJJlE6vC2CeXnYSN0ZTs90hZrgeJoYGQnhsiE83rHLBDUbOU4RWF379vEYG9t+8iZ80ZKjkDDByA== X-Received: by 2002:a5d:404f:0:b0:307:7f38:37f with SMTP id w15-20020a5d404f000000b003077f38037fmr9063280wrp.66.1688927596657; Sun, 09 Jul 2023 11:33:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 23/37] target/i386: Use aesdec_ISB_ISR_IMC_AK Date: Sun, 9 Jul 2023 19:28:58 +0100 Message-Id: <20230709182934.309468-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927865192100005 This implements the AESDEC instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/target/i386/ops_sse.h b/target/i386/ops_sse.h index 93a4e0cf16..a0e425733f 100644 --- a/target/i386/ops_sse.h +++ b/target/i386/ops_sse.h @@ -2162,16 +2162,12 @@ void glue(helper_pclmulqdq, SUFFIX)(CPUX86State *en= v, Reg *d, Reg *v, Reg *s, =20 void glue(helper_aesdec, SUFFIX)(CPUX86State *env, Reg *d, Reg *v, Reg *s) { - int i; - Reg st =3D *v; - Reg rk =3D *s; + for (int i =3D 0; i < SHIFT; i++) { + AESState *ad =3D (AESState *)&d->ZMM_X(i); + AESState *st =3D (AESState *)&v->ZMM_X(i); + AESState *rk =3D (AESState *)&s->ZMM_X(i); =20 - for (i =3D 0 ; i < 2 << SHIFT ; i++) { - int j =3D i & 3; - d->L(i) =3D rk.L(i) ^ bswap32(AES_Td0[st.B(AES_ishifts[4 * j + 0])= ] ^ - AES_Td1[st.B(AES_ishifts[4 * j + 1])] ^ - AES_Td2[st.B(AES_ishifts[4 * j + 2])] ^ - AES_Td3[st.B(AES_ishifts[4 * j + 3])]); + aesdec_ISB_ISR_IMC_AK(ad, st, rk, false); } } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927950; cv=none; d=zohomail.com; s=zohoarc; b=htK/DvnymTCyI+nzdfNAyrQo1sRhvtg5yjs2PBhXZuLKCcq5QZ4M/xfQH3QL6iiCNPiFGxwhGqH5v/CU8V3qpjB/5hc3xz1q0T3sEwxsQtjtf6lR7XPAGr4V9lYQqDb3fvBVE5TiJR5nMyDM7D0Ts1KAEfgZrPxTAd2VVXYeFDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=SnVF37ggW3ze06d47qS2oprDG/MDBnNs2FahEL0681gm/RIKbGNCiNmyntWk6YbJvHe5IVntKqeoYMs1ETtt31bemVeCbYPbdQ+FTfE2zSXw+5BuRdt9gGyZiJCv72RrNN6JJ7GLOvpHGaRnkXpVNinEhx6bBrH9sQdRcvVTudM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927950289842.8525601609906; Sun, 9 Jul 2023 11:39:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEP-0005sa-NL; Sun, 09 Jul 2023 14:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDm-0003IU-MB for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:22 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDk-0004Ap-Qc for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:22 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3143ccb0f75so4500852f8f.0 for ; Sun, 09 Jul 2023 11:33:18 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927597; x=1691519597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=Y3jTRAGhWNlLnjxFvFMZObU7LDmyk1EIlyWJzFIdgT3RszI4UvO45dVU+4BHS2zJmy yFG6Xu4v2b3JXPdYsIvG8+5tT0g5dC744DDnbo9uBz5q5B1nV2xacBL7AKODFSNTu86c p4Zq7Vud8zWagOUY4h3fPSTFSsb/Awh29YXWE0YHXXyN9MufQ64j0bPmAjWQYVtdfgLp u2Pi+uvU1t4inDzcebn8g6QXH2YNXi/NgarIX3p/HaXzThT1d00cyAw9SQo0DGABWGGa lI6F+EscYc91tqODeDQfz02g/jPt/LVEbQ0q0LOrh4OwO7QAgn+hV4d2z7uTvoQGbfGY wSzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927597; x=1691519597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7XT7/zvTpZMeqxSdbndcDLpIQTRXhkVJ5EOXRYsTIYQ=; b=U2tIt4WpGhwuAuWn7sKRIEMvAwgBPo0k3qOwY/jDPgWCt56YtL0uyXuTJD1TxtpYa9 3YBCf/+/9G+Wbx3Z9jceyJZm4bpoh2KIw6/jwVbDzIQhEaV3RHzOKk1oc16ELqPSIjPb nyiwt9JKc6pLFj764CXYcjDW6wnmLYfszcUBacLl7qlBjSj9vQwsfsc0YEOU7iFtq+zf u7+uip2qTNDYMqogQHhKpDu8Tgsfqg6CAOhZCD/irXSWL8eK7+chmHfytxVnHzBnXC/m o6gfbIh9B+Y9nCkdKekTj9sxBHCZT/1wVtUj7tQEs1Jgl6/cRO/HzDY6muDiNvxsAKn1 iWGg== X-Gm-Message-State: ABy/qLaflYDH9GsL7bny2tTFf7OXSCW+i3yjCQTuJdsH1zODQqmg2a2I X8m3mKJlv+PhvSkr9+gUTf6XxknsSeW4SW0H/EcrlA== X-Google-Smtp-Source: APBJJlFZdq50X/wsOxXKVyYIeK4mCDGzndwoghOQ6SmqQBw+jR6r2W+ybBn/j51Olwj8dnsAiRLWNQ== X-Received: by 2002:adf:ee8c:0:b0:314:748:d59d with SMTP id b12-20020adfee8c000000b003140748d59dmr11590079wro.27.1688927597527; Sun, 09 Jul 2023 11:33:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 24/45] linux-user: Split TARGET_PROT_* out of syscall_defs.h Date: Sun, 9 Jul 2023 19:28:59 +0100 Message-Id: <20230709182934.309468-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927951380100001 Move the values into the per-target target_mman.h headers Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-8-richard.henderson@linaro.org> --- linux-user/aarch64/target_mman.h | 8 ++++++++ linux-user/generic/target_mman.h | 6 +++++- linux-user/mips/target_mman.h | 2 ++ linux-user/syscall_defs.h | 11 ----------- linux-user/xtensa/target_mman.h | 2 ++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/linux-user/aarch64/target_mman.h b/linux-user/aarch64/target_m= man.h index e7ba6070fe..f721295fe1 100644 --- a/linux-user/aarch64/target_mman.h +++ b/linux-user/aarch64/target_mman.h @@ -1 +1,9 @@ +#ifndef AARCH64_TARGET_MMAN_H +#define AARCH64_TARGET_MMAN_H + +#define TARGET_PROT_BTI 0x10 +#define TARGET_PROT_MTE 0x20 + #include "../generic/target_mman.h" + +#endif diff --git a/linux-user/generic/target_mman.h b/linux-user/generic/target_m= man.h index 7b888fb7f8..ec76a91b46 100644 --- a/linux-user/generic/target_mman.h +++ b/linux-user/generic/target_mman.h @@ -23,7 +23,11 @@ #define TARGET_MAP_NORESERVE 0x4000 #endif =20 -/* Other MAP flags are defined in asm-generic/mman-common.h */ +/* Defined in asm-generic/mman-common.h */ +#ifndef TARGET_PROT_SEM +#define TARGET_PROT_SEM 0x08 +#endif + #ifndef TARGET_MAP_TYPE #define TARGET_MAP_TYPE 0x0f #endif diff --git a/linux-user/mips/target_mman.h b/linux-user/mips/target_mman.h index cd566c24b6..e97694aa4e 100644 --- a/linux-user/mips/target_mman.h +++ b/linux-user/mips/target_mman.h @@ -1,6 +1,8 @@ #ifndef MIPS_TARGET_MMAN_H #define MIPS_TARGET_MMAN_H =20 +#define TARGET_PROT_SEM 0x10 + #define TARGET_MAP_NORESERVE 0x0400 #define TARGET_MAP_ANONYMOUS 0x0800 #define TARGET_MAP_GROWSDOWN 0x1000 diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 041105b7a7..77ba343c85 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1227,17 +1227,6 @@ struct target_winsize { =20 #include "termbits.h" =20 -#if defined(TARGET_MIPS) || defined(TARGET_XTENSA) -#define TARGET_PROT_SEM 0x10 -#else -#define TARGET_PROT_SEM 0x08 -#endif - -#ifdef TARGET_AARCH64 -#define TARGET_PROT_BTI 0x10 -#define TARGET_PROT_MTE 0x20 -#endif - #include "target_mman.h" =20 #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \ diff --git a/linux-user/xtensa/target_mman.h b/linux-user/xtensa/target_mma= n.h index 3891bb5e07..3933771b5b 100644 --- a/linux-user/xtensa/target_mman.h +++ b/linux-user/xtensa/target_mman.h @@ -1,6 +1,8 @@ #ifndef XTENSA_TARGET_MMAN_H #define XTENSA_TARGET_MMAN_H =20 +#define TARGET_PROT_SEM 0x10 + #define TARGET_MAP_NORESERVE 0x0400 #define TARGET_MAP_ANONYMOUS 0x0800 #define TARGET_MAP_GROWSDOWN 0x1000 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928167; cv=none; d=zohomail.com; s=zohoarc; b=NjepH7E1Zc6GP+4TiQk7is/m5gz5pVX/8F97GPihnJPFfNlYNRjntddyY9atni9GN18g2HVgKH4v4TaYda1Lo0yLHbNbcCMZ63C2HMrMD8VZqZi4FT6as6me0VRyHTy3fHFzG2mjobOAeM0tCuN/fXEBqzsAPMZCVsrm1BuJ9H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928167; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O7ydnBYQ5OsAEU6obJ0/WYba/6nStgh78o+Q1/ZISH0=; b=WoIz9HX0IAGnh+1W//0oFEsx4u6w63INcaEzPk6Ww1W32tEmsGehsXUGhonVqfnoErFY9lonBWthGHGFxMJLxoBiXsueByMw+oCP9pyJVFV1GX757xQrVBDHN/WlaAat37TBV7/vxFV7WE3In9ofq/wZ+XVJ83o1QsKlcEyGgg8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928167857851.978507371113; Sun, 9 Jul 2023 11:42:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE3-0003nW-5i; Sun, 09 Jul 2023 14:33:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0003Rv-Bh for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:26 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDk-0004Ax-RE for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:25 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fbc77e76abso39545075e9.1 for ; Sun, 09 Jul 2023 11:33:19 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927598; x=1691519598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O7ydnBYQ5OsAEU6obJ0/WYba/6nStgh78o+Q1/ZISH0=; b=ilR0OBCRgobFIdqHfHCrUS2RI6j6aoO8jGoRxPPfKnfUWn+CywRuI3HySEMe3RodOE MKl3z5xcKqHNL7Mh38lczn0yoDR+4SJ01ujvHg9F4BSe8VgM7XKmPxch+iCjLQWUWqdg 4Ph5CvtmBu+IvBCOGikKet5GXYs3+Ngov7MX6HOxChEvPAoau4ATGf71LrZBS6D2Xpoj 24Kp5RePAR69lLmry1KUw4XE2QMPtGETYoXDcA6I1w2hPYbXZS5GEbrllqC2Pd5Stqlz xWYeyNrxgFM1AiYNeRIxdC5kEBXh5wcGWrWluw5XgS6NX28rzo8XrUoNF3PupB9LjEoS nKow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927598; x=1691519598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O7ydnBYQ5OsAEU6obJ0/WYba/6nStgh78o+Q1/ZISH0=; b=gAZoahxzYq9whfatlUuMJhrUP+rSyCJCdjs56LoG0TTzRY4DkJ41W9Jkz5N479R3dA 9WsvViN/qBu6NZRBzK7ypQQrz+HtXYy3W9MYXlnp1UJc7DFUzh+4XYu5G5R7pjsoUxWM beOtQ7cAX+hHE035IeX3YgIPjC9ojrLerQlt5NXW6+Fwkv3P0O+4vUARYcVnjysw6N46 RwqPLJiUcvmyNIG4paMo+hPV/myq4w+iTXAUA58DBEFMr/60Wp/JblC+XPjkwgiAJGS+ nTgVMKchoeunOT8jNHB3DE9iwxgAFI19kUvV5BrdqSXUHpneh+bckJsLTNup0RFd1syr /YKg== X-Gm-Message-State: ABy/qLacxUKwo3LZHuzGpABLVq9I8VWTO5E5rjEJtBKvTb+gIMjteO2m cs/THcdsYtdqtZDr92pzDu0OAhi9fvbdmQkxR/uR1w== X-Google-Smtp-Source: APBJJlHYLttwzUys8nSJte8+8IEggt4d7SsMAAw2Pyvh3Aph6ggSIPvng8XwHExRS/oi6jfw+fPUzA== X-Received: by 2002:a7b:c457:0:b0:3fb:739d:27b2 with SMTP id l23-20020a7bc457000000b003fb739d27b2mr9172846wmi.8.1688927598319; Sun, 09 Jul 2023 11:33:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 24/37] target/arm: Demultiplex AESE and AESMC Date: Sun, 9 Jul 2023 19:29:00 +0100 Message-Id: <20230709182934.309468-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928169367100001 Split these helpers so that we are not passing 'decrypt' within the simd descriptor. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/helper.h | 2 ++ target/arm/tcg/sve.decode | 4 ++-- target/arm/tcg/crypto_helper.c | 37 +++++++++++++++++++++++---------- target/arm/tcg/translate-a64.c | 13 ++++-------- target/arm/tcg/translate-neon.c | 4 ++-- target/arm/tcg/translate-sve.c | 8 ++++--- 6 files changed, 41 insertions(+), 27 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 3335c2b10b..95e32a697a 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -552,7 +552,9 @@ DEF_HELPER_FLAGS_2(neon_qzip16, TCG_CALL_NO_RWG, void, = ptr, ptr) DEF_HELPER_FLAGS_2(neon_qzip32, TCG_CALL_NO_RWG, void, ptr, ptr) =20 DEF_HELPER_FLAGS_4(crypto_aese, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(crypto_aesd, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_3(crypto_aesmc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_3(crypto_aesimc, TCG_CALL_NO_RWG, void, ptr, ptr, i32) =20 DEF_HELPER_FLAGS_4(crypto_sha1su0, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i= 32) DEF_HELPER_FLAGS_4(crypto_sha1c, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/sve.decode b/target/arm/tcg/sve.decode index 14b3a69c36..04b6fcc0cf 100644 --- a/target/arm/tcg/sve.decode +++ b/target/arm/tcg/sve.decode @@ -1629,8 +1629,8 @@ STNT1_zprz 1110010 .. 10 ..... 001 ... ..... ...= .. \ ### SVE2 Crypto Extensions =20 # SVE2 crypto unary operations -# AESMC and AESIMC -AESMC 01000101 00 10000011100 decrypt:1 00000 rd:5 +AESMC 01000101 00 10000011100 0 00000 rd:5 +AESIMC 01000101 00 10000011100 1 00000 rd:5 =20 # SVE2 crypto destructive binary operations AESE 01000101 00 10001 0 11100 0 ..... ..... @rdn_rm_e0 diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index 06254939d2..75882d9ea3 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -45,11 +45,9 @@ static void clear_tail_16(void *vd, uint32_t desc) clear_tail(vd, opr_sz, max_sz); } =20 -static void do_crypto_aese(uint64_t *rd, uint64_t *rn, - uint64_t *rm, bool decrypt) +static void do_crypto_aese(uint64_t *rd, uint64_t *rn, uint64_t *rm, + const uint8_t *sbox, const uint8_t *shift) { - static uint8_t const * const sbox[2] =3D { AES_sbox, AES_isbox }; - static uint8_t const * const shift[2] =3D { AES_shifts, AES_ishifts }; union CRYPTO_STATE rk =3D { .l =3D { rm[0], rm[1] } }; union CRYPTO_STATE st =3D { .l =3D { rn[0], rn[1] } }; int i; @@ -60,7 +58,7 @@ static void do_crypto_aese(uint64_t *rd, uint64_t *rn, =20 /* combine ShiftRows operation and sbox substitution */ for (i =3D 0; i < 16; i++) { - CR_ST_BYTE(st, i) =3D sbox[decrypt][CR_ST_BYTE(rk, shift[decrypt][= i])]; + CR_ST_BYTE(st, i) =3D sbox[CR_ST_BYTE(rk, shift[i])]; } =20 rd[0] =3D st.l[0]; @@ -70,18 +68,26 @@ static void do_crypto_aese(uint64_t *rd, uint64_t *rn, void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc) { intptr_t i, opr_sz =3D simd_oprsz(desc); - bool decrypt =3D simd_data(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aese(vd + i, vn + i, vm + i, decrypt); + do_crypto_aese(vd + i, vn + i, vm + i, AES_sbox, AES_shifts); } clear_tail(vd, opr_sz, simd_maxsz(desc)); } =20 -static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm, bool decrypt) +void HELPER(crypto_aesd)(void *vd, void *vn, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz =3D simd_oprsz(desc); + + for (i =3D 0; i < opr_sz; i +=3D 16) { + do_crypto_aese(vd + i, vn + i, vm + i, AES_isbox, AES_ishifts); + } + clear_tail(vd, opr_sz, simd_maxsz(desc)); +} + +static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm, const uint32_t *mc) { union CRYPTO_STATE st =3D { .l =3D { rm[0], rm[1] } }; - const uint32_t *mc =3D decrypt ? AES_imc_rot : AES_mc_rot; int i; =20 for (i =3D 0; i < 16; i +=3D 4) { @@ -99,10 +105,19 @@ static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm= , bool decrypt) void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t desc) { intptr_t i, opr_sz =3D simd_oprsz(desc); - bool decrypt =3D simd_data(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aesmc(vd + i, vm + i, decrypt); + do_crypto_aesmc(vd + i, vm + i, AES_mc_rot); + } + clear_tail(vd, opr_sz, simd_maxsz(desc)); +} + +void HELPER(crypto_aesimc)(void *vd, void *vm, uint32_t desc) +{ + intptr_t i, opr_sz =3D simd_oprsz(desc); + + for (i =3D 0; i < opr_sz; i +=3D 16) { + do_crypto_aesmc(vd + i, vm + i, AES_imc_rot); } clear_tail(vd, opr_sz, simd_maxsz(desc)); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 3baab6aa60..7d0c8f79a7 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -13210,7 +13210,6 @@ static void disas_crypto_aes(DisasContext *s, uint3= 2_t insn) int opcode =3D extract32(insn, 12, 5); int rn =3D extract32(insn, 5, 5); int rd =3D extract32(insn, 0, 5); - int decrypt; gen_helper_gvec_2 *genfn2 =3D NULL; gen_helper_gvec_3 *genfn3 =3D NULL; =20 @@ -13221,20 +13220,16 @@ static void disas_crypto_aes(DisasContext *s, uin= t32_t insn) =20 switch (opcode) { case 0x4: /* AESE */ - decrypt =3D 0; genfn3 =3D gen_helper_crypto_aese; break; case 0x6: /* AESMC */ - decrypt =3D 0; genfn2 =3D gen_helper_crypto_aesmc; break; case 0x5: /* AESD */ - decrypt =3D 1; - genfn3 =3D gen_helper_crypto_aese; + genfn3 =3D gen_helper_crypto_aesd; break; case 0x7: /* AESIMC */ - decrypt =3D 1; - genfn2 =3D gen_helper_crypto_aesmc; + genfn2 =3D gen_helper_crypto_aesimc; break; default: unallocated_encoding(s); @@ -13245,9 +13240,9 @@ static void disas_crypto_aes(DisasContext *s, uint3= 2_t insn) return; } if (genfn2) { - gen_gvec_op2_ool(s, true, rd, rn, decrypt, genfn2); + gen_gvec_op2_ool(s, true, rd, rn, 0, genfn2); } else { - gen_gvec_op3_ool(s, true, rd, rd, rn, decrypt, genfn3); + gen_gvec_op3_ool(s, true, rd, rd, rn, 0, genfn3); } } =20 diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neo= n.c index 03913de047..8de4ceb203 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -3451,9 +3451,9 @@ static bool trans_VMVN(DisasContext *s, arg_2misc *a) } =20 WRAP_2M_3_OOL_FN(gen_AESE, gen_helper_crypto_aese, 0) -WRAP_2M_3_OOL_FN(gen_AESD, gen_helper_crypto_aese, 1) +WRAP_2M_3_OOL_FN(gen_AESD, gen_helper_crypto_aesd, 0) WRAP_2M_2_OOL_FN(gen_AESMC, gen_helper_crypto_aesmc, 0) -WRAP_2M_2_OOL_FN(gen_AESIMC, gen_helper_crypto_aesmc, 1) +WRAP_2M_2_OOL_FN(gen_AESIMC, gen_helper_crypto_aesimc, 0) WRAP_2M_2_OOL_FN(gen_SHA1H, gen_helper_crypto_sha1h, 0) WRAP_2M_2_OOL_FN(gen_SHA1SU1, gen_helper_crypto_sha1su1, 0) WRAP_2M_2_OOL_FN(gen_SHA256SU0, gen_helper_crypto_sha256su0, 0) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 225d358922..8350a65f31 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -7151,12 +7151,14 @@ TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_= arg_zzzz, a->esz =3D=3D 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) =20 TRANS_FEAT_NONSTREAMING(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, - gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) + gen_helper_crypto_aesmc, a->rd, a->rd, 0) +TRANS_FEAT_NONSTREAMING(AESIMC, aa64_sve2_aes, gen_gvec_ool_zz, + gen_helper_crypto_aesimc, a->rd, a->rd, 0) =20 TRANS_FEAT_NONSTREAMING(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, false) + gen_helper_crypto_aese, a, 0) TRANS_FEAT_NONSTREAMING(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, true) + gen_helper_crypto_aesd, a, 0) =20 TRANS_FEAT_NONSTREAMING(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, gen_helper_crypto_sm4e, a, 0) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927961; cv=none; d=zohomail.com; s=zohoarc; b=QssXqgDTDNCGh6322yShUHH+D5KlpNqeWuNOPNh6kG5lwh0cPQIGuIjwrQEfvyAE8+kpkI6GTBbdDA2Z3MemUalWJgupPAxCqLb2pJtlptVu+SyIykz/7jenlkSPt4u8r9O27wZv/Ruj+P9fn2ebAt56Oqc8ikuXNXnYGosblQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927961; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WbTpqwootsmsPZFIj0kNAknK91pBd8Tm6VoiJxSZmAw=; b=anTP7x1PlSLZ6HL/D2sbEMo+fmirJ7lDLG9AEuA01IslBEq03UzLLZXdcF1CbSg5E/6zH8rSXKL4isV/HMqemGi7jvXcZ+kBBGveeFNcF8YcgEJuFPM/GrVCx5icid+dZaf0zJr0IHvPh79M3i09MJWNjtH7LpqrkTJnGxoejv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927961324823.4662241487389; Sun, 9 Jul 2023 11:39:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE8-000414-1w; Sun, 09 Jul 2023 14:33:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0003Re-3Y for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:26 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDl-0004BC-7V for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:23 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fb4146e8ceso39594475e9.0 for ; Sun, 09 Jul 2023 11:33:20 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927600; x=1691519600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WbTpqwootsmsPZFIj0kNAknK91pBd8Tm6VoiJxSZmAw=; b=uRmNxWE5KF3dlnd0e7ZJqXCjPdhZbigBAxIDblgtYWMmQnDU5nH6XxMSkKrNPDHcB2 c+wFvqUmQUntB2zatQquQJAMW2NCiGR20OtgyHJbwEVf4+AkmoEAij8rZEpQl+emtxjh lDNkzWKUuLv+vwtYc1E60NZtv6j5Dfw0Ik7AwxjqBAQjbRWug3hrFzBXYbtVh5h3ck+l +WP+bM4lgt3e4IeLH4twRmwIP+8tap1Mk7IFbyXoun00oF0HW8CaTsC7w1m8qZ8KZQcL CSj9cYoAOCFWOghc6jLoMLaoW5m3WRUuawu1XK9V8xlAytz+sLe8lqkmEA0SkR8/hOHk NYYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927600; x=1691519600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WbTpqwootsmsPZFIj0kNAknK91pBd8Tm6VoiJxSZmAw=; b=LL3NIaqKZe6jrjAABe3srzf11QaXWvZ5h66f4wCkCcy7jiXD3lh47PwA2tb8zhh7aH IIfx9DVWvGOm7MjTMQ0MiIJxfmMPHDFr7pEYrg3TB2LKH5Dsvt2dw4IoA5HwIVk299Kg fJX69OfoK9Kgdid6E/k0p0GMqQc7b7LBZtQ8QpwxlQ/hWjh+84oO/+oYbz1zTOVk7p7T PM6R+1+4w9aiqJQEEQJoFf90lw9xzSpHY66GtnDmg210QIMCnFp/TRGyeq//kMxg26mX ql3wGG6sxN8BnMsTVMrb9E3JZ5vKo3xlN0gkxbP68SNR5I86AJF6axth3LFNDF9EuyJK ui7A== X-Gm-Message-State: ABy/qLZDjgleYndqociWurbKl6BbSe/UlHUq/pyGxBueR0sZ+whPAP7F FvXdSoWqXR+/6rIMFYvec4YXNNK3HGUOjs1DOoNx0w== X-Google-Smtp-Source: APBJJlH8lOpF0qU5E3WxMNDD5uu5Wk9gzYHuQD5TPz7P5nGIyxII7uDTWfYk+qzsbobN0B0STmg15w== X-Received: by 2002:a05:6000:1b86:b0:314:34dd:aaec with SMTP id r6-20020a0560001b8600b0031434ddaaecmr9476824wru.8.1688927599878; Sun, 09 Jul 2023 11:33:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/37] target/arm: Use aesenc_SB_SR_AK Date: Sun, 9 Jul 2023 19:29:02 +0100 Message-Id: <20230709182934.309468-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927963472100007 This implements the AESE instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/tcg/crypto_helper.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index 75882d9ea3..00f3b21507 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -15,6 +15,7 @@ #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "crypto/sm4.h" #include "vec_internal.h" =20 @@ -45,6 +46,8 @@ static void clear_tail_16(void *vd, uint32_t desc) clear_tail(vd, opr_sz, max_sz); } =20 +static const AESState aes_zero =3D { }; + static void do_crypto_aese(uint64_t *rd, uint64_t *rn, uint64_t *rm, const uint8_t *sbox, const uint8_t *shift) { @@ -70,7 +73,26 @@ void HELPER(crypto_aese)(void *vd, void *vn, void *vm, u= int32_t desc) intptr_t i, opr_sz =3D simd_oprsz(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aese(vd + i, vn + i, vm + i, AES_sbox, AES_shifts); + AESState *ad =3D (AESState *)(vd + i); + AESState *st =3D (AESState *)(vn + i); + AESState *rk =3D (AESState *)(vm + i); + AESState t; + + /* + * Our uint64_t are in the wrong order for big-endian. + * The Arm AddRoundKey comes first, while the API AddRoundKey + * comes last: perform the xor here, and provide zero to API. + */ + if (HOST_BIG_ENDIAN) { + t.d[0] =3D st->d[1] ^ rk->d[1]; + t.d[1] =3D st->d[0] ^ rk->d[0]; + aesenc_SB_SR_AK(&t, &t, &aes_zero, false); + ad->d[0] =3D t.d[1]; + ad->d[1] =3D t.d[0]; + } else { + t.v =3D st->v ^ rk->v; + aesenc_SB_SR_AK(ad, &t, &aes_zero, false); + } } clear_tail(vd, opr_sz, simd_maxsz(desc)); } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928157; cv=none; d=zohomail.com; s=zohoarc; b=SoNI+/SSWr+PMsgr0b8CYRxbKNYc5rpDQq3P5GtQ3seLeWTFi6Kg8I3U/t0PxJiEoV0l6u+vSTQZIVa3R6Acw4N/oTnJ1D+U/U5E74DTML/PhQ5IelVlp5hkw700KCH6Z+b3yAeLAyTMrahK/CGYcDbNxR/hDuhC1DgHJCQ+JRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928157; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uIuxSLqMoIpVaPV7oBSzF0bXGsGWX5Yu9PjHzEifuto=; b=KfMufQXDcNIJ5aSXhA+8j9ng6/aWS6MUyKTr5RjVl42UtpEmwAecdkmEkGqLURl6TpPQji5WMonPGLwERfDhpVGruRYCm/EL+3O8Qex968OgT6Nk3f+18fAh+qrSvwTyGz9xDPfWz1v8KSSGsb64DW1mSFI7weKe/9nk7GI2ydg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928157120707.8026415741944; Sun, 9 Jul 2023 11:42:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEN-0005qr-Qu; Sun, 09 Jul 2023 14:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDm-0003IB-HP for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:22 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDk-0004B4-RE for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:22 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3141c8a6f30so3699994f8f.1 for ; Sun, 09 Jul 2023 11:33:19 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927599; x=1691519599; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uIuxSLqMoIpVaPV7oBSzF0bXGsGWX5Yu9PjHzEifuto=; b=pqKf6mnb2pIUuQOfxWaLusZV7eZHaTzGBLyRe4PtGrxHTGKxPbMMjOq0NTyJLVmxQc MYwfCw9/jW/j+jeD5lCFN4hD8xGRleO+rRLLkdMWMRfW+7pzIgsHc5xrFvQX21QlFeJ4 JJER3YDaNJnmOH5uWjUUXoZExXHOssyYBa92lfPsTggSHbsSE/r+Exxkti8OvHXx1gui 4Q432ivqlx1575EUg/gQV5c5DK5WmrnWHRltOwhELJ4/8srU33AdZK9KISBZjq3visEf Qv+pXcF4cM+MfbJGZqU12+hdUC8UN2gGCDYJ8HXUZsEn6zPyjrx5gLZL4oVX3XBPG/e8 310w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927599; x=1691519599; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uIuxSLqMoIpVaPV7oBSzF0bXGsGWX5Yu9PjHzEifuto=; b=UT/7eLFDeiz/tgl1BUY+VAgCI6sNtKV+Inptff2kfgcC5HyuuHzRNWd3KHBMQD6y5b 20bVHpGOxYmQYRd3VP8Y6GpzqdDSx/XeIPNJLeOz7IKogLcSPTtv829X+HhED3VRstC1 ZXNeliXciJZryo/Kd1tDipy+1ANK9DFfCMa3m/5kZu860BKOcibR35sCYETlSHH4EGZO j2T9fV6QbQIJsafgUuUHZPdmlw5tHsaV3/fte6QaKjTsEiQ7WXJ59Wut50dzVYkYU6WD ZE9yap3agnIJKr9Fwr3Skxj87evHxZPDBOXRZE5YfofoqstVcI+hdNSJOcnP2vdFEU61 ayQA== X-Gm-Message-State: ABy/qLbYeAw5RueLCLmu5icr0XcDn2c3EpsYoCuwuO9CH7jPjEQMZmKD kS6ynNE54IzM1ncIzu3sKi6HJ2CRfR8fapRuljGEPw== X-Google-Smtp-Source: APBJJlGeyWR21v6B2u0GmXVd717UDJosX1Xu8/pO/YdQ8zwMWreCp0rKT0TjPu6zDRDo0H1okZegeA== X-Received: by 2002:a5d:44c7:0:b0:313:f33c:24c4 with SMTP id z7-20020a5d44c7000000b00313f33c24c4mr6710114wrr.39.1688927599104; Sun, 09 Jul 2023 11:33:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 25/45] linux-user: Populate more bits in mmap_flags_tbl Date: Sun, 9 Jul 2023 19:29:01 +0100 Message-Id: <20230709182934.309468-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928159359100011 Fix translation of TARGET_MAP_SHARED and TARGET_MAP_PRIVATE, which are types not single bits. Add TARGET_MAP_SHARED_VALIDATE, TARGET_MAP_SYNC, TARGET_MAP_NONBLOCK, TARGET_MAP_POPULATE, TARGET_MAP_FIXED_NOREPLACE, and TARGET_MAP_UNINITIALIZED. Update strace to match. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-9-richard.henderson@linaro.org> --- linux-user/strace.c | 23 ++++++++++------------- linux-user/syscall.c | 21 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 566396d051..af5c5f135b 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1094,28 +1094,25 @@ UNUSED static const struct flags mmap_prot_flags[] = =3D { }; =20 UNUSED static const struct flags mmap_flags[] =3D { - FLAG_TARGET(MAP_SHARED), - FLAG_TARGET(MAP_PRIVATE), + FLAG_TARGET_MASK(MAP_SHARED, MAP_TYPE), + FLAG_TARGET_MASK(MAP_PRIVATE, MAP_TYPE), + FLAG_TARGET_MASK(MAP_SHARED_VALIDATE, MAP_TYPE), FLAG_TARGET(MAP_ANONYMOUS), FLAG_TARGET(MAP_DENYWRITE), - FLAG_TARGET(MAP_FIXED), - FLAG_TARGET(MAP_GROWSDOWN), FLAG_TARGET(MAP_EXECUTABLE), -#ifdef MAP_LOCKED + FLAG_TARGET(MAP_FIXED), + FLAG_TARGET(MAP_FIXED_NOREPLACE), + FLAG_TARGET(MAP_GROWSDOWN), + FLAG_TARGET(MAP_HUGETLB), FLAG_TARGET(MAP_LOCKED), -#endif -#ifdef MAP_NONBLOCK FLAG_TARGET(MAP_NONBLOCK), -#endif FLAG_TARGET(MAP_NORESERVE), -#ifdef MAP_POPULATE FLAG_TARGET(MAP_POPULATE), -#endif -#if defined(TARGET_MAP_UNINITIALIZED) && TARGET_MAP_UNINITIALIZED !=3D 0 + FLAG_TARGET(MAP_STACK), + FLAG_TARGET(MAP_SYNC), +#if TARGET_MAP_UNINITIALIZED !=3D 0 FLAG_TARGET(MAP_UNINITIALIZED), #endif - FLAG_TARGET(MAP_HUGETLB), - FLAG_TARGET(MAP_STACK), FLAG_END, }; =20 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 04e07cf261..36c4d88793 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6002,9 +6002,19 @@ static const StructEntry struct_termios_def =3D { .print =3D print_termios, }; =20 +/* If the host does not provide these bits, they may be safely discarded. = */ +#ifndef MAP_SYNC +#define MAP_SYNC 0 +#endif +#ifndef MAP_UNINITIALIZED +#define MAP_UNINITIALIZED 0 +#endif + static const bitmask_transtbl mmap_flags_tbl[] =3D { - { TARGET_MAP_SHARED, TARGET_MAP_SHARED, MAP_SHARED, MAP_SHARED }, - { TARGET_MAP_PRIVATE, TARGET_MAP_PRIVATE, MAP_PRIVATE, MAP_PRIVATE }, + { TARGET_MAP_TYPE, TARGET_MAP_SHARED, MAP_TYPE, MAP_SHARED }, + { TARGET_MAP_TYPE, TARGET_MAP_PRIVATE, MAP_TYPE, MAP_PRIVATE }, + { TARGET_MAP_TYPE, TARGET_MAP_SHARED_VALIDATE, + MAP_TYPE, MAP_SHARED_VALIDATE }, { TARGET_MAP_FIXED, TARGET_MAP_FIXED, MAP_FIXED, MAP_FIXED }, { TARGET_MAP_ANONYMOUS, TARGET_MAP_ANONYMOUS, MAP_ANONYMOUS, MAP_ANONYMOUS }, @@ -6022,6 +6032,13 @@ static const bitmask_transtbl mmap_flags_tbl[] =3D { Recognize it for the target insofar as we do not want to pass it through to the host. */ { TARGET_MAP_STACK, TARGET_MAP_STACK, 0, 0 }, + { TARGET_MAP_SYNC, TARGET_MAP_SYNC, MAP_SYNC, MAP_SYNC }, + { TARGET_MAP_NONBLOCK, TARGET_MAP_NONBLOCK, MAP_NONBLOCK, MAP_NONBLOCK= }, + { TARGET_MAP_POPULATE, TARGET_MAP_POPULATE, MAP_POPULATE, MAP_POPULATE= }, + { TARGET_MAP_FIXED_NOREPLACE, TARGET_MAP_FIXED_NOREPLACE, + MAP_FIXED_NOREPLACE, MAP_FIXED_NOREPLACE }, + { TARGET_MAP_UNINITIALIZED, TARGET_MAP_UNINITIALIZED, + MAP_UNINITIALIZED, MAP_UNINITIALIZED }, { 0, 0, 0, 0 } }; =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928084; cv=none; d=zohomail.com; s=zohoarc; b=XdNFx+r+Hu8A2seLsr4k1YPIr89yuC9PwZLz7Ci8UtlhMInGJRUKC/zfW+vMhdSQa7CqNzzUxOuvWdSV2zD84IMjhm4nczAGLTfTImawZNo6flpQHtqZsn+LfJ0gS9Xba805HBGY3fKXnRQKpiMC4Z1hhe4AP8X4eXcgsrBQPio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928084; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=dLSy0wGV8SuTIPBvwQoJbUEoBRJPNDMGRIO4gcPyQAELVjKWABmqUIOJ4/9c+J6zV3W8fEipK2x1f3SUwATTQXKnJsntJIdaD438/w6KA2ngUeq0XPSyjvYCJHRfiUZdDCrhlyZsJ1SMbsm4vX/h5Eibw4M/1WI6uQv7Zfet0+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928084186218.79556792484163; Sun, 9 Jul 2023 11:41:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE9-0004Qn-Cq; Sun, 09 Jul 2023 14:33:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0003Rd-24 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:26 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDm-0004Cw-Am for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:23 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3142a9ff6d8so4027673f8f.3 for ; Sun, 09 Jul 2023 11:33:21 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927600; x=1691519600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=S16XyXELblcr/OMp2WDghERS+Hx24cT4ia1sFMrsT6JejvWOKCMcXU+N9NL5hrHhaB Tv1PW8e91jrnAl01ykA95weOuKrWqLPGvqFngTLJgcJmPQOfq4WXPcAWZXCb2lP26sG1 GFA3TIk6wkGn0afFrAI8v5d+FBrQ2zBySnYSXy+g6t476O7m/LoaNCZUOVnH6U2pS6dD MduoFYovHaAiNkCgWz9x/XlAcDeEIwreED1d98Ezmr0lZhxr0HCPyhMCd06JHhl0tVWa dE4rNZ6I6xKdNMtfgYnx0AiRp4W/UitYyx49I3cLdtRwRYQdyrFXcXhzha0dU590lrm4 3QQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927600; x=1691519600; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=viFchcHGsP+nKMHrpwcA4jNmykwjrSvjDrmv/nDVIvw=; b=Gx7b75J5dV0uWHwn25l9PUNpoo53vT1NKwgnW+LxpShYKfmY/8eGE5aQUjVbosjvLG qx880HvcdLrjzzw9M4e6zpyOw5Bc8pFjbAX0j/d4NFqc4i+/iYeQuFehzIlSVgO4JRTT jrhDl3f2t3wwZrj4epzqLtwRD0X4MX3wfLIot9Hm+WYKmxu7VrE/o6caZmgIHLSTPyzi wvdHMz9ZBqrFsMlq/PZePDimDqPOfHY/Bs1z8tQ86AL2hBTQbQE6iGr0LER8XHmjFj+F e/mi36wf7H9RapYDqbuPWCZr89Gvuzn5l76rB9HlIMxnYPl5Uh9ZIEsTCgnh35hvyCWJ uvYw== X-Gm-Message-State: ABy/qLY/go4IBoowhc7khkaG+VnJFXXVLz0sSjnVlJgQPZIRx+d3bpTV vC5xM0N0+owe9DjI/MA0Km3nwfay8G6V9oY0sC9hgg== X-Google-Smtp-Source: APBJJlGSlWj16aqrnUmlV+OEYz7SPbcqkKC6IPrXDXjFMPzTVDRdpj9odiFEI6beDh/EYF2arxqDqQ== X-Received: by 2002:a5d:6601:0:b0:314:10c1:881d with SMTP id n1-20020a5d6601000000b0031410c1881dmr9949103wru.68.1688927600623; Sun, 09 Jul 2023 11:33:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 26/45] accel/tcg: Introduce page_check_range_empty Date: Sun, 9 Jul 2023 19:29:03 +0100 Message-Id: <20230709182934.309468-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928084745100001 Examine the interval tree to validate that a region has no existing mappings. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-10-richard.henderson@linaro.org> --- include/exec/cpu-all.h | 12 ++++++++++++ accel/tcg/user-exec.c | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 472fe9ad9c..94f828b109 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -224,6 +224,18 @@ void page_set_flags(target_ulong start, target_ulong l= ast, int flags); void page_reset_target_data(target_ulong start, target_ulong last); int page_check_range(target_ulong start, target_ulong len, int flags); =20 +/** + * page_check_range_empty: + * @start: first byte of range + * @last: last byte of range + * Context: holding mmap lock + * + * Return true if the entire range [@start, @last] is unmapped. + * The memory lock must be held so that the caller will can ensure + * the result stays true until a new mapping can be installed. + */ +bool page_check_range_empty(target_ulong start, target_ulong last); + /** * page_get_target_data(address) * @address: guest virtual address diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index d95b875a6a..ab684a3ea2 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -598,6 +598,13 @@ int page_check_range(target_ulong start, target_ulong = len, int flags) return ret; } =20 +bool page_check_range_empty(target_ulong start, target_ulong last) +{ + assert(last >=3D start); + assert_memory_lock(); + return pageflags_find(start, last) =3D=3D NULL; +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928195; cv=none; d=zohomail.com; s=zohoarc; b=ZwOctRs52nXU5aO5GmUK/IPocQqwVfOeQUTmw9RfLt62toGZyh7owKy5f4UsfIM1N7rhdFIK2jhBGNclpI9FMPvmtAFDU439EDmH2hquIUe/Hyy9tYFviVJ1/KObGFT3/6m1U3pbPP3H/A5sDpT6AOqX94IhSZYP3D7SkovhiwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928195; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cKGE3OvFNd5jAIbGE9ocD3KdoxUzDMvYMbDIoK+kebA=; b=SpPkrJaKMpy9uMUaO/W7/6/4isHGVMwfXFCU+gN7QMSwoVwCBHtBLVU3itVSS/kkBWD+dgBkdYGPkyLf5kGLb2CTkAeXD+88dqFRwPrqzKxMyPKiV5wVahkXVu/HLACcfVRwgFidN7rqTn/oCc3SJlaq/OZzW2y1To2mMR6/yzI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928195406332.7558888974106; Sun, 9 Jul 2023 11:43:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEH-0005hX-FV; Sun, 09 Jul 2023 14:33:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0003Rw-EY for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:26 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDm-0004D4-QF for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:25 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-313fb7f0f80so3705454f8f.2 for ; Sun, 09 Jul 2023 11:33:22 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927601; x=1691519601; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cKGE3OvFNd5jAIbGE9ocD3KdoxUzDMvYMbDIoK+kebA=; b=vScQjbkPhMpo8WTzIasfj9G1DPhrTyZftcLRkAUP3To/+U3FCPZvwizKS8tBbSs5/9 5U/3xZ91St20qOvWNaqkpAaog6yGfC7lylujnyAMPZUP12aM38w1i7nGooC7UcbJKq5n zlX3pWxxd4UUKf279DqlHZ0vPyMTCRXCnUabjecvA9eiX/uYRMbJdN4JdMhDVd4JfMNW 0BR0fNxUr0GRYbS1xl+ZfUV8N2k4fNSJ//dMRiTZjWIzEkmUIOs9SJopf2CYovFUz+Nk LLYWdsRAdN7Ltaj7szvE83pn9/EtQBmQQkUMja4z8kpCpLsF4C/Tkba59X6HhwGnatlb AJoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927601; x=1691519601; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cKGE3OvFNd5jAIbGE9ocD3KdoxUzDMvYMbDIoK+kebA=; b=fPhwvFXsr1DzVc4r/V+hAxEQg9HvtTBzm/xrDOxpl0rKMNVdP3kJpKOBT4CZPZ04X8 MfpvGiZ1Mr04FIt+n8oN0pP8m8aR8VB9EKJbW3QvXHQA/swmhjtxjS9p5KjorOWwPXR2 27gVIzCJyX54k6lSru3ItBbxjGSMFcT44ZcZkOcaAYxe0IoCyj0TZRnYaY1p8wb/QRYB 454K30o4pRUrI//im7xHSugHB9GqJ0NiXH+3JUytbblLTB1cvCj87JbAINBtounSeKno z49DaQNK0zN/2Rr2MNtwDymAkR3zty8f5OAmZTrJLRbh4z+MKO4xp8d7hxpoHpl37rTT kipQ== X-Gm-Message-State: ABy/qLbmhmQauQ8SIOpBbFmSBKbYJrBSQDszajzQSVox3OMa0TdCLpPj SKq2pBu1D2DwU+9BXw+GXPTiULDhDKm58CMWuMzZuA== X-Google-Smtp-Source: APBJJlEo05m4JsypabxrrthO3/V/Epi/YGrnKoEj+3XMd7DLq1aBoAuBslMjxQ0S5cVTsczgq8nxJA== X-Received: by 2002:a5d:4109:0:b0:30f:c1ab:a039 with SMTP id l9-20020a5d4109000000b0030fc1aba039mr8156992wrp.40.1688927601477; Sun, 09 Jul 2023 11:33:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 26/37] target/arm: Use aesdec_ISB_ISR_AK Date: Sun, 9 Jul 2023 19:29:04 +0100 Message-Id: <20230709182934.309468-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928197537100003 This implements the AESD instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/tcg/crypto_helper.c | 37 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index 00f3b21507..d2cb74e7fc 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -48,26 +48,6 @@ static void clear_tail_16(void *vd, uint32_t desc) =20 static const AESState aes_zero =3D { }; =20 -static void do_crypto_aese(uint64_t *rd, uint64_t *rn, uint64_t *rm, - const uint8_t *sbox, const uint8_t *shift) -{ - union CRYPTO_STATE rk =3D { .l =3D { rm[0], rm[1] } }; - union CRYPTO_STATE st =3D { .l =3D { rn[0], rn[1] } }; - int i; - - /* xor state vector with round key */ - rk.l[0] ^=3D st.l[0]; - rk.l[1] ^=3D st.l[1]; - - /* combine ShiftRows operation and sbox substitution */ - for (i =3D 0; i < 16; i++) { - CR_ST_BYTE(st, i) =3D sbox[CR_ST_BYTE(rk, shift[i])]; - } - - rd[0] =3D st.l[0]; - rd[1] =3D st.l[1]; -} - void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc) { intptr_t i, opr_sz =3D simd_oprsz(desc); @@ -102,7 +82,22 @@ void HELPER(crypto_aesd)(void *vd, void *vn, void *vm, = uint32_t desc) intptr_t i, opr_sz =3D simd_oprsz(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aese(vd + i, vn + i, vm + i, AES_isbox, AES_ishifts); + AESState *ad =3D (AESState *)(vd + i); + AESState *st =3D (AESState *)(vn + i); + AESState *rk =3D (AESState *)(vm + i); + AESState t; + + /* Our uint64_t are in the wrong order for big-endian. */ + if (HOST_BIG_ENDIAN) { + t.d[0] =3D st->d[1] ^ rk->d[1]; + t.d[1] =3D st->d[0] ^ rk->d[0]; + aesdec_ISB_ISR_AK(&t, &t, &aes_zero, false); + ad->d[0] =3D t.d[1]; + ad->d[1] =3D t.d[0]; + } else { + t.v =3D st->v ^ rk->v; + aesdec_ISB_ISR_AK(ad, &t, &aes_zero, false); + } } clear_tail(vd, opr_sz, simd_maxsz(desc)); } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927993; cv=none; d=zohomail.com; s=zohoarc; b=jksMQfkx/E7+45icR6A6GFUwHStkX8ymKdEto1g5QmwRBn18rOGmzFWfZc9O3TwBNlvoGYWLooKZwnOaTyPrHZpn9zGpzhP/T8wiB9WBCLeEaUNIBv0AiA4HOBMZPC7Tgik1gHSX/MALD7kzSb+5NEjzDx/OBqUKuosHY8ydg+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927993; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; b=RM9NHmugEwQ9m0LoVN385B1sjjsSVt97XdeO3nrRqahTQBBfWtXOIjy7nBX+En408FF8AsRmj9pVb1dMrYZxLTOM3IJpw9rzG1715ljWrjgMidkZMK+63ZwyQb5pHcqRS9Be0f6dFfvp/GJeyesWHWxvEQFXxQ3puBkqC4ciCLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168892799391291.08561685737232; Sun, 9 Jul 2023 11:39:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE8-0004Ls-J6; Sun, 09 Jul 2023 14:33:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDs-0003WP-EI for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0004Dv-1X for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:27 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so37720685e9.1 for ; Sun, 09 Jul 2023 11:33:24 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927603; x=1691519603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; b=bC7HqoJUdK/9jTD+nPvdkdjxFlWyq7W3M3OKwNVoT1egDBw1IvPhgHPcZiXgMoTZEl yFptIoshhgvv11Z8HHJyPI2tDkFJuD2Ysg+6qi1CJAtpPOcdU04bBvJs9yIWDqHlXeGz Aiyx7vu1PCCSYvjDkEuPpTEvjJt7H4bftFt66BXwCWRTIlLggrmEV2/PJL1R+LziExuM dSF04n+dhTJ5uwvhJ/qUAvq1X7BPgbk/xIMkp4Q0adDck+1YkTyJWLyyicaLpfFy9yWd h2h0St7E6cSi8TYRyPngw8mtb9NFLN2yxXHknWvRsl7nUvV3+IjfJoTAjGjzytQ3W1C+ uauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927603; x=1691519603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; b=YQtF7yt6px6G27VGovtK3GlHOrUcCHMQNuW75/q5PhClcFxxzjz0EiW4WT+DDuT1q8 PNL45OvageuAfn6lsUcHiy4PlCxbpuRrB64hvQkQKtAPDzLcNyo5mi4gkRzv1jDsx9xG zpiUlWFE0d23B3J+XF5Jo1ajy7nAX3Ue/hCgWV1gPx08oMHy9odPO1ChJ9/hA9NvOXTu BVn+wo11/AH6qDCiBCUeROVO/2wu9g43aN0VDserSQckehFAsXl9OAenk3iCBeigslbo fR9dca6aBJyiZTjJ5fx6waev21bWrZQh54uhLA9qSnIiDOqXeTcmTky1Eq23K2Spub63 MX8w== X-Gm-Message-State: ABy/qLZ6YkNgRRjEoI6f67hF4Q5qY5oDO/g/gzNwMpUw1+UKV8ZBk9/i c9YPV9ZYMM8aFsxP8DkObeJRThAV2sBvLtQGHOL/ag== X-Google-Smtp-Source: APBJJlHf+w7ZKrSmkucTux4TUZBdnfk3uLGw0prQ3VKAKLN6dwu3afcPYhcSz/kIO4tE7+JphakrbA== X-Received: by 2002:a7b:cd96:0:b0:3fc:443:3773 with SMTP id y22-20020a7bcd96000000b003fc04433773mr4435572wmj.30.1688927603172; Sun, 09 Jul 2023 11:33:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 27/37] target/arm: Use aesenc_MC Date: Sun, 9 Jul 2023 19:29:06 +0100 Message-Id: <20230709182934.309468-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927994943100001 This implements the AESMC instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/tcg/crypto_helper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index d2cb74e7fc..1952aaac58 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -124,7 +124,20 @@ void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t= desc) intptr_t i, opr_sz =3D simd_oprsz(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aesmc(vd + i, vm + i, AES_mc_rot); + AESState *ad =3D (AESState *)(vd + i); + AESState *st =3D (AESState *)(vm + i); + AESState t; + + /* Our uint64_t are in the wrong order for big-endian. */ + if (HOST_BIG_ENDIAN) { + t.d[0] =3D st->d[1]; + t.d[1] =3D st->d[0]; + aesenc_MC(&t, &t, false); + ad->d[0] =3D t.d[1]; + ad->d[1] =3D t.d[0]; + } else { + aesenc_MC(ad, st, false); + } } clear_tail(vd, opr_sz, simd_maxsz(desc)); } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927984; cv=none; d=zohomail.com; s=zohoarc; b=hS9TCXACR4k3tjKdBrcGbm6ZNZ+ZpiejT33rcywYC943HvZpRH5+EHWs3JSQKISCJQr3QF1onAy6kj2iFSkX3U6ci3Ol3PuI9ZRpoVRPEuLgmCYxdzRIWNs6mByJFrmmX08Pla5HPKth0XD70YgIHuX7Uwq91zpDn1nkv5O6oy8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927984; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=ffHK9rqYLGS/WxI5bSEKVi+uo6Sdk5ZK0hhXonV6l6m7yFKX1W9P7UOLlmBWItighd8B+SiTRJbOZpST/F1u0qsf5e80QoEUqHX1y1qeWWTmHv6kjY/oUxGZvgP538q3Felu2/6AVg+/ieKhNTQ0agJpPDqoYO4s7qYsnQHKcpk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927984953112.30011408784446; Sun, 9 Jul 2023 11:39:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEF-0005Nl-Hx; Sun, 09 Jul 2023 14:33:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDp-0003Ru-8j for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:26 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDn-0004DR-L8 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:24 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc6ab5ff5so39279625e9.1 for ; Sun, 09 Jul 2023 11:33:23 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927602; x=1691519602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=RpCPrxDPWDuIDYJcsr0IynwmWGxTCXXvAqP6bOQs6IcfErSvvPixiPsTgTKDOrycm7 huQCrrfYVoqZv/P8R9DqjTPMFkdf/OUj6NCAMXbZ3JMlI8hSsFuzLpr36fWIAU2cX1XG OoIQ6UN5KAK44oqFQpqE1Ma4SoMDJcD/mylZ1XjxNSkR5MSkbHRLSMkSfdeha4lggbVM bCwm8rMtgsR6+WdwqGqLkyutawiwn7YmH2IgXeaZQA3FmqZRm6tGLWMjnQ+wZF+VFmRb HXlIqvWMC+e5K4BWyW0ltwbU9yjVmoXYp3PKNsYdtYbYo8WHO26zj5Hip5MOCZnN18sG dBtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927602; x=1691519602; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZraICE1rSSuyJwFU+r8vOCOFS1v3NI7u5DpDqpVSLj4=; b=FFO9E/NYd1M5q9Da2RCVeNwweYasbKMlBdpiYHTp9ELmllIEncCS3jBGBDXA9rd7M0 0OG4FtgwSyfDtLIykdbSl/z4w56HuTsEB+Ycq4vgZ++1Mz3j/UgsgO6eqPtAw9rv05Oj QhM1/gM4rsMKHTLq0/ffmhQDmG3j8tyVwu0Wgv5DR10/uc8QI7G+apxVAPbMt7At18KJ +p9L+oZ5g0jtIZOi7zm85yS0e6nUYJx451wclNpYvo9UkF1dXLD8OVHHwfgiqA3nFMtl 8nuP5U6sBb3dQSBl1r/Jzc7x4lPRURoziPBSSXvBSIRi93YeWVWGA/CJ3qItGUsdqbim /yMw== X-Gm-Message-State: ABy/qLZUnknHF72QJdgYL25ndCOHvyVq04HDepuRYXGD/xAirG7Vu7mC sQfk3jgf8VWLfX0ekZv3zC+wiWhupDPtjGGTufGPEQ== X-Google-Smtp-Source: APBJJlFuvB0ptxMjgmW9WBpaZGYBg+xxAcuHty8gwN4plwVM8VlzjivVxeVJD/W38KFkcEUl13Azaw== X-Received: by 2002:a1c:7318:0:b0:3fb:b61f:c719 with SMTP id d24-20020a1c7318000000b003fbb61fc719mr9062778wmb.33.1688927602411; Sun, 09 Jul 2023 11:33:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Warner Losh , Kyle Evans Subject: [PATCH 27/45] bsd-user: Use page_check_range_empty for MAP_EXCL Date: Sun, 9 Jul 2023 19:29:05 +0100 Message-Id: <20230709182934.309468-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927986930100003 Content-Type: text/plain; charset="utf-8" The previous check returned -1 when any page within [start, start+len) is unmapped, not when all are unmapped. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson Reviewed-by: Warner Losh Message-Id: <20230707204054.8792-11-richard.henderson@linaro.org> --- bsd-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 565b9f97ed..07b5b8055e 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -609,7 +609,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t prot, } =20 /* Reject the mapping if any page within the range is mapped */ - if ((flags & MAP_EXCL) && page_check_range(start, len, 0) < 0) { + if ((flags & MAP_EXCL) && !page_check_range_empty(start, end - 1))= { errno =3D EINVAL; goto fail; } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927938; cv=none; d=zohomail.com; s=zohoarc; b=GDg/tsFSZia7kRd81KD7JnOOvnppm35C6cMltGKKx8u675IYf5dvLeLHeHWbiT02Vm3R+B0toT3eHmP1ws8zA/ZMUeEm/aUEGre9ldpYg7vOIe1a7kjuJpKbNkYinGzCvh6iPk9BNOK9744HJm9Jrhxbbdhe3Vwt1ZaRl93BU8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927938; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZNJt+xQSaKcqRS2slBC4RsFLFu+ocScsUgiRpjPIdes=; b=MM2+A9XWSf3cUeKxzoJkhDSPu6vAPOQ8XFh4bCQPG28dJAWDre2pbPmEL2tnEsVh+E7cg9oafA5cKyQcGuIZutXUF2eAwuQ35GM5Jcr1Qqzy6ZxQBRe7eaw0b3892ulpNo/r2lWK+DW4s/12DVeNK2naxCRUItM+fsOCpAayvjc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927938110185.6563093354697; Sun, 9 Jul 2023 11:38:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004b7-HC; Sun, 09 Jul 2023 14:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0003Wo-D7 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDq-0004El-9j for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:29 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbef8ad9bbso42002125e9.0 for ; Sun, 09 Jul 2023 11:33:25 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927605; x=1691519605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZNJt+xQSaKcqRS2slBC4RsFLFu+ocScsUgiRpjPIdes=; b=FxZvPlWTr/jm9Mpm7/6AppNvIqAR9ZwESYc68AEZ4IzHMTdTkKlrkRKx9Bhwg+qUqt d1cUP4dJTd9+164djJcx3bJSNge8d+E/5HBrhYcw+uYbZKjXeGQh49a0kPJtatqfuTIt avnHEL+PNR1dGPvxjUCBvLGphfGqZe/hn0Mi9xrAR6u/ID2//p1wpUdwBxNkYr5UmZoB 8QJcG3OadYA0jaG7z+iobNsW84KEYHm8wDlVS6a/f25EBsWlUMeG+C2R0m4b5LxRLYM6 suqyRop0yIiHPb8WHwC1OV1HIW4fMX7UTl/Lg7eF8qQwuGB7Z8P/ovNuEBlA950BcDNJ mixQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927605; x=1691519605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZNJt+xQSaKcqRS2slBC4RsFLFu+ocScsUgiRpjPIdes=; b=CN8vrMQsJFt86XrpX9LR2hDiNocdAa0c4mF7Yp37W/id8QsSDnvDWbhOoQXH0/CKI4 jfqzzemwfOFlJfedrkwxlLqaceQsY80JbiozRMkxZtNGNibMti6WFYJC5dSlpZeh6Ynm iR+KzLpxqxbCcKZX3wjtJkEGJcaQwEJFan/Cg6anaqbJpfgOTOMaM+UBU256594uv+iI hVQnSJ2PSmFYTlmiNMKZqN8P110nwocuCNP68LV20Vpo2H+wajJweRr54XWDIcQBE5E2 pQa27udHLC8e2yCOfjxuHf4LelXGIOVX6oHaM8OwxMO/b0t39tsMpzxu915vIFaG7mRv 9mHg== X-Gm-Message-State: ABy/qLYHeDQHwR2De9mMIv3UGAmE4AUlGGMqtLTEWYaHo0J+biuD0kc8 14eXfQLI3r0e1C7NsQdjP1m3gJh38UzTMlvhkhuCKA== X-Google-Smtp-Source: APBJJlFn5T/Gs61ECeanKzfzukL+spPIdFAjdEyC8CqaBwbgRYq0sHgCMyKcCQdHYCK8wBdyFQHDNw== X-Received: by 2002:a05:600c:294a:b0:3fc:1a9:7900 with SMTP id n10-20020a05600c294a00b003fc01a97900mr3217935wmd.16.1688927604868; Sun, 09 Jul 2023 11:33:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 28/37] target/arm: Use aesdec_IMC Date: Sun, 9 Jul 2023 19:29:08 +0100 Message-Id: <20230709182934.309468-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927939409100001 This implements the AESIMC instruction. We have converted everything to crypto/aes-round.h; crypto/aes.h is no longer needed. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/arm/tcg/crypto_helper.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index 1952aaac58..fdd70abbfd 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -14,7 +14,6 @@ #include "cpu.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" -#include "crypto/aes.h" #include "crypto/aes-round.h" #include "crypto/sm4.h" #include "vec_internal.h" @@ -102,23 +101,6 @@ void HELPER(crypto_aesd)(void *vd, void *vn, void *vm,= uint32_t desc) clear_tail(vd, opr_sz, simd_maxsz(desc)); } =20 -static void do_crypto_aesmc(uint64_t *rd, uint64_t *rm, const uint32_t *mc) -{ - union CRYPTO_STATE st =3D { .l =3D { rm[0], rm[1] } }; - int i; - - for (i =3D 0; i < 16; i +=3D 4) { - CR_ST_WORD(st, i >> 2) =3D - mc[CR_ST_BYTE(st, i)] ^ - rol32(mc[CR_ST_BYTE(st, i + 1)], 8) ^ - rol32(mc[CR_ST_BYTE(st, i + 2)], 16) ^ - rol32(mc[CR_ST_BYTE(st, i + 3)], 24); - } - - rd[0] =3D st.l[0]; - rd[1] =3D st.l[1]; -} - void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t desc) { intptr_t i, opr_sz =3D simd_oprsz(desc); @@ -147,7 +129,20 @@ void HELPER(crypto_aesimc)(void *vd, void *vm, uint32_= t desc) intptr_t i, opr_sz =3D simd_oprsz(desc); =20 for (i =3D 0; i < opr_sz; i +=3D 16) { - do_crypto_aesmc(vd + i, vm + i, AES_imc_rot); + AESState *ad =3D (AESState *)(vd + i); + AESState *st =3D (AESState *)(vm + i); + AESState t; + + /* Our uint64_t are in the wrong order for big-endian. */ + if (HOST_BIG_ENDIAN) { + t.d[0] =3D st->d[1]; + t.d[1] =3D st->d[0]; + aesdec_IMC(&t, &t, false); + ad->d[0] =3D t.d[1]; + ad->d[1] =3D t.d[0]; + } else { + aesdec_IMC(ad, st, false); + } } clear_tail(vd, opr_sz, simd_maxsz(desc)); } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928191; cv=none; d=zohomail.com; s=zohoarc; b=ZxDkGPuo2WJ5Ro/Eg7MTC/rOdNQQV8WTU1lYSaAy5iO4i3v8cjhhy+NzLhjtE0lOlF4qQ6XW4gcucu4FiKE9hdXDAq/MBwSShjyPp5xb6SYXJoW4jb/rSgYEu+VYB5FY4AR3n2XP64hNqICkuV27G2Sq+QQKEkNbK6bGq7FomSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928191; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=RqV8CcZ9dhzNsE6U1iUgvaGVlGUIZOX1bhh2PsUdcG1EQDlcK/aAElxHU4oZrTLKMTMufWOBNaJUifFEjSe0uGJIYrEK36Em6UBjWJ0tFqcOHNsyZ4o9Udn9gZFUsDbirxklTJUSDWxiRXxiQE+ZouHnQXIxM7OJai/O39KBqp4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928191168630.1874393474673; Sun, 9 Jul 2023 11:43:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE9-0004Ui-Qd; Sun, 09 Jul 2023 14:33:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0003Wp-DC for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDq-0004ED-9a for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:29 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbfa811667so19654605e9.1 for ; Sun, 09 Jul 2023 11:33:24 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927604; x=1691519604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=Te502nStAJsDxJZLfJsnaWCc+RMx+MF1zCZjPakbbQtsg/Rc1mtz0RnR/0CeANyusO gIRnBrABCPxdL14RfGVY/REJR7og2Y+sFJHPF8lIiGVbdbw8B+OGcNQ+pMKEHkHaLkw7 tzEVrCxNxVq5llKILPE3bSqWAV2en3Q0cy5+XGRXn6z8UTTaCdg5rJdaNQhYqRUAFlto VN3WJypkEkEccQH4Lnb14C27MIWW4EF6C08dVQctBJIZSbu9GP6C8U8JozV5BbEG+8Fr G5PMvMiirbNzTok0x2PGGmQ9gg9uBdi8zVBWgGq68W4kMlUouNUlzz1dUwavC84g6nbV HQig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927604; x=1691519604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QVp7bvOVNX9kOQlZjcnMWNBhc4o39/6I/4Tb+lJViFc=; b=L55pMAj72HiEE7JikmKcs9pUrsr1uzpqJj11/2scs5GxQTuiVyFGDxgU9X5VW8BOMe TkKxme/FJBgQH8IHVekdvfRHJbO5n8qEcXePQgCd+FO1eJq5crO2gqdbzxYctlCMT18l emHOaBk9cfXhqPXQOdNiua/rGMy+asrtSBD/QJq+ZEEoet8oZ3tpDpYVKvnqPAJjdofb q7YWJhleyJdxJRb5Vy9EkAbVBJVg3b/7Rn5iuwMfppw5feBwY5CR/DAFeynAPiQgERjR wfwmhn5VAQZyWFTlUVZ0k2ZisAoDAhk+EHeLRhs/vM/U/hovNZMSAfTd4bW5UO5VFPMZ 0vvA== X-Gm-Message-State: ABy/qLZXdeLIyLctlSzvanNB8v2bBJnVaFY3IVecBnS0fgzOWTFSDJXv /3YUrCKpNSObOrZMl48/v5OAHRnS6WUl53EE+R7/fg== X-Google-Smtp-Source: APBJJlFZ7htkh0QP1Rqbz+dp/JAzhvbVd0K91B/JFK3zjInJPK/9e4EuxS3C/FK39oTy5Yp1RBZuGQ== X-Received: by 2002:a1c:cc02:0:b0:3fb:4064:7e22 with SMTP id h2-20020a1ccc02000000b003fb40647e22mr3602869wmb.19.1688927604024; Sun, 09 Jul 2023 11:33:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 28/45] linux-user: Implement MAP_FIXED_NOREPLACE Date: Sun, 9 Jul 2023 19:29:07 +0100 Message-Id: <20230709182934.309468-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928193066100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-12-richard.henderson@linaro.org> --- linux-user/mmap.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 639921dba0..9dc34fc29d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -509,7 +509,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, * If the user is asking for the kernel to find a location, do that * before we truncate the length for mapping files below. */ - if (!(flags & MAP_FIXED)) { + if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); start =3D mmap_find_vma(real_start, host_len, TARGET_PAGE_SIZE); @@ -551,7 +551,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, } } =20 - if (!(flags & MAP_FIXED)) { + if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; void *p; =20 @@ -600,6 +600,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, i= nt target_prot, goto fail; } =20 + /* Validate that the chosen range is empty. */ + if ((flags & MAP_FIXED_NOREPLACE) + && !page_check_range_empty(start, end - 1)) { + errno =3D EEXIST; + goto fail; + } + /* * worst case: we cannot map the file because the offset is not * aligned, so we read it @@ -615,7 +622,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, goto fail; } retaddr =3D target_mmap(start, len, target_prot | PROT_WRITE, - MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, + (flags & (MAP_FIXED | MAP_FIXED_NOREPLAC= E)) + | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (retaddr =3D=3D -1) { goto fail; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928338; cv=none; d=zohomail.com; s=zohoarc; b=Hpmp9mlnq+h1TIPBn1bJLNzT/cDt4DpjUtJcyJyjxTvzmdeiKfffKSVtbTcebYWUl45QNRiAt2Bs8glYyd8ntJNhpsAC9RsyXd93iOzkLlQhRFL0q0AUDdBLZwQeEI4L7rA1w284U7fSDgLX+rQGYSffRJC1n8BsVFZ9EgpMwmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928338; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5cwUPdSqiTi+cpvjs0+320/XSt6FYwReeMeUR4tviQI=; b=axJai4sM+9huLj5bFlkBdVZCPk/jHqKsutguHTD3WREL03pPV7UVY06uc9wOmrHInS+dOER0LAUcnh1gyuUldrN5NcPLIWqonSs4uqontVMiTGhcMcJ4UASCyGmBltoO64awvRiSk4h3qOdHTtWl8Lk2kNeUnPOOO1PerxsLtOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168892833872997.14946833660929; Sun, 9 Jul 2023 11:45:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEQ-0005su-7h; Sun, 09 Jul 2023 14:34:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDv-0003Wr-JD for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDt-0004FT-6S for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:31 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbfcc6daa9so26808355e9.3 for ; Sun, 09 Jul 2023 11:33:27 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927606; x=1691519606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5cwUPdSqiTi+cpvjs0+320/XSt6FYwReeMeUR4tviQI=; b=WnJbu1XoAQF1YeJpIUIepdedJ11UoER2gej/RuGURGu3QaLvKQZdbjZXPf6iJbo1Ia dlqXl6K5zcxIy2aIHIFpgDk1/AUl/0puBhnkBS3hG+CqbXarO59+U+tMk9EMGEaVvVYJ Kx6CLR3mw4bpmlmvqkTAUyZtuqweSdxzecMJ+sN82fes7m1jZwDEg+iKYcuHg3w8tWfa AoIcGLEb+Z+hz3ktF4iu3d59hPQpHNwtPN0cT6tWCQfCrTIEUeYY6WkRtthZG0SnrocI ZcJF7AxHQA7T5CEKe5IYQexhxyvPEe+QCgIyYFQ7Y0HVEGlvRAsMC4pedu6RliOLvRWd cgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927606; x=1691519606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5cwUPdSqiTi+cpvjs0+320/XSt6FYwReeMeUR4tviQI=; b=kmCcFaqBZeHQHkSXkM3JbWhF1fUcDzyDq0TCOnYHo+s1m5s9fjEWUtz0Uzi4hp3hqe 3+MaU9ylWoz8HMbCSMQXNlOPgOwSfBDO77vz3uvWzjcVQ1UBtsp/SEj/JJ7WGO7Uuaa8 S/er9hLhvYA8vaWT0ZB0sft04KoIRns37h+nKjK5s2f3zfYHejlOYEHC0pwyKlGcE0FO j8AWWgIdh6MT1+n1pGGuAUFnr3K6pibzAlfiwxFfbn3JDBjCghwBaMJ5STD7ri1z+1ZN j3u2MOyLEeWe0CQYo/tlyl8jn7wG/45N/TVMnUTiT7cPFOUt9FgcU1b6TxwlxNLEzRO0 Q9zQ== X-Gm-Message-State: ABy/qLaSJ3QONewuuD56ZTgGNqqHAKxvehz1wAmdcE956aXUdjj03ewH RA+M21/+/VNrHw0djDJX2ruggYdzqvjQb7rNVPisAg== X-Google-Smtp-Source: APBJJlEt6Qqr7wr32KBE2J0S5BQlHqy8QTA5pQ+kfgv2zcSdigSuGJVav2vLY+IFFBQpbyMtODuOtA== X-Received: by 2002:a5d:48d2:0:b0:30f:c42e:3299 with SMTP id p18-20020a5d48d2000000b0030fc42e3299mr7687003wrs.60.1688927606477; Sun, 09 Jul 2023 11:33:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 29/37] target/riscv: Use aesenc_SB_SR_AK Date: Sun, 9 Jul 2023 19:29:10 +0100 Message-Id: <20230709182934.309468-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928340520100002 This implements the AES64ES instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index 2ef30281b1..b072fed3e2 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -22,6 +22,7 @@ #include "exec/exec-all.h" #include "exec/helper-proto.h" #include "crypto/aes.h" +#include "crypto/aes-round.h" #include "crypto/sm4.h" =20 #define AES_XTIME(a) \ @@ -136,6 +137,8 @@ target_ulong HELPER(aes32dsi)(target_ulong rs1, target_= ulong rs2, AES_INVMIXBYTE(COL, 1, 2, 3, 0) << 8 | \ AES_INVMIXBYTE(COL, 0, 1, 2, 3) << 0) =20 +static const AESState aes_zero =3D { }; + static inline target_ulong aes64_operation(target_ulong rs1, target_ulong = rs2, bool enc, bool mix) { @@ -200,7 +203,12 @@ target_ulong HELPER(aes64esm)(target_ulong rs1, target= _ulong rs2) =20 target_ulong HELPER(aes64es)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, true, false); + AESState t; + + t.d[HOST_BIG_ENDIAN] =3D rs1; + t.d[!HOST_BIG_ENDIAN] =3D rs2; + aesenc_SB_SR_AK(&t, &t, &aes_zero, false); + return t.d[HOST_BIG_ENDIAN]; } =20 target_ulong HELPER(aes64ds)(target_ulong rs1, target_ulong rs2) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928169; cv=none; d=zohomail.com; s=zohoarc; b=Yk/C31yDfyZvHT2X3g1DZjmS9e1WJoCVspKqhaA75q/FBW5obM7XmItmN4+XIkO0zlJ3jatnFueN2IMdyXgSywoQn4eYoBEOE3ig33yACecAibUGT1x95aHiC+kOXGYvaoM3IaFerGWd9rTWfTa12tYv1d7hN+Fex6vc3aTd0Ao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928169; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=WUXm97W1ZhEfn4l0HO1IV69ncZpeDJY70xQLMZZTlrJ6/7OHsQoJ2dgsteI3CrFHO3s1rRf3Y0vpaMq3Osx40+StU51EwPtjAKHbAATQjDzeMAA+OtgcTI3ohMeQw5M1RULBdUTdoTHBmMQ1LicHpWRAYRZwWLOzhyFtlSBiN5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928169882518.2321426680023; Sun, 9 Jul 2023 11:42:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZE9-0004PS-97; Sun, 09 Jul 2023 14:33:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0003X4-8t for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDt-0004F9-6H for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso28087955e9.0 for ; Sun, 09 Jul 2023 11:33:26 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927605; x=1691519605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=thoAjB3GpxKzMJcx1kcs1fdv/HJfX7A6qoQcNWX16u3f1tAbZANWzjLy0zZYzfdPWl 4q6roZnfopurtCdH/6cETa9Hq4wtedV8RlP4KV9D2A1Th1D35hTOe4ju9iyRMR1FFOzB uu+/fCVoLwkZZM4MBauvIDCGNL2EJZZtOYOz9nDfXUn7sMHR/6Bpdxk/JoicIwdGFP/1 j4tOUSsKyI1pSVFrDFGuMTOlxBZoeJVilSkwowpI/JKInmuLNq/ajmGKbRQyJt1J0RIT rfvsVFWKHthiUEoSy3aisPuKSSzO1kfsE+gbwaYT8ag2CutdV5U4AWoYTirdbgfC5luF CQGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927605; x=1691519605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7S8fJjWsfM8/RKnCcasDShb0DLhg94fNTjj77rs37DE=; b=QyzfaF6M2yrBfwu66jTUvn3B8Bo4dPfW1os0cry5K1yNUBv+e1PHjT2HdDnO8Ol4Jl PUMROlUScFkwhNmtXdWuEe8PHDobGN0XLO50bsGWxbMnC2IY9CB5livzBDznje2tLzYe Yp7YadRkGOaYh7HYcC9dHsNOicOsXyulFKCPekKm4FQDI39ZnuTwkRCc0L1slxLZxGQz mHPW6p/E9c2DsZ1CreDXksCivQhUJIo1WEIkHtxO+WxhWrbZW1L2lmUZUBTf0ozGxWsG rdMs6fMX4X0865dwgbo6zdiYRgWstAlXE1QV4Hukx4jPTwsA/9dfT+QB1mefxHwVjTNB XrwA== X-Gm-Message-State: ABy/qLbLN9Q3i9Gd9x2k22IsTIFtZ1vukRxACR9/nmQBtugKu1nWg/Dw rWBStSOqmrKZTFcFdX+9GX90ouhCJfWIY/pVUYur+A== X-Google-Smtp-Source: APBJJlEKT+MLvRyZnoQ1pjkI4oI5LKr4gDuq+j639HCg/KWneAxU1WJB/NPgT9HSUQSvJfeVkLNcdw== X-Received: by 2002:a1c:741a:0:b0:3fc:1a6:79a9 with SMTP id p26-20020a1c741a000000b003fc01a679a9mr1230997wmc.16.1688927605638; Sun, 09 Jul 2023 11:33:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 29/45] linux-user: Split out target_to_host_prot Date: Sun, 9 Jul 2023 19:29:09 +0100 Message-Id: <20230709182934.309468-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928171626100013 Split out from validate_prot_to_pageflags, as there is not one single host_prot for the entire range. We need to adjust prot for every host page that overlaps multiple guest pages. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-13-richard.henderson@linaro.org> --- linux-user/mmap.c | 78 ++++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 9dc34fc29d..12b1308a83 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -69,24 +69,11 @@ void mmap_fork_end(int child) * Return 0 if the target prot bitmask is invalid, otherwise * the internal qemu page_flags (which will include PAGE_VALID). */ -static int validate_prot_to_pageflags(int *host_prot, int prot) +static int validate_prot_to_pageflags(int prot) { int valid =3D PROT_READ | PROT_WRITE | PROT_EXEC | TARGET_PROT_SEM; int page_flags =3D (prot & PAGE_BITS) | PAGE_VALID; =20 - /* - * For the host, we need not pass anything except read/write/exec. - * While PROT_SEM is allowed by all hosts, it is also ignored, so - * don't bother transforming guest bit to host bit. Any other - * target-specific prot bits will not be understood by the host - * and will need to be encoded into page_flags for qemu emulation. - * - * Pages that are executable by the guest will never be executed - * by the host, but the host will need to be able to read them. - */ - *host_prot =3D (prot & (PROT_READ | PROT_WRITE)) - | (prot & PROT_EXEC ? PROT_READ : 0); - #ifdef TARGET_AARCH64 { ARMCPU *cpu =3D ARM_CPU(thread_cpu); @@ -114,18 +101,34 @@ static int validate_prot_to_pageflags(int *host_prot,= int prot) return prot & ~valid ? 0 : page_flags; } =20 +/* + * For the host, we need not pass anything except read/write/exec. + * While PROT_SEM is allowed by all hosts, it is also ignored, so + * don't bother transforming guest bit to host bit. Any other + * target-specific prot bits will not be understood by the host + * and will need to be encoded into page_flags for qemu emulation. + * + * Pages that are executable by the guest will never be executed + * by the host, but the host will need to be able to read them. + */ +static int target_to_host_prot(int prot) +{ + return (prot & (PROT_READ | PROT_WRITE)) | + (prot & PROT_EXEC ? PROT_READ : 0); +} + /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) { abi_ulong end, host_start, host_end, addr; - int prot1, ret, page_flags, host_prot; + int prot1, ret, page_flags; =20 trace_target_mprotect(start, len, target_prot); =20 if ((start & ~TARGET_PAGE_MASK) !=3D 0) { return -TARGET_EINVAL; } - page_flags =3D validate_prot_to_pageflags(&host_prot, target_prot); + page_flags =3D validate_prot_to_pageflags(target_prot); if (!page_flags) { return -TARGET_EINVAL; } @@ -143,7 +146,7 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= target_prot) host_end =3D HOST_PAGE_ALIGN(end); if (start > host_start) { /* handle host page containing start */ - prot1 =3D host_prot; + prot1 =3D target_prot; for (addr =3D host_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { prot1 |=3D page_get_flags(addr); } @@ -154,19 +157,19 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) end =3D host_end; } ret =3D mprotect(g2h_untagged(host_start), qemu_host_page_size, - prot1 & PAGE_BITS); + target_to_host_prot(prot1)); if (ret !=3D 0) { goto error; } host_start +=3D qemu_host_page_size; } if (end < host_end) { - prot1 =3D host_prot; + prot1 =3D target_prot; for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE) { prot1 |=3D page_get_flags(addr); } ret =3D mprotect(g2h_untagged(host_end - qemu_host_page_size), - qemu_host_page_size, prot1 & PAGE_BITS); + qemu_host_page_size, target_to_host_prot(prot1)); if (ret !=3D 0) { goto error; } @@ -175,8 +178,8 @@ int target_mprotect(abi_ulong start, abi_ulong len, int= target_prot) =20 /* handle the pages in the middle */ if (host_start < host_end) { - ret =3D mprotect(g2h_untagged(host_start), - host_end - host_start, host_prot); + ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, + target_to_host_prot(target_prot)); if (ret !=3D 0) { goto error; } @@ -212,7 +215,8 @@ static int mmap_frag(abi_ulong real_start, =20 if (prot1 =3D=3D 0) { /* no page was there, so we allocate one */ - void *p =3D mmap(host_start, qemu_host_page_size, prot, + void *p =3D mmap(host_start, qemu_host_page_size, + target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { return -1; @@ -233,7 +237,8 @@ static int mmap_frag(abi_ulong real_start, =20 /* adjust protection to be able to read */ if (!(prot1 & PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot1) | PROT_WRITE); } =20 /* read the corresponding file data */ @@ -243,11 +248,13 @@ static int mmap_frag(abi_ulong real_start, =20 /* put final protection */ if (prot_new !=3D (prot1 | PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, prot_new); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot_new)); } } else { if (prot_new !=3D prot1) { - mprotect(host_start, qemu_host_page_size, prot_new); + mprotect(host_start, qemu_host_page_size, + target_to_host_prot(prot_new)); } if (prot_new & PROT_WRITE) { memset(g2h_untagged(start), 0, end - start); @@ -460,7 +467,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, { abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_l= en, passthrough_start =3D -1, passthrough_end =3D -1; - int page_flags, host_prot; + int page_flags; =20 mmap_lock(); trace_target_mmap(start, len, target_prot, flags, fd, offset); @@ -470,7 +477,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, goto fail; } =20 - page_flags =3D validate_prot_to_pageflags(&host_prot, target_prot); + page_flags =3D validate_prot_to_pageflags(target_prot); if (!page_flags) { errno =3D EINVAL; goto fail; @@ -553,10 +560,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, =20 if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { unsigned long host_start; + int host_prot; void *p; =20 host_len =3D len + offset - host_offset; host_len =3D HOST_PAGE_ALIGN(host_len); + host_prot =3D target_to_host_prot(target_prot); =20 /* * Note: we prefer to control the mapping address. It is @@ -617,7 +626,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, * msync() won't work here, so we return an error if write is * possible while it is a shared mapping */ - if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && (host_prot & PROT_= WRITE)) { + if ((flags & MAP_TYPE) =3D=3D MAP_SHARED + && (target_prot & PROT_WRITE)) { errno =3D EINVAL; goto fail; } @@ -631,7 +641,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, if (pread(fd, g2h_untagged(start), len, offset) =3D=3D -1) { goto fail; } - if (!(host_prot & PROT_WRITE)) { + if (!(target_prot & PROT_WRITE)) { ret =3D target_mprotect(start, len, target_prot); assert(ret =3D=3D 0); } @@ -643,14 +653,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, if (real_end =3D=3D real_start + qemu_host_page_size) { /* one single host page */ ret =3D mmap_frag(real_start, start, end, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret =3D=3D -1) { goto fail; } goto the_end1; } ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, - host_prot, flags, fd, offset); + target_prot, flags, fd, offset); if (ret =3D=3D -1) { goto fail; } @@ -660,7 +670,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, if (end < real_end) { ret =3D mmap_frag(real_end - qemu_host_page_size, real_end - qemu_host_page_size, end, - host_prot, flags, fd, + target_prot, flags, fd, offset + real_end - qemu_host_page_size - star= t); if (ret =3D=3D -1) { goto fail; @@ -678,7 +688,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, offset1 =3D offset + real_start - start; } p =3D mmap(g2h_untagged(real_start), real_end - real_start, - host_prot, flags, fd, offset1); + target_to_host_prot(target_prot), flags, fd, offset1); if (p =3D=3D MAP_FAILED) { goto fail; } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928271; cv=none; d=zohomail.com; s=zohoarc; b=Wl87BIoG2M200T7xrMe87ZIvIDfFsUb8vFH+ujDhvUaUElNn1PKf24pgRl++bYfHB9ZGvnxBB05NzCtjM18UCCDcq8DSO3XvnbCZlpEYE4FM5P9UocO6BEsXpmXpMzbqgj1PtZnTk5k5icgu096kTJbNiqo3X6m43cbmjwFC3Z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928271; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SPxXjVkEBfCIbnZstLW82ROIVL7eKNAPasvd0ZIUexI=; b=iw0QOyppOjjJRx44i4/rvHSMNJ4xTKg/2Py0Yy5ridGDyWyHyhIUGtsnIEa4CED0plZnsHhwgJb/G3UvorlCQAXt7JOqnM++8vEcmrde4VtkUMx8ht9i3IO1dpH5Z9HQ3kETDtDhdVJGc+VpXAhDKl6coE8Y/092HBZfVbARH7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928271822383.29528919541065; Sun, 9 Jul 2023 11:44:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEM-0005pb-Hp; Sun, 09 Jul 2023 14:33:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0003X3-8E for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0004Fs-4A for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:32 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3110ab7110aso4037004f8f.3 for ; Sun, 09 Jul 2023 11:33:28 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927608; x=1691519608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SPxXjVkEBfCIbnZstLW82ROIVL7eKNAPasvd0ZIUexI=; b=hATF6DCngcDbRCg1HJDI3/RJmRhxoooUNfrT5iPA9qkR4tWVMGJr/mW767FYTphoSc hiNx8ZCP4ivqCwXb4KBnrVpQ/SWlCqwuaToi1yKpAFyyRY6Lj7xU2EoYdl2ZGeZwlUCf 2HOy0FeVtYvoyScMKLSOWCv0d+fXnyFWKg64PJBgkOtpo9jfRmz5ID9h/x1lJ+2Q7bs8 zvsI0fZpF1Wr+Rqu+j5N1byH/H36jpHV59DxqLXPQp8YWk2o1Kw3Bqo6Nfbgpz19soXT KUmncHNrwteaMC1HuUznhh8c3TZ3WsPmIG8wIW5oQ5vMVpKYhgmjykMtWOvE9KpMr0Zf N1cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927608; x=1691519608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SPxXjVkEBfCIbnZstLW82ROIVL7eKNAPasvd0ZIUexI=; b=RfcNWYacG4QCNrVnWpofXMZqFsAYwXJ1dS/Q/JT10M2fX6SE7RqSNZgojVNSbd7CQN MLq/nGd2bTG5vyBnA/lTRIdQC7Db34lNj0mqzA1xLDD2pB//3/YszFBdEau9znGi7jQj lenphEY/bQs1/vQIZpyyKr4wV/HwTTD9c8wTycqBvhIv7fUEEDhQiTmUaWOurxVYOU4Q /Och5a3z/l9ty3cvy51OLpXWU/ofSEq45Tv+bPthDFPWDsDwu4HeRqQwL7B8jd+/wwvc oav6iI3+9BiUr942hRs/R46K51wQ2kWJpjFRRVZavVkmlFD9iNSQltnnjq/ftzvBS2AT 1AVw== X-Gm-Message-State: ABy/qLaruzY+gAC09A3vAT8Wz/hlwIfl9G4hurtg8i/84SWOCZYGo7CJ g7H4COsV7NJ+P0MU9zK35hLYhOsAQRJm3W7C4DJlzQ== X-Google-Smtp-Source: APBJJlER/5NIP5KyKfZ0iZRr34kA5MYVLQr6jL/vAu+PPKu/QCn42r9ooZzWAbOX5+QvbVFudUERXA== X-Received: by 2002:a05:6000:4ec:b0:314:1483:d8ad with SMTP id cr12-20020a05600004ec00b003141483d8admr9000185wrb.44.1688927608083; Sun, 09 Jul 2023 11:33:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 30/37] target/riscv: Use aesdec_ISB_ISR_AK Date: Sun, 9 Jul 2023 19:29:12 +0100 Message-Id: <20230709182934.309468-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928273884100023 This implements the AES64DS instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index b072fed3e2..e61f7fe1e5 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -213,7 +213,12 @@ target_ulong HELPER(aes64es)(target_ulong rs1, target_= ulong rs2) =20 target_ulong HELPER(aes64ds)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, false, false); + AESState t; + + t.d[HOST_BIG_ENDIAN] =3D rs1; + t.d[!HOST_BIG_ENDIAN] =3D rs2; + aesdec_ISB_ISR_AK(&t, &t, &aes_zero, false); + return t.d[HOST_BIG_ENDIAN]; } =20 target_ulong HELPER(aes64dsm)(target_ulong rs1, target_ulong rs2) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927876; cv=none; d=zohomail.com; s=zohoarc; b=Y5JqOQ6Z9Z84GelpA59yBW0apujPCzGnfgA3LyahcX67LwGT7+WLc/B0vWyMLtfFF7zVu7E297rzQ83xa3+Rc2tfO2TG0RqVPV77jyXfAUMStpz0CCZYD7/bRLBMXyLn7HQ/imWDA0l4S5NEjru4NuPMhi8UPs+FEwWHDhEzmIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927876; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n45s477h1C3Bg6RmtpzjbWFEleMZVTqSI+26VJaWtyU=; b=CBIEy0nVGEloUcDS8i5mhLHbjS9gJqYCbdqJrBVoNgLTTFVmNfSdrY0sqzDKivMXQ/rXdiRTA49tTjb9OVipEwGub3ICLmlyzGx38zA/j/9yR5UqRYct5yC/AyCUQLzd6u0aN3t6XnoVtv/oTJ3SybXeCfeZeQxHgsIZMarf6/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927876576532.6173622695344; Sun, 9 Jul 2023 11:37:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEC-0004tr-K9; Sun, 09 Jul 2023 14:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0003X2-7g for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0004Fd-6A for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:32 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3142860734aso3826039f8f.1 for ; Sun, 09 Jul 2023 11:33:28 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927607; x=1691519607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n45s477h1C3Bg6RmtpzjbWFEleMZVTqSI+26VJaWtyU=; b=IB8ycmOvK5tx6xi4Wa0QGm8UQPho6UWjQDCIYg7eKygLgYJ3YC0euY63P/uBnYtpJB QCVFWgqIepX5YJqC18ZUGidPJCKJUcdEjJ9uECKL/GuglKrcRVJyZ88nWWD4Cq7eedgV VsGxwkMQN0cO2O5Xu7RoxRwDSeqN6rUk+JbPgBqc9+X7l4LYuQmfv7YkiB7cANaC5sce IOGRX5mIVvJMP26X+dSgFld0ApPpS3LRQhaC9qNAieL7TS0JK17gWPC4w9n+YBj1b5cI 7XbJpFniuvPFWm2WU8whXRKVQ/fFdZTjLsm6MjIXICntW+0T4qn7Hakw0V66iV1NIhQe NF7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927607; x=1691519607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n45s477h1C3Bg6RmtpzjbWFEleMZVTqSI+26VJaWtyU=; b=hJX3ncPFgQpsbcCje2rnNwA8UhHDlTwNOhAJYX9FbwtHhNtJUcrClnxxnDmDSEisl7 f7cQle5xRfLKQcV4IMDeZMgORvTbbK5HAYEJAA3m2m7EWHhZJMemkxfwUshzGXxBmgGs 2eUs2cdhVvysBSVr0dMRyZQSs4w0NLguzu0b3IRytIhZ8GnCuVInKP8zSixF2nZPvBBJ 1tlxviQk62JRNSVYWYSXYLrWk18Rcrs22LoKe/1Uykv/84KOBwOPJ80YCKjMIrgODL+S qFZRuhXe4q5CkXtARJ7B8CNrSpDqwVhAxUan1lBl2Yo0itrNeaQsbO9ZYao7VPOo5Lom Yfvg== X-Gm-Message-State: ABy/qLYNeXfjudOZu2+xIjGxlQWOvqzb195LG0CRES1OFCn0USW21pzj yeE25A5y6tyO8nUB8AVRwzQWspdqvJfNcD/09Gbp0Q== X-Google-Smtp-Source: APBJJlF3fSyqd2wfpjhXcxwBbIwAb0I97p3a95SfbS0W9VCSVCPxG1iO/sBNe2Sht+rPqYRSVFH6+w== X-Received: by 2002:a5d:4b91:0:b0:315:8f4f:9c50 with SMTP id b17-20020a5d4b91000000b003158f4f9c50mr3667365wrt.16.1688927607326; Sun, 09 Jul 2023 11:33:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 30/45] linux-user: Widen target_mmap offset argument to off_t Date: Sun, 9 Jul 2023 19:29:11 +0100 Message-Id: <20230709182934.309468-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927877568100011 We build with _FILE_OFFSET_BITS=3D64, so off_t =3D off64_t =3D uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the computation of the full value of offset. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-14-richard.henderson@linaro.org> --- linux-user/user-mmap.h | 2 +- linux-user/mmap.c | 14 ++++++++------ linux-user/syscall.c | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/linux-user/user-mmap.h b/linux-user/user-mmap.h index 480ce1c114..3fc986f92f 100644 --- a/linux-user/user-mmap.h +++ b/linux-user/user-mmap.h @@ -20,7 +20,7 @@ =20 int target_mprotect(abi_ulong start, abi_ulong len, int prot); abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, abi_ulong offset); + int flags, int fd, off_t offset); int target_munmap(abi_ulong start, abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags, diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 12b1308a83..b2c2d85857 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -196,7 +196,7 @@ error: /* map an incomplete host page */ static int mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong end, - int prot, int flags, int fd, abi_ulong offset) + int prot, int flags, int fd, off_t offset) { abi_ulong real_end, addr; void *host_start; @@ -463,11 +463,12 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong si= ze, abi_ulong align) =20 /* NOTE: all the constants are the HOST ones */ abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, - int flags, int fd, abi_ulong offset) + int flags, int fd, off_t offset) { - abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_l= en, + abi_ulong ret, end, real_start, real_end, retaddr, host_len, passthrough_start =3D -1, passthrough_end =3D -1; int page_flags; + off_t host_offset; =20 mmap_lock(); trace_target_mmap(start, len, target_prot, flags, fd, offset); @@ -559,7 +560,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, } =20 if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) { - unsigned long host_start; + uintptr_t host_start; int host_prot; void *p; =20 @@ -578,7 +579,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, goto fail; } /* update start so that it points to the file position at 'offset'= */ - host_start =3D (unsigned long)p; + host_start =3D (uintptr_t)p; if (!(flags & MAP_ANONYMOUS)) { p =3D mmap(g2h_untagged(start), len, host_prot, flags | MAP_FIXED, fd, host_offset); @@ -681,7 +682,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, /* map the middle (easier) */ if (real_start < real_end) { void *p; - unsigned long offset1; + off_t offset1; + if (flags & MAP_ANONYMOUS) { offset1 =3D 0; } else { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 36c4d88793..8a5a82fcec 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10436,7 +10436,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, #endif ret =3D target_mmap(arg1, arg2, arg3, target_to_host_bitmask(arg4, mmap_flags_tbl), - arg5, arg6 << MMAP_SHIFT); + arg5, (off_t)(abi_ulong)arg6 << MMAP_SHIFT); return get_errno(ret); #endif case TARGET_NR_munmap: --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927966; cv=none; d=zohomail.com; s=zohoarc; b=EuDwgHsbJMXijqu05r4LSfXEugyOLvEHG5XVySwSb0oU5U3bmT8rpgCDtyhFezqNfM4F8NYhafQeKXPlqbJ0ALm17s+BDEbqdWpkp+UlOM4Ary5iosdy91gqpzLUufKUDDIp1gEr3MAwTv9ADTLYSGf9xXDKZu76XVuP740bR9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927966; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=AV1UAw7wTh2VfPNe8ftJG3IOnAts0tDtu/zDV/Emz7F8+GIbIFgAZ8orvzDLW6rKXFiZKWuqsgboZl2WtKjjzP3rvnqCNIAQ4DvIy8IodfO7Qw1BTToR2e6Srko2DjQkx9vV+Q3qO5PGh9Ky3nZ/oy08cvKr83/wiAXnlmVYkvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927966087649.715530416852; Sun, 9 Jul 2023 11:39:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEP-0005sX-Ke; Sun, 09 Jul 2023 14:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0003X1-7X for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0004G3-6Q for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:32 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3094910b150so4053614f8f.0 for ; Sun, 09 Jul 2023 11:33:29 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927608; x=1691519608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=G9K+b0x9w8fTHKaRB/7mFxdF7zebDiwf/1ae7p57yxhIZMbZ7ru9zNwbLrwKvhysgI I5IFwLo/q39j/pwYp6TvxBedqiiGFDJuRDAgtFrTTrQzliTNOkeVlBMcqrfHdtpf2g72 jApRWKYq48yHz8hWGIX6oFO4rwodJ7U91vR+1igc6Efe0hmBDnJAtDC+6/1NprcjU6lM rchprJEmasgDek4l7hkkuaq8/X9ZwR12PnmIL/CXdKKM5F4tW62MVKgqD0C3Eu/WjEeU dvelBYRFwzB8IIo03P2mlqHnud1vhwlyT1kHGG/3kxpdjncd0Ko2U9lxRIFxq29e9l9n CtsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927608; x=1691519608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N9gguT3TBruptKaq1lWfbF+0g4+LhgVIPeZNOW/uhRg=; b=L9oIsWILnGE6o38WT8DIKPnqn7/2u8sY8Rai8pGPz00Gn+5iaFGBcLSepl30t8Kabo ENH3StzhalF79dDZz1BwuTD0S8LiKz/CHOq9FRWuDNmXwIqHWioH6vjpC9lzkaXEfv21 SskyfoTmpy2sA696cmL4W+xP6n97vZOW1krQ63SVWkKL9Nv5ws7vqhcaz2UP3AfaqV6e 9EoLppbnlbP0E+gajjT8+aHb9EPidHdCCYavIordyJs3cC79/1Cy8ZUVGuH77dQaUO8t l9nhbJ/81fbgsSMr+T4f9rZ8uqFrbIIiyFlO8J+4MqP8epSSw7ufQx+gd+wSR4rW6Tio +IqA== X-Gm-Message-State: ABy/qLa+QnQllJ8U7aCojP6uWASJPRmYhapkqgCTM5ClxlX/uQkRcdTv oTOA5YVm0ZeawrHD+BMyPjFdVS9HSzMMGSIKMvXdJA== X-Google-Smtp-Source: APBJJlHKhVSXQEioYRq6hnPmoCSX5MEeD7q12HzZMkd31HgQJ5h0PqgLtWXab6S/aUgO5o6iATns9Q== X-Received: by 2002:adf:e286:0:b0:313:dfb8:b4d0 with SMTP id v6-20020adfe286000000b00313dfb8b4d0mr10365023wri.66.1688927608768; Sun, 09 Jul 2023 11:33:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 31/45] linux-user: Rewrite target_mprotect Date: Sun, 9 Jul 2023 19:29:13 +0100 Message-Id: <20230709182934.309468-62-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927967516100001 Content-Type: text/plain; charset="utf-8" Use 'last' variables instead of 'end' variables. When host page size > guest page size, detect when adjacent host pages have the same protection and merge that expanded host range into fewer syscalls. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-15-richard.henderson@linaro.org> --- linux-user/mmap.c | 106 +++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index b2c2d85857..d02d74d279 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -120,8 +120,11 @@ static int target_to_host_prot(int prot) /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int target_prot) { - abi_ulong end, host_start, host_end, addr; - int prot1, ret, page_flags; + abi_ulong starts[3]; + abi_ulong lens[3]; + int prots[3]; + abi_ulong host_start, host_last, last; + int prot1, ret, page_flags, nranges; =20 trace_target_mprotect(start, len, target_prot); =20 @@ -132,63 +135,88 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) if (!page_flags) { return -TARGET_EINVAL; } - len =3D TARGET_PAGE_ALIGN(len); - end =3D start + len; - if (!guest_range_valid_untagged(start, len)) { - return -TARGET_ENOMEM; - } if (len =3D=3D 0) { return 0; } + len =3D TARGET_PAGE_ALIGN(len); + if (!guest_range_valid_untagged(start, len)) { + return -TARGET_ENOMEM; + } + + last =3D start + len - 1; + host_start =3D start & qemu_host_page_mask; + host_last =3D HOST_PAGE_ALIGN(last) - 1; + nranges =3D 0; =20 mmap_lock(); - host_start =3D start & qemu_host_page_mask; - host_end =3D HOST_PAGE_ALIGN(end); - if (start > host_start) { - /* handle host page containing start */ + + if (host_last - host_start < qemu_host_page_size) { + /* Single host page contains all guest pages: sum the prot. */ prot1 =3D target_prot; - for (addr =3D host_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot1 |=3D page_get_flags(addr); + for (abi_ulong a =3D host_start; a < start; a +=3D TARGET_PAGE_SIZ= E) { + prot1 |=3D page_get_flags(a); } - if (host_end =3D=3D host_start + qemu_host_page_size) { - for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot1 |=3D page_get_flags(addr); + for (abi_ulong a =3D last; a < host_last; a +=3D TARGET_PAGE_SIZE)= { + prot1 |=3D page_get_flags(a + 1); + } + starts[nranges] =3D host_start; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + } else { + if (host_start < start) { + /* Host page contains more than one guest page: sum the prot. = */ + prot1 =3D target_prot; + for (abi_ulong a =3D host_start; a < start; a +=3D TARGET_PAGE= _SIZE) { + prot1 |=3D page_get_flags(a); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 !=3D target_prot) { + starts[nranges] =3D host_start; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + host_start +=3D qemu_host_page_size; } - end =3D host_end; } - ret =3D mprotect(g2h_untagged(host_start), qemu_host_page_size, - target_to_host_prot(prot1)); - if (ret !=3D 0) { - goto error; + + if (last < host_last) { + /* Host page contains more than one guest page: sum the prot. = */ + prot1 =3D target_prot; + for (abi_ulong a =3D last; a < host_last; a +=3D TARGET_PAGE_S= IZE) { + prot1 |=3D page_get_flags(a + 1); + } + /* If the resulting sum differs, create a new range. */ + if (prot1 !=3D target_prot) { + host_last -=3D qemu_host_page_size; + starts[nranges] =3D host_last + 1; + lens[nranges] =3D qemu_host_page_size; + prots[nranges] =3D prot1; + nranges++; + } } - host_start +=3D qemu_host_page_size; - } - if (end < host_end) { - prot1 =3D target_prot; - for (addr =3D end; addr < host_end; addr +=3D TARGET_PAGE_SIZE) { - prot1 |=3D page_get_flags(addr); + + /* Create a range for the middle, if any remains. */ + if (host_start < host_last) { + starts[nranges] =3D host_start; + lens[nranges] =3D host_last - host_start + 1; + prots[nranges] =3D target_prot; + nranges++; } - ret =3D mprotect(g2h_untagged(host_end - qemu_host_page_size), - qemu_host_page_size, target_to_host_prot(prot1)); - if (ret !=3D 0) { - goto error; - } - host_end -=3D qemu_host_page_size; } =20 - /* handle the pages in the middle */ - if (host_start < host_end) { - ret =3D mprotect(g2h_untagged(host_start), host_end - host_start, - target_to_host_prot(target_prot)); + for (int i =3D 0; i < nranges; ++i) { + ret =3D mprotect(g2h_untagged(starts[i]), lens[i], + target_to_host_prot(prots[i])); if (ret !=3D 0) { goto error; } } =20 - page_set_flags(start, start + len - 1, page_flags); + page_set_flags(start, last, page_flags); ret =3D 0; =20 -error: + error: mmap_unlock(); return ret; } --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927990; cv=none; d=zohomail.com; s=zohoarc; b=emSsA1H6tlcVJ/vcUM8BNTbK/6z7LvNNSO9KwwlCNJTkM9U1bCzux3C4vdDiNAZjGpNrXNdC3LQPyBzP3Zhv7mAC5qBHO3+sImvHEFCmBAK+Rq1pKk/Y73kNnedQY8yGtUESuxCTIF3PVUfN2GwEv/YzEc2RX34dfPK7QXWDBFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927990; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=muoNLx2OrRgCzPDttQEHoOl2grqT5w0p62Pb+0kehUU=; b=euuGVdAyue97F1VcH3HFdUYQGr62W8S2jxx2s0U+wEGp/WEQPLZ0GeJvwflSv0e3Q4XLapMVOWgu4uN3rHapwLNrA1g3p75I5BwasE9E80Vh5bZr+/zhOWg5PjDfloAKvVl6or/vMIyFHKAVnm8VKJcwhMN6kt4RayctJhCC8lY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927990108886.0405714439232; Sun, 9 Jul 2023 11:39:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEP-0005sT-E1; Sun, 09 Jul 2023 14:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0003X5-9X for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDu-0004GC-NR for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:32 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-31297125334so2803160f8f.0 for ; Sun, 09 Jul 2023 11:33:30 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927609; x=1691519609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=muoNLx2OrRgCzPDttQEHoOl2grqT5w0p62Pb+0kehUU=; b=fzNRL4odUbIDIIEK+BUCxux4T2ttI2eV353QmptJ3gUfZptgYhBzz49ZS/GtjLuJ5I Kex/lWg9AK2IozO5VUjY9FVzHFExrYttWkO2rAFKxHxUdY39F/HarekCKChs1/xKsUqe 9pccjpi6tYkNh3V0lqE655AX8KWlY9iJmeK5XoNThOTeapzemGpzq27ZPniES//MQAUK FxymSDXfTT0arbmn/16v3xpIpY2uyy6G07vl9uhtnuKEDe1ZA8pH174iqirjxaJYeVoX GonCEZaKfGD/qHHOM8dBj8twuIMcOn/GuuFkEAR5vfodt6HI/fz/jg9fCp0J/CuTjt6E vwlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927609; x=1691519609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=muoNLx2OrRgCzPDttQEHoOl2grqT5w0p62Pb+0kehUU=; b=PJbhzUrFXfLH0xOwltH0dxuN3icDQmUZKfABCoIhRI5DqWalcU4h2lvo1MjInJX0VO gnQJ0oy/i3Ztzia0cj8f4CWS/DJVqK/TbkgLTCYDvzZxRyVgjNW4yJSSispmVXadoglL hEP/uJ0XtW0lHerkd2KOl9zCim9nHJlhSHhCS7F0C8feYsKs8ljA7T4hLRBe05Rb50os cGPL0uOChRYFkqXOW2T+suQtEmwBGgyJKDiDT2Qbq2RFTMH0/66E9KmQZlTF5t8uBYDp EKUFh8eMogcQsPnuSFsVF4OPSAXvk1/34iYJHv8BiVR05HZUnVgUsJoogzNWG3dtbciv mBjg== X-Gm-Message-State: ABy/qLY85YOSs1wiQIJdGc+O/271dDP45oZJq4K5TDFa+Qfi/rDNXPYR 32Lqi+VaA/g0rrhm/mn7ALJriyZJ6k9c7b/Wiz35Zw== X-Google-Smtp-Source: APBJJlGz1xvEvR6KYnuFPj+9tAEIIiey+Jtx2cg/Z33mFJFVFRlPtdVyEwZ4UDTJs7ih9OrMNyqT0w== X-Received: by 2002:adf:db46:0:b0:314:1096:6437 with SMTP id f6-20020adfdb46000000b0031410966437mr6848139wrj.19.1688927609553; Sun, 09 Jul 2023 11:33:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 31/37] target/riscv: Use aesdec_IMC Date: Sun, 9 Jul 2023 19:29:14 +0100 Message-Id: <20230709182934.309468-63-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927991632100001 This implements the AES64IM instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index e61f7fe1e5..505166ce5a 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -272,17 +272,12 @@ target_ulong HELPER(aes64ks1i)(target_ulong rs1, targ= et_ulong rnum) =20 target_ulong HELPER(aes64im)(target_ulong rs1) { - uint64_t RS1 =3D rs1; - uint32_t col_0 =3D RS1 & 0xFFFFFFFF; - uint32_t col_1 =3D RS1 >> 32; - target_ulong result; + AESState t; =20 - col_0 =3D AES_INVMIXCOLUMN(col_0); - col_1 =3D AES_INVMIXCOLUMN(col_1); - - result =3D ((uint64_t)col_1 << 32) | col_0; - - return result; + t.d[HOST_BIG_ENDIAN] =3D rs1; + t.d[!HOST_BIG_ENDIAN] =3D 0; + aesdec_IMC(&t, &t, false); + return t.d[HOST_BIG_ENDIAN]; } =20 target_ulong HELPER(sm4ed)(target_ulong rs1, target_ulong rs2, --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927893; cv=none; d=zohomail.com; s=zohoarc; b=GQkyZidS98SZ/J3EvkpuExmZsMgJM8s/V7cHOEBTdI/0bqqZqhrVJKYiQrZWVyXhBwvEGBI5eLVf2mIPfIc2mFv9AZxEfc1Kdu8bBNiPb/thBANSyO8CXo2P+znLqppW4KA9R6euEuNxuROn7q3z+xDLxHp10ZbHhW3rSttfDzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927893; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; b=LSwfJORmG/UwL5p9xv8s6lEQHjLaq/Usva545/O4hlzbt9fB5Tz0r5NpUI8WzJe41wEmsnaCFp28v3Uf0gvX5cD1a3YjBRH+s4dT5LjymAyszENLlH51mFcR6pH+aNm7EN+J8zdVLipDYty8QAzYiFp6lH8CcIO+PC+zD6ERdp4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927893200649.9424688752836; Sun, 9 Jul 2023 11:38:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEC-0004wI-Rr; Sun, 09 Jul 2023 14:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDy-0003Ze-F9 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0004Ge-0G for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:34 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbea147034so37230395e9.0 for ; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927611; x=1691519611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; b=ts7b6gID2uM1UB8wm54G4iRs2Wgna6SgDMVYW/LMvOZzFo1eAWQ5nZRPDBolohZQQv 01vAYnIiWKteCL7xvKWw/mwK2SXwzhh3rrDXHBEj3O3yMC3yqYmh9So5m9TR2hmz/RlA kKbRu7dCiCCgJcqgwHlygvlGQGoaQ1sRppYC8GI14238uLEcBDH03gmHFVfqI3HA7jOB Vq9zcMJj9rASvfsFXM118QBPlghqvZyHKP0Iz7X+/j9TbEL9Umzi0iydErQQdu6nGuxw /3ERoCQPAcEkWYJ93jVES0aiPFwNXgpJQYkuLondspvwA5Gd06u4D9QxeKF/Qqa5/rb/ ML4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927611; x=1691519611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; b=j1iTINeAL0pqJ1ytJpVZm3RfxMEfqRDRuJCjUnKP/SlognoR1nNEabMHXH2pb6yNi+ Wtly6+VZXsSVCW2BSnSWM6AtmJIKg+ECRBZ4nRFGl+pDw4oYEf+585ZY0YDTb+MiYyeT US5j9yd04rG1UsELnP6MQqk7uFgBUXtoLdA1c7fTjR6IqInLK1uO0q4pYQbh25gByguB G3ilxJVY4eU6X3jzH+gNkakkbh66GQwTWfsiH0hs+8ejcUBOzLa33fK7zDT3IoB6KOKL XQpgCyhiv3xmX+IcRfINt8mjRZrELsTOgB6Puyvc/ISMueb4J4fICd8fFEYqgPMGf2h+ fV+w== X-Gm-Message-State: ABy/qLZ3vqHxEK5ZFW4xeq3pNhtykWhptWL9RoKOjYp+K2Bwv3ph1MKt mAAdC8ukBu8qNkZf9DtMPO57KLWZ6jC9X+ts1LO4Pw== X-Google-Smtp-Source: APBJJlGmxWPXlYITkzWQ7lr7qsZx1Q9znY2lfOWADGxt+f/6fqLXbQON3a7A3mUrJOl0b2oGE4MB0Q== X-Received: by 2002:a05:600c:294c:b0:3fb:ffef:d058 with SMTP id n12-20020a05600c294c00b003fbffefd058mr5897516wmd.0.1688927611071; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 32/37] target/riscv: Use aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:29:16 +0100 Message-Id: <20230709182934.309468-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927893411100001 This implements the AES64ESM instruction. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index 505166ce5a..c036fe8632 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -198,7 +198,12 @@ static inline target_ulong aes64_operation(target_ulon= g rs1, target_ulong rs2, =20 target_ulong HELPER(aes64esm)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, true, true); + AESState t; + + t.d[HOST_BIG_ENDIAN] =3D rs1; + t.d[!HOST_BIG_ENDIAN] =3D rs2; + aesenc_SB_SR_MC_AK(&t, &t, &aes_zero, false); + return t.d[HOST_BIG_ENDIAN]; } =20 target_ulong HELPER(aes64es)(target_ulong rs1, target_ulong rs2) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927754; cv=none; d=zohomail.com; s=zohoarc; b=LaCZztDqToE0xPdoTie7L90oWD4NfixJ71WKlllF8f6Nckmm06n9PNJY2HDUBHqKkJdrZfjz8F0PUJKe3ph/5VKRz7Gb2vP/YPGsAhGun5xAGp/gqLmbXEa8HVGkP7VqYfDn+h5QB9TjR4u/5BHgGxfAzKjob6fpD309K8yRvKU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927754; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=CQHXtHQffltOpGUoMD1g+IM/LHVc+1D8qa5Tj8jEaS0IibBxj3APbmXaK0TIvNwZVw43qmyHxtSwf8+jknicejWLPYDBP0hm5PuCDz+uBtOEJUioUivZwLUc+TeUNmzCbTSVXchnXpvXndKZhPnaFfc4tNkBPb3wLT3P72MGA7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927754706798.1779922839606; Sun, 9 Jul 2023 11:35:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEB-0004ev-SF; Sun, 09 Jul 2023 14:33:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDy-0003Zg-ON for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0004GT-04 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:34 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3143798f542so4034462f8f.2 for ; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927610; x=1691519610; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=XmvrBllEYIuse+EO/aSoasxM2KjC4/sZgIhKeFv+VAk7IHJ09hm8nY18PtVonNEHBQ 3ZYDhuDQ3tQPaVR0b7Lnmhu2BlkqKD9MR2cfVoXFp4rXwn/uUQqBs+xwojX9U/Xf474J ASpwMKyWqI1CTIespcEDe8kwRYo1bZIzL5btNGNqvbMkvaCWKfiHTQMTHwGfJEPBK0po z6bPGDPE/dj37RIRX4vFqIUAZDy1BB92gj3bxlq8/t6DhQMccLQfBT2RHlzLG9EO31uE 6OZMVd8mjgYCOoI0uY2CxEst5hkhxEmoV28LpxZSEuGqOvLQVCG0I9nNeB8gyhy1JN7B GS7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927610; x=1691519610; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aO8i+PWWEj2wFULENv6+H9RCy3N3UL0z2bpJ1K4Mi2s=; b=cafcNc5FPU7H9ouTR237MKcOoIWERZVG/HfE2Ktpwlb1bx+VOVGW2EKnXrs8/QmNQS rN4z30jY99tSRLR1hZVkodFiEIiohTrCBeJvLqo/M81r5CV/g2X2goMtXTU2XsmZ3eEl 5IwwubNSeywH5s6qCCqg+qkEJUPFCMzTB8NaHq+wJYaZyg9gDffkImQBl6QSJyB5mKuq 9XLXVSpvt4g8hI36UAGIAbinp2DeUri25cZ9yViX1ZflsJrIFC/uVJIDVgMAOQ5A7eMG HKj66VSrIiGJCAL5QFuttGOaAv0VvbbYsnNWZ6AmuEB6YYVtmvCIOBoLvUg1hXT4Tqsg Qj/g== X-Gm-Message-State: ABy/qLaBZpzrSgjuexsAd0HkkOdb1PaH5alW9Z60Ua6Y6gYDcI/7UNq/ 5/RXNHcNjCG0P8/wUjhPgXvOjCqwc5kDIsJSWDgQOw== X-Google-Smtp-Source: APBJJlES7Sw+GBjTBOz5K/3qViVxuRvSRlhpMVr6i63BJv+RQzNUjEjIfvnm27f9ivWlLuCsGcYz0w== X-Received: by 2002:adf:edc1:0:b0:313:ec05:3e30 with SMTP id v1-20020adfedc1000000b00313ec053e30mr8959198wro.45.1688927610331; Sun, 09 Jul 2023 11:33:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 32/45] linux-user: Rewrite mmap_frag Date: Sun, 9 Jul 2023 19:29:15 +0100 Message-Id: <20230709182934.309468-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927757011100003 Content-Type: text/plain; charset="utf-8" Use 'last' variables instead of 'end' variables. Always zero MAP_ANONYMOUS fragments, which we previously failed to do if they were not writable; early exit in case we allocate a new page from the kernel, known zeros. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-16-richard.henderson@linaro.org> --- linux-user/mmap.c | 123 +++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index d02d74d279..c4b2515271 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -222,73 +222,76 @@ int target_mprotect(abi_ulong start, abi_ulong len, i= nt target_prot) } =20 /* map an incomplete host page */ -static int mmap_frag(abi_ulong real_start, - abi_ulong start, abi_ulong end, - int prot, int flags, int fd, off_t offset) +static bool mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong las= t, + int prot, int flags, int fd, off_t offset) { - abi_ulong real_end, addr; + abi_ulong real_last; void *host_start; - int prot1, prot_new; + int prot_old, prot_new; + int host_prot_old, host_prot_new; =20 - real_end =3D real_start + qemu_host_page_size; - host_start =3D g2h_untagged(real_start); - - /* get the protection of the target pages outside the mapping */ - prot1 =3D 0; - for (addr =3D real_start; addr < real_end; addr++) { - if (addr < start || addr >=3D end) { - prot1 |=3D page_get_flags(addr); - } + if (!(flags & MAP_ANONYMOUS) + && (flags & MAP_TYPE) =3D=3D MAP_SHARED + && (prot & PROT_WRITE)) { + /* + * msync() won't work with the partial page, so we return an + * error if write is possible while it is a shared mapping. + */ + errno =3D EINVAL; + return false; } =20 - if (prot1 =3D=3D 0) { - /* no page was there, so we allocate one */ + real_last =3D real_start + qemu_host_page_size - 1; + host_start =3D g2h_untagged(real_start); + + /* Get the protection of the target pages outside the mapping. */ + prot_old =3D 0; + for (abi_ulong a =3D real_start; a < start; a +=3D TARGET_PAGE_SIZE) { + prot_old |=3D page_get_flags(a); + } + for (abi_ulong a =3D real_last; a > last; a -=3D TARGET_PAGE_SIZE) { + prot_old |=3D page_get_flags(a); + } + + if (prot_old =3D=3D 0) { + /* + * Since !(prot_old & PAGE_VALID), there were no guest pages + * outside of the fragment we need to map. Allocate a new host + * page to cover, discarding whatever else may have been present. + */ void *p =3D mmap(host_start, qemu_host_page_size, target_to_host_prot(prot), flags | MAP_ANONYMOUS, -1, 0); if (p =3D=3D MAP_FAILED) { - return -1; + return false; } - prot1 =3D prot; + prot_old =3D prot; } - prot1 &=3D PAGE_BITS; + prot_new =3D prot | prot_old; =20 - prot_new =3D prot | prot1; - if (!(flags & MAP_ANONYMOUS)) { - /* - * msync() won't work here, so we return an error if write is - * possible while it is a shared mapping. - */ - if ((flags & MAP_TYPE) =3D=3D MAP_SHARED && (prot & PROT_WRITE)) { - return -1; - } + host_prot_old =3D target_to_host_prot(prot_old); + host_prot_new =3D target_to_host_prot(prot_new); =20 - /* adjust protection to be able to read */ - if (!(prot1 & PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot1) | PROT_WRITE); - } + /* Adjust protection to be able to write. */ + if (!(host_prot_old & PROT_WRITE)) { + host_prot_old |=3D PROT_WRITE; + mprotect(host_start, qemu_host_page_size, host_prot_old); + } =20 - /* read the corresponding file data */ - if (pread(fd, g2h_untagged(start), end - start, offset) =3D=3D -1)= { - return -1; - } - - /* put final protection */ - if (prot_new !=3D (prot1 | PROT_WRITE)) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot_new)); - } + /* Read or zero the new guest pages. */ + if (flags & MAP_ANONYMOUS) { + memset(g2h_untagged(start), 0, last - start + 1); } else { - if (prot_new !=3D prot1) { - mprotect(host_start, qemu_host_page_size, - target_to_host_prot(prot_new)); - } - if (prot_new & PROT_WRITE) { - memset(g2h_untagged(start), 0, end - start); + if (pread(fd, g2h_untagged(start), last - start + 1, offset) =3D= =3D -1) { + return false; } } - return 0; + + /* Put final protection */ + if (host_prot_new !=3D host_prot_old) { + mprotect(host_start, qemu_host_page_size, host_prot_new); + } + return true; } =20 #if HOST_LONG_BITS =3D=3D 64 && TARGET_ABI_BITS =3D=3D 64 @@ -681,27 +684,25 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, if (start > real_start) { if (real_end =3D=3D real_start + qemu_host_page_size) { /* one single host page */ - ret =3D mmap_frag(real_start, start, end, - target_prot, flags, fd, offset); - if (ret =3D=3D -1) { + if (!mmap_frag(real_start, start, end - 1, + target_prot, flags, fd, offset)) { goto fail; } goto the_end1; } - ret =3D mmap_frag(real_start, start, real_start + qemu_host_pa= ge_size, - target_prot, flags, fd, offset); - if (ret =3D=3D -1) { + if (!mmap_frag(real_start, start, + real_start + qemu_host_page_size - 1, + target_prot, flags, fd, offset)) { goto fail; } real_start +=3D qemu_host_page_size; } /* handle the end of the mapping */ if (end < real_end) { - ret =3D mmap_frag(real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end, - target_prot, flags, fd, - offset + real_end - qemu_host_page_size - star= t); - if (ret =3D=3D -1) { + if (!mmap_frag(real_end - qemu_host_page_size, + real_end - qemu_host_page_size, end - 1, + target_prot, flags, fd, + offset + real_end - qemu_host_page_size - start= )) { goto fail; } real_end -=3D qemu_host_page_size; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928202; cv=none; d=zohomail.com; s=zohoarc; b=UgUf9cJBh+EwEIXM1NiE3k5ctwxSc7f+q7twP/eKB2II58VDdiphAK93SCSDCm/LPABQsJn80m4EglXYT1cnEI1rxG6EFcVfdw9mpRjIPsp1NkLikluZhnGlN8RV1uti1HUVXypeuvvvRxh5rGufP85o/ZtWRGZ83GJwDzJJ7II= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928202; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=ALCSn96e21PQ4datPNPm631k47WpAl7IsEbugN2UaN4lCRKoAHxm0cih1UY7uofA+vdoVmu+lPXeg4xIZoMo+4DnJkYmMhwbyjzJNW7uJh6eB2uZVe9o1+lxEAKG1WDYiq09LPDAHl8qcNN8nk900yKDb9uweG9qHMhWnuZM2rA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928202962588.4076784939278; Sun, 9 Jul 2023 11:43:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZED-00055q-NS; Sun, 09 Jul 2023 14:33:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDz-0003aB-OB for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0004Gl-6F for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-31441dfbf97so4314267f8f.1 for ; Sun, 09 Jul 2023 11:33:32 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927612; x=1691519612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=UvYjNgBIl4rFgkHQ+ucXCccsdPHZvz0zzQ2m2UAxjRcoK4Pq7/Zk5hOFe7HF5NEDl/ F3wIF5YLkaoMC9zrWhYcZpz+8tTXtEf2BV9S78J/905R+6PvsxI0duzG+DdKEJZFLXWF BZVpS1xTwzPsV6XlXh1RFREbB4VFm5viAZPwpe1d+HSa6QIA3nLKnU1bNkqC6eAjEj6p Z9OUmjB0y6+huTFxGssMdRy+dIgMaGUHZu0GNoJs9p+Tx3KLuvuNO2YQEmT+jVkk7JIt SStiweAv69RwjczpvEx+ELjacjmYAnNYgR0WSycwpaXzdc+9QYzEl1jo4uO75dNeU7YG CWrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927612; x=1691519612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tw+lHuhQDkl8BHlJVK/TymddlbqOTxzC1UGZ1En8Tes=; b=RBOw+trl9O2ZC/mqFS/UYYW+4h1kipIsS7P4rdh87co/6o12IQPLYV+V9PWyNNuBVF 4ly7V/6bjO7+z+wd9ZOPP5Hs0PQz258F123YoJa9cdtuUzhvjAnAjIxscuyqM9omsZ+I R66xuw8xBVosZ6jkXxRwymv/xP4kRb4lK/ApelDzfKxVq/lNNHGK4Pqef9QjYBui7pI9 FUHVxuq7j2rXnu+pII0CrnxtsZVHuTh0vlSWXjlLjNLqUTb7aVzeVkKbejEHh32Yc4+8 IG8p0fTwW1lnwpg+eKWhe7X5coxQfrRmRgVif0Ljn2eJPZB+mQa+jD3iN5oulRiGV4eH OGXQ== X-Gm-Message-State: ABy/qLbVazWtewG4mIX2znqAt+pyBheyuBV0G2+6SgG++t+XKuGhXscI Ze2SXfmk23/mynNc4Q92i4QWerCtl0L7LDUeYyCN9Q== X-Google-Smtp-Source: APBJJlEFoi90emDeeLOqJVQ6LxOJepZtEw6jNVk2SiusMa1BytxWIIm5VlySZxeUb0r4hLwuSYaiTg== X-Received: by 2002:adf:ec90:0:b0:314:545f:6e94 with SMTP id z16-20020adfec90000000b00314545f6e94mr9968414wrn.65.1688927611853; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 33/45] accel/tcg: Introduce page_find_range_empty Date: Sun, 9 Jul 2023 19:29:17 +0100 Message-Id: <20230709182934.309468-66-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928203853100001 Content-Type: text/plain; charset="utf-8" Use the interval tree to locate an unused range in the VM. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-17-richard.henderson@linaro.org> --- include/exec/cpu-all.h | 15 +++++++++++++++ accel/tcg/user-exec.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 94f828b109..eb1c54701a 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -236,6 +236,21 @@ int page_check_range(target_ulong start, target_ulong = len, int flags); */ bool page_check_range_empty(target_ulong start, target_ulong last); =20 +/** + * page_find_range_empty + * @min: first byte of search range + * @max: last byte of search range + * @len: size of the hole required + * @align: alignment of the hole required (power of 2) + * + * If there is a range [x, x+@len) within [@min, @max] such that + * x % @align =3D=3D 0, then return x. Otherwise return -1. + * The memory lock must be held, as the caller will want to ensure + * the returned range stays empty until a new mapping can be installed. + */ +target_ulong page_find_range_empty(target_ulong min, target_ulong max, + target_ulong len, target_ulong align); + /** * page_get_target_data(address) * @address: guest virtual address diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index ab684a3ea2..e4f9563730 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -605,6 +605,47 @@ bool page_check_range_empty(target_ulong start, target= _ulong last) return pageflags_find(start, last) =3D=3D NULL; } =20 +target_ulong page_find_range_empty(target_ulong min, target_ulong max, + target_ulong len, target_ulong align) +{ + target_ulong len_m1, align_m1; + + assert(min <=3D max); + assert(max <=3D GUEST_ADDR_MAX); + assert(len !=3D 0); + assert(is_power_of_2(align)); + assert_memory_lock(); + + len_m1 =3D len - 1; + align_m1 =3D align - 1; + + /* Iteratively narrow the search region. */ + while (1) { + PageFlagsNode *p; + + /* Align min and double-check there's enough space remaining. */ + min =3D (min + align_m1) & ~align_m1; + if (min > max) { + return -1; + } + if (len_m1 > max - min) { + return -1; + } + + p =3D pageflags_find(min, min + len_m1); + if (p =3D=3D NULL) { + /* Found! */ + return min; + } + if (max <=3D p->itree.last) { + /* Existing allocation fills the remainder of the search regio= n. */ + return -1; + } + /* Skip across existing allocation. */ + min =3D p->itree.last + 1; + } +} + void page_protect(tb_page_addr_t address) { PageFlagsNode *p; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927966; cv=none; d=zohomail.com; s=zohoarc; b=mpDhurHpMQaL/i0J3kpp7wU8FoV3wuVsW5Jn2f3vsbcl5+VaDdIbYXiVxEyLW2LWauTy/0flCsZXTf5v5KD0lfZExBbLW/lq/aUO+6LmyH/Yy1ZtLA92N/5t/z5tJ+kJsGUBxOgLU+iRBzIb+UGXB/e5H2fARfuOMqZKhNTDMLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927966; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UNvrPJBGJx5dGrfGxip7sDDn/+xiNFreEIZcy5LuLWI=; b=U4gLmdutNAFbOKs6bl0deoUuFJXt/pYkNDisf4CPWlByli7qeJ4bucGVrmt7jOaoeyIbyu4cYkApCApponsnmlTfuoLwveZcKWP7OMXjMeyDjV6y5ZHduDFqVrOK69PSkeb7kaeYRVX+C100f+UGJT9rYbwOi77cpbedtc8xKBE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927966532627.8584529370195; Sun, 9 Jul 2023 11:39:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEF-0005Jb-Ae; Sun, 09 Jul 2023 14:33:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZDz-0003aF-T1 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0004H1-T2 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so38097945e9.0 for ; Sun, 09 Jul 2023 11:33:33 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927612; x=1691519612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UNvrPJBGJx5dGrfGxip7sDDn/+xiNFreEIZcy5LuLWI=; b=tWw1yDr184gNGbHwm5grNX7bEX6MfUXs9/p9iqJGvW3lz972IUH9JKjCgGN66O/cx0 nZe6TWtt+lhMpU26GDt/gftrlSdT+pkrPStCYTbOiUYNeyBVn///o69CheonPMTeljdY b0L6K+f1RZyv3brTmOJYku4lFUzWWlDOh9eg3V+s62gOjxkW/chKe7O+YK+A1blyxx06 pddD4bUnzEonYtKVz0+EqWssMoPe7SsPGnXlouuVa6F1eIwkPme+wwY1Y8ZTqnDW5GQH p9LZThqdsQPDG2/c3gyFVZ0i/eYVXP7rGNoQPGhVK6D48/sxi4EYFlfLzgcggJU3s77N ggZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927612; x=1691519612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UNvrPJBGJx5dGrfGxip7sDDn/+xiNFreEIZcy5LuLWI=; b=TqJcwprWDwKjqSvTPVSjPKurDD9QQmrwO18idsJZBO/Wfqwh+DGJErhSWvxxXQPJXY aloWBhNwKM54YZkBLFyW2u4phf1d/zLXBfKTb8dEs/dOb2NzDqdmg3dwiCZI4GkU0HBL AdvtJ6jYFyqL/Lm3mzvk3HCQPiVxDmxGUKISzOgsG/b95s3CA2IvddvvxJCK1iRQEHxx tc2524Us6t45FesapTmwalVdBRDpSFST/fijJVnum5O1mkPUXrHD7vpQJSw+53bCB084 ov758089t26rs3ojLHbVBeR5bZ7YkCEl0lC/MZKPprONqxjz4YdocRiri83LclRKHkxD Lxsg== X-Gm-Message-State: ABy/qLZMmR9LCEfw2H6X7bt8agtIVGi0vkXkd3nSK5eWAZCgla3kIQ7x VYSaSW7hXc6zqtqKB/M9cDvk4ywHImoZnW74ScVXtg== X-Google-Smtp-Source: APBJJlGZdIFgtU/4UC0PLsVVf+IQKkKqxBlOX8PLFEDzad6iaJWA/V/CiSQFmWPkNquP+9S+EFQRhw== X-Received: by 2002:adf:ee4a:0:b0:314:11d7:c919 with SMTP id w10-20020adfee4a000000b0031411d7c919mr8866085wro.49.1688927612628; Sun, 09 Jul 2023 11:33:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 33/37] target/riscv: Use aesdec_ISB_ISR_IMC_AK Date: Sun, 9 Jul 2023 19:29:18 +0100 Message-Id: <20230709182934.309468-67-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927967787100003 This implements the AES64DSM instruction. This was the last use of aes64_operation and its support macros, so remove them all. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 101 ++++------------------------------- 1 file changed, 10 insertions(+), 91 deletions(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index c036fe8632..99d85a6188 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -104,98 +104,8 @@ target_ulong HELPER(aes32dsi)(target_ulong rs1, target= _ulong rs2, return aes32_operation(shamt, rs1, rs2, false, false); } =20 -#define BY(X, I) ((X >> (8 * I)) & 0xFF) - -#define AES_SHIFROWS_LO(RS1, RS2) ( \ - (((RS1 >> 24) & 0xFF) << 56) | (((RS2 >> 48) & 0xFF) << 48) | \ - (((RS2 >> 8) & 0xFF) << 40) | (((RS1 >> 32) & 0xFF) << 32) | \ - (((RS2 >> 56) & 0xFF) << 24) | (((RS2 >> 16) & 0xFF) << 16) | \ - (((RS1 >> 40) & 0xFF) << 8) | (((RS1 >> 0) & 0xFF) << 0)) - -#define AES_INVSHIFROWS_LO(RS1, RS2) ( \ - (((RS2 >> 24) & 0xFF) << 56) | (((RS2 >> 48) & 0xFF) << 48) | \ - (((RS1 >> 8) & 0xFF) << 40) | (((RS1 >> 32) & 0xFF) << 32) | \ - (((RS1 >> 56) & 0xFF) << 24) | (((RS2 >> 16) & 0xFF) << 16) | \ - (((RS2 >> 40) & 0xFF) << 8) | (((RS1 >> 0) & 0xFF) << 0)) - -#define AES_MIXBYTE(COL, B0, B1, B2, B3) ( \ - BY(COL, B3) ^ BY(COL, B2) ^ AES_GFMUL(BY(COL, B1), 3) ^ \ - AES_GFMUL(BY(COL, B0), 2)) - -#define AES_MIXCOLUMN(COL) ( \ - AES_MIXBYTE(COL, 3, 0, 1, 2) << 24 | \ - AES_MIXBYTE(COL, 2, 3, 0, 1) << 16 | \ - AES_MIXBYTE(COL, 1, 2, 3, 0) << 8 | AES_MIXBYTE(COL, 0, 1, 2, 3) << 0) - -#define AES_INVMIXBYTE(COL, B0, B1, B2, B3) ( \ - AES_GFMUL(BY(COL, B3), 0x9) ^ AES_GFMUL(BY(COL, B2), 0xd) ^ \ - AES_GFMUL(BY(COL, B1), 0xb) ^ AES_GFMUL(BY(COL, B0), 0xe)) - -#define AES_INVMIXCOLUMN(COL) ( \ - AES_INVMIXBYTE(COL, 3, 0, 1, 2) << 24 | \ - AES_INVMIXBYTE(COL, 2, 3, 0, 1) << 16 | \ - AES_INVMIXBYTE(COL, 1, 2, 3, 0) << 8 | \ - AES_INVMIXBYTE(COL, 0, 1, 2, 3) << 0) - static const AESState aes_zero =3D { }; =20 -static inline target_ulong aes64_operation(target_ulong rs1, target_ulong = rs2, - bool enc, bool mix) -{ - uint64_t RS1 =3D rs1; - uint64_t RS2 =3D rs2; - uint64_t result; - uint64_t temp; - uint32_t col_0; - uint32_t col_1; - - if (enc) { - temp =3D AES_SHIFROWS_LO(RS1, RS2); - temp =3D (((uint64_t)AES_sbox[(temp >> 0) & 0xFF] << 0) | - ((uint64_t)AES_sbox[(temp >> 8) & 0xFF] << 8) | - ((uint64_t)AES_sbox[(temp >> 16) & 0xFF] << 16) | - ((uint64_t)AES_sbox[(temp >> 24) & 0xFF] << 24) | - ((uint64_t)AES_sbox[(temp >> 32) & 0xFF] << 32) | - ((uint64_t)AES_sbox[(temp >> 40) & 0xFF] << 40) | - ((uint64_t)AES_sbox[(temp >> 48) & 0xFF] << 48) | - ((uint64_t)AES_sbox[(temp >> 56) & 0xFF] << 56)); - if (mix) { - col_0 =3D temp & 0xFFFFFFFF; - col_1 =3D temp >> 32; - - col_0 =3D AES_MIXCOLUMN(col_0); - col_1 =3D AES_MIXCOLUMN(col_1); - - result =3D ((uint64_t)col_1 << 32) | col_0; - } else { - result =3D temp; - } - } else { - temp =3D AES_INVSHIFROWS_LO(RS1, RS2); - temp =3D (((uint64_t)AES_isbox[(temp >> 0) & 0xFF] << 0) | - ((uint64_t)AES_isbox[(temp >> 8) & 0xFF] << 8) | - ((uint64_t)AES_isbox[(temp >> 16) & 0xFF] << 16) | - ((uint64_t)AES_isbox[(temp >> 24) & 0xFF] << 24) | - ((uint64_t)AES_isbox[(temp >> 32) & 0xFF] << 32) | - ((uint64_t)AES_isbox[(temp >> 40) & 0xFF] << 40) | - ((uint64_t)AES_isbox[(temp >> 48) & 0xFF] << 48) | - ((uint64_t)AES_isbox[(temp >> 56) & 0xFF] << 56)); - if (mix) { - col_0 =3D temp & 0xFFFFFFFF; - col_1 =3D temp >> 32; - - col_0 =3D AES_INVMIXCOLUMN(col_0); - col_1 =3D AES_INVMIXCOLUMN(col_1); - - result =3D ((uint64_t)col_1 << 32) | col_0; - } else { - result =3D temp; - } - } - - return result; -} - target_ulong HELPER(aes64esm)(target_ulong rs1, target_ulong rs2) { AESState t; @@ -228,7 +138,16 @@ target_ulong HELPER(aes64ds)(target_ulong rs1, target_= ulong rs2) =20 target_ulong HELPER(aes64dsm)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, false, true); + AESState t, z =3D { }; + + /* + * This instruction does not include a round key, + * so supply a zero to our primitive. + */ + t.d[HOST_BIG_ENDIAN] =3D rs1; + t.d[!HOST_BIG_ENDIAN] =3D rs2; + aesdec_ISB_ISR_IMC_AK(&t, &t, &z, false); + return t.d[HOST_BIG_ENDIAN]; } =20 target_ulong HELPER(aes64ks2)(target_ulong rs1, target_ulong rs2) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928156; cv=none; d=zohomail.com; s=zohoarc; b=UvOZxZtZiZBUB/3m+T52XtNIVYkBgHwvi+LP2Iyb/hCptGUiBVSc/f0ZN4usb6QuyeKwpcKk3QX34vX/M29bwQDcfV24qfyx8XjYjCSRnrIjwl/zgRIwpGul12KW7dc1hh6Tn2d6OFoS24lHn3sh37BYEAKNoSc9EuEdz3FxfLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928156; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=ObjpOt7fG17+rtmDoXwO3cTibIHgmr8mshsV1cqXirHG0dZ7X+9WndfE3FIE29FAlvfXuPxJZvDgJsHJVDakdrsIuQKPH+GAB8Gm70KyvYA+HezLPFWk0iYofYvrGA0UBqNFG6b77fRBriTFJ9M4FucLjzlWe67TF36QGR7ql1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928156487788.8345461271886; Sun, 9 Jul 2023 11:42:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZED-00052V-Fj; Sun, 09 Jul 2023 14:33:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE0-0003cP-7Y for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:38 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDy-0004HP-NF for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbfa811667so19655015e9.1 for ; Sun, 09 Jul 2023 11:33:34 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927613; x=1691519613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=Owl5H1sHBMbZEz/AJsmVnI8Pxc5Sm9o908wqmw5nqZScNiDYcJxe9LnazFZqnye1HZ Ri1jRZqald3TGzUARdgTKa2JFhFQ99phScy/YkT9aEzWro11pth83nhsGgy5fyQGVOAt Azq1X5Yo/ZBCGYiTr5BB/mzcozPxz263OS1lS/0BBmA3SfoygfyDWtjFVZKRgwzQNOlF hR0SIaCbLlH58CiCQhxI//QuIiOYSNsz49bHmV3dRqE46rs4SaaAgywJd8UV83V8sfy4 aon6FBX8G6Y20RCWC2JDUIDiHbTZzv9gICKjzO0cF+MJ371hOJPazmFnfU0D2bwg5rnZ 0JUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927613; x=1691519613; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QRxmyw2NI294w3E1OCW/a4A3Z0jUfk7Gsk9X8Q/8iho=; b=Ga7kKIPWMmLksG7lx86Ufj6KuzWrLTQUu6FzZEqCnC6GXNhJ9bYso96RysKxlZKYvn Khr0PeKcdDs0mAaAKTrL2Hcft+zVsoE82iai8qyb8j5BnZGGAuv6z7c6IYrBJ8aGvbtz pXFg3jATXEu2kNSP9G2Qw5uC7CaunyWWR9cdgSvfL/v3OH0AnzXcfkSzQ+uEKxS+/yDN o6msye9dcjhk6Y5grYPJ9YaxuTFgWiC4hn1Kk0XGy1yx/fLiZbXcpGyHfADjplI07UcE 7KSc17e91lPGl0Leq7dnNmXETas0z0zp8vGI1Y44D4kZ7de6m4uq505EkOLw2M/pbnIb K+CA== X-Gm-Message-State: ABy/qLbZq3KuBu5CpHky1AwKoaT3+A0ERmP+74LrvAEwrWlnM3q8yJc9 ifEOsdLMEwKbFS3V2uyMlvU/otu4vlzY/OhMNAHZ+w== X-Google-Smtp-Source: APBJJlHl5iMaGkAe2NImhnaCjOYXzcVWZct54sc7siFRofZ3y1wcZHUdfwWmCd/NjJzYfxA2RZRqFA== X-Received: by 2002:adf:e4cb:0:b0:313:e88d:e6d3 with SMTP id v11-20020adfe4cb000000b00313e88de6d3mr13286461wrm.14.1688927613516; Sun, 09 Jul 2023 11:33:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Warner Losh , Kyle Evans Subject: [PATCH 34/45] bsd-user: Use page_find_range_empty for mmap_find_vma_reserved Date: Sun, 9 Jul 2023 19:29:19 +0100 Message-Id: <20230709182934.309468-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928157642100007 Content-Type: text/plain; charset="utf-8" Use the interval tree to find empty space, rather than probing each page in turn. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson Reviewed-bt: Warner Losh Message-Id: <20230707204054.8792-18-richard.henderson@linaro.org> --- bsd-user/mmap.c | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 07b5b8055e..aca8764356 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -222,50 +222,16 @@ unsigned long last_brk; static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong alignment) { - abi_ulong addr; - abi_ulong end_addr; - int prot; - int looped =3D 0; + abi_ulong ret; =20 - if (size > reserved_va) { - return (abi_ulong)-1; + ret =3D page_find_range_empty(start, reserved_va, size, alignment); + if (ret =3D=3D -1 && start > TARGET_PAGE_SIZE) { + /* Restart at the beginning of the address space. */ + ret =3D page_find_range_empty(TARGET_PAGE_SIZE, start - 1, + size, alignment); } =20 - size =3D HOST_PAGE_ALIGN(size) + alignment; - end_addr =3D start + size; - if (end_addr > reserved_va) { - end_addr =3D reserved_va + 1; - } - addr =3D end_addr - qemu_host_page_size; - - while (1) { - if (addr > end_addr) { - if (looped) { - return (abi_ulong)-1; - } - end_addr =3D reserved_va + 1; - addr =3D end_addr - qemu_host_page_size; - looped =3D 1; - continue; - } - prot =3D page_get_flags(addr); - if (prot) { - end_addr =3D addr; - } - if (end_addr - addr >=3D size) { - break; - } - addr -=3D qemu_host_page_size; - } - - if (start =3D=3D mmap_next_start) { - mmap_next_start =3D addr; - } - /* addr is sufficiently low to align it up */ - if (alignment !=3D 0) { - addr =3D (addr + alignment) & ~(alignment - 1); - } - return addr; + return ret; } =20 /* --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927873; cv=none; d=zohomail.com; s=zohoarc; b=KOSg3r2mt6Ry+h3Ydr9Ebg0eRcTs7nA5S1ILmvXTGPK/564m1x15M0JRd2ZyDGivo7I21+TwA6/xlNWAu4dZr+uJasGrGyDzcuqyG8IRx5HS7/K4Yl3jLQeUiw63nnB0Q/FvBnCCBAalqjsa9I51b4VEbps7S0r01nSPhSzxG/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927873; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LO6Chl8aQYLOaHq+kw102b8WCIYofNouZUqxF+V9shk=; b=XXAIqXm12uTA5wSTK7Iheo6IBmoMU3L54UCGUjQEQDpGCvm3NYNWgPEoQ2NempHtbK55gvy7Ajlhtp40M1gAg/PabEwlreYqPWlq9JPq9gCO2duBttQRRwe+TVktBs5NGywXvqfUuEotcrpjBTSjR+FtrObu1UOzO13UcrTUyeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927873515998.4569265576107; Sun, 9 Jul 2023 11:37:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004ak-EA; Sun, 09 Jul 2023 14:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE1-0003fr-9s for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:38 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDz-0004Hn-Mu for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:37 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-313fb7f0f80so3705621f8f.2 for ; Sun, 09 Jul 2023 11:33:35 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927614; x=1691519614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LO6Chl8aQYLOaHq+kw102b8WCIYofNouZUqxF+V9shk=; b=YUquXa/bAZ/dDSgopJMyVJK4PI5dw/yTfgXIQr7FcTnqAXPegY+ZqIUMXVXi1NumoK wBoVhjMxCesXNJ2iUhBQbvECh73CY3U1P4gc8Dw79xBboDIE9ZBiDqyAqZ+3NZbVnQMz JzCqGcK2/0WAdTeGfRb1CQ2SjFjSlmSQjbXMb9iXbx7rCWnlxYiwYODOHWG8qRcIF0wm JtWFDCI7ke0G5UmDKShKkkv+JZcia2sZrMBhNALBvN4w10OCqhD2o+pQjFevNqK7F0Ab KeiR33tg5WNvVgi/ezf10PPm39bsZX/9PmJugMnHzZluhdP8pUbdwsV5hzJz/DiJV26j y/7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927614; x=1691519614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LO6Chl8aQYLOaHq+kw102b8WCIYofNouZUqxF+V9shk=; b=dO1rKYlppjmzO3D0wnHHXAWDJ/ohAWVG/0F8vSVx3IeSXiTdgftSkJLo0odwOkYXSn x3DmN5y3aO58EGuSjir13cdWIExM+1jDXMrV4l7Ujubg3QySVUn01JniqYX+UaVQaZ8H Yi6/F0zu9847cuJ1Y9LmSW0L8p5FE964dVHIkzKgOdpIN39DlNZ3KtETNH31jreDaiy6 Z8LkaZmgumEHdkRt00RilRboKxJvBffcVzF8m6AC8u2ecZiTt1mbw8qByThSfokoLjiA uz6kA1kps21V4jHC6UERsOp4JIecsrvnWJ5N0GX2mM27x0Iij1FMfeb/sqw+CsJRivKT /WZA== X-Gm-Message-State: ABy/qLaaqYveHH9eMdLHSiDgkL0aCjHKFSUxeszNqNei3HGtUdBiLnv5 wxUkOYbrogy5pct07oSUSP44PDAtTd//mUhP3TFMoQ== X-Google-Smtp-Source: APBJJlFPPPAbjvXgjiD/LU1+OqRWDnjqsd3ZyPh45leyHL/RazZvVaU7Rv/VhGe+dFUUApxIJKbK1Q== X-Received: by 2002:a5d:528e:0:b0:30f:ca58:a00d with SMTP id c14-20020a5d528e000000b0030fca58a00dmr7873346wrv.45.1688927614386; Sun, 09 Jul 2023 11:33:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 34/37] crypto: Remove AES_shifts, AES_ishifts Date: Sun, 9 Jul 2023 19:29:20 +0100 Message-Id: <20230709182934.309468-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927874571100001 These arrays are no longer used, replaced by AES_SH_*, AES_ISH_*. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/crypto/aes.h | 4 ---- crypto/aes.c | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/include/crypto/aes.h b/include/crypto/aes.h index 24b073d569..aa8b54065d 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -30,10 +30,6 @@ void AES_decrypt(const unsigned char *in, unsigned char = *out, extern const uint8_t AES_sbox[256]; extern const uint8_t AES_isbox[256]; =20 -/* AES ShiftRows and InvShiftRows */ -extern const uint8_t AES_shifts[16]; -extern const uint8_t AES_ishifts[16]; - /* AES MixColumns, for use with rot32. */ extern const uint32_t AES_mc_rot[256]; =20 diff --git a/crypto/aes.c b/crypto/aes.c index c765f11c1e..00e16d3f92 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -114,23 +114,9 @@ const uint8_t AES_isbox[256] =3D { /* AES ShiftRows, for complete unrolling. */ #define AES_SH(X) (((X) * 5) & 15) =20 -const uint8_t AES_shifts[16] =3D { - AES_SH(0x0), AES_SH(0x1), AES_SH(0x2), AES_SH(0x3), - AES_SH(0x4), AES_SH(0x5), AES_SH(0x6), AES_SH(0x7), - AES_SH(0x8), AES_SH(0x9), AES_SH(0xA), AES_SH(0xB), - AES_SH(0xC), AES_SH(0xD), AES_SH(0xE), AES_SH(0xF), -}; - /* AES InvShiftRows, for complete unrolling. */ #define AES_ISH(X) (((X) * 13) & 15) =20 -const uint8_t AES_ishifts[16] =3D { - AES_ISH(0x0), AES_ISH(0x1), AES_ISH(0x2), AES_ISH(0x3), - AES_ISH(0x4), AES_ISH(0x5), AES_ISH(0x6), AES_ISH(0x7), - AES_ISH(0x8), AES_ISH(0x9), AES_ISH(0xA), AES_ISH(0xB), - AES_ISH(0xC), AES_ISH(0xD), AES_ISH(0xE), AES_ISH(0xF), -}; - /* * MixColumns lookup table, for use with rot32. */ --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928168; cv=none; d=zohomail.com; s=zohoarc; b=iDpfN//zWoeKD7UgiEqxYApaozA25BuGnERbiUwe9wFUfOIdO6oZFiSRkXUz5ORZqx0179WQzKMY1zgmnMR8U9+fqIEuwVFiyViu5E9DltnsZD3gJmlxYOFKZgG+Zq3E2+7bR9HpkZdFBdej/f5WxWwTwR7YyRgRYfUy6ZP+kU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928168; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=EmmECgdZCaQtne4jHdvVaMMuqB530KHGd5gHkiXwhTA9PodCzIIZqSxXDmpizVenHTOtZLBiXiKtqLAQS8itCaq/Ya/7EF7Xztj8XJbleOWYPPWCaUGt2ZucVMD6ZE+HVfMyX24oOeZuU2Cdj3L1IJhEStnkL6Nh5GrQ3smJhwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928168681646.85720699094; Sun, 9 Jul 2023 11:42:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEE-0005Cf-FL; Sun, 09 Jul 2023 14:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE2-0003on-UR for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:39 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE1-0004IG-AW for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:38 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31427ddd3fbso3834985f8f.0 for ; Sun, 09 Jul 2023 11:33:36 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927616; x=1691519616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=eb82pVZK0qXY2jf957nkIICog1cf/S3GbH4wZXYGvKqx+3bwq3ywxeMG0GIruaw+sD LeHv3Ybddcgx/EFHb/6e7f1C8a0IvqCtWUl5ezTGJnX7Q2YyIlbNzqDwqZz1n3HRQBFU 4RbSSVKX3A+80lEeGxzZYIc9JGu96lSWt3MkZ83MZLm76ItERgz6MakhPD59fXWI0uv2 UiOAi4YgwsmekL9+IocbKi3itOAJOIDnjJkRpoPpIQGd7pDCjx49Tk7vnDHQY0Ifcyel fDsxpjLGRaJxoTpssVy7V/PR3Ys3PekYtytbTml0RPDPvd0ysfPaitGA8ZGm6huRG0XE KLoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927616; x=1691519616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5+vFU351RDeVAwRNg/WDopVOnzTmK+ZtjZmF1Bh7abU=; b=Jjpicz6+1YoxABuOOFhRPROz1FzvKMvNbK2xamAvqORjbmarL6jObevFikk/qvjQfv zEv6689ux4g9L4PbfQRs8mTeSDMkkUD9MfkMLdQ3fPAEITPRFvLh2k5xtQBca8zBpDb8 4bocrvLxj0h3j6Q78f3Hcm88lyA/EhxjwEvxMGm28w6cNTBT1JDHcec5pjlINxaKQ+IC vhOCgDQ6yo/NmNCt4xL+3grZ1ehkhenXarymCAQP1g159wJqzt8zFMN82Vq6SgVn6kBv WwYl7fYuGaPzYlB//BBQAoLgOahtK0fwgAQ3NDjPjEA6bllqLBaW/XkbzRvocC/i6M1l NT3Q== X-Gm-Message-State: ABy/qLaf3A0dKV1GZSuZKeXKD+yroYHfYPVLo9TVus3g0zSpdqWvHaC4 0O/zYSGMKMSnzPmZo6NdAYXbSMyfK169kosSIOkxAg== X-Google-Smtp-Source: APBJJlEuLkh2ziXjccOAscHh+uflx3coNsy1c7I/1Nj0QQfaQf67/TcoJ4SGpaZcgxjm/90hO44nMA== X-Received: by 2002:a05:6000:1b86:b0:314:34dd:aaec with SMTP id r6-20020a0560001b8600b0031434ddaaecmr9477319wru.8.1688927616087; Sun, 09 Jul 2023 11:33:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 35/45] linux-user: Use page_find_range_empty for mmap_find_vma_reserved Date: Sun, 9 Jul 2023 19:29:22 +0100 Message-Id: <20230709182934.309468-71-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928169550100005 Content-Type: text/plain; charset="utf-8" Use the interval tree to find empty space, rather than probing each page in turn. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-19-richard.henderson@linaro.org> --- linux-user/mmap.c | 52 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c4b2515271..738b9b797d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -318,55 +318,15 @@ unsigned long last_brk; static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size, abi_ulong align) { - abi_ulong addr, end_addr, incr =3D qemu_host_page_size; - int prot; - bool looped =3D false; + target_ulong ret; =20 - if (size > reserved_va) { - return (abi_ulong)-1; + ret =3D page_find_range_empty(start, reserved_va, size, align); + if (ret =3D=3D -1 && start > mmap_min_addr) { + /* Restart at the beginning of the address space. */ + ret =3D page_find_range_empty(mmap_min_addr, start - 1, size, alig= n); } =20 - /* Note that start and size have already been aligned by mmap_find_vma= . */ - - end_addr =3D start + size; - /* - * Start at the top of the address space, ignoring the last page. - * If reserved_va =3D=3D UINT32_MAX, then end_addr wraps to 0, - * throwing the rest of the calculations off. - * TODO: rewrite using last_addr instead. - * TODO: use the interval tree instead of probing every page. - */ - if (start > reserved_va - size) { - end_addr =3D ((reserved_va - size) & -align) + size; - looped =3D true; - } - - /* Search downward from END_ADDR, checking to see if a page is in use.= */ - addr =3D end_addr; - while (1) { - addr -=3D incr; - if (addr > end_addr) { - if (looped) { - /* Failure. The entire address space has been searched. = */ - return (abi_ulong)-1; - } - /* Re-start at the top of the address space (see above). */ - addr =3D end_addr =3D ((reserved_va - size) & -align) + size; - looped =3D true; - } else { - prot =3D page_get_flags(addr); - if (prot) { - /* Page in use. Restart below this page. */ - addr =3D end_addr =3D ((addr - size) & -align) + size; - } else if (addr && addr + size =3D=3D end_addr) { - /* Success! All pages between ADDR and END_ADDR are free.= */ - if (start =3D=3D mmap_next_start) { - mmap_next_start =3D addr; - } - return addr; - } - } - } + return ret; } =20 /* --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928271; cv=none; d=zohomail.com; s=zohoarc; b=UABPb4Z4Eiwa4nHM3PjqbkbtE1RvZzIrw4bOTRQ5+3vHiqXajtosYpDqGZWAO5bV2gQ4LQ653XUg1JhWHVHGYF8qBmLOjbq5xzXQFRwSJIDOe078Uq8LxCQgb1LWeJG4bmWYF/qU37Ho/z7v4CrkPJYiGUE6nbtbnPtOgmOa3L0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928271; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KoRRyATrWAHPOTZCqqegjuftHV3UOSCP+hcOlJjHRIM=; b=auIg7sjc9vTcVTwnsTJQmcysyI1UjeQSFObT86AboNjTJHiEgMQ/R58C2QCiASUtDwfb2yD0dJenfNlavzRtmdyV4NFQcoHKgJq1z/9oFhDmg66CGUIAuNNCcU5foiXg2msdDktJAQTt7cVfiuVkE+KO6MGCo+Vv4RMzMcEGy74= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928271140967.2246823926032; Sun, 9 Jul 2023 11:44:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEM-0005pX-As; Sun, 09 Jul 2023 14:33:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE2-0003gl-8d for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:38 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE0-0004I1-Ip for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:37 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fbf1b82d9cso39263965e9.2 for ; Sun, 09 Jul 2023 11:33:36 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927615; x=1691519615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KoRRyATrWAHPOTZCqqegjuftHV3UOSCP+hcOlJjHRIM=; b=jYEt8ghh2tTy4YfzkHOmJk71IGprWwIzM/TcJt4Wdps2hJpwjzQomwm0ecLfWq5Z1I k7W+XJPPXBwigCehQ4K5wRiNR6/lnR8khleqGuHqgxnFeN4nQF94HEmH88YZ8wOmz394 Lbd8cuuC7P1DAp7NEyNkSQApQ6H3W727Wwa7DEw3NH5secY6saadfk4FprUlznOwX2kI 6OVDQAhUVLBgKa/xNys1gVvAxiZjS/UOEXg6mFwShky3Q3rQ4AjNZc0/6w7fYUPUFp4L 74JuTQdv2mxOeu09HjOrCSScIKaNa1v/SWaKq3ciZ9dGjrB1wIW4EjyBI/7SjL8bUgyE aUbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927615; x=1691519615; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KoRRyATrWAHPOTZCqqegjuftHV3UOSCP+hcOlJjHRIM=; b=SDcavctPlo9A8ibskGv1fXm1a2qPdcLK1I70+IyjdFUjEAQeaALg1Du3B8Al89qyXM SiXSMHtfrnsa5rwg7O6g4dBguIwBFsXEdVf4Tgspu5pqsy8tzfUTGcxUC4JfGrcj0J/n 0TKktX7DHEq+88cuvnbAQv67rrePNRqVnn5yL0i2fL1s1n3u6UxfIX6KtIhBrv3iiHNF AYJxAKep2pWBhO6cct5QCVwjv7rP6Hty4SHrFzzM+jAUJ8dbgVEp51Vw7YD1dVOYoNpo ZRV4gHVipX+LLVOazpTocwKqi9NWMdg3Y+rT33xIVVHNUIuv9oPRZDhF8AkiSuFV4TfD 89kg== X-Gm-Message-State: ABy/qLaGgR4//CSxUOSBtEurv5iyGjl6xpQI8O0B1QCZczwrmUrBxMN7 S0/E3Jn8244elT4V84+tCjsqDNyZXDH6qN+a+Cu8nA== X-Google-Smtp-Source: APBJJlHYUTCcMCk7gddeZJQ71aEofGK4yWWFeRznOKzkPPRZ8XtU/8ohpnCkJqzo7FpaJw4cmRJaYw== X-Received: by 2002:a1c:7514:0:b0:3fc:173:b670 with SMTP id o20-20020a1c7514000000b003fc0173b670mr5082965wmc.41.1688927615347; Sun, 09 Jul 2023 11:33:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 35/37] crypto: Implement aesdec_IMC with AES_imc_rot Date: Sun, 9 Jul 2023 19:29:21 +0100 Message-Id: <20230709182934.309468-70-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928272073100013 This method uses one uint32_t * 256 table instead of 4, which means its data cache overhead is less. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- crypto/aes.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/crypto/aes.c b/crypto/aes.c index 00e16d3f92..d93883eb18 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1377,39 +1377,39 @@ aesdec_IMC_swap(AESState *r, const AESState *st, bo= ol swap) bool be =3D HOST_BIG_ENDIAN ^ swap; uint32_t t; =20 - /* Note that AES_imc is encoded for big-endian. */ - t =3D (AES_imc[st->b[swap_b ^ 0x0]][0] ^ - AES_imc[st->b[swap_b ^ 0x1]][1] ^ - AES_imc[st->b[swap_b ^ 0x2]][2] ^ - AES_imc[st->b[swap_b ^ 0x3]][3]); - if (!be) { + /* Note that AES_imc_rot is encoded for little-endian. */ + t =3D ( AES_imc_rot[st->b[swap_b ^ 0x0]] ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x1]], 8) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x2]], 16) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x3]], 24)); + if (be) { t =3D bswap32(t); } r->w[swap_w ^ 0] =3D t; =20 - t =3D (AES_imc[st->b[swap_b ^ 0x4]][0] ^ - AES_imc[st->b[swap_b ^ 0x5]][1] ^ - AES_imc[st->b[swap_b ^ 0x6]][2] ^ - AES_imc[st->b[swap_b ^ 0x7]][3]); - if (!be) { + t =3D ( AES_imc_rot[st->b[swap_b ^ 0x4]] ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x5]], 8) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x6]], 16) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x7]], 24)); + if (be) { t =3D bswap32(t); } r->w[swap_w ^ 1] =3D t; =20 - t =3D (AES_imc[st->b[swap_b ^ 0x8]][0] ^ - AES_imc[st->b[swap_b ^ 0x9]][1] ^ - AES_imc[st->b[swap_b ^ 0xA]][2] ^ - AES_imc[st->b[swap_b ^ 0xB]][3]); - if (!be) { + t =3D ( AES_imc_rot[st->b[swap_b ^ 0x8]] ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0x9]], 8) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0xA]], 16) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0xB]], 24)); + if (be) { t =3D bswap32(t); } r->w[swap_w ^ 2] =3D t; =20 - t =3D (AES_imc[st->b[swap_b ^ 0xC]][0] ^ - AES_imc[st->b[swap_b ^ 0xD]][1] ^ - AES_imc[st->b[swap_b ^ 0xE]][2] ^ - AES_imc[st->b[swap_b ^ 0xF]][3]); - if (!be) { + t =3D ( AES_imc_rot[st->b[swap_b ^ 0xC]] ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0xD]], 8) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0xE]], 16) ^ + rol32(AES_imc_rot[st->b[swap_b ^ 0xF]], 24)); + if (be) { t =3D bswap32(t); } r->w[swap_w ^ 3] =3D t; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927924; cv=none; d=zohomail.com; s=zohoarc; b=dctxX07jDO0jdKzumGfb/etD9L3eT5SE/zuPyUpajoIzahiArmgkIiKSffyj1qMBthA+PXbZd/Dcf5Z3z+w2OEFin71IniulHg9sSX2mW7FG6OD44YnDsSUPntSFHAc5KHQU6xXB4q9ocOqIw0vucre6MH13bhn9gCRLyjMft7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927924; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=IOeYDsp5f0qifASV+Jop/qFcBg6kKxoFiRono0mNKL9GLaAl1HPQYYsGOSXeqChSvzcfmdiH5CCJ8PwIj7qNQxr9PiyftCUxtWUYo3l7VbxlqaDmVzLUCP4FoQqJxkfCbT5kv4vcucMvm4ixstUlwnB6OFOTWv5WmrW87alpkWA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927924915857.5069049544937; Sun, 9 Jul 2023 11:38:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEC-0004ms-09; Sun, 09 Jul 2023 14:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE8-0004KA-1u for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:44 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE3-0004Iz-85 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:40 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3128fcd58f3so4042883f8f.1 for ; Sun, 09 Jul 2023 11:33:38 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927618; x=1691519618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=Iu769+CeDmbhxeaP4f3c/BUQzMW00to6eQPH8l9S4Twt9ml4jNywDOIozg16e/cLuj Y3gdayKKPxma+e1VR2wileGpd3hvnI3CfJ/9DLff9lKI4RqfEeJN26+QXnGmDM27ZXw2 S5/Ho/+5Hcrf/bZ9BZvfhdh7pYXPRhf15NAFjwYvbDvKM+BW64HZ3fY3MVhsf3tJstOH b5NDev7Rog5h/QEcxgFn9Z0Gtc3x0r/HDs2L565wle4XFLOKZSNPPT4++0k8fYJuIrrh 2guCMO283HZ/eYb+OQwodWXdRmAXOqevFVJp49tC8ph6hRIV2E5gq39Y7cvtlt9S6cyg uM5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927618; x=1691519618; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jfvLV6T2p9fP56/v/Xia6iQ7yK2dQ6zBkNiykDOKhfw=; b=kil+BwgTdJViItSq0KorjLGF0t4d9Kf9wkSY3SH2hbPxKzQLMvvOL3zqkGwcP1RCgT Z9ZxVeZLAxfWorLXW20h0uZc5Ys/16p8BLNJw2Dgh4OBRTkUsmOXoVt7iV4DV57DpBHv CZIMu/rxMOBRhZIa87q2aVde+EAfQRGempa/OdoqiE5n/7hp//Rr25t47qd8AzAlqJcF +peylS+FrH4hH0/c5TYOQLYH6vEUYIxU4uhG+Af2WuonrAy1BmIcVGhVhaWRfHvcg012 eb6BMdtsvnV5Hvn1V5K+uv4ZKiGD1Imcd7iAx/csCdyyjxSmWm6yBWnbwmoqsACCMS4u ajaA== X-Gm-Message-State: ABy/qLaKyT7RSxORhzwlXYdJjCzoMnv9mjTcri2JMrVlifJsXqG3CpXH i00xPwUxjClI1k/VWzudnZI3ttqnx+0tPvmmS5Ly0A== X-Google-Smtp-Source: APBJJlG5f59GrLEkDZPzq0oKmGX1P0Qu9yH8iQa2fQLSveoP3Sf4h5anCgRMrF/9/Nk8h0EGHcHWMg== X-Received: by 2002:adf:ed05:0:b0:313:f0d7:a43 with SMTP id a5-20020adfed05000000b00313f0d70a43mr9922790wro.23.1688927617982; Sun, 09 Jul 2023 11:33:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 36/45] linux-user: Use 'last' instead of 'end' in target_mmap Date: Sun, 9 Jul 2023 19:29:24 +0100 Message-Id: <20230709182934.309468-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927925687100003 Complete the transition within the mmap functions to a formulation that does not overflow at the end of the address space. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230707204054.8792-20-richard.henderson@linaro.org> --- linux-user/mmap.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 738b9b797d..bb9cbe52cd 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -456,8 +456,8 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size= , abi_ulong align) abi_long target_mmap(abi_ulong start, abi_ulong len, int target_prot, int flags, int fd, off_t offset) { - abi_ulong ret, end, real_start, real_end, retaddr, host_len, - passthrough_start =3D -1, passthrough_end =3D -1; + abi_ulong ret, last, real_start, real_last, retaddr, host_len; + abi_ulong passthrough_start =3D -1, passthrough_last =3D 0; int page_flags; off_t host_offset; =20 @@ -581,29 +581,30 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, host_start +=3D offset - host_offset; } start =3D h2g(host_start); + last =3D start + len - 1; passthrough_start =3D start; - passthrough_end =3D start + len; + passthrough_last =3D last; } else { if (start & ~TARGET_PAGE_MASK) { errno =3D EINVAL; goto fail; } - end =3D start + len; - real_end =3D HOST_PAGE_ALIGN(end); + last =3D start + len - 1; + real_last =3D HOST_PAGE_ALIGN(last) - 1; =20 /* * Test if requested memory area fits target address space * It can fail only on 64-bit host with 32-bit target. * On any other target/host host mmap() handles this error correct= ly. */ - if (end < start || !guest_range_valid_untagged(start, len)) { + if (last < start || !guest_range_valid_untagged(start, len)) { errno =3D ENOMEM; goto fail; } =20 /* Validate that the chosen range is empty. */ if ((flags & MAP_FIXED_NOREPLACE) - && !page_check_range_empty(start, end - 1)) { + && !page_check_range_empty(start, last)) { errno =3D EEXIST; goto fail; } @@ -642,9 +643,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, in= t target_prot, =20 /* handle the start of the mapping */ if (start > real_start) { - if (real_end =3D=3D real_start + qemu_host_page_size) { + if (real_last =3D=3D real_start + qemu_host_page_size - 1) { /* one single host page */ - if (!mmap_frag(real_start, start, end - 1, + if (!mmap_frag(real_start, start, last, target_prot, flags, fd, offset)) { goto fail; } @@ -658,18 +659,18 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, real_start +=3D qemu_host_page_size; } /* handle the end of the mapping */ - if (end < real_end) { - if (!mmap_frag(real_end - qemu_host_page_size, - real_end - qemu_host_page_size, end - 1, + if (last < real_last) { + abi_ulong real_page =3D real_last - qemu_host_page_size + 1; + if (!mmap_frag(real_page, real_page, last, target_prot, flags, fd, - offset + real_end - qemu_host_page_size - start= )) { + offset + real_page - start)) { goto fail; } - real_end -=3D qemu_host_page_size; + real_last -=3D qemu_host_page_size; } =20 /* map the middle (easier) */ - if (real_start < real_end) { + if (real_start < real_last) { void *p; off_t offset1; =20 @@ -678,13 +679,13 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, } else { offset1 =3D offset + real_start - start; } - p =3D mmap(g2h_untagged(real_start), real_end - real_start, + p =3D mmap(g2h_untagged(real_start), real_last - real_start + = 1, target_to_host_prot(target_prot), flags, fd, offset1); if (p =3D=3D MAP_FAILED) { goto fail; } passthrough_start =3D real_start; - passthrough_end =3D real_end; + passthrough_last =3D real_last; } } the_end1: @@ -692,16 +693,16 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, = int target_prot, page_flags |=3D PAGE_ANON; } page_flags |=3D PAGE_RESET; - if (passthrough_start =3D=3D passthrough_end) { - page_set_flags(start, start + len - 1, page_flags); + if (passthrough_start > passthrough_last) { + page_set_flags(start, last, page_flags); } else { if (start < passthrough_start) { page_set_flags(start, passthrough_start - 1, page_flags); } - page_set_flags(passthrough_start, passthrough_end - 1, + page_set_flags(passthrough_start, passthrough_last, page_flags | PAGE_PASSTHROUGH); - if (passthrough_end < start + len) { - page_set_flags(passthrough_end, start + len - 1, page_flags); + if (passthrough_last < last) { + page_set_flags(passthrough_last + 1, last, page_flags); } } the_end: --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928342; cv=none; d=zohomail.com; s=zohoarc; b=JeJUXV4v6YWSN5DXv76lFtijCzXxJrRn36h42cqCXDqDsT4mHhNcRYrzaWCJQAm+o9NqykQ9L4uvlxI34wJ1rf/2922BPQkWT0oPxC4kR4d3sWKBBX2mYW/d5gWQDrNH2O+E0pjjHIB0X8sYaqiGJCxn6HKCW6oceK+v+ycBVVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928342; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QDJWgUvS8Zs4L2lTferPtp1fyLNTd5LXy05o4rblG4c=; b=k49OY8+mMDDdhqOu2G8+32cyDLGLEtModzNuv0S2kvSdp0F9nBLjWIupuhYbbC8QfD1dzYYMehTZzHnyHU/P3Q1jmIYZ+a/QO9HQp6Iv3W0AyueFnDxz60E7iW8CFD5dOCHbqxua4ZNIznaHVYKIcLhSWit0OhFUCIE9nJDPcP0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928342566943.5368867645378; Sun, 9 Jul 2023 11:45:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZER-0005xF-3a; Sun, 09 Jul 2023 14:34:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE8-0004KC-1u for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:44 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE2-0004Ik-FG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:41 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3fbc244d384so38098425e9.0 for ; Sun, 09 Jul 2023 11:33:38 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927617; x=1691519617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QDJWgUvS8Zs4L2lTferPtp1fyLNTd5LXy05o4rblG4c=; b=nfnZzEqQhxKRajrInbuCPgGff+WI/c67A5hJcW+3C6JOLO1460HZVgsxQ/KaDimrjp 8BO45wJzpgyNOz70O0LXOHqniigEwLb0uI3udFyiWIz1W3VjjhDKrVACyADgI51alFCy J/ggCLK6zHlZ4oWdpapU5GSgSatBUo74i4fXjTAQkUqPwkFKghXHpJ/WDw4IPwIDilAf A86jUpWWjNQ09mOi5/GXqPtaBiz/Xza+tumSK7Dox8sY/WNsGkD4uNmNPEI1Wa4TpiZ2 BsEnIHaUh28gnlAsJaMmfHkdDU27i06S/2SffBSSydGQWoNnWTAwMv85YcvxocO3/Bj6 2ZrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927617; x=1691519617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QDJWgUvS8Zs4L2lTferPtp1fyLNTd5LXy05o4rblG4c=; b=AJ8cY3dNf0kMHibIKHW9pCXfulPMvcAuaNMr0GhJzMQMT0AbUEcIGOpEwFniX81OVw xQcHqLj0Ic7O7EeDTiTN1m/uv1m6NirCAXGXtL/36Z/Bzt0c+eA3sXvQ5XwICanwbTo7 /V0jlZkvrt9yrfaq/BgqmyVe8nJHiUzvB+x5aE384GJZOnaeUNjlpDSiJQczv2N+u7R7 xb7W4qWIR2qdtW1NC/ej+nG098j46lN2EXRt3SNgmSaRnyZpG3YMviD2EF5XCyiAv4nu MB6A6uOLAj7v8LRf2n/6n5U9o1lp6gGqvLXt/pLx1QF+MWuuYq6xisKGfRoXT9+TO5uG GjyQ== X-Gm-Message-State: ABy/qLZWx13UjEee9sI0gekmYAz0hf/36r/wjyO0GREHACtWbluvQy7D FJrfDD0K3ow7xaq+P0qu3uWZ1VdhGEbfzw0CdVgLfw== X-Google-Smtp-Source: APBJJlHe0pKeJRdaAe52vhRMJEzEwK4gcBzn/HOwhH8QoXgEh3hIkyhEXfUjeK4Bla4m87xmQSwtOA== X-Received: by 2002:a1c:7914:0:b0:3f9:b1e7:8a4b with SMTP id l20-20020a1c7914000000b003f9b1e78a4bmr8622158wme.21.1688927617085; Sun, 09 Jul 2023 11:33:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 36/37] crypto: Remove AES_imc Date: Sun, 9 Jul 2023 19:29:23 +0100 Message-Id: <20230709182934.309468-72-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928344504100011 This array is no longer used. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/crypto/aes.h | 7 -- crypto/aes.c | 264 ------------------------------------------- 2 files changed, 271 deletions(-) diff --git a/include/crypto/aes.h b/include/crypto/aes.h index aa8b54065d..99209f51b9 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -36,13 +36,6 @@ extern const uint32_t AES_mc_rot[256]; /* AES InvMixColumns, for use with rot32. */ extern const uint32_t AES_imc_rot[256]; =20 -/* AES InvMixColumns */ -/* AES_imc[x][0] =3D [x].[0e, 09, 0d, 0b]; */ -/* AES_imc[x][1] =3D [x].[0b, 0e, 09, 0d]; */ -/* AES_imc[x][2] =3D [x].[0d, 0b, 0e, 09]; */ -/* AES_imc[x][3] =3D [x].[09, 0d, 0b, 0e]; */ -extern const uint32_t AES_imc[256][4]; - /* AES_Te0[x] =3D S [x].[02, 01, 01, 03]; AES_Te1[x] =3D S [x].[03, 02, 01, 01]; diff --git a/crypto/aes.c b/crypto/aes.c index d93883eb18..685efbd583 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -257,270 +257,6 @@ const uint32_t AES_imc_rot[256] =3D { 0xbe805d9f, 0xb58d5491, 0xa89a4f83, 0xa397468d, }; =20 -/* AES_imc[x][0] =3D [x].[0e, 09, 0d, 0b]; */ -/* AES_imc[x][1] =3D [x].[0b, 0e, 09, 0d]; */ -/* AES_imc[x][2] =3D [x].[0d, 0b, 0e, 09]; */ -/* AES_imc[x][3] =3D [x].[09, 0d, 0b, 0e]; */ -const uint32_t AES_imc[256][4] =3D { - { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }, /* x=3D00 */ - { 0x0E090D0B, 0x0B0E090D, 0x0D0B0E09, 0x090D0B0E, }, /* x=3D01 */ - { 0x1C121A16, 0x161C121A, 0x1A161C12, 0x121A161C, }, /* x=3D02 */ - { 0x121B171D, 0x1D121B17, 0x171D121B, 0x1B171D12, }, /* x=3D03 */ - { 0x3824342C, 0x2C382434, 0x342C3824, 0x24342C38, }, /* x=3D04 */ - { 0x362D3927, 0x27362D39, 0x3927362D, 0x2D392736, }, /* x=3D05 */ - { 0x24362E3A, 0x3A24362E, 0x2E3A2436, 0x362E3A24, }, /* x=3D06 */ - { 0x2A3F2331, 0x312A3F23, 0x23312A3F, 0x3F23312A, }, /* x=3D07 */ - { 0x70486858, 0x58704868, 0x68587048, 0x48685870, }, /* x=3D08 */ - { 0x7E416553, 0x537E4165, 0x65537E41, 0x4165537E, }, /* x=3D09 */ - { 0x6C5A724E, 0x4E6C5A72, 0x724E6C5A, 0x5A724E6C, }, /* x=3D0A */ - { 0x62537F45, 0x4562537F, 0x7F456253, 0x537F4562, }, /* x=3D0B */ - { 0x486C5C74, 0x74486C5C, 0x5C74486C, 0x6C5C7448, }, /* x=3D0C */ - { 0x4665517F, 0x7F466551, 0x517F4665, 0x65517F46, }, /* x=3D0D */ - { 0x547E4662, 0x62547E46, 0x4662547E, 0x7E466254, }, /* x=3D0E */ - { 0x5A774B69, 0x695A774B, 0x4B695A77, 0x774B695A, }, /* x=3D0F */ - { 0xE090D0B0, 0xB0E090D0, 0xD0B0E090, 0x90D0B0E0, }, /* x=3D10 */ - { 0xEE99DDBB, 0xBBEE99DD, 0xDDBBEE99, 0x99DDBBEE, }, /* x=3D11 */ - { 0xFC82CAA6, 0xA6FC82CA, 0xCAA6FC82, 0x82CAA6FC, }, /* x=3D12 */ - { 0xF28BC7AD, 0xADF28BC7, 0xC7ADF28B, 0x8BC7ADF2, }, /* x=3D13 */ - { 0xD8B4E49C, 0x9CD8B4E4, 0xE49CD8B4, 0xB4E49CD8, }, /* x=3D14 */ - { 0xD6BDE997, 0x97D6BDE9, 0xE997D6BD, 0xBDE997D6, }, /* x=3D15 */ - { 0xC4A6FE8A, 0x8AC4A6FE, 0xFE8AC4A6, 0xA6FE8AC4, }, /* x=3D16 */ - { 0xCAAFF381, 0x81CAAFF3, 0xF381CAAF, 0xAFF381CA, }, /* x=3D17 */ - { 0x90D8B8E8, 0xE890D8B8, 0xB8E890D8, 0xD8B8E890, }, /* x=3D18 */ - { 0x9ED1B5E3, 0xE39ED1B5, 0xB5E39ED1, 0xD1B5E39E, }, /* x=3D19 */ - { 0x8CCAA2FE, 0xFE8CCAA2, 0xA2FE8CCA, 0xCAA2FE8C, }, /* x=3D1A */ - { 0x82C3AFF5, 0xF582C3AF, 0xAFF582C3, 0xC3AFF582, }, /* x=3D1B */ - { 0xA8FC8CC4, 0xC4A8FC8C, 0x8CC4A8FC, 0xFC8CC4A8, }, /* x=3D1C */ - { 0xA6F581CF, 0xCFA6F581, 0x81CFA6F5, 0xF581CFA6, }, /* x=3D1D */ - { 0xB4EE96D2, 0xD2B4EE96, 0x96D2B4EE, 0xEE96D2B4, }, /* x=3D1E */ - { 0xBAE79BD9, 0xD9BAE79B, 0x9BD9BAE7, 0xE79BD9BA, }, /* x=3D1F */ - { 0xDB3BBB7B, 0x7BDB3BBB, 0xBB7BDB3B, 0x3BBB7BDB, }, /* x=3D20 */ - { 0xD532B670, 0x70D532B6, 0xB670D532, 0x32B670D5, }, /* x=3D21 */ - { 0xC729A16D, 0x6DC729A1, 0xA16DC729, 0x29A16DC7, }, /* x=3D22 */ - { 0xC920AC66, 0x66C920AC, 0xAC66C920, 0x20AC66C9, }, /* x=3D23 */ - { 0xE31F8F57, 0x57E31F8F, 0x8F57E31F, 0x1F8F57E3, }, /* x=3D24 */ - { 0xED16825C, 0x5CED1682, 0x825CED16, 0x16825CED, }, /* x=3D25 */ - { 0xFF0D9541, 0x41FF0D95, 0x9541FF0D, 0x0D9541FF, }, /* x=3D26 */ - { 0xF104984A, 0x4AF10498, 0x984AF104, 0x04984AF1, }, /* x=3D27 */ - { 0xAB73D323, 0x23AB73D3, 0xD323AB73, 0x73D323AB, }, /* x=3D28 */ - { 0xA57ADE28, 0x28A57ADE, 0xDE28A57A, 0x7ADE28A5, }, /* x=3D29 */ - { 0xB761C935, 0x35B761C9, 0xC935B761, 0x61C935B7, }, /* x=3D2A */ - { 0xB968C43E, 0x3EB968C4, 0xC43EB968, 0x68C43EB9, }, /* x=3D2B */ - { 0x9357E70F, 0x0F9357E7, 0xE70F9357, 0x57E70F93, }, /* x=3D2C */ - { 0x9D5EEA04, 0x049D5EEA, 0xEA049D5E, 0x5EEA049D, }, /* x=3D2D */ - { 0x8F45FD19, 0x198F45FD, 0xFD198F45, 0x45FD198F, }, /* x=3D2E */ - { 0x814CF012, 0x12814CF0, 0xF012814C, 0x4CF01281, }, /* x=3D2F */ - { 0x3BAB6BCB, 0xCB3BAB6B, 0x6BCB3BAB, 0xAB6BCB3B, }, /* x=3D30 */ - { 0x35A266C0, 0xC035A266, 0x66C035A2, 0xA266C035, }, /* x=3D31 */ - { 0x27B971DD, 0xDD27B971, 0x71DD27B9, 0xB971DD27, }, /* x=3D32 */ - { 0x29B07CD6, 0xD629B07C, 0x7CD629B0, 0xB07CD629, }, /* x=3D33 */ - { 0x038F5FE7, 0xE7038F5F, 0x5FE7038F, 0x8F5FE703, }, /* x=3D34 */ - { 0x0D8652EC, 0xEC0D8652, 0x52EC0D86, 0x8652EC0D, }, /* x=3D35 */ - { 0x1F9D45F1, 0xF11F9D45, 0x45F11F9D, 0x9D45F11F, }, /* x=3D36 */ - { 0x119448FA, 0xFA119448, 0x48FA1194, 0x9448FA11, }, /* x=3D37 */ - { 0x4BE30393, 0x934BE303, 0x03934BE3, 0xE303934B, }, /* x=3D38 */ - { 0x45EA0E98, 0x9845EA0E, 0x0E9845EA, 0xEA0E9845, }, /* x=3D39 */ - { 0x57F11985, 0x8557F119, 0x198557F1, 0xF1198557, }, /* x=3D3A */ - { 0x59F8148E, 0x8E59F814, 0x148E59F8, 0xF8148E59, }, /* x=3D3B */ - { 0x73C737BF, 0xBF73C737, 0x37BF73C7, 0xC737BF73, }, /* x=3D3C */ - { 0x7DCE3AB4, 0xB47DCE3A, 0x3AB47DCE, 0xCE3AB47D, }, /* x=3D3D */ - { 0x6FD52DA9, 0xA96FD52D, 0x2DA96FD5, 0xD52DA96F, }, /* x=3D3E */ - { 0x61DC20A2, 0xA261DC20, 0x20A261DC, 0xDC20A261, }, /* x=3D3F */ - { 0xAD766DF6, 0xF6AD766D, 0x6DF6AD76, 0x766DF6AD, }, /* x=3D40 */ - { 0xA37F60FD, 0xFDA37F60, 0x60FDA37F, 0x7F60FDA3, }, /* x=3D41 */ - { 0xB16477E0, 0xE0B16477, 0x77E0B164, 0x6477E0B1, }, /* x=3D42 */ - { 0xBF6D7AEB, 0xEBBF6D7A, 0x7AEBBF6D, 0x6D7AEBBF, }, /* x=3D43 */ - { 0x955259DA, 0xDA955259, 0x59DA9552, 0x5259DA95, }, /* x=3D44 */ - { 0x9B5B54D1, 0xD19B5B54, 0x54D19B5B, 0x5B54D19B, }, /* x=3D45 */ - { 0x894043CC, 0xCC894043, 0x43CC8940, 0x4043CC89, }, /* x=3D46 */ - { 0x87494EC7, 0xC787494E, 0x4EC78749, 0x494EC787, }, /* x=3D47 */ - { 0xDD3E05AE, 0xAEDD3E05, 0x05AEDD3E, 0x3E05AEDD, }, /* x=3D48 */ - { 0xD33708A5, 0xA5D33708, 0x08A5D337, 0x3708A5D3, }, /* x=3D49 */ - { 0xC12C1FB8, 0xB8C12C1F, 0x1FB8C12C, 0x2C1FB8C1, }, /* x=3D4A */ - { 0xCF2512B3, 0xB3CF2512, 0x12B3CF25, 0x2512B3CF, }, /* x=3D4B */ - { 0xE51A3182, 0x82E51A31, 0x3182E51A, 0x1A3182E5, }, /* x=3D4C */ - { 0xEB133C89, 0x89EB133C, 0x3C89EB13, 0x133C89EB, }, /* x=3D4D */ - { 0xF9082B94, 0x94F9082B, 0x2B94F908, 0x082B94F9, }, /* x=3D4E */ - { 0xF701269F, 0x9FF70126, 0x269FF701, 0x01269FF7, }, /* x=3D4F */ - { 0x4DE6BD46, 0x464DE6BD, 0xBD464DE6, 0xE6BD464D, }, /* x=3D50 */ - { 0x43EFB04D, 0x4D43EFB0, 0xB04D43EF, 0xEFB04D43, }, /* x=3D51 */ - { 0x51F4A750, 0x5051F4A7, 0xA75051F4, 0xF4A75051, }, /* x=3D52 */ - { 0x5FFDAA5B, 0x5B5FFDAA, 0xAA5B5FFD, 0xFDAA5B5F, }, /* x=3D53 */ - { 0x75C2896A, 0x6A75C289, 0x896A75C2, 0xC2896A75, }, /* x=3D54 */ - { 0x7BCB8461, 0x617BCB84, 0x84617BCB, 0xCB84617B, }, /* x=3D55 */ - { 0x69D0937C, 0x7C69D093, 0x937C69D0, 0xD0937C69, }, /* x=3D56 */ - { 0x67D99E77, 0x7767D99E, 0x9E7767D9, 0xD99E7767, }, /* x=3D57 */ - { 0x3DAED51E, 0x1E3DAED5, 0xD51E3DAE, 0xAED51E3D, }, /* x=3D58 */ - { 0x33A7D815, 0x1533A7D8, 0xD81533A7, 0xA7D81533, }, /* x=3D59 */ - { 0x21BCCF08, 0x0821BCCF, 0xCF0821BC, 0xBCCF0821, }, /* x=3D5A */ - { 0x2FB5C203, 0x032FB5C2, 0xC2032FB5, 0xB5C2032F, }, /* x=3D5B */ - { 0x058AE132, 0x32058AE1, 0xE132058A, 0x8AE13205, }, /* x=3D5C */ - { 0x0B83EC39, 0x390B83EC, 0xEC390B83, 0x83EC390B, }, /* x=3D5D */ - { 0x1998FB24, 0x241998FB, 0xFB241998, 0x98FB2419, }, /* x=3D5E */ - { 0x1791F62F, 0x2F1791F6, 0xF62F1791, 0x91F62F17, }, /* x=3D5F */ - { 0x764DD68D, 0x8D764DD6, 0xD68D764D, 0x4DD68D76, }, /* x=3D60 */ - { 0x7844DB86, 0x867844DB, 0xDB867844, 0x44DB8678, }, /* x=3D61 */ - { 0x6A5FCC9B, 0x9B6A5FCC, 0xCC9B6A5F, 0x5FCC9B6A, }, /* x=3D62 */ - { 0x6456C190, 0x906456C1, 0xC1906456, 0x56C19064, }, /* x=3D63 */ - { 0x4E69E2A1, 0xA14E69E2, 0xE2A14E69, 0x69E2A14E, }, /* x=3D64 */ - { 0x4060EFAA, 0xAA4060EF, 0xEFAA4060, 0x60EFAA40, }, /* x=3D65 */ - { 0x527BF8B7, 0xB7527BF8, 0xF8B7527B, 0x7BF8B752, }, /* x=3D66 */ - { 0x5C72F5BC, 0xBC5C72F5, 0xF5BC5C72, 0x72F5BC5C, }, /* x=3D67 */ - { 0x0605BED5, 0xD50605BE, 0xBED50605, 0x05BED506, }, /* x=3D68 */ - { 0x080CB3DE, 0xDE080CB3, 0xB3DE080C, 0x0CB3DE08, }, /* x=3D69 */ - { 0x1A17A4C3, 0xC31A17A4, 0xA4C31A17, 0x17A4C31A, }, /* x=3D6A */ - { 0x141EA9C8, 0xC8141EA9, 0xA9C8141E, 0x1EA9C814, }, /* x=3D6B */ - { 0x3E218AF9, 0xF93E218A, 0x8AF93E21, 0x218AF93E, }, /* x=3D6C */ - { 0x302887F2, 0xF2302887, 0x87F23028, 0x2887F230, }, /* x=3D6D */ - { 0x223390EF, 0xEF223390, 0x90EF2233, 0x3390EF22, }, /* x=3D6E */ - { 0x2C3A9DE4, 0xE42C3A9D, 0x9DE42C3A, 0x3A9DE42C, }, /* x=3D6F */ - { 0x96DD063D, 0x3D96DD06, 0x063D96DD, 0xDD063D96, }, /* x=3D70 */ - { 0x98D40B36, 0x3698D40B, 0x0B3698D4, 0xD40B3698, }, /* x=3D71 */ - { 0x8ACF1C2B, 0x2B8ACF1C, 0x1C2B8ACF, 0xCF1C2B8A, }, /* x=3D72 */ - { 0x84C61120, 0x2084C611, 0x112084C6, 0xC6112084, }, /* x=3D73 */ - { 0xAEF93211, 0x11AEF932, 0x3211AEF9, 0xF93211AE, }, /* x=3D74 */ - { 0xA0F03F1A, 0x1AA0F03F, 0x3F1AA0F0, 0xF03F1AA0, }, /* x=3D75 */ - { 0xB2EB2807, 0x07B2EB28, 0x2807B2EB, 0xEB2807B2, }, /* x=3D76 */ - { 0xBCE2250C, 0x0CBCE225, 0x250CBCE2, 0xE2250CBC, }, /* x=3D77 */ - { 0xE6956E65, 0x65E6956E, 0x6E65E695, 0x956E65E6, }, /* x=3D78 */ - { 0xE89C636E, 0x6EE89C63, 0x636EE89C, 0x9C636EE8, }, /* x=3D79 */ - { 0xFA877473, 0x73FA8774, 0x7473FA87, 0x877473FA, }, /* x=3D7A */ - { 0xF48E7978, 0x78F48E79, 0x7978F48E, 0x8E7978F4, }, /* x=3D7B */ - { 0xDEB15A49, 0x49DEB15A, 0x5A49DEB1, 0xB15A49DE, }, /* x=3D7C */ - { 0xD0B85742, 0x42D0B857, 0x5742D0B8, 0xB85742D0, }, /* x=3D7D */ - { 0xC2A3405F, 0x5FC2A340, 0x405FC2A3, 0xA3405FC2, }, /* x=3D7E */ - { 0xCCAA4D54, 0x54CCAA4D, 0x4D54CCAA, 0xAA4D54CC, }, /* x=3D7F */ - { 0x41ECDAF7, 0xF741ECDA, 0xDAF741EC, 0xECDAF741, }, /* x=3D80 */ - { 0x4FE5D7FC, 0xFC4FE5D7, 0xD7FC4FE5, 0xE5D7FC4F, }, /* x=3D81 */ - { 0x5DFEC0E1, 0xE15DFEC0, 0xC0E15DFE, 0xFEC0E15D, }, /* x=3D82 */ - { 0x53F7CDEA, 0xEA53F7CD, 0xCDEA53F7, 0xF7CDEA53, }, /* x=3D83 */ - { 0x79C8EEDB, 0xDB79C8EE, 0xEEDB79C8, 0xC8EEDB79, }, /* x=3D84 */ - { 0x77C1E3D0, 0xD077C1E3, 0xE3D077C1, 0xC1E3D077, }, /* x=3D85 */ - { 0x65DAF4CD, 0xCD65DAF4, 0xF4CD65DA, 0xDAF4CD65, }, /* x=3D86 */ - { 0x6BD3F9C6, 0xC66BD3F9, 0xF9C66BD3, 0xD3F9C66B, }, /* x=3D87 */ - { 0x31A4B2AF, 0xAF31A4B2, 0xB2AF31A4, 0xA4B2AF31, }, /* x=3D88 */ - { 0x3FADBFA4, 0xA43FADBF, 0xBFA43FAD, 0xADBFA43F, }, /* x=3D89 */ - { 0x2DB6A8B9, 0xB92DB6A8, 0xA8B92DB6, 0xB6A8B92D, }, /* x=3D8A */ - { 0x23BFA5B2, 0xB223BFA5, 0xA5B223BF, 0xBFA5B223, }, /* x=3D8B */ - { 0x09808683, 0x83098086, 0x86830980, 0x80868309, }, /* x=3D8C */ - { 0x07898B88, 0x8807898B, 0x8B880789, 0x898B8807, }, /* x=3D8D */ - { 0x15929C95, 0x9515929C, 0x9C951592, 0x929C9515, }, /* x=3D8E */ - { 0x1B9B919E, 0x9E1B9B91, 0x919E1B9B, 0x9B919E1B, }, /* x=3D8F */ - { 0xA17C0A47, 0x47A17C0A, 0x0A47A17C, 0x7C0A47A1, }, /* x=3D90 */ - { 0xAF75074C, 0x4CAF7507, 0x074CAF75, 0x75074CAF, }, /* x=3D91 */ - { 0xBD6E1051, 0x51BD6E10, 0x1051BD6E, 0x6E1051BD, }, /* x=3D92 */ - { 0xB3671D5A, 0x5AB3671D, 0x1D5AB367, 0x671D5AB3, }, /* x=3D93 */ - { 0x99583E6B, 0x6B99583E, 0x3E6B9958, 0x583E6B99, }, /* x=3D94 */ - { 0x97513360, 0x60975133, 0x33609751, 0x51336097, }, /* x=3D95 */ - { 0x854A247D, 0x7D854A24, 0x247D854A, 0x4A247D85, }, /* x=3D96 */ - { 0x8B432976, 0x768B4329, 0x29768B43, 0x4329768B, }, /* x=3D97 */ - { 0xD134621F, 0x1FD13462, 0x621FD134, 0x34621FD1, }, /* x=3D98 */ - { 0xDF3D6F14, 0x14DF3D6F, 0x6F14DF3D, 0x3D6F14DF, }, /* x=3D99 */ - { 0xCD267809, 0x09CD2678, 0x7809CD26, 0x267809CD, }, /* x=3D9A */ - { 0xC32F7502, 0x02C32F75, 0x7502C32F, 0x2F7502C3, }, /* x=3D9B */ - { 0xE9105633, 0x33E91056, 0x5633E910, 0x105633E9, }, /* x=3D9C */ - { 0xE7195B38, 0x38E7195B, 0x5B38E719, 0x195B38E7, }, /* x=3D9D */ - { 0xF5024C25, 0x25F5024C, 0x4C25F502, 0x024C25F5, }, /* x=3D9E */ - { 0xFB0B412E, 0x2EFB0B41, 0x412EFB0B, 0x0B412EFB, }, /* x=3D9F */ - { 0x9AD7618C, 0x8C9AD761, 0x618C9AD7, 0xD7618C9A, }, /* x=3DA0 */ - { 0x94DE6C87, 0x8794DE6C, 0x6C8794DE, 0xDE6C8794, }, /* x=3DA1 */ - { 0x86C57B9A, 0x9A86C57B, 0x7B9A86C5, 0xC57B9A86, }, /* x=3DA2 */ - { 0x88CC7691, 0x9188CC76, 0x769188CC, 0xCC769188, }, /* x=3DA3 */ - { 0xA2F355A0, 0xA0A2F355, 0x55A0A2F3, 0xF355A0A2, }, /* x=3DA4 */ - { 0xACFA58AB, 0xABACFA58, 0x58ABACFA, 0xFA58ABAC, }, /* x=3DA5 */ - { 0xBEE14FB6, 0xB6BEE14F, 0x4FB6BEE1, 0xE14FB6BE, }, /* x=3DA6 */ - { 0xB0E842BD, 0xBDB0E842, 0x42BDB0E8, 0xE842BDB0, }, /* x=3DA7 */ - { 0xEA9F09D4, 0xD4EA9F09, 0x09D4EA9F, 0x9F09D4EA, }, /* x=3DA8 */ - { 0xE49604DF, 0xDFE49604, 0x04DFE496, 0x9604DFE4, }, /* x=3DA9 */ - { 0xF68D13C2, 0xC2F68D13, 0x13C2F68D, 0x8D13C2F6, }, /* x=3DAA */ - { 0xF8841EC9, 0xC9F8841E, 0x1EC9F884, 0x841EC9F8, }, /* x=3DAB */ - { 0xD2BB3DF8, 0xF8D2BB3D, 0x3DF8D2BB, 0xBB3DF8D2, }, /* x=3DAC */ - { 0xDCB230F3, 0xF3DCB230, 0x30F3DCB2, 0xB230F3DC, }, /* x=3DAD */ - { 0xCEA927EE, 0xEECEA927, 0x27EECEA9, 0xA927EECE, }, /* x=3DAE */ - { 0xC0A02AE5, 0xE5C0A02A, 0x2AE5C0A0, 0xA02AE5C0, }, /* x=3DAF */ - { 0x7A47B13C, 0x3C7A47B1, 0xB13C7A47, 0x47B13C7A, }, /* x=3DB0 */ - { 0x744EBC37, 0x37744EBC, 0xBC37744E, 0x4EBC3774, }, /* x=3DB1 */ - { 0x6655AB2A, 0x2A6655AB, 0xAB2A6655, 0x55AB2A66, }, /* x=3DB2 */ - { 0x685CA621, 0x21685CA6, 0xA621685C, 0x5CA62168, }, /* x=3DB3 */ - { 0x42638510, 0x10426385, 0x85104263, 0x63851042, }, /* x=3DB4 */ - { 0x4C6A881B, 0x1B4C6A88, 0x881B4C6A, 0x6A881B4C, }, /* x=3DB5 */ - { 0x5E719F06, 0x065E719F, 0x9F065E71, 0x719F065E, }, /* x=3DB6 */ - { 0x5078920D, 0x0D507892, 0x920D5078, 0x78920D50, }, /* x=3DB7 */ - { 0x0A0FD964, 0x640A0FD9, 0xD9640A0F, 0x0FD9640A, }, /* x=3DB8 */ - { 0x0406D46F, 0x6F0406D4, 0xD46F0406, 0x06D46F04, }, /* x=3DB9 */ - { 0x161DC372, 0x72161DC3, 0xC372161D, 0x1DC37216, }, /* x=3DBA */ - { 0x1814CE79, 0x791814CE, 0xCE791814, 0x14CE7918, }, /* x=3DBB */ - { 0x322BED48, 0x48322BED, 0xED48322B, 0x2BED4832, }, /* x=3DBC */ - { 0x3C22E043, 0x433C22E0, 0xE0433C22, 0x22E0433C, }, /* x=3DBD */ - { 0x2E39F75E, 0x5E2E39F7, 0xF75E2E39, 0x39F75E2E, }, /* x=3DBE */ - { 0x2030FA55, 0x552030FA, 0xFA552030, 0x30FA5520, }, /* x=3DBF */ - { 0xEC9AB701, 0x01EC9AB7, 0xB701EC9A, 0x9AB701EC, }, /* x=3DC0 */ - { 0xE293BA0A, 0x0AE293BA, 0xBA0AE293, 0x93BA0AE2, }, /* x=3DC1 */ - { 0xF088AD17, 0x17F088AD, 0xAD17F088, 0x88AD17F0, }, /* x=3DC2 */ - { 0xFE81A01C, 0x1CFE81A0, 0xA01CFE81, 0x81A01CFE, }, /* x=3DC3 */ - { 0xD4BE832D, 0x2DD4BE83, 0x832DD4BE, 0xBE832DD4, }, /* x=3DC4 */ - { 0xDAB78E26, 0x26DAB78E, 0x8E26DAB7, 0xB78E26DA, }, /* x=3DC5 */ - { 0xC8AC993B, 0x3BC8AC99, 0x993BC8AC, 0xAC993BC8, }, /* x=3DC6 */ - { 0xC6A59430, 0x30C6A594, 0x9430C6A5, 0xA59430C6, }, /* x=3DC7 */ - { 0x9CD2DF59, 0x599CD2DF, 0xDF599CD2, 0xD2DF599C, }, /* x=3DC8 */ - { 0x92DBD252, 0x5292DBD2, 0xD25292DB, 0xDBD25292, }, /* x=3DC9 */ - { 0x80C0C54F, 0x4F80C0C5, 0xC54F80C0, 0xC0C54F80, }, /* x=3DCA */ - { 0x8EC9C844, 0x448EC9C8, 0xC8448EC9, 0xC9C8448E, }, /* x=3DCB */ - { 0xA4F6EB75, 0x75A4F6EB, 0xEB75A4F6, 0xF6EB75A4, }, /* x=3DCC */ - { 0xAAFFE67E, 0x7EAAFFE6, 0xE67EAAFF, 0xFFE67EAA, }, /* x=3DCD */ - { 0xB8E4F163, 0x63B8E4F1, 0xF163B8E4, 0xE4F163B8, }, /* x=3DCE */ - { 0xB6EDFC68, 0x68B6EDFC, 0xFC68B6ED, 0xEDFC68B6, }, /* x=3DCF */ - { 0x0C0A67B1, 0xB10C0A67, 0x67B10C0A, 0x0A67B10C, }, /* x=3DD0 */ - { 0x02036ABA, 0xBA02036A, 0x6ABA0203, 0x036ABA02, }, /* x=3DD1 */ - { 0x10187DA7, 0xA710187D, 0x7DA71018, 0x187DA710, }, /* x=3DD2 */ - { 0x1E1170AC, 0xAC1E1170, 0x70AC1E11, 0x1170AC1E, }, /* x=3DD3 */ - { 0x342E539D, 0x9D342E53, 0x539D342E, 0x2E539D34, }, /* x=3DD4 */ - { 0x3A275E96, 0x963A275E, 0x5E963A27, 0x275E963A, }, /* x=3DD5 */ - { 0x283C498B, 0x8B283C49, 0x498B283C, 0x3C498B28, }, /* x=3DD6 */ - { 0x26354480, 0x80263544, 0x44802635, 0x35448026, }, /* x=3DD7 */ - { 0x7C420FE9, 0xE97C420F, 0x0FE97C42, 0x420FE97C, }, /* x=3DD8 */ - { 0x724B02E2, 0xE2724B02, 0x02E2724B, 0x4B02E272, }, /* x=3DD9 */ - { 0x605015FF, 0xFF605015, 0x15FF6050, 0x5015FF60, }, /* x=3DDA */ - { 0x6E5918F4, 0xF46E5918, 0x18F46E59, 0x5918F46E, }, /* x=3DDB */ - { 0x44663BC5, 0xC544663B, 0x3BC54466, 0x663BC544, }, /* x=3DDC */ - { 0x4A6F36CE, 0xCE4A6F36, 0x36CE4A6F, 0x6F36CE4A, }, /* x=3DDD */ - { 0x587421D3, 0xD3587421, 0x21D35874, 0x7421D358, }, /* x=3DDE */ - { 0x567D2CD8, 0xD8567D2C, 0x2CD8567D, 0x7D2CD856, }, /* x=3DDF */ - { 0x37A10C7A, 0x7A37A10C, 0x0C7A37A1, 0xA10C7A37, }, /* x=3DE0 */ - { 0x39A80171, 0x7139A801, 0x017139A8, 0xA8017139, }, /* x=3DE1 */ - { 0x2BB3166C, 0x6C2BB316, 0x166C2BB3, 0xB3166C2B, }, /* x=3DE2 */ - { 0x25BA1B67, 0x6725BA1B, 0x1B6725BA, 0xBA1B6725, }, /* x=3DE3 */ - { 0x0F853856, 0x560F8538, 0x38560F85, 0x8538560F, }, /* x=3DE4 */ - { 0x018C355D, 0x5D018C35, 0x355D018C, 0x8C355D01, }, /* x=3DE5 */ - { 0x13972240, 0x40139722, 0x22401397, 0x97224013, }, /* x=3DE6 */ - { 0x1D9E2F4B, 0x4B1D9E2F, 0x2F4B1D9E, 0x9E2F4B1D, }, /* x=3DE7 */ - { 0x47E96422, 0x2247E964, 0x642247E9, 0xE9642247, }, /* x=3DE8 */ - { 0x49E06929, 0x2949E069, 0x692949E0, 0xE0692949, }, /* x=3DE9 */ - { 0x5BFB7E34, 0x345BFB7E, 0x7E345BFB, 0xFB7E345B, }, /* x=3DEA */ - { 0x55F2733F, 0x3F55F273, 0x733F55F2, 0xF2733F55, }, /* x=3DEB */ - { 0x7FCD500E, 0x0E7FCD50, 0x500E7FCD, 0xCD500E7F, }, /* x=3DEC */ - { 0x71C45D05, 0x0571C45D, 0x5D0571C4, 0xC45D0571, }, /* x=3DED */ - { 0x63DF4A18, 0x1863DF4A, 0x4A1863DF, 0xDF4A1863, }, /* x=3DEE */ - { 0x6DD64713, 0x136DD647, 0x47136DD6, 0xD647136D, }, /* x=3DEF */ - { 0xD731DCCA, 0xCAD731DC, 0xDCCAD731, 0x31DCCAD7, }, /* x=3DF0 */ - { 0xD938D1C1, 0xC1D938D1, 0xD1C1D938, 0x38D1C1D9, }, /* x=3DF1 */ - { 0xCB23C6DC, 0xDCCB23C6, 0xC6DCCB23, 0x23C6DCCB, }, /* x=3DF2 */ - { 0xC52ACBD7, 0xD7C52ACB, 0xCBD7C52A, 0x2ACBD7C5, }, /* x=3DF3 */ - { 0xEF15E8E6, 0xE6EF15E8, 0xE8E6EF15, 0x15E8E6EF, }, /* x=3DF4 */ - { 0xE11CE5ED, 0xEDE11CE5, 0xE5EDE11C, 0x1CE5EDE1, }, /* x=3DF5 */ - { 0xF307F2F0, 0xF0F307F2, 0xF2F0F307, 0x07F2F0F3, }, /* x=3DF6 */ - { 0xFD0EFFFB, 0xFBFD0EFF, 0xFFFBFD0E, 0x0EFFFBFD, }, /* x=3DF7 */ - { 0xA779B492, 0x92A779B4, 0xB492A779, 0x79B492A7, }, /* x=3DF8 */ - { 0xA970B999, 0x99A970B9, 0xB999A970, 0x70B999A9, }, /* x=3DF9 */ - { 0xBB6BAE84, 0x84BB6BAE, 0xAE84BB6B, 0x6BAE84BB, }, /* x=3DFA */ - { 0xB562A38F, 0x8FB562A3, 0xA38FB562, 0x62A38FB5, }, /* x=3DFB */ - { 0x9F5D80BE, 0xBE9F5D80, 0x80BE9F5D, 0x5D80BE9F, }, /* x=3DFC */ - { 0x91548DB5, 0xB591548D, 0x8DB59154, 0x548DB591, }, /* x=3DFD */ - { 0x834F9AA8, 0xA8834F9A, 0x9AA8834F, 0x4F9AA883, }, /* x=3DFE */ - { 0x8D4697A3, 0xA38D4697, 0x97A38D46, 0x4697A38D, }, /* x=3DFF */ -}; - - =20 /* AES_Te0[x] =3D S [x].[02, 01, 01, 03]; --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928109; cv=none; d=zohomail.com; s=zohoarc; b=WX1Lj+U247JDbRZLUTN4XtOJuiiNKCDTSLR2olPTv/aLj64/JVyWp+xBKbX6OwzfU/hEVNv0zlZgqUbjcDaR+DzGH8lZYKl/0dPmW9QVOBfp3weirj4i2vesgRyf8MEEz31xWi+drns20c6qKbIv376yCSsPMEsY9ojZkf2FqkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928109; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1F2YVr3IWQtmqpjJeR+MoFqCj9awn2sZVMTfzE1Dbtk=; b=erHpvDOSzm3gGmBgM9ae7u/rB/8xvON+fMtaTqxDq/h++WHRzY3bdoWPY5pOWxhLqVLxZM2Ipxtru1vnmoAQ4uFPEN+wnbZFLY0I548CKkLX7D4WMEJurMvKjT2Jx3ewz9AeV8atE+TscB7jiIeNtxj5WVjvG5o1g/DLhiWbYKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928109200202.67076197597567; Sun, 9 Jul 2023 11:41:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEG-0005aa-VU; Sun, 09 Jul 2023 14:33:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEC-0004ra-Cn for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:48 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE7-0004JE-OG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:48 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fba8e2aa52so42044675e9.1 for ; Sun, 09 Jul 2023 11:33:39 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927619; x=1691519619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1F2YVr3IWQtmqpjJeR+MoFqCj9awn2sZVMTfzE1Dbtk=; b=vv5/sAHgPhVuWtQjtVGI/Vqw7lnLUfVWYbTua4JNp8Rt8VQCTMJDJ3Cfvwrj5hmBG9 LeHQVGV4YWJsjs500+NlNvgaMuZY8m7nhGrqk+L9rLyy7sB3TLzPzkHD9CteKTR99sa+ wuFmOCaSSI1pwtirPQKm7akbH8L8kyG9g0fzqGq7B+Bc01GelYlawLOl1mn8Dqip+yQ4 tHX0/K7Vtov6RdQuoIkWqdrHGZM+s7PQAsfE3WbxT+I9P7bQkjPGq03JoRMNSKTP3M+m a/ShxbtmLjFcg6GwzPyaJWwZiZYIHylc7+RZ2JsmNvF+lmCEhsSh31P7W+HUNMqFEyay zOUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927619; x=1691519619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1F2YVr3IWQtmqpjJeR+MoFqCj9awn2sZVMTfzE1Dbtk=; b=eaj4vb3aU+GMaFY3oj8iWDDnvPXHL2KyV8WES8SK4d3eg0mUhcT2xQIFYXEKmXdskT B3nFGDop6YMzRghvuJRd+KBf7akpWASJbptgpL9uNCkT2BjK9owww1l895332dQOy3dL Un0rAiTMYzdpmADVsCfgvT6fk3z7fPIYf5Z0oYQSnrt1h78JKlTfhTjrdiJ9EHHmBMTh rC7seT3N2S2rmXdtS9gyM8Bs/Ny4PgtV8e6UzLs7I+HCdVIGKSxz0p+Nf+G13TLVlRKz eUAjgypzr2/lKlka/E500O5OpemuYKySu4PH+dG/S0mnxPtmz2ICSp+CgjdyExHE5u+8 HrKQ== X-Gm-Message-State: ABy/qLZjDh/3UPkBMKHG8aqaxJlHC6+1d30GpLAD6KuCxskh7IUo0lJP jbhrKyroXfZR4A14kpo8MwM+nbR8lY/a71F3XOS0Pg== X-Google-Smtp-Source: APBJJlFnWrBSaI32XrgfFXbRyylhi+nCHJbkg8nk3jLgAqlX3L7+zwYip0+QxfLPSxSS3lJKqLcnKg== X-Received: by 2002:a05:600c:258:b0:3fb:c15c:698a with SMTP id 24-20020a05600c025800b003fbc15c698amr10397580wmj.4.1688927618792; Sun, 09 Jul 2023 11:33:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 37/37] crypto: Unexport AES_*_rot, AES_TeN, AES_TdN Date: Sun, 9 Jul 2023 19:29:25 +0100 Message-Id: <20230709182934.309468-74-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928111100100001 These arrays are no longer used outside of aes.c. Acked-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/crypto/aes.h | 25 ------------------------- crypto/aes.c | 33 +++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/include/crypto/aes.h b/include/crypto/aes.h index 99209f51b9..709d4d226b 100644 --- a/include/crypto/aes.h +++ b/include/crypto/aes.h @@ -30,29 +30,4 @@ void AES_decrypt(const unsigned char *in, unsigned char = *out, extern const uint8_t AES_sbox[256]; extern const uint8_t AES_isbox[256]; =20 -/* AES MixColumns, for use with rot32. */ -extern const uint32_t AES_mc_rot[256]; - -/* AES InvMixColumns, for use with rot32. */ -extern const uint32_t AES_imc_rot[256]; - -/* -AES_Te0[x] =3D S [x].[02, 01, 01, 03]; -AES_Te1[x] =3D S [x].[03, 02, 01, 01]; -AES_Te2[x] =3D S [x].[01, 03, 02, 01]; -AES_Te3[x] =3D S [x].[01, 01, 03, 02]; -AES_Te4[x] =3D S [x].[01, 01, 01, 01]; - -AES_Td0[x] =3D Si[x].[0e, 09, 0d, 0b]; -AES_Td1[x] =3D Si[x].[0b, 0e, 09, 0d]; -AES_Td2[x] =3D Si[x].[0d, 0b, 0e, 09]; -AES_Td3[x] =3D Si[x].[09, 0d, 0b, 0e]; -AES_Td4[x] =3D Si[x].[01, 01, 01, 01]; -*/ - -extern const uint32_t AES_Te0[256], AES_Te1[256], AES_Te2[256], - AES_Te3[256], AES_Te4[256]; -extern const uint32_t AES_Td0[256], AES_Td1[256], AES_Td2[256], - AES_Td3[256], AES_Td4[256]; - #endif diff --git a/crypto/aes.c b/crypto/aes.c index 685efbd583..836d7d5c0b 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -120,7 +120,7 @@ const uint8_t AES_isbox[256] =3D { /* * MixColumns lookup table, for use with rot32. */ -const uint32_t AES_mc_rot[256] =3D { +static const uint32_t AES_mc_rot[256] =3D { 0x00000000, 0x03010102, 0x06020204, 0x05030306, 0x0c040408, 0x0f05050a, 0x0a06060c, 0x0907070e, 0x18080810, 0x1b090912, 0x1e0a0a14, 0x1d0b0b16, @@ -190,7 +190,7 @@ const uint32_t AES_mc_rot[256] =3D { /* * Inverse MixColumns lookup table, for use with rot32. */ -const uint32_t AES_imc_rot[256] =3D { +static const uint32_t AES_imc_rot[256] =3D { 0x00000000, 0x0b0d090e, 0x161a121c, 0x1d171b12, 0x2c342438, 0x27392d36, 0x3a2e3624, 0x31233f2a, 0x58684870, 0x5365417e, 0x4e725a6c, 0x457f5362, @@ -272,7 +272,7 @@ AES_Td3[x] =3D Si[x].[09, 0d, 0b, 0e]; AES_Td4[x] =3D Si[x].[01, 01, 01, 01]; */ =20 -const uint32_t AES_Te0[256] =3D { +static const uint32_t AES_Te0[256] =3D { 0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU, 0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U, 0x60303050U, 0x02010103U, 0xce6767a9U, 0x562b2b7dU, @@ -338,7 +338,8 @@ const uint32_t AES_Te0[256] =3D { 0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U, 0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU, }; -const uint32_t AES_Te1[256] =3D { + +static const uint32_t AES_Te1[256] =3D { 0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU, 0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U, 0x50603030U, 0x03020101U, 0xa9ce6767U, 0x7d562b2bU, @@ -404,7 +405,8 @@ const uint32_t AES_Te1[256] =3D { 0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU, 0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U, }; -const uint32_t AES_Te2[256] =3D { + +static const uint32_t AES_Te2[256] =3D { 0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU, 0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U, 0x30506030U, 0x01030201U, 0x67a9ce67U, 0x2b7d562bU, @@ -470,8 +472,8 @@ const uint32_t AES_Te2[256] =3D { 0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU, 0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U, }; -const uint32_t AES_Te3[256] =3D { =20 +static const uint32_t AES_Te3[256] =3D { 0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U, 0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U, 0x30305060U, 0x01010302U, 0x6767a9ceU, 0x2b2b7d56U, @@ -537,7 +539,8 @@ const uint32_t AES_Te3[256] =3D { 0x4141c382U, 0x9999b029U, 0x2d2d775aU, 0x0f0f111eU, 0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU, }; -const uint32_t AES_Te4[256] =3D { + +static const uint32_t AES_Te4[256] =3D { 0x63636363U, 0x7c7c7c7cU, 0x77777777U, 0x7b7b7b7bU, 0xf2f2f2f2U, 0x6b6b6b6bU, 0x6f6f6f6fU, 0xc5c5c5c5U, 0x30303030U, 0x01010101U, 0x67676767U, 0x2b2b2b2bU, @@ -603,7 +606,8 @@ const uint32_t AES_Te4[256] =3D { 0x41414141U, 0x99999999U, 0x2d2d2d2dU, 0x0f0f0f0fU, 0xb0b0b0b0U, 0x54545454U, 0xbbbbbbbbU, 0x16161616U, }; -const uint32_t AES_Td0[256] =3D { + +static const uint32_t AES_Td0[256] =3D { 0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U, 0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U, 0x2030fa55U, 0xad766df6U, 0x88cc7691U, 0xf5024c25U, @@ -669,7 +673,8 @@ const uint32_t AES_Td0[256] =3D { 0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U, 0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U, }; -const uint32_t AES_Td1[256] =3D { + +static const uint32_t AES_Td1[256] =3D { 0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU, 0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U, 0x552030faU, 0xf6ad766dU, 0x9188cc76U, 0x25f5024cU, @@ -735,7 +740,8 @@ const uint32_t AES_Td1[256] =3D { 0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U, 0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U, }; -const uint32_t AES_Td2[256] =3D { + +static const uint32_t AES_Td2[256] =3D { 0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U, 0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U, 0xfa552030U, 0x6df6ad76U, 0x769188ccU, 0x4c25f502U, @@ -802,7 +808,8 @@ const uint32_t AES_Td2[256] =3D { 0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U, 0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U, }; -const uint32_t AES_Td3[256] =3D { + +static const uint32_t AES_Td3[256] =3D { 0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU, 0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU, 0x30fa5520U, 0x766df6adU, 0xcc769188U, 0x024c25f5U, @@ -868,7 +875,8 @@ const uint32_t AES_Td3[256] =3D { 0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U, 0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U, }; -const uint32_t AES_Td4[256] =3D { + +static const uint32_t AES_Td4[256] =3D { 0x52525252U, 0x09090909U, 0x6a6a6a6aU, 0xd5d5d5d5U, 0x30303030U, 0x36363636U, 0xa5a5a5a5U, 0x38383838U, 0xbfbfbfbfU, 0x40404040U, 0xa3a3a3a3U, 0x9e9e9e9eU, @@ -934,6 +942,7 @@ const uint32_t AES_Td4[256] =3D { 0xe1e1e1e1U, 0x69696969U, 0x14141414U, 0x63636363U, 0x55555555U, 0x21212121U, 0x0c0c0c0cU, 0x7d7d7d7dU, }; + static const u32 rcon[] =3D { 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928226; cv=none; d=zohomail.com; s=zohoarc; b=CLSvFigZTvaxH4U3aVYf6weVOY57tAcbeLbLgGaHguUm/TqcorWHOnvGcdtv3cMYZJU9rvOCeVQ48EhmldDCup7qmi9tx2VnFPm4eiCk6X3EfIR5AFMhfOOO33Z2U/sMWibgjort+QtLbkNMqUZQ+4Ua4LcParKSRfuNyEnSfHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928226; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=GKXL9RpUK21XgwXc0/j2x/CpAWylysx9E3gYlwc0HvjZho/UqSyNR++lZ4z5TDUbDhNvg14zyLoPvoPJRPau3RkjbKD8VbGC4IwLmpsefpuZlhyVCVCdkE8ghL9a+MQz1ohrY0BwI9qF7n95GfroflAATrTGI+CGdhJ/WmD2ifc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168892822682629.21719532079078; Sun, 9 Jul 2023 11:43:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEQ-0005sf-0u; Sun, 09 Jul 2023 14:34:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004di-OG for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE7-0004JX-Py for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbab0d0b88so37716355e9.0 for ; Sun, 09 Jul 2023 11:33:40 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927619; x=1691519619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=ai1DTp+ccHs4f1A3033BgUFM6Uw7ESmhWqxSLSPOuYNx47XuZDu4C7f+vRbKbAaWUT GeIhdRdnINtPqY3HofItJhLnW4SyPrA2NTYohFa7zEuVwW0Hm2BmAdT8cQ+VJ0NfdOdI SQS24I4mUOT6qnuMV84nmam/yTvx0Egh57pS1nQdFvdtTXegRrkYJEZ6VD4hkwV7LMKN lahF12qWckmrg5qvPxqNpwipYlexr/HF3P8c21LqAc0Fn8d/En5r5Hn+8isbw3Bavg3X P7HHKZ2GF8tinYtSzBURCfK+l9yzJNCk/wnouvCT6jWbF2CpQ1j3nVtSGpqJ8gtClERC S4AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927619; x=1691519619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LwsEQEgJb6LbDaZv4vgO4Dp17xTKrnyDcX9Cf57n7+Y=; b=aAQxwh+T3s/wc6A3BfdT/W1qrsIN6jlxqbpWVj5+XDfTq4EEWBwYQjhMy/+wYR4Nks tGA9/XlOWye8j0XeDD/G5U+KrtZqtdUVD0MeBUzNjvdPX4eg2QlbYsEuLEcszzYlYzjE YESnoDzn6Gny+yF7sBz+uF2TSemcsEDNZDkBODdeuOIL+WnhRbPKqulyOrhc2uHLEvK9 y+g2J+PmZk87eWs94MSLYrecar65xYy7ZhKL4mTIKaWLQzYFEIoqwEuG0GUkcw2ypdoV /csgtyqkjhEhjGpvkrySBs8ZpJa9iVVQsMtW9jSXYxfPp2JrsZZ95BGhQJBMt7H/dhXs uWkg== X-Gm-Message-State: ABy/qLYTGc+UT8NCIUOpmtjTRfDUom6vO8pINetp/+gIwkybQUQBW3Iz e2J1PbrIr5urQICVp5ER3ohyFFYDWETcMcavUxtldA== X-Google-Smtp-Source: APBJJlGsuylhUpLLqcAYJ62JIiqlMMX22d+czLmqbViCM/Ag6gTxt0lJlpsPyHgfHPAKMI8+IlMiYg== X-Received: by 2002:adf:dec5:0:b0:314:423c:95a3 with SMTP id i5-20020adfdec5000000b00314423c95a3mr12599566wrn.9.1688927619494; Sun, 09 Jul 2023 11:33:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 37/45] linux-user: Rewrite mmap_reserve Date: Sun, 9 Jul 2023 19:29:26 +0100 Message-Id: <20230709182934.309468-75-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928227659100001 Content-Type: text/plain; charset="utf-8" Use 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-21-richard.henderson@linaro.org> --- linux-user/mmap.c | 68 +++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index bb9cbe52cd..6308787942 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -722,47 +722,63 @@ fail: return -1; } =20 -static void mmap_reserve(abi_ulong start, abi_ulong size) +static void mmap_reserve(abi_ulong start, abi_ulong len) { abi_ulong real_start; - abi_ulong real_end; - abi_ulong addr; - abi_ulong end; + abi_ulong real_last; + abi_ulong real_len; + abi_ulong last; + abi_ulong a; + void *host_start, *ptr; int prot; =20 + last =3D start + len - 1; real_start =3D start & qemu_host_page_mask; - real_end =3D HOST_PAGE_ALIGN(start + size); - end =3D start + size; - if (start > real_start) { - /* handle host page containing start */ + real_last =3D HOST_PAGE_ALIGN(last) - 1; + + /* + * If guest pages remain on the first or last host pages, + * adjust the deallocation to retain those guest pages. + * The single page special case is required for the last page, + * lest real_start overflow to zero. + */ + if (real_last - real_start < qemu_host_page_size) { prot =3D 0; - for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); + for (a =3D real_start; a < start; a +=3D TARGET_PAGE_SIZE) { + prot |=3D page_get_flags(a); } - if (real_end =3D=3D real_start + qemu_host_page_size) { - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - end =3D real_end; + for (a =3D last; a < real_last; a +=3D TARGET_PAGE_SIZE) { + prot |=3D page_get_flags(a + 1); + } + if (prot !=3D 0) { + return; + } + } else { + for (prot =3D 0, a =3D real_start; a < start; a +=3D TARGET_PAGE_S= IZE) { + prot |=3D page_get_flags(a); } if (prot !=3D 0) { real_start +=3D qemu_host_page_size; } - } - if (end < real_end) { - prot =3D 0; - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { - prot |=3D page_get_flags(addr); + + for (prot =3D 0, a =3D last; a < real_last; a +=3D TARGET_PAGE_SIZ= E) { + prot |=3D page_get_flags(a + 1); } if (prot !=3D 0) { - real_end -=3D qemu_host_page_size; + real_last -=3D qemu_host_page_size; + } + + if (real_last < real_start) { + return; } } - if (real_start !=3D real_end) { - mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, - -1, 0); - } + + real_len =3D real_last - real_start + 1; + host_start =3D g2h_untagged(real_start); + + ptr =3D mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1= , 0); + assert(ptr =3D=3D host_start); } =20 int target_munmap(abi_ulong start, abi_ulong len) --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928014; cv=none; d=zohomail.com; s=zohoarc; b=J1bZ1Gi9wiUyShwf+rxiKpVyDBrEOSzDA9xbw3HdWSTpZJD+o5lS52dzpKZdgK08fTop7DkH0iCizc6hoclI8nMWwahVv+oDQdqBfMgAQQJa7chav48YLkuZxP5aKpAijLSmGgfiIrYLrvNJBbYnZtcsKA7bbLWdgkZ7bcPY4HA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928014; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=GG1V+xXskhXdU3XFjzQGY6vdDCC7zENfzE3bBcBTdxkgPT+R+t0Mq6fK6dr4g0sT4HroNT5hNLHs53KX7hKPd6Kp+kGj7wL/VB757Lf47O5A9R9prwUfo1FS464HljaDSos01kWbxtmvBNpIcqaP0aJuPk9BXH1p2diEBgOEWwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928014566877.1788687064802; Sun, 9 Jul 2023 11:40:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEN-0005q9-3g; Sun, 09 Jul 2023 14:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004ef-S7 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE7-0004Ji-QD for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc59de0e2so39224275e9.3 for ; Sun, 09 Jul 2023 11:33:41 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927620; x=1691519620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=bWpCwr6oIeaRCR3Ljp5v3nPuvlCaD/jzUjNqgX71QHYBMq46PU2JuphL67Oz9eG+vH zVpSM3rAzArFaDZ9m+94SIgvLZS/YQYvBDOjfSzgpktizCpRmrCddd3eQUwensory+MN lFAza014Hzc1tnmVfQyrSM4Kd6tcI8e9zv2bNd/x91JIkl7XCuxXlkwGCvaAPxa98EDb Ag5/PbjIev+XMH7tsvC1WIXZuwLqJq5+cGfx9BOgWKI4FV18eCpQ5/6BaDeWXZau26jh +qGf0qmFOsaQZq435z7EC5yWjX8xWmjt8wyr/EF51Gvva6pgifU7g1nhIKsR9G+U+QIG q/BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927620; x=1691519620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PG65sHHMcFZxBzSd8xJSgpPdsxuZoeu52o+OB1adTRg=; b=fdFOQVCb9fHzpc+P6bjM0QLvtVllJxNdRa0hT5cjfbNpPHjc8zldBGpbiwNqLrRzcF +/lf+ggE/+GkKBMh4eEwUSdNm2jIFcqpR89j+be+yC7UbF0I+gvcnyeNNgCSlmpBS+La u4DVjDQICSzTQq9r2Pbw+5GIbR5gofg1WCqlJKQg0JzNuxkFYs4UifwmlakVBXjyQeBf GWCE8sgvHMemfXQFPHKyvt+ll0hkaMPfS6c9fPAS2wntR8n7A3PrcJIMOoGvDmd1LJel M6XCb3i0THPFSUVGIJZ/9IOFPNVchKx6Cw7sbPe3fiwsWgmq0Idra93aHTZjJsCb0A8M 39UQ== X-Gm-Message-State: ABy/qLYtN47WXKm57nbg3jh9b0N7vw/92CLLQ3xYrrxfaLrI+QkoI8MS 015oktLccEXzGowiLiWOzR/C9CPwDGXXll048V1Pmg== X-Google-Smtp-Source: APBJJlGAJMcgwp5FHZV0xgXEBkha/Xvi2D3OoLCZySTPTTho9zmRRvlyGCmm+8oLSxb48bXH+6tRcw== X-Received: by 2002:a1c:7416:0:b0:3fc:27:7e46 with SMTP id p22-20020a1c7416000000b003fc00277e46mr6260858wmc.3.1688927620257; Sun, 09 Jul 2023 11:33:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 38/45] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap Date: Sun, 9 Jul 2023 19:29:27 +0100 Message-Id: <20230709182934.309468-76-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928016725100001 Content-Type: text/plain; charset="utf-8" If !reserved_va, munmap instead and assert success. Update all callers. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-22-richard.henderson@linaro.org> --- linux-user/mmap.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 6308787942..22c2869be8 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -722,14 +722,14 @@ fail: return -1; } =20 -static void mmap_reserve(abi_ulong start, abi_ulong len) +static void mmap_reserve_or_unmap(abi_ulong start, abi_ulong len) { abi_ulong real_start; abi_ulong real_last; abi_ulong real_len; abi_ulong last; abi_ulong a; - void *host_start, *ptr; + void *host_start; int prot; =20 last =3D start + len - 1; @@ -776,9 +776,15 @@ static void mmap_reserve(abi_ulong start, abi_ulong le= n) real_len =3D real_last - real_start + 1; host_start =3D g2h_untagged(real_start); =20 - ptr =3D mmap(host_start, real_len, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1= , 0); - assert(ptr =3D=3D host_start); + if (reserved_va) { + void *ptr =3D mmap(host_start, real_len, PROT_NONE, + MAP_FIXED | MAP_ANONYMOUS + | MAP_PRIVATE | MAP_NORESERVE, -1, 0); + assert(ptr =3D=3D host_start); + } else { + int ret =3D munmap(host_start, real_len); + assert(ret =3D=3D 0); + } } =20 int target_munmap(abi_ulong start, abi_ulong len) @@ -830,11 +836,7 @@ int target_munmap(abi_ulong start, abi_ulong len) ret =3D 0; /* unmap what we can */ if (real_start < real_end) { - if (reserved_va) { - mmap_reserve(real_start, real_end - real_start); - } else { - ret =3D munmap(g2h_untagged(real_start), real_end - real_start= ); - } + mmap_reserve_or_unmap(real_start, real_end - real_start); } =20 if (ret =3D=3D 0) { @@ -871,7 +873,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_size, * If new and old addresses overlap then the above mremap will * already have failed with EINVAL. */ - mmap_reserve(old_addr, old_size); + mmap_reserve_or_unmap(old_addr, old_size); } } else if (flags & MREMAP_MAYMOVE) { abi_ulong mmap_start; @@ -886,7 +888,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_size, flags | MREMAP_FIXED, g2h_untagged(mmap_start)); if (reserved_va) { - mmap_reserve(old_addr, old_size); + mmap_reserve_or_unmap(old_addr, old_size); } } } else { @@ -912,7 +914,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong ol= d_size, errno =3D ENOMEM; host_addr =3D MAP_FAILED; } else if (reserved_va && old_size > new_size) { - mmap_reserve(old_addr + old_size, old_size - new_size); + mmap_reserve_or_unmap(old_addr + old_size, + old_size - new_size); } } } else { --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928271; cv=none; d=zohomail.com; s=zohoarc; b=myge+QCf+95twh/Py3N08u6P0/rEIB1m0gMRp2Vdi9kTs1A3fA4v1njF3c3oV6MYEb69tl9snG3kWfZFsrNhU/PG2h9zNd/Emta7vV9nq7KrH5prCuZ4tDg7YoSk7w4kd6O3mWCYQPEbOT4ylo+nr+kRAuzDSxVYZxydq7yScys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928271; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=VpGTa9lAeLawZp7CpEW8FEjRj5KfKeHuM3Qld0KNTA2fOIRo4GGhvvi27LRZdRFxvlJ83yxeD+Lv7VVF7kaBmVgj4BoEHisoHr1soVISQuzy9eAvD1YNLHk3tJnBVQlJdcRs6x+dKWzkhVc9Ts8qKQkSnBXZRAwF7pQtklPblN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928271758186.08121844375705; Sun, 9 Jul 2023 11:44:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEM-0005pY-B6; Sun, 09 Jul 2023 14:33:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004ea-Ru for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE7-0004Jn-Qb for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fc0aecf107so8739125e9.2 for ; Sun, 09 Jul 2023 11:33:41 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927621; x=1691519621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=kQaUVUPQHaIfuWMdM6KPEnpd41H8weDogiYdg+ahuQs3fuP763VCmoofEAwrGNDZgU ClaVUgb7o3nX8Wq6TyTLefd68wl3OMFnhGtaX6OakKTb/BEgXjf2DzYr2s5wrcDbl5Ef KsrY7ehB00eBo2Waagk7yWeRBdi7X0824QYRBNh2iAGTxschPplO3hrvTFupOy6tVYeq uRwPBWQ1Tg1AwahAycLribuuWRmWI08vXyggTExjL8YmSH9VsZxBS5HW/+RHpktQRtT0 Y4znok1w5Sl/ssuGasaIX04B2lurqO55J9RTupe523r8LAPilc31F0lsUF+bsnRrIbdf c0pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927621; x=1691519621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t83L6VQqehKor298fA996V/rrvqxT+XEe+3FbTWkw4k=; b=V44QD8Fskcdkl0jLKHgIOPvCe0wsSyAsqTh+0POv1WA0Cju1lFVVD36Wy6DU77PeQd QKAckZb4sgHM5fC/osATRSH6ojIW1N/lk85gbCCO/L+sVpcqy7xLbg7e60v20E20RHF6 2xOSemy71cIxljU9kJ1K5/xCDo9NL9Yi/dfNBJc6GInMPIJ9YPmzvxsni69v5KwLTxhl CiKzXF6hhTqtWc/pFn7dl/lxvq+xCsPO8n744GtlV8rURO6Cd+91cFTiV5rtdQM+skUn 5zW2AMNmxgSr3G/eiM9Lr+O9lDhfZ/ewANrIAvUxt1s9GvaMOQOhu5hvO8VunhERgija C5NA== X-Gm-Message-State: ABy/qLYOr/bq7XnOC7jg2IvTC49STE+HpX/IwVT2pSVpMMPw5nhj0T1n p/vMxHVSFlJtdFyamRwR2ObJpGrrSM0IliECvd45zg== X-Google-Smtp-Source: APBJJlFGPnkG9jnMB62fakJYv2KbwyezP1/rAIco1iLmgsS/SQS2Up4zmrHL3n/wGsmMO4185Vjttw== X-Received: by 2002:a7b:c8cd:0:b0:3fc:5d2:1f47 with SMTP id f13-20020a7bc8cd000000b003fc05d21f47mr3988040wml.20.1688927620957; Sun, 09 Jul 2023 11:33:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 39/45] linux-user: Simplify target_munmap Date: Sun, 9 Jul 2023 19:29:28 +0100 Message-Id: <20230709182934.309468-77-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928272286100015 Content-Type: text/plain; charset="utf-8" All of the guest to host page adjustment is handled by mmap_reserve_or_unmap; there is no need to duplicate that. There are no failure modes for munmap after alignment and guest address range have been validated. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-23-richard.henderson@linaro.org> --- linux-user/mmap.c | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 22c2869be8..c0946322fb 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -789,9 +789,6 @@ static void mmap_reserve_or_unmap(abi_ulong start, abi_= ulong len) =20 int target_munmap(abi_ulong start, abi_ulong len) { - abi_ulong end, real_start, real_end, addr; - int prot, ret; - trace_target_munmap(start, len); =20 if (start & ~TARGET_PAGE_MASK) { @@ -803,47 +800,11 @@ int target_munmap(abi_ulong start, abi_ulong len) } =20 mmap_lock(); - end =3D start + len; - real_start =3D start & qemu_host_page_mask; - real_end =3D HOST_PAGE_ALIGN(end); - - if (start > real_start) { - /* handle host page containing start */ - prot =3D 0; - for (addr =3D real_start; addr < start; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - if (real_end =3D=3D real_start + qemu_host_page_size) { - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE= ) { - prot |=3D page_get_flags(addr); - } - end =3D real_end; - } - if (prot !=3D 0) { - real_start +=3D qemu_host_page_size; - } - } - if (end < real_end) { - prot =3D 0; - for (addr =3D end; addr < real_end; addr +=3D TARGET_PAGE_SIZE) { - prot |=3D page_get_flags(addr); - } - if (prot !=3D 0) { - real_end -=3D qemu_host_page_size; - } - } - - ret =3D 0; - /* unmap what we can */ - if (real_start < real_end) { - mmap_reserve_or_unmap(real_start, real_end - real_start); - } - - if (ret =3D=3D 0) { - page_set_flags(start, start + len - 1, 0); - } + mmap_reserve_or_unmap(start, len); + page_set_flags(start, start + len - 1, 0); mmap_unlock(); - return ret; + + return 0; } =20 abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928196; cv=none; d=zohomail.com; s=zohoarc; b=k1ReuDKlcFK4c56d/WLyQ0NGyYfll3fDSTB6Uw2zk5qFjvSAv53OB1erBDeoB6Ogymw0NLjHWDFECxpfBy8COJV8OmRTeuNpDIeheg+RprkPEQ7N8mzSygRlZpTSZb7l+pWVCAzySXIh5Kic7W/4QFwhyg1BikkxSSCLGG0sEog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928196; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=eESjpgTmZvcGsfL/dayIYkzzUJrJaL0uccI7XZaLzjoAP/IocszUCDRRiYkUq6STmTFoIipfjKvl+VH4erp4fZqAOfFR0IdjyExzjpB8uwLLRq7PXfnYNHsfrwS0j3BXewyoK/otM8486JgFHNfkHgwfpVcIFVFo26q8UbAsiV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928196033538.3764861109386; Sun, 9 Jul 2023 11:43:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEE-0005BQ-CD; Sun, 09 Jul 2023 14:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZE9-0004QN-9L for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:45 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE7-0004Js-Pm for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:44 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbca8935bfso37967655e9.3 for ; Sun, 09 Jul 2023 11:33:42 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927622; x=1691519622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=YH4bzitB7tbGEyrhunznqzVxTiIaWzTjoUq5WxnikLyFHp5Nihcv1GTLxBpptbXvWN mSG5fo6M1eUpbrm0xqoj8cMxGbLH9INnHzdZKB0ZrGxDoTDlHbkuG3uEQcCxMrR8ZVV8 +Cgr2eOzqA9V2O0FSMub7ZSsmz08L3d3ZlSz5vp5Ca3JOZ4qrwmfYSQSZEkPPtz1ahgC pGhj4jMdgkwxAB9I864M3Y/iqfIp9hrCeYrh4EGQjiyPhEjDAlwhwtvtzpdniqh6RrnM vvnmTmtZ9e+anvfi4FUs5JRInnZ17Yibpl6tuD8s02/9pR9gfu947i6bkmNo9gNQfHU+ drMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927622; x=1691519622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+u+6sqOJ5iK1/8L4kug7OWcFShgptBBIOzAjdLQUcYU=; b=gxjkZ0yVX+qBntNakuagerZmeC+WJxO+HWZH7uNq8v3IRv+250c2YbOJMy8UudC8s/ wv6A+fUmE+lTbkdeB1zoA+CX64RLWxF3/UAlGbWg3XOyWexOJU93H+0anQV1MsePfI5r K/u2sih0hGHRhqvwC0BQpzLfeLJbd1oLUFRTeDdTqzp4hPdxnhrtiIp/0jgdHTia4wc4 +uAm1CTVJSdOBGzNOhbNYozfrr4n3z7N+Xczjdbyhwn0wu0nKIiGTGpFF6Pn+ZO2+DWG gSH+vTrhFqcnxQHxIcEVUd5II74/7bFC7cnO+pPzQneVmgU2OerY40hYr4nO49DS1Y7k y29A== X-Gm-Message-State: ABy/qLZU1jCbNsYzHPa1xoQNCkqgXuuR6eBNv8+lvskPFBvqeDNGUIS4 b9Wlx5rGFo+JxhN8+JPL9oRagtLtXiCVJLfS0aNQjA== X-Google-Smtp-Source: APBJJlE0bGPtx7Hkvtk79HZDHlTmwhR9tSQquc/FBsUPFKZ3NmB2ElwinRUiCGJhYleXQMCbJ/RZzQ== X-Received: by 2002:a5d:4809:0:b0:314:3ad6:2327 with SMTP id l9-20020a5d4809000000b003143ad62327mr7584486wrq.12.1688927621850; Sun, 09 Jul 2023 11:33:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 40/45] accel/tcg: Accept more page flags in page_check_range Date: Sun, 9 Jul 2023 19:29:29 +0100 Message-Id: <20230709182934.309468-78-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928197797100006 Only PAGE_WRITE needs special attention, all others can be handled as we do for PAGE_READ. Adjust the mask. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230707204054.8792-24-richard.henderson@linaro.org> --- accel/tcg/user-exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index e4f9563730..1e8fcaf6b0 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -561,8 +561,8 @@ int page_check_range(target_ulong start, target_ulong l= en, int flags) } =20 missing =3D flags & ~p->flags; - if (missing & PAGE_READ) { - ret =3D -1; /* page not readable */ + if (missing & ~PAGE_WRITE) { + ret =3D -1; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927929; cv=none; d=zohomail.com; s=zohoarc; b=USWNUdl5YKKhvtLsn+duIH+4PUjaGYMQrFpsZ7lHcRhH1ZsJovCroYi3/Yxo7ZPLg412+6w1uhOudX8uK2kmNNvk3xkk1I9xJAfLJApGrrzYbVlsVB5HOrbY6ECU7PsaJKBTRyQ70HI16sOWAmKIzY/uueGRMKs1UVU+Mq1Q5Dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927929; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oeaMN26iaa0LPgHmrLDUb1dwvxX1dVRVMAoE87lDllw=; b=bsPYb+3Zy1tyhZoQD4Ya5GjkrSIeDQIsRuHw7gFJuptHumUxlKBKf46QTuMhi8Ifi83s0Knq2TaB6H1JMWyRH8GUSHGPRwA9DlHpSSH2kens4jsn+5065eKtWxRZuVk/QGnfxcuPKNTbh8fGoJXVa9Cu8B/J4Fym60NPSJIZp4g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927929973875.4600158229733; Sun, 9 Jul 2023 11:38:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEN-0005q5-1Y; Sun, 09 Jul 2023 14:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEC-0004uJ-Jg for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:48 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE8-0004Jz-RX for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:48 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbf7fbe722so43531365e9.3 for ; Sun, 09 Jul 2023 11:33:43 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927622; x=1691519622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oeaMN26iaa0LPgHmrLDUb1dwvxX1dVRVMAoE87lDllw=; b=d/4vCl7Knanzf6o+OPCn04YJWYaCWORWATUv54RhvszQ3C5TA/qIsJZimT9K2L++rg S7np8jaJmGb6U+Qfci7dvAKznisPiBmE4JUTE/B9bFM6snOulg7RrMWB9ESaWZWHbF8X YOC/+fm6Lh0RFmtRu0sjWAkjpWcDKjy9HoCjxS9Y3Yj59pBZp3RfOb6cqurycnFw2iJ7 3vzVmCWP72Au6hlcxHa0sdtliD/7qQgZWXMB8f2CLdByJTgGzqXEY+ZIbW6cPulZvcWK rCTLxKPsuvJBpFpXBck05XnnlzW6C0NfhMENIb30gjWi1i0bxpWEmtw/Uv9d037yWX/7 WmKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927622; x=1691519622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oeaMN26iaa0LPgHmrLDUb1dwvxX1dVRVMAoE87lDllw=; b=YRyaQD3dNM4Wo5u2NmiqlOeNdoX+mpvP2knwMsTjQbZw3tNaohMXh2xHPpP251mkQo jzkV21BHFLvfQwdPuE3P787zWdAYjNuCGL/9OUX/5kQyOXFjxEjSdtiBHcND58V528mX KwubcN3KVSG4h9w3CLOTLmDVwJiVVsI/GI+FSnxE+TDa1tKYFSgjBkiEv5l4D7Uy+XHO HxrNBjNsranH2zwBHFBVzTumSKifoSu4RWV5udCZ8G8cgTDbs2a2RIoqs/v6QfMZ3FQV aKdbms6tBKT2QzWW5OfXc3V9EL7wICONHsNpZnd5+K/9JXoTXqiEcTezPrRUvJLTmsXq FjWw== X-Gm-Message-State: ABy/qLZz8ExEF//re8nnZtkCdWaovReAQ3iFiHVonHlapfE/9LH7EkqV FYLcjKFStBn59ItgVAlBgweUjLrJtSOBZHc2iCk/ew== X-Google-Smtp-Source: APBJJlHE9kUJe/Dgj5U7c6ghxTYFiW3ndAX1x4s0h0N2QqUcho3OwFc4daY+N/Z0CXFuKwI2DFTQRQ== X-Received: by 2002:adf:ee0c:0:b0:314:3997:530d with SMTP id y12-20020adfee0c000000b003143997530dmr13042027wrn.31.1688927622564; Sun, 09 Jul 2023 11:33:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 41/45] accel/tcg: Return bool from page_check_range Date: Sun, 9 Jul 2023 19:29:30 +0100 Message-Id: <20230709182934.309468-79-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927931662100001 Content-Type: text/plain; charset="utf-8" Replace the 0/-1 result with true/false. Invert the sense of the test of all callers. Document the function. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-25-richard.henderson@linaro.org> --- bsd-user/qemu.h | 2 +- include/exec/cpu-all.h | 13 ++++++++++++- linux-user/qemu.h | 2 +- accel/tcg/user-exec.c | 22 +++++++++++----------- linux-user/syscall.c | 2 +- target/hppa/op_helper.c | 2 +- target/riscv/vector_helper.c | 2 +- target/sparc/ldst_helper.c | 2 +- accel/tcg/ldst_atomicity.c.inc | 4 ++-- 9 files changed, 31 insertions(+), 20 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 41d84e0b81..edf9602f9b 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -267,7 +267,7 @@ abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg= 1, abi_long arg2); =20 static inline bool access_ok(int type, abi_ulong addr, abi_ulong size) { - return page_check_range((target_ulong)addr, size, type) =3D=3D 0; + return page_check_range((target_ulong)addr, size, type); } =20 /* diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index eb1c54701a..94f44f1f59 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -222,7 +222,18 @@ int walk_memory_regions(void *, walk_memory_regions_fn= ); int page_get_flags(target_ulong address); void page_set_flags(target_ulong start, target_ulong last, int flags); void page_reset_target_data(target_ulong start, target_ulong last); -int page_check_range(target_ulong start, target_ulong len, int flags); + +/** + * page_check_range + * @start: first byte of range + * @len: length of range + * @flags: flags required for each page + * + * Return true if every page in [@start, @start+@len) has @flags set. + * Return false if any page is unmapped. Thus testing flags =3D=3D 0 is + * equivalent to testing for flags =3D=3D PAGE_VALID. + */ +bool page_check_range(target_ulong start, target_ulong last, int flags); =20 /** * page_check_range_empty: diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 9b8e0860d7..802794db63 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -182,7 +182,7 @@ static inline bool access_ok_untagged(int type, abi_ulo= ng addr, abi_ulong size) : !guest_range_valid_untagged(addr, size)) { return false; } - return page_check_range((target_ulong)addr, size, type) =3D=3D 0; + return page_check_range((target_ulong)addr, size, type); } =20 static inline bool access_ok(CPUState *cpu, int type, diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 1e8fcaf6b0..df60c7d673 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -520,19 +520,19 @@ void page_set_flags(target_ulong start, target_ulong = last, int flags) } } =20 -int page_check_range(target_ulong start, target_ulong len, int flags) +bool page_check_range(target_ulong start, target_ulong len, int flags) { target_ulong last; int locked; /* tri-state: =3D0: unlocked, +1: global, -1: local */ - int ret; + bool ret; =20 if (len =3D=3D 0) { - return 0; /* trivial length */ + return true; /* trivial length */ } =20 last =3D start + len - 1; if (last < start) { - return -1; /* wrap around */ + return false; /* wrap around */ } =20 locked =3D have_mmap_lock(); @@ -551,33 +551,33 @@ int page_check_range(target_ulong start, target_ulong= len, int flags) p =3D pageflags_find(start, last); } if (!p) { - ret =3D -1; /* entire region invalid */ + ret =3D false; /* entire region invalid */ break; } } if (start < p->itree.start) { - ret =3D -1; /* initial bytes invalid */ + ret =3D false; /* initial bytes invalid */ break; } =20 missing =3D flags & ~p->flags; if (missing & ~PAGE_WRITE) { - ret =3D -1; /* page doesn't match */ + ret =3D false; /* page doesn't match */ break; } if (missing & PAGE_WRITE) { if (!(p->flags & PAGE_WRITE_ORG)) { - ret =3D -1; /* page not writable */ + ret =3D false; /* page not writable */ break; } /* Asking about writable, but has been protected: undo. */ if (!page_unprotect(start, 0)) { - ret =3D -1; + ret =3D false; break; } /* TODO: page_unprotect should take a range, not a single page= . */ if (last - start < TARGET_PAGE_SIZE) { - ret =3D 0; /* ok */ + ret =3D true; /* ok */ break; } start +=3D TARGET_PAGE_SIZE; @@ -585,7 +585,7 @@ int page_check_range(target_ulong start, target_ulong l= en, int flags) } =20 if (last <=3D p->itree.last) { - ret =3D 0; /* ok */ + ret =3D true; /* ok */ break; } start =3D p->itree.last + 1; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8a5a82fcec..5870eb84e5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8108,7 +8108,7 @@ static int open_self_maps_1(CPUArchState *cpu_env, in= t fd, bool smaps) max =3D h2g_valid(max - 1) ? max : (uintptr_t) g2h_untagged(GUEST_ADDR_MAX) + 1; =20 - if (page_check_range(h2g(min), max - min, flags) =3D=3D -1) { + if (!page_check_range(h2g(min), max - min, flags)) { continue; } =20 diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 32c27c66b2..f25a5a72aa 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -168,7 +168,7 @@ target_ureg HELPER(probe)(CPUHPPAState *env, target_ulo= ng addr, uint32_t level, uint32_t want) { #ifdef CONFIG_USER_ONLY - return (page_check_range(addr, 1, want) =3D=3D 0) ? 1 : 0; + return page_check_range(addr, 1, want); #else int prot, excp; hwaddr phys; diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c index 1e06e7447c..1f9549f168 100644 --- a/target/riscv/vector_helper.c +++ b/target/riscv/vector_helper.c @@ -583,7 +583,7 @@ vext_ldff(void *vd, void *v0, target_ulong base, cpu_mmu_index(env, false)); if (host) { #ifdef CONFIG_USER_ONLY - if (page_check_range(addr, offset, PAGE_READ) < 0) { + if (page_check_range(addr, offset, PAGE_READ)) { vl =3D i; goto ProbeSuccess; } diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index 981a47d8bb..78b03308ae 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1191,7 +1191,7 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulo= ng addr, case ASI_PNFL: /* Primary no-fault LE */ case ASI_SNF: /* Secondary no-fault */ case ASI_SNFL: /* Secondary no-fault LE */ - if (page_check_range(addr, size, PAGE_READ) =3D=3D -1) { + if (!page_check_range(addr, size, PAGE_READ)) { ret =3D 0; break; } diff --git a/accel/tcg/ldst_atomicity.c.inc b/accel/tcg/ldst_atomicity.c.inc index de70531a7a..4de0a80492 100644 --- a/accel/tcg/ldst_atomicity.c.inc +++ b/accel/tcg/ldst_atomicity.c.inc @@ -159,7 +159,7 @@ static uint64_t load_atomic8_or_exit(CPUArchState *env,= uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(pv), 8, PAGE_WRITE_ORG)) { uint64_t *p =3D __builtin_assume_aligned(pv, 8); return *p; } @@ -194,7 +194,7 @@ static Int128 load_atomic16_or_exit(CPUArchState *env, = uintptr_t ra, void *pv) * another process, because the fallback start_exclusive solution * provides no protection across processes. */ - if (!page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { + if (page_check_range(h2g(p), 16, PAGE_WRITE_ORG)) { return *p; } #endif --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688927738; cv=none; d=zohomail.com; s=zohoarc; b=F2Q/BhtpBMNeptv/xMimifKK95qKnBglmuak7H5uVm5VydbI8GPfplwogsO07BN1vKntAyA0KcKNKB3joFmDN02G1lFwdkn/7sUkwcP2CCNy1BtvplVB3IALqYAEwL9iTTpg0t3X1TgYQZgMGLdB2DdSvm0miPE9DV+8VCPKSL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688927738; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=bskGhNCO5r4nu0caxEsQHrR0/jOMzbyyKdsqyXKe9vnX0I84F0isVVgWsDlgLL7zN6djG7yJEyGrVlnNTHDDi61ie23nQxx9NP+pmLQu5LehMNjhLiArsyt+D+x19J5wltatTPAeLrHH2ZCT7NHFEDsxbanSN+mZovoNeSympW8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688927738022234.52722766696877; Sun, 9 Jul 2023 11:35:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZEG-0005TN-7z; Sun, 09 Jul 2023 14:33:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZEA-0004eg-Sd for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZE8-0004K5-KE for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:46 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-307d20548adso3709569f8f.0 for ; Sun, 09 Jul 2023 11:33:44 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927623; x=1691519623; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=mMoCMklIrOEVeo9gSyyjnpyAee6Tn3Zwd9lMS9f0NVqSbhQDLo1leNcYaVy7ES37TE nPFQBH4wuDkHZYxvdqd0SBNj6p0UdH3PMc9yZpnK5iLY+pRnzOYxlqXrJwyrBgiPjmmE u+f/CxM4aqDoL/CpjNbiBgP/R20At12TaKz6etgSGb5XaHwWU3bSx/oJJWH29NmElfvU nfp9j/J1E1PZXS5kzjl8cYiRg8xh1bRwqUmTxllDd3h3DxukZSIO0i6auuhvtPw3FYso QVB110MhdNSafXl9Q8/ghLixOfjO6MGimStFCZwGxiqihZvZiaBfLFCLpg20GK+vBZb3 UQAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927623; x=1691519623; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZRHsYp/A8D0Uk3Tfg/o0B0POYY0J/63KdYiHo0geXzY=; b=l8E5NL4S/vnxF98Bg0sEURmqp/gSd5QHfm4WaZ+qYLQ3M+OWlq4fFAKV5RJy4mS6Nd gz5kevU8/TJyO4xjXDExad5DZ2QbnlAW1B+GDT8zrOGK38fSwDg1Mfu7XIlMMgm3YdGr 89L5Sp8LvfUXbvwiBjorJV3O0wIPsJGilsUtwso5otX7ZozP6qX8nNTD0z9Upvibnd0+ UDxm2HjjyqP2xF6xLLGllFEK2Y7IM8Tt+xiCVAOSHS2gVhmP1QFTVZ3Yp5tKn8IEe/hl D8GYcbb9MwJ0yQu24hQuq/FH9nvoNiCPX/A2j7DRa8UMK1OBv3vN3Ap3baRKayJYzsjC ryfg== X-Gm-Message-State: ABy/qLaQ9aFKxlJhvivmnEBAZiArkeKnLZYjTTJt7nXe/B2XqLH+pS76 OrD6/QHm/4lFW7Sy4PSFpES+0cik5BCi5Q3SEkyvhg== X-Google-Smtp-Source: APBJJlGI1jtHHVZUiQz6y7gGUa+jJbJF5vwV9BQ+X79uZBkbdgAAejW+Tk4QVXHzOs07hYU1PrXTeg== X-Received: by 2002:a5d:5109:0:b0:314:dc0:73f1 with SMTP id s9-20020a5d5109000000b003140dc073f1mr8442169wrt.38.1688927623387; Sun, 09 Jul 2023 11:33:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 42/45] linux-user: Remove can_passthrough_madvise Date: Sun, 9 Jul 2023 19:29:31 +0100 Message-Id: <20230709182934.309468-80-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688927738742100001 Content-Type: text/plain; charset="utf-8" Use page_check_range instead, which uses the interval tree instead of checking each page individually. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-26-richard.henderson@linaro.org> --- linux-user/mmap.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c0946322fb..49cfa873e0 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -898,23 +898,6 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong o= ld_size, return new_addr; } =20 -static bool can_passthrough_madvise(abi_ulong start, abi_ulong end) -{ - ulong addr; - - if ((start | end) & ~qemu_host_page_mask) { - return false; - } - - for (addr =3D start; addr < end; addr +=3D TARGET_PAGE_SIZE) { - if (!(page_get_flags(addr) & PAGE_PASSTHROUGH)) { - return false; - } - } - - return true; -} - abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) { abi_ulong len, end; @@ -964,9 +947,8 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_= in, int advice) * * A straight passthrough for those may not be safe because qemu somet= imes * turns private file-backed mappings into anonymous mappings. - * can_passthrough_madvise() helps to check if a passthrough is possib= le by - * comparing mappings that are known to have the same semantics in the= host - * and the guest. In this case passthrough is safe. + * If all guest pages have PAGE_PASSTHROUGH set, mappings have the + * same semantics for the host as for the guest. * * We pass through MADV_WIPEONFORK and MADV_KEEPONFORK if possible and * return failure if not. @@ -984,7 +966,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_= in, int advice) ret =3D -EINVAL; /* fall through */ case MADV_DONTNEED: - if (can_passthrough_madvise(start, end)) { + if (page_check_range(start, len, PAGE_PASSTHROUGH)) { ret =3D get_errno(madvise(g2h_untagged(start), len, advice)); if ((advice =3D=3D MADV_DONTNEED) && (ret =3D=3D 0)) { page_reset_target_data(start, start + len - 1); --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928169; cv=none; d=zohomail.com; s=zohoarc; b=I+kC4WEH1AABFdSfh2AWwHwYIzizw5EPEzOT9LI1aLPaUMgNgi0z/jbIO0wuwjyxsp/rjN4Lv8DxuASEGMHl0xAYZnEogptCuEoKlYczQKdRQbX0sGiGPR3rAX8qA9U5qhSZLeF029pwv/B0g+8z5CaxXhpnmqKJEqBjhYZ2RcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=DflfRYvI7qaHRVb8OT53JndywwxgnsdOEvKv197AyPslfVgRREHuEfMljiGt/R/sVo0teBLxyRzGunrIV0onqkt+VKqDEBq0K+U/esIqhTHYJuzX9bMcl4+wKERJq+PMdcVtH1ZOa2VdPEJlZpS2Vd1Hjsj+9JgV0ZKnslDnPMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928169672224.11715459860534; Sun, 9 Jul 2023 11:42:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZHI-0003tU-Ri; Sun, 09 Jul 2023 14:37:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZH7-0003pg-Iw for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:50 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZH4-00051j-BJ for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:47 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fbc0609cd6so37270055e9.1 for ; Sun, 09 Jul 2023 11:36:45 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id i6-20020a5d6306000000b00313de682eb3sm9735832wru.65.2023.07.09.11.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927805; x=1691519805; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=POT/JoZrzkE6XvE3VWyv+BKAhZKWkHqbLjOAKAE/ZZ+pmGDcLSUgUevY47h8+fWOCT 4YWh71Gps1pvOn8bEnzbGXPif1FtW79MkyyAq0wIzCUD+gFSwNgsHIZZKHTOngK7mA4g 5xPjlJHOE2T5KVLyyb98R11yOnOTs7Yvbp0piYORFE1sw3qUvljXWl3l3IAstCGchzhI tNMwU5TEUkH/cSA7w71MJgg6eaWaApan25AAh6Z4F7UCLsNhBtE7LQJjCmtVm45Jvg4C qBR4b/vG+dHg7tTph6cV+zKJU935jJNz9MQ6RgsP/MnPSNfCyDDbNKCdfWAaZxkPbep+ PUUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927805; x=1691519805; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vXDNUHkoHKMJOTYkZxcm9eNGIwvNIgvNekBczYJkm1c=; b=G+grdaF63CLkeOKlxzRTlvMcWJruDFyKPkPnAaSMSiFhdKAoKwxvfzpuczJ1b49mGo Mrl82LhKlXTpWf7z8PjzNdq/aKYBv6EJST2NH/jT++0hfq9Fg6pzciNgUPM5JSaTY2oL 6EaHzEsLoytaSPy96hGYE9IxtD6bZTIKmTJof6+qnBrLvKR3pM3RubfWppae9yEhIk2y uI5GoBKGLJneHRK6ja5M9GvCcvoghXGKJrmgSD6yrQl6hrbVcThiWnFYKNSuP1JL6r/7 cDqeqY5V42hSriGIEcVativGV/G+xY8o4QGvoWIE/xKox6W8jbhq/hNrgBNWimxkeiAG NiAw== X-Gm-Message-State: ABy/qLZPFQUlVu9iVayyqC9Z/PP6J1LDrH6RD8/fSH8wnLW9TI6EhoV4 TxHCG++PUdflCBiE4UGEefLBEezG7xa3/ING+Xhm6Q== X-Google-Smtp-Source: APBJJlHO1by/DZRK25J0uqaET1lpMdefjunmbNhQZvN/If/4mrjXHeIyOkmz3hC9K6bn/aiMJ2hBdQ== X-Received: by 2002:a05:600c:286:b0:3fc:4e0:be97 with SMTP id 6-20020a05600c028600b003fc04e0be97mr2790670wmk.6.1688927804950; Sun, 09 Jul 2023 11:36:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH 43/45] linux-user: Simplify target_madvise Date: Sun, 9 Jul 2023 19:29:32 +0100 Message-Id: <20230709182934.309468-81-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928171009100009 Content-Type: text/plain; charset="utf-8" The trivial length 0 check can be moved up, simplifying some of the other cases. The end < start test is handled by guest_range_valid_untagged. Signed-off-by: Richard Henderson Message-Id: <20230707204054.8792-27-richard.henderson@linaro.org> --- linux-user/mmap.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 49cfa873e0..44b53bd446 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -900,28 +900,17 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong = old_size, =20 abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice) { - abi_ulong len, end; + abi_ulong len; int ret =3D 0; =20 if (start & ~TARGET_PAGE_MASK) { return -TARGET_EINVAL; } - len =3D TARGET_PAGE_ALIGN(len_in); - - if (len_in && !len) { - return -TARGET_EINVAL; - } - - end =3D start + len; - if (end < start) { - return -TARGET_EINVAL; - } - - if (end =3D=3D start) { + if (len_in =3D=3D 0) { return 0; } - - if (!guest_range_valid_untagged(start, len)) { + len =3D TARGET_PAGE_ALIGN(len_in); + if (len =3D=3D 0 || !guest_range_valid_untagged(start, len)) { return -TARGET_EINVAL; } =20 --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928269; cv=none; d=zohomail.com; s=zohoarc; b=JpJ5/8fgHH2V+fRdPjrlxGowiSVlbm+hDX7976KAOBc1ARjj61SKwWNXizILqqwmZJkU5A8VaLMY4gbhh7fYkyJViemqS/Dxfe3X2DC2tOKKKqL9z1ZkVwjy9h/ce1v3dYa3RXIHaMejlMyiTPpu4C0dScJgXogGo2V+eypDHv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928269; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I3ntvwGeIvPIaD5TgXh48cA42oiiDsy6pVSZ4qqqrPg=; b=QgAmkCtlDku+tNKOmVO3pv5EzZ2rpraEuQVIRVIq4KOWWBdZ56Hbp0VkkqyeZOGCdIoZ8mINbm2vt0GDPsCqTeCyYNJyBhLHevxAH2Mj7hOk4jFs7poBs0Wf/OCqcM3StywVe6IWXGzuoR4SapUsrh+ZhFm5iN3RGojJSVCQDIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928269701975.0974391505588; Sun, 9 Jul 2023 11:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZHM-00048Y-Dl; Sun, 09 Jul 2023 14:37:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZHA-0003q6-C8 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:52 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZH6-000520-DU for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:49 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fbc5d5742eso41929975e9.3 for ; Sun, 09 Jul 2023 11:36:47 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id i6-20020a5d6306000000b00313de682eb3sm9735832wru.65.2023.07.09.11.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927806; x=1691519806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I3ntvwGeIvPIaD5TgXh48cA42oiiDsy6pVSZ4qqqrPg=; b=I6RtJRlYfIX2gkBLiXywdeJkqegBhnkimgH/j7Ms9pzErqrTSoyCtQdhGubAIWGpx2 L65Kfi5PgggasHSKcQeOj/cNlkG7e6FlFmWDoZnqRjn+/w4qj6QXY5QlTyR4rbnNvm3i iqWTLwrpwV8jmhZjEIVJMLCyWdOrDs90gkPqLH9FMwpzGQTjvVcQwLG/TuL2GSCfu6UK q4d2UjvXHGKNsiaEwb4xX3UCsuTDn0FonPpBHvnEcxd6bMfBunmYLwDQVu+7CvVhbZ/E W1mOgNI4WMHx0WWl+dYrQmBmBUKpAc7Ho9ayy6NESTf0w4cxKpHbtm/V1N2C1T/GJ+7e imLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927806; x=1691519806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I3ntvwGeIvPIaD5TgXh48cA42oiiDsy6pVSZ4qqqrPg=; b=jAlNorE8BM2CuYVRrT0WoktKOgOAB2SBSqeALSXr25rPPNabcAPFFKBKrhtIFwLHq3 r/kqPhz/YR/gO+ZvLm4NUE4sNGz9HPQKzfqn2YCwbu5pxxHY3DyxYQhUxIlgfIgvee6z ZLH2kqOBr6v32GyWtDiiSX20KvA5LGpJCilkQnJOHpKf4tjL2e1sPtiishmWElNvi2QV XEmCGKBfu1op+aMd/cjyv1kFb1N5kcCxwlcsW2CvcyoY0kHDj1wlfvbZs5Fj3y9ZVjuV Aum8Z/gkHw53tKu2SaCKiQgpwLa3LTGc1lv2W+p1DAxaM+X1bPtczTVATyajtrw+NbhA rQ+w== X-Gm-Message-State: ABy/qLaLH9sT7/a/vMu/GFQsZEDSpV6HDaZzwJWccNPk660AM/+DHTuD 8YSqT2a4Www5ocKJWa+iKPzxX3YfxSa8naLElN3SbQ== X-Google-Smtp-Source: APBJJlEOID1psoLQlvGlcjBOGRrLEwhF4TgmdsBzr5OvU9gClbcFhWawjI+04p4AMWZEp6DW24xVmg== X-Received: by 2002:a1c:cc0d:0:b0:3fb:b1fd:4183 with SMTP id h13-20020a1ccc0d000000b003fbb1fd4183mr10007347wmb.12.1688927806067; Sun, 09 Jul 2023 11:36:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Juan Quintela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 44/45] linux-user: Drop uint and ulong Date: Sun, 9 Jul 2023 19:29:33 +0100 Message-Id: <20230709182934.309468-82-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928271982100011 From: Juan Quintela These are types not used anymore anywhere else. Signed-off-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: <20230511085056.13809-1-quintela@redhat.com> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5870eb84e5..d2d6cad59d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -309,16 +309,16 @@ _syscall0(int, sys_gettid) #endif =20 #if defined(TARGET_NR_getdents) && defined(EMULATE_GETDENTS_WITH_GETDENTS) -_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, = count); +_syscall3(int, sys_getdents, unsigned int, fd, struct linux_dirent *, dirp= , unsigned int, count); #endif #if (defined(TARGET_NR_getdents) && \ !defined(EMULATE_GETDENTS_WITH_GETDENTS)) || \ (defined(TARGET_NR_getdents64) && defined(__NR_getdents64)) -_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, ui= nt, count); +_syscall3(int, sys_getdents64, unsigned int, fd, struct linux_dirent64 *, = dirp, unsigned int, count); #endif #if defined(TARGET_NR__llseek) && defined(__NR_llseek) -_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); +_syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned lo= ng, lo, + loff_t *, res, unsigned int, wh); #endif _syscall3(int, sys_rt_sigqueueinfo, pid_t, pid, int, sig, siginfo_t *, uin= fo) _syscall4(int, sys_rt_tgsigqueueinfo, pid_t, pid, pid_t, tid, int, sig, --=20 2.34.1 From nobody Mon Feb 9 21:40:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688928269; cv=none; d=zohomail.com; s=zohoarc; b=aTxrBEMjWWpkBsgn7YaY0plDPBehp7xTUQPi/x095fXryhyallDKYpHF1iQNrTBWumgeF9YwcIxT1W7cDcvkArjMCZvou4UlJvXU1jten87eDCtjSWNTEMF3eH/WfaAV3nPK6Yb+EuRGo3zzzqu9fuzHSYT2faP5MzmqFsIB5M0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688928269; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=b9LuMYd95477+OXo1OAWP9AY4NBDJaRVHD5duuyt7VI=; b=aVPo/WLf8WuxCvNM64EQtlX2GsM803aj/MLcQ2xwXXrOjmWFYpztZUlpheI+idP4nWB++dxMX4BatiUModp520QWAi6SGhcYqA0qkB0UuxeSbsuqMoid9cqYiVxCmd9pGIBxuo4cfxCCCmGAx/d0W22wHlUTXtxXgswJ568ugWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688928269481248.48055485013242; Sun, 9 Jul 2023 11:44:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIZHM-00046Q-4H; Sun, 09 Jul 2023 14:37:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIZHB-0003qL-IA for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:53 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZH6-00052D-KR for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:36:51 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3fbc1218262so43742485e9.3 for ; Sun, 09 Jul 2023 11:36:47 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id i6-20020a5d6306000000b00313de682eb3sm9735832wru.65.2023.07.09.11.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927807; x=1691519807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b9LuMYd95477+OXo1OAWP9AY4NBDJaRVHD5duuyt7VI=; b=huI4hDVO5hshjqT2LARath/+I6pZftVoaugSK/rhSxnHRM7zemKSWfocNQ7QB0F/Fm B2M1mViDz/zTPzYWeMAJw6VYJ/Fw5cinVVobNvXX57b9TWbBZIuqD8WgQERI6joExRPV OzIFrQqXEgb+PJ++Q5pOV0lRkl1zdo+jwM+lfgGTQ/b0b3fFJyWKXSKxmByokj04oO8o uDn+2W0m0as8R0Vyzu8OwEWYJBOoHuSBh8WZfTuy7OVjLdVXhsYbUaXrsKn3zmPsLv1n 2mhWKcPmQq7SZdgHGSk5kWsAVKO1b4sScePvN53SPj3w8P9qo3V4f12D4J0e3AZAehNc pTbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927807; x=1691519807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b9LuMYd95477+OXo1OAWP9AY4NBDJaRVHD5duuyt7VI=; b=ElebTNRLuPF1unNXZvm7C0rtlLBeYx6dYbsydbT8A6X0JF9/9ImAfietUgFGAqHe9q no4iTNLS7P1+XE0UEr4IvYlnJiwCF4I3IdsVkm5hdn1tbln5vki9bffcPPKNtOfKUe6z YQZfso8TyoMo1IC4SYR88dPd1OKCeUSe9fksIPNDptQw863HsDS6YjC5KzCjEQ8F3Z1w Vu76z5baEflb+AOGgheObd18DFPz+l4VxZyL1WdjyugCLVH2jEbDTRb2LUVY2ukTDTfV +uXGNtBrK6NMaHhOB/+nfi1pRfju4qRwEsjWiyvz+D+hKlkqJMoebekvWdJ8tRXPwMfJ QlsA== X-Gm-Message-State: ABy/qLYW3YFVzyialv2DC8EYMj9jzhyu3gdHeLrzD53IV1j2VpIXk1AK MS4uSj+vUFDYUaHkvEPMFDZYjHNTMxymzSe2WTaAVg== X-Google-Smtp-Source: APBJJlH3IjDjBzMrOAHXvILToyXeTqnuKSfYW28ngUrdEVti5p2ooXCZpQY7yRYgzUeiit1apS5UkQ== X-Received: by 2002:a7b:cb8d:0:b0:3fc:b78:fec6 with SMTP id m13-20020a7bcb8d000000b003fc0b78fec6mr3007904wmi.7.1688927806941; Sun, 09 Jul 2023 11:36:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, Robbin Ehn , Palmer Dabbelt Subject: [PATCH 45/45] linux-user/riscv: Add syscall riscv_hwprobe Date: Sun, 9 Jul 2023 19:29:34 +0100 Message-Id: <20230709182934.309468-83-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688928270456100009 Content-Type: text/plain; charset="utf-8" From: Robbin Ehn This patch adds the new syscall for the "RISC-V Hardware Probing Interface" (https://docs.kernel.org/riscv/hwprobe.html). Signed-off-by: Robbin Ehn Reviewed-by: Palmer Dabbelt Message-Id: <7f8d733df6e9b6151e9efb843d55441348805e70.camel@rivosinc.com> Signed-off-by: Richard Henderson --- linux-user/riscv/syscall32_nr.h | 1 + linux-user/riscv/syscall64_nr.h | 1 + linux-user/syscall.c | 146 ++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) diff --git a/linux-user/riscv/syscall32_nr.h b/linux-user/riscv/syscall32_n= r.h index 1327d7dffa..412e58e5b2 100644 --- a/linux-user/riscv/syscall32_nr.h +++ b/linux-user/riscv/syscall32_nr.h @@ -228,6 +228,7 @@ #define TARGET_NR_accept4 242 #define TARGET_NR_arch_specific_syscall 244 #define TARGET_NR_riscv_flush_icache (TARGET_NR_arch_specific_syscall + 15) +#define TARGET_NR_riscv_hwprobe (TARGET_NR_arch_specific_syscall + 14) #define TARGET_NR_prlimit64 261 #define TARGET_NR_fanotify_init 262 #define TARGET_NR_fanotify_mark 263 diff --git a/linux-user/riscv/syscall64_nr.h b/linux-user/riscv/syscall64_n= r.h index 6659751933..29e1eb2075 100644 --- a/linux-user/riscv/syscall64_nr.h +++ b/linux-user/riscv/syscall64_nr.h @@ -251,6 +251,7 @@ #define TARGET_NR_recvmmsg 243 #define TARGET_NR_arch_specific_syscall 244 #define TARGET_NR_riscv_flush_icache (TARGET_NR_arch_specific_syscall + 15) +#define TARGET_NR_riscv_hwprobe (TARGET_NR_arch_specific_syscall + 14) #define TARGET_NR_wait4 260 #define TARGET_NR_prlimit64 261 #define TARGET_NR_fanotify_init 262 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d2d6cad59d..4e5ccd0886 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8989,6 +8989,147 @@ static int do_getdents64(abi_long dirfd, abi_long a= rg2, abi_long count) } #endif /* TARGET_NR_getdents64 */ =20 +#if defined(TARGET_NR_riscv_hwprobe) + +#define RISCV_HWPROBE_KEY_MVENDORID 0 +#define RISCV_HWPROBE_KEY_MARCHID 1 +#define RISCV_HWPROBE_KEY_MIMPID 2 + +#define RISCV_HWPROBE_KEY_BASE_BEHAVIOR 3 +#define RISCV_HWPROBE_BASE_BEHAVIOR_IMA (1 << 0) + +#define RISCV_HWPROBE_KEY_IMA_EXT_0 4 +#define RISCV_HWPROBE_IMA_FD (1 << 0) +#define RISCV_HWPROBE_IMA_C (1 << 1) + +#define RISCV_HWPROBE_KEY_CPUPERF_0 5 +#define RISCV_HWPROBE_MISALIGNED_UNKNOWN (0 << 0) +#define RISCV_HWPROBE_MISALIGNED_EMULATED (1 << 0) +#define RISCV_HWPROBE_MISALIGNED_SLOW (2 << 0) +#define RISCV_HWPROBE_MISALIGNED_FAST (3 << 0) +#define RISCV_HWPROBE_MISALIGNED_UNSUPPORTED (4 << 0) +#define RISCV_HWPROBE_MISALIGNED_MASK (7 << 0) + +struct riscv_hwprobe { + abi_llong key; + abi_ullong value; +}; + +static void risc_hwprobe_fill_pairs(CPURISCVState *env, + struct riscv_hwprobe *pair, + size_t pair_count) +{ + const RISCVCPUConfig *cfg =3D riscv_cpu_cfg(env); + + for (; pair_count > 0; pair_count--, pair++) { + abi_llong key; + abi_ullong value; + __put_user(0, &pair->value); + __get_user(key, &pair->key); + switch (key) { + case RISCV_HWPROBE_KEY_MVENDORID: + __put_user(cfg->mvendorid, &pair->value); + break; + case RISCV_HWPROBE_KEY_MARCHID: + __put_user(cfg->marchid, &pair->value); + break; + case RISCV_HWPROBE_KEY_MIMPID: + __put_user(cfg->mimpid, &pair->value); + break; + case RISCV_HWPROBE_KEY_BASE_BEHAVIOR: + value =3D riscv_has_ext(env, RVI) && + riscv_has_ext(env, RVM) && + riscv_has_ext(env, RVA) ? + RISCV_HWPROBE_BASE_BEHAVIOR_IMA : 0; + __put_user(value, &pair->value); + break; + case RISCV_HWPROBE_KEY_IMA_EXT_0: + value =3D riscv_has_ext(env, RVF) && + riscv_has_ext(env, RVD) ? + RISCV_HWPROBE_IMA_FD : 0; + value |=3D riscv_has_ext(env, RVC) ? + RISCV_HWPROBE_IMA_C : pair->value; + __put_user(value, &pair->value); + break; + case RISCV_HWPROBE_KEY_CPUPERF_0: + __put_user(RISCV_HWPROBE_MISALIGNED_FAST, &pair->value); + break; + default: + __put_user(-1, &pair->key); + break; + } + } +} + +static int cpu_set_valid(abi_long arg3, abi_long arg4) +{ + int ret, i, tmp; + size_t host_mask_size, target_mask_size; + unsigned long *host_mask; + + /* + * cpu_set_t represent CPU masks as bit masks of type unsigned long *. + * arg3 contains the cpu count. + */ + tmp =3D (8 * sizeof(abi_ulong)); + target_mask_size =3D ((arg3 + tmp - 1) / tmp) * sizeof(abi_ulong); + host_mask_size =3D (target_mask_size + (sizeof(*host_mask) - 1)) & + ~(sizeof(*host_mask) - 1); + + host_mask =3D alloca(host_mask_size); + + ret =3D target_to_host_cpu_mask(host_mask, host_mask_size, + arg4, target_mask_size); + if (ret !=3D 0) { + return ret; + } + + for (i =3D 0 ; i < host_mask_size / sizeof(*host_mask); i++) { + if (host_mask[i] !=3D 0) { + return 0; + } + } + return -TARGET_EINVAL; +} + +static abi_long do_riscv_hwprobe(CPUArchState *cpu_env, abi_long arg1, + abi_long arg2, abi_long arg3, + abi_long arg4, abi_long arg5) +{ + int ret; + struct riscv_hwprobe *host_pairs; + + /* flags must be 0 */ + if (arg5 !=3D 0) { + return -TARGET_EINVAL; + } + + /* check cpu_set */ + if (arg3 !=3D 0) { + ret =3D cpu_set_valid(arg3, arg4); + if (ret !=3D 0) { + return ret; + } + } else if (arg4 !=3D 0) { + return -TARGET_EINVAL; + } + + /* no pairs */ + if (arg2 =3D=3D 0) { + return 0; + } + + host_pairs =3D lock_user(VERIFY_WRITE, arg1, + sizeof(*host_pairs) * (size_t)arg2, 0); + if (host_pairs =3D=3D NULL) { + return -TARGET_EFAULT; + } + risc_hwprobe_fill_pairs(cpu_env, host_pairs, arg2); + unlock_user(host_pairs, arg1, sizeof(*host_pairs) * (size_t)arg2); + return 0; +} +#endif /* TARGET_NR_riscv_hwprobe */ + #if defined(TARGET_NR_pivot_root) && defined(__NR_pivot_root) _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) #endif @@ -13671,6 +13812,11 @@ static abi_long do_syscall1(CPUArchState *cpu_env,= int num, abi_long arg1, return ret; #endif =20 +#if defined(TARGET_NR_riscv_hwprobe) + case TARGET_NR_riscv_hwprobe: + return do_riscv_hwprobe(cpu_env, arg1, arg2, arg3, arg4, arg5); +#endif + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); return -TARGET_ENOSYS; --=20 2.34.1