From patchwork Mon May 15 14:32:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 681979 Delivered-To: patch@linaro.org Received: by 2002:adf:fd8f:0:0:0:0:0 with SMTP id d15csp1154323wrr; Mon, 15 May 2023 07:48:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7M0VjURdYEi+cRNIkq6TxigwAN7GoDKwJfq56lcXCGKL3Vo+06iYo822HCOktoPxJd1TTG X-Received: by 2002:a5d:6885:0:b0:306:373e:7b14 with SMTP id h5-20020a5d6885000000b00306373e7b14mr26449657wru.63.1684162099679; Mon, 15 May 2023 07:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684162099; cv=none; d=google.com; s=arc-20160816; b=nXcY2nAzVnZ4bIHezlZlICMlK6QTwz2T5Ft+yRkY+HKOvTvXnWnLTp6vbYgMrAU1gD Tv5FZAcJnhtzJo88AQNTYI/Pq3lCglrWY0baXsNgE6LGQgn9OiQ6umqS+CNgu9WVzYq2 GwXwcFOwFWFVNELig9tkZ8GNPxI6UrbQLfmUV9QFClR+chh9r3j9DPgbg5yCL1Pd0Kdf 69ryuReby9P86xP9lS3mtIGegiInQzDFc/n12KWPt4x0IsUjn1TUOqfvl03oPGoT0Oxi 8irrM4KM2yBHbVyow9Ps0TKWiEk/LzRihWAL8aDvmUgim+c+4spzLIyodcfRr2ZXwKOp EZaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C7A+mEX1ZrmjjLYqtzKZHi9DyEb4qEYbCIsoKmrRzio=; b=Ly+xfpVG193L0gDqwiRScf6NnLR1jFw9jz45jiD5vk9GhS8+KuV1yvW1U4jco+Cuxk EmnEzXqK+FJFKYBElnLoiLDko/GOY9epcbmwiycxVney9MmqJT8/TBPYlAz7XTYTWHT4 ZWAHZOhTM0PAk9leIBDIStDAE+2WKuRLJa7pNAsP1t67FCuMbfiyAtilnZA9kwws0TZ1 JjNw3HTLg5VZyOzcEbYJe4mVWH9pXPSSuC83aeR6pEMJ8ehWfIsB9P3Dh25Tc9nFcuZ/ FfU7/0VEWZx+vsyMMPZlD500ggFhVEO0YYMnm5nlJM/3B86t6Ijri43Ks/+WYLWn1z+l /dZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qx4vHVbi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n10-20020a5d484a000000b0030641171ee2si1225wrs.391.2023.05.15.07.48.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 May 2023 07:48:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qx4vHVbi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyZIf-0000d0-4D; Mon, 15 May 2023 10:35: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 1pyZHj-0007C6-Vy for qemu-devel@nongnu.org; Mon, 15 May 2023 10:34:50 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyZHc-00051t-D1 for qemu-devel@nongnu.org; Mon, 15 May 2023 10:34:46 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-24e09b4153eso8789301a91.2 for ; Mon, 15 May 2023 07:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684161221; x=1686753221; 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=C7A+mEX1ZrmjjLYqtzKZHi9DyEb4qEYbCIsoKmrRzio=; b=Qx4vHVbiUZILX0umSe3uJ//SoyiAOG2QS/k+csfwJlgO6E/jwDGcSvOOOYEhTcxepU NoIul6WxPoeKEK+8h+pRxVQtVC7EjN+hMMqqznWKTQtHzwsySZCcVmCmOyh9pGdtY0oi bztJ6KQJtKd6LAukLW9EB6D+4OsATa/GeLeP2Pf4tLzY8kdUIz5yBEr6T/FK/GBfTz3B yJpT8X5IhTYj3iNfeEpwpsO0fHr1S9fmP0A3osMPkiOqXWbivY2mjtdJVB0IyFK/OUJJ xUaQ7/JsYq6NMFd/buI6f/EtQgjKTqhsq9X8VCheSkj9WEqzlWl7zQXH6aE7YUODizzW fQAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684161221; x=1686753221; 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=C7A+mEX1ZrmjjLYqtzKZHi9DyEb4qEYbCIsoKmrRzio=; b=Y1wvAdZ9MksxeG2gUt5G2SSMEJy3rHb3uIUbhxWyNl06H65Eyf8humxbfmmyRc+O9R Ufkgd8iwuNpHNsGWyfK+M3t/gyoszW/W4FelFTqBblE09HyeA7UMzRsCrpZIkYacyFD/ h+IcHhsG6HRCtJA+eLfwIjuCHPIUhkrVXnwQs7qJUA3nVDPq70kyFSNvU+Xyw815fZJn x95Lv0LesJItUnoktu3rh3HSFYePYixGYTu8DrtDZnmXtbsP1m5NGiEUWs93jeoyeuOc TVkW3tcuwqAn2sSas2rXrFG1D3IzmdB5NKhBwLzinlevCE39O3P1MXTSbcccpcrvwmjc F5aQ== X-Gm-Message-State: AC+VfDwIXusQ1VeQ+Va/T+YQ6mwCj9ldzsVNst5a6yfmLSPXTl1/4fbW jrmGnNZkCwxr0tWkG079K2h12nrC/GqfmVbvcgI= X-Received: by 2002:a17:90b:4c06:b0:246:5f9e:e4cf with SMTP id na6-20020a17090b4c0600b002465f9ee4cfmr33500057pjb.43.1684161221380; Mon, 15 May 2023 07:33:41 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:9902:96ac:8d8c:4366]) by smtp.gmail.com with ESMTPSA id ik9-20020a170902ab0900b001ab0aec388bsm13694335plb.135.2023.05.15.07.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:33:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v5 31/54] tcg/loongarch64: Check the host supports unaligned accesses Date: Mon, 15 May 2023 07:32:50 -0700 Message-Id: <20230515143313.734053-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230515143313.734053-1-richard.henderson@linaro.org> References: <20230515143313.734053-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This should be true of all loongarch64 running Linux. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- tcg/loongarch64/tcg-target.c.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index e651ec5c71..33d8e67513 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -30,6 +30,7 @@ */ #include "../tcg-ldst.c.inc" +#include #ifdef CONFIG_DEBUG_TCG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { @@ -1674,6 +1675,14 @@ static void tcg_target_qemu_prologue(TCGContext *s) static void tcg_target_init(TCGContext *s) { + unsigned long hwcap = qemu_getauxval(AT_HWCAP); + + /* Server and desktop class cpus have UAL; embedded cpus do not. */ + if (!(hwcap & HWCAP_LOONGARCH_UAL)) { + error_report("TCG: unaligned access support required; exiting"); + exit(EXIT_FAILURE); + } + tcg_target_available_regs[TCG_TYPE_I32] = ALL_GENERAL_REGS; tcg_target_available_regs[TCG_TYPE_I64] = ALL_GENERAL_REGS;