From patchwork Mon Jul 4 09:33:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587105 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp644425map; Mon, 4 Jul 2022 02:35:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxbWVr71H6I8XEdja/kGlBxuH+WzsVhwpScBhEYwVPR8vWOLpo/C6g3tTTm2IVWanCgFNI X-Received: by 2002:a81:5c05:0:b0:31c:6154:edb1 with SMTP id q5-20020a815c05000000b0031c6154edb1mr17949734ywb.112.1656927333270; Mon, 04 Jul 2022 02:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927333; cv=none; d=google.com; s=arc-20160816; b=0H2rFHq9U4Kj20ZGCVPUZM8/RmR1hyzZooCNBXz6DLy8yLGZy79EKVDWH8MiwbbW+e 2Dt1AahZ8wOhXdkoToKI+48pk6gF5f8WwurZkc3sLkAcpG+LVWrLGFFhYxnqrQfPqNes I5BkAkQsH1WsNw0WOnJf/W1Pea31DabNUJSnqbRPsgB149NO14uTUnJdblNiriOhIf5+ ES8CcDlTV66yNfXLB1IPt+qnHorG0wrBcCW/c3e5RDQ8S3K7aCJ4qGo9zScZBdz2TX43 DoBiuTJqTG0fY9lOnpeV3kBFNZ/oucDYd5Q7ZZuD09+iJSVrUhX9WBlQcV8k1XPg0ThA kKtQ== 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=jfQQ/MNFWhWhCmZ0fDK6Z3yWGSF3sEm5B4lXRoyup6I=; b=TMcQ58NZjtai4hnxptjZNa2zuyqybm2IAHi36+Z6X3CPvOP8bav3bgYlCvv1a/Hquo WXPkZl9gvr3qh5C18601X2Hna8evTEn1cApAbS32vQ250DXCqUwtvXG660GSTpD581Ai jzl0qRxxrYzcSzMrHcczYJXKwwaxeo+V/qUh0DIFtRPLFOBOT3yc2owYKIy8cQl8jise NyzeC+9rEtXOGG12Sibrf+oYbjEwt1k8rlwfT2DFhmAeJKO0PRgdAfwJerrvB6Vjd47e PCKhoGeCjfOkpBMtIjQFpenlcoMsej28CS4kM+LeWIv9brVeXiNXDY3yXxYbzczdAS2L ltrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GPt4rEg+; 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 y190-20020a814bc7000000b0031c24cc29b6si18915153ywa.307.2022.07.04.02.35.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:35:33 -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=GPt4rEg+; 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]:55554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IUO-0008Kf-Gv for patch@linaro.org; Mon, 04 Jul 2022 05:35:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8IT3-0008Gz-4S for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:09 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46893) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8IT1-0004vt-Dg for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:08 -0400 Received: by mail-pl1-x62f.google.com with SMTP id l12so2730960plk.13 for ; Mon, 04 Jul 2022 02:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jfQQ/MNFWhWhCmZ0fDK6Z3yWGSF3sEm5B4lXRoyup6I=; b=GPt4rEg+016A0HCaWClohznDEoeMsgn82kpFDB4R4VqTIq1r/XlH1Gyo3nDpOBo6Dh eXsvUon5zGXYJZ6KtKMQc4FKUpWDgLV7QkdBwe5ybd2fJ3CPNRtaTMLRjo8M838NRqdv mBB6NVsbiGAi7G1UkVJnninHDpp8I9fhCM4swMnEbeqNKjVuTl/6I9L/CcaF97xZvxRl vXqFcrkWPBQULOHEKNgulHvm859vuix1UITs7OVOxwVx/wsiyCBJtNFNPdJW9fje+4ol Q8G2kdTknb2fbVTgFAM94iNiGBDLVv1MVMdQEqbCetKPH1N0m4O2LVFBKod8uXZlzGQQ oqDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jfQQ/MNFWhWhCmZ0fDK6Z3yWGSF3sEm5B4lXRoyup6I=; b=5gxqucRcnxX/SMLorY8HfJsPVFMN/7+famjA7V481eEn/FDdkUJtSxX3xLVS8+/pL8 P5oMhEYmpAPwKyPCj32Lpw6Nx/0+HUX79QqUtWXNbK6I375saBqMoHNUQB1aULZRBAoH jAXRpZynE6p+eq680Z87U5ksRpdu9tEN+eHM6pscipbRezu/oPNeie+B2asmAhHdcEPp exIf8AnKi2qgkSCPcXuyFb4gEQ66bPdeoKjnYy1oncnkvggsSIUbXLUVViG+AQOr3QKg iHfWn6Ihcwcxu1pKGNop9BYgYJU+4h655Y0/Cp1Rc7oQmX5CW/sl6HyX52EexY0u4s9K 0sdA== X-Gm-Message-State: AJIora+WBeEbmhq0NVd/Ejr1+qnKGF/Chfog2Jdt7SocBi3mN5Zd/SUC gsdgWH62ab1o/FRHNv6FSWAKGi0Vmx2XgqgC X-Received: by 2002:a17:90a:cf90:b0:1ef:87d5:4798 with SMTP id i16-20020a17090acf9000b001ef87d54798mr5180961pju.140.1656927245985; Mon, 04 Jul 2022 02:34:05 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , WANG Xuerui Subject: [PULL 01/23] linux-user: Add LoongArch generic header files Date: Mon, 4 Jul 2022 15:03:35 +0530 Message-Id: <20220704093357.983255-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao This includes: - sockbits.h - target_errno_defs.h - target_fcntl.h - termbits.h - target_resource.h - target_structs.h Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: WANG Xuerui Message-Id: <20220624031049.1716097-2-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/sockbits.h | 11 +++++++++++ linux-user/loongarch64/target_errno_defs.h | 12 ++++++++++++ linux-user/loongarch64/target_fcntl.h | 11 +++++++++++ linux-user/loongarch64/target_prctl.h | 1 + linux-user/loongarch64/target_resource.h | 11 +++++++++++ linux-user/loongarch64/target_structs.h | 11 +++++++++++ linux-user/loongarch64/termbits.h | 11 +++++++++++ 7 files changed, 68 insertions(+) create mode 100644 linux-user/loongarch64/sockbits.h create mode 100644 linux-user/loongarch64/target_errno_defs.h create mode 100644 linux-user/loongarch64/target_fcntl.h create mode 100644 linux-user/loongarch64/target_prctl.h create mode 100644 linux-user/loongarch64/target_resource.h create mode 100644 linux-user/loongarch64/target_structs.h create mode 100644 linux-user/loongarch64/termbits.h diff --git a/linux-user/loongarch64/sockbits.h b/linux-user/loongarch64/sockbits.h new file mode 100644 index 0000000000..1cffcae120 --- /dev/null +++ b/linux-user/loongarch64/sockbits.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_SOCKBITS_H +#define LOONGARCH_TARGET_SOCKBITS_H + +#include "../generic/sockbits.h" + +#endif diff --git a/linux-user/loongarch64/target_errno_defs.h b/linux-user/loongarch64/target_errno_defs.h new file mode 100644 index 0000000000..c198b8aca9 --- /dev/null +++ b/linux-user/loongarch64/target_errno_defs.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_ERRNO_DEFS_H +#define LOONGARCH_TARGET_ERRNO_DEFS_H + +/* Target uses generic errno */ +#include "../generic/target_errno_defs.h" + +#endif diff --git a/linux-user/loongarch64/target_fcntl.h b/linux-user/loongarch64/target_fcntl.h new file mode 100644 index 0000000000..99bf586854 --- /dev/null +++ b/linux-user/loongarch64/target_fcntl.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_FCNTL_H +#define LOONGARCH_TARGET_FCNTL_H + +#include "../generic/fcntl.h" + +#endif diff --git a/linux-user/loongarch64/target_prctl.h b/linux-user/loongarch64/target_prctl.h new file mode 100644 index 0000000000..eb53b31ad5 --- /dev/null +++ b/linux-user/loongarch64/target_prctl.h @@ -0,0 +1 @@ +/* No special prctl support required. */ diff --git a/linux-user/loongarch64/target_resource.h b/linux-user/loongarch64/target_resource.h new file mode 100644 index 0000000000..0f86bf24ee --- /dev/null +++ b/linux-user/loongarch64/target_resource.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_RESOURCE_H +#define LOONGARCH_TARGET_RESOURCE_H + +#include "../generic/target_resource.h" + +#endif diff --git a/linux-user/loongarch64/target_structs.h b/linux-user/loongarch64/target_structs.h new file mode 100644 index 0000000000..6041441e15 --- /dev/null +++ b/linux-user/loongarch64/target_structs.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_STRUCTS_H +#define LOONGARCH_TARGET_STRUCTS_H + +#include "../generic/target_structs.h" + +#endif diff --git a/linux-user/loongarch64/termbits.h b/linux-user/loongarch64/termbits.h new file mode 100644 index 0000000000..d425db8748 --- /dev/null +++ b/linux-user/loongarch64/termbits.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_TERMBITS_H +#define LOONGARCH_TARGET_TERMBITS_H + +#include "../generic/termbits.h" + +#endif From patchwork Mon Jul 4 09:33:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587108 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp644831map; Mon, 4 Jul 2022 02:36:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tr3VynPB2uWhLm4Rl0iHGtebLrzXtBTS1/ylysixEGYBgqTpNRZN0HVDjjbfBA/B9lLKq7 X-Received: by 2002:a05:6902:1c1:b0:669:3f6a:6d69 with SMTP id u1-20020a05690201c100b006693f6a6d69mr31385640ybh.33.1656927372229; Mon, 04 Jul 2022 02:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927372; cv=none; d=google.com; s=arc-20160816; b=ltk2cfneNuv4QCNWmL7Zni79QjttIG27UDK3v1iJ852MGi/s4Gc29otbedNBoKUeyA WQDgqeKIdkV0kXxBOYSdpR9Dgh7qOQ2dtxw/euUE1yjCDGPpmx4p5IbMTo8neN4wX270 VKaWmjHmriWQk3O2mYCMB7wf1HS1CWvFsWd8RpEHbvHjx/W7nW1eXvcRQ2k+S5DqUqZd wRht0Nqh0hpL0uUMEWh1vMRXHX2Hmv091q4UFa4y7ZBOzJnSeTKCFJI7kUsE4P8a+ZU+ FLUfa2ZtQTWnzxUB/SdLvY6cP9hcjA/K+Ytc9EbUdelajSa7j5vGALRSRvWqK0aNfcpW lWsw== 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=AUPE1C4HXl6AujPRUCwFngmcCgBSgGym03nofdyDOGU=; b=H9czwW6DtbE2WlK4bN6f/Y1H2cMGzucibxX89eZkUglld0nHYBTFWQkcroxE0kGIYF 217H1Dwyuzf13TxqOQmYE/QbNeTD6sGFCguy10AtT9I4WLGid0FB/GdmSaZY9NnVd12y DQhjNkwQNZHtGHoNl44P5EQu9445C7S5QYeRDN5Mx4LhSATTQpX5BThuSZ4ePAd7UNbN yy7rll270ysEePPzbie7tc5eKadyAC9bHo+7Yp7xGDO/Y13zQo8I80QLhE2RuQuPnUst R9pdJ0YxY2wu84283oXi7dFs/0D/w2Gu652GGGimgp4DPHOg3lft5abpWOZ2N0Ivzot9 evQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZLgX814+; 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 e11-20020a25b74b000000b0066cf504f751si33380178ybm.285.2022.07.04.02.36.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:36:12 -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=ZLgX814+; 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]:55986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IV1-0000Ak-Nt for patch@linaro.org; Mon, 04 Jul 2022 05:36:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8IT6-0008OP-Qf for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:12 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:45570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8IT4-0004wB-Ry for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:12 -0400 Received: by mail-pj1-x1036.google.com with SMTP id g20-20020a17090a579400b001ed52939d72so8993950pji.4 for ; Mon, 04 Jul 2022 02:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AUPE1C4HXl6AujPRUCwFngmcCgBSgGym03nofdyDOGU=; b=ZLgX814+p7UfUcBylR85a/nfYodQEk9Ur1JiEO+q4SDS5jCHHP48JpXJ6t9JHX85wM /1fc4p86ArgJHN1gaahnzjJYoa1lQXMVq7yCgcEpWJSj5U4nzAN3Cgvn2PoJaEBPNyiC lUIlloaEElcyFF31RSywuitor+6oCkzJH/F14x0Nm0QE5jisK8Js6DnS4X46G97QY6de AJ60kJHmIJJ4utG2uYe1POuddoCHvLI8zMTjqrIaeJq+dPRWjJvDz3KdTKaf6RQshKpx 7FiP25WTMTysxIwDaCl7z2V/Deh4W4dUeN7IsDDsBl3hnuv5AVLFFifRh5FN9DkUfPTL KprQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AUPE1C4HXl6AujPRUCwFngmcCgBSgGym03nofdyDOGU=; b=E0VKCccDjjO5ZogqORVsZBAPravo0sN49NunAuqacESetrSrfIIn5OevVpszC7i0DT EFmuYnDbafmPIAa8sVE2q0StiLzENdfWWoyfkdWJGjQSXYHQgBk2lotjFnabie+BEbT1 BkCzRv6c83xc7Dz7kWeXQn+9cjmp5+PXTpkmLAjbEiMewp/Nu/o6W9YaWQExJIS7NEED wmbMO0h7Rs2y/baM9vTSyzYATV9kyeL2EBgovqnUBjFGE+9rFc+BXC1K9Q/gHLm+MqDD pTrlhVW1llrrsBeFIllew/NxJ6QdDku8Hy7202b8A9T/iYQ9PqWeZfFrEcqAed0TjvML H7Jg== X-Gm-Message-State: AJIora+pmyA+X7xkntdLi/8Nk+vXVdVeS264R1F5sBkX4V0OwYEiHug1 BsAbP6TEQEJogsgV76asXidS27DFH84b8swI X-Received: by 2002:a17:902:e543:b0:16a:7d9e:6517 with SMTP id n3-20020a170902e54300b0016a7d9e6517mr34490867plf.151.1656927248963; Mon, 04 Jul 2022 02:34:08 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 02/23] linux-user: Add LoongArch signal support Date: Mon, 4 Jul 2022 15:03:36 +0530 Message-Id: <20220704093357.983255-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Message-Id: <20220624031049.1716097-3-gaosong@loongson.cn> [rth: Rework extctx frame allocation and locking; Properly read/write fcc from signal frame.] Signed-off-by: Richard Henderson --- linux-user/loongarch64/target_signal.h | 13 + linux-user/loongarch64/signal.c | 335 +++++++++++++++++++++++++ 2 files changed, 348 insertions(+) create mode 100644 linux-user/loongarch64/target_signal.h create mode 100644 linux-user/loongarch64/signal.c diff --git a/linux-user/loongarch64/target_signal.h b/linux-user/loongarch64/target_signal.h new file mode 100644 index 0000000000..ad3aaffcb4 --- /dev/null +++ b/linux-user/loongarch64/target_signal.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_SIGNAL_H +#define LOONGARCH_TARGET_SIGNAL_H + +#include "../generic/signal.h" + +#define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1 + +#endif /* LOONGARCH_TARGET_SIGNAL_H */ diff --git a/linux-user/loongarch64/signal.c b/linux-user/loongarch64/signal.c new file mode 100644 index 0000000000..65fd5f3857 --- /dev/null +++ b/linux-user/loongarch64/signal.c @@ -0,0 +1,335 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * LoongArch emulation of Linux signals + * + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#include "qemu/osdep.h" +#include "qemu.h" +#include "user-internals.h" +#include "signal-common.h" +#include "linux-user/trace.h" + +#include "target/loongarch/internals.h" + +/* FP context was used */ +#define SC_USED_FP (1 << 0) + +struct target_sigcontext { + uint64_t sc_pc; + uint64_t sc_regs[32]; + uint32_t sc_flags; + uint64_t sc_extcontext[0] QEMU_ALIGNED(16); +}; + + +#define FPU_CTX_MAGIC 0x46505501 +#define FPU_CTX_ALIGN 8 +struct target_fpu_context { + uint64_t regs[32]; + uint64_t fcc; + uint32_t fcsr; +} QEMU_ALIGNED(FPU_CTX_ALIGN); + +#define CONTEXT_INFO_ALIGN 16 +struct target_sctx_info { + uint32_t magic; + uint32_t size; + uint64_t padding; +} QEMU_ALIGNED(CONTEXT_INFO_ALIGN); + +struct target_ucontext { + abi_ulong tuc_flags; + abi_ptr tuc_link; + target_stack_t tuc_stack; + target_sigset_t tuc_sigmask; + uint8_t __unused[1024 / 8 - sizeof(target_sigset_t)]; + struct target_sigcontext tuc_mcontext; +}; + +struct target_rt_sigframe { + struct target_siginfo rs_info; + struct target_ucontext rs_uc; +}; + +/* + * These two structures are not present in guest memory, are private + * to the signal implementation, but are largely copied from the + * kernel's signal implementation. + */ +struct ctx_layout { + void *haddr; + abi_ptr gaddr; + unsigned int size; +}; + +struct extctx_layout { + unsigned int size; + unsigned int flags; + struct ctx_layout fpu; + struct ctx_layout end; +}; + +/* The kernel's sc_save_fcc macro is a sequence of MOVCF2GR+BSTRINS. */ +static uint64_t read_all_fcc(CPULoongArchState *env) +{ + uint64_t ret = 0; + + for (int i = 0; i < 8; ++i) { + ret |= (uint64_t)env->cf[i] << (i * 8); + } + + return ret; +} + +/* The kernel's sc_restore_fcc macro is a sequence of BSTRPICK+MOVGR2CF. */ +static void write_all_fcc(CPULoongArchState *env, uint64_t val) +{ + for (int i = 0; i < 8; ++i) { + env->cf[i] = (val >> (i * 8)) & 1; + } +} + +static abi_ptr extframe_alloc(struct extctx_layout *extctx, + struct ctx_layout *sctx, unsigned size, + unsigned align, abi_ptr orig_sp) +{ + abi_ptr sp = orig_sp; + + sp -= sizeof(struct target_sctx_info) + size; + align = MAX(align, CONTEXT_INFO_ALIGN); + sp = ROUND_DOWN(sp, align); + sctx->gaddr = sp; + + size = orig_sp - sp; + sctx->size = size; + extctx->size += size; + + return sp; +} + +static abi_ptr setup_extcontext(struct extctx_layout *extctx, abi_ptr sp) +{ + memset(extctx, 0, sizeof(struct extctx_layout)); + + /* Grow down, alloc "end" context info first. */ + sp = extframe_alloc(extctx, &extctx->end, 0, CONTEXT_INFO_ALIGN, sp); + + /* For qemu, there is no lazy fp context switch, so fp always present. */ + extctx->flags = SC_USED_FP; + sp = extframe_alloc(extctx, &extctx->fpu, + sizeof(struct target_rt_sigframe), FPU_CTX_ALIGN, sp); + + return sp; +} + +static void setup_sigframe(CPULoongArchState *env, + struct target_sigcontext *sc, + struct extctx_layout *extctx) +{ + struct target_sctx_info *info; + struct target_fpu_context *fpu_ctx; + int i; + + __put_user(extctx->flags, &sc->sc_flags); + __put_user(env->pc, &sc->sc_pc); + __put_user(0, &sc->sc_regs[0]); + for (i = 1; i < 32; ++i) { + __put_user(env->gpr[i], &sc->sc_regs[i]); + } + + /* + * Set fpu context + */ + info = extctx->fpu.haddr; + __put_user(FPU_CTX_MAGIC, &info->magic); + __put_user(extctx->fpu.size, &info->size); + + fpu_ctx = (struct target_fpu_context *)(info + 1); + for (i = 0; i < 32; ++i) { + __put_user(env->fpr[i], &fpu_ctx->regs[i]); + } + __put_user(read_all_fcc(env), &fpu_ctx->fcc); + __put_user(env->fcsr0, &fpu_ctx->fcsr); + + /* + * Set end context + */ + info = extctx->end.haddr; + __put_user(0, &info->magic); + __put_user(extctx->end.size, &info->size); +} + +static bool parse_extcontext(struct extctx_layout *extctx, abi_ptr frame) +{ + memset(extctx, 0, sizeof(*extctx)); + + while (1) { + uint32_t magic, size; + + if (get_user_u32(magic, frame) || get_user_u32(size, frame + 4)) { + return false; + } + + switch (magic) { + case 0: /* END */ + extctx->end.gaddr = frame; + extctx->end.size = size; + extctx->size += size; + return true; + + case FPU_CTX_MAGIC: + if (size < (sizeof(struct target_sctx_info) + + sizeof(struct target_fpu_context))) { + return false; + } + extctx->fpu.gaddr = frame; + extctx->fpu.size = size; + extctx->size += size; + break; + default: + return false; + } + + frame += size; + } +} + +static void restore_sigframe(CPULoongArchState *env, + struct target_sigcontext *sc, + struct extctx_layout *extctx) +{ + int i; + + __get_user(env->pc, &sc->sc_pc); + for (i = 1; i < 32; ++i) { + __get_user(env->gpr[i], &sc->sc_regs[i]); + } + + if (extctx->fpu.haddr) { + struct target_fpu_context *fpu_ctx = + extctx->fpu.haddr + sizeof(struct target_sctx_info); + uint64_t fcc; + + for (i = 0; i < 32; ++i) { + __get_user(env->fpr[i], &fpu_ctx->regs[i]); + } + __get_user(fcc, &fpu_ctx->fcc); + write_all_fcc(env, fcc); + __get_user(env->fcsr0, &fpu_ctx->fcsr); + restore_fp_status(env); + } +} + +/* + * Determine which stack to use. + */ +static abi_ptr get_sigframe(struct target_sigaction *ka, + CPULoongArchState *env, + struct extctx_layout *extctx) +{ + abi_ulong sp; + + sp = target_sigsp(get_sp_from_cpustate(env), ka); + sp = ROUND_DOWN(sp, 16); + sp = setup_extcontext(extctx, sp); + sp -= sizeof(struct target_rt_sigframe); + + assert(QEMU_IS_ALIGNED(sp, 16)); + + return sp; +} + +void setup_rt_frame(int sig, struct target_sigaction *ka, + target_siginfo_t *info, + target_sigset_t *set, CPULoongArchState *env) +{ + struct target_rt_sigframe *frame; + struct extctx_layout extctx; + abi_ptr frame_addr; + int i; + + frame_addr = get_sigframe(ka, env, &extctx); + trace_user_setup_rt_frame(env, frame_addr); + + frame = lock_user(VERIFY_WRITE, frame_addr, + sizeof(*frame) + extctx.size, 0); + if (!frame) { + force_sigsegv(sig); + return; + } + extctx.fpu.haddr = (void *)frame + (extctx.fpu.gaddr - frame_addr); + extctx.end.haddr = (void *)frame + (extctx.end.gaddr - frame_addr); + + tswap_siginfo(&frame->rs_info, info); + + __put_user(0, &frame->rs_uc.tuc_flags); + __put_user(0, &frame->rs_uc.tuc_link); + target_save_altstack(&frame->rs_uc.tuc_stack, env); + + setup_sigframe(env, &frame->rs_uc.tuc_mcontext, &extctx); + + for (i = 0; i < TARGET_NSIG_WORDS; i++) { + __put_user(set->sig[i], &frame->rs_uc.tuc_sigmask.sig[i]); + } + + env->gpr[4] = sig; + env->gpr[5] = frame_addr + offsetof(struct target_rt_sigframe, rs_info); + env->gpr[6] = frame_addr + offsetof(struct target_rt_sigframe, rs_uc); + env->gpr[3] = frame_addr; + env->gpr[1] = default_rt_sigreturn; + + env->pc = ka->_sa_handler; + unlock_user(frame, frame_addr, sizeof(*frame) + extctx.size); +} + +long do_rt_sigreturn(CPULoongArchState *env) +{ + struct target_rt_sigframe *frame; + struct extctx_layout extctx; + abi_ulong frame_addr; + sigset_t blocked; + + frame_addr = env->gpr[3]; + trace_user_do_rt_sigreturn(env, frame_addr); + + if (!parse_extcontext(&extctx, frame_addr + sizeof(*frame))) { + goto badframe; + } + + frame = lock_user(VERIFY_READ, frame_addr, + sizeof(*frame) + extctx.size, 1); + if (!frame) { + goto badframe; + } + if (extctx.fpu.gaddr) { + extctx.fpu.haddr = (void *)frame + (extctx.fpu.gaddr - frame_addr); + } + + target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask); + set_sigmask(&blocked); + + restore_sigframe(env, &frame->rs_uc.tuc_mcontext, &extctx); + + target_restore_altstack(&frame->rs_uc.tuc_stack, env); + + unlock_user(frame, frame_addr, 0); + return -QEMU_ESIGRETURN; + + badframe: + force_sig(TARGET_SIGSEGV); + return -QEMU_ESIGRETURN; +} + +void setup_sigtramp(abi_ulong sigtramp_page) +{ + uint32_t *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 8, 0); + assert(tramp != NULL); + + __put_user(0x03822c0b, tramp + 0); /* ori a7, zero, 0x8b */ + __put_user(0x002b0000, tramp + 1); /* syscall 0 */ + + default_rt_sigreturn = sigtramp_page; + unlock_user(tramp, sigtramp_page, 8); +} From patchwork Mon Jul 4 09:33:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587107 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp644787map; Mon, 4 Jul 2022 02:36:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tJMilDM2OGUlFbXQNwDPmaxSZ3QmrJDUd3OiXMQfIWFONEHp2WKd50oSAUg0vX81Pt/CIU X-Received: by 2002:a81:8a44:0:b0:31b:c2d1:43a4 with SMTP id a65-20020a818a44000000b0031bc2d143a4mr32561693ywg.387.1656927367750; Mon, 04 Jul 2022 02:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927367; cv=none; d=google.com; s=arc-20160816; b=nwZwn2AvnP8S9Asvc0Png+PbAXguvkP9Ukqs9fmMxhaoLyI1LxbufL5BVdLgmLT7XX iboKQvvJN/UzfrY2hp2o6HBCi0PBaOeQUKL/rl3nZpCyz1J1P7lk8ROjfOg5B0LEp7f/ v9cjg6H7CejifNneNdeynK5aPkGD01yPMeKGMeBAQVECjo+i71kvXnJDj5luNctVAh6r mJhbsbq4Xv5MuBbg2ejyI34pCtoBbXl75BuRt23a327vnEe4T7zLYjG+OzYaSSqMAWju 2zs9A5UlSo2AovxYJ1P25R7FNQ5BQSngAm4g4FGOTaLcAF4lCibHGCKT9cVG9xhWjleH 1pIw== 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=wdR2AdXYQcU9MB9eRdNwupFKlHHJUO4XdfGfsX7z9ZA=; b=lMPCXcagl11piKErsbubDfxUcEV7xPCz74eAS2BEem3kGHuj7v/Gk0aQxLu1MuWchT cgH+vOEJ5LVsXkY+NAxqrUCXowyv/m+0kk/Q3XuF74zInj3JXpQc5crRxuUJyoyjbrbT HBEToi/6+uFyHwfPDFbL/cIyZlaGLgeqO4at8neqZ2/5B0q8PiKfhwg2vaPBe1Cl9GgY iViDluy5MMZZA+oBuPvB4ecsmKxbQI8dCgKg8FwkRq3LuERYHHEGviL6HnSUwsMVpOwc NtwKY5wXoEREPhsqNr/eRaqWbXMy1aYykYYAOxDCXjmW84muc96+lVCmo0CH1vnXVW/w bvUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TfwS/Uso"; 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 w2-20020a05690210c200b00668a7a6108fsi34513377ybu.100.2022.07.04.02.36.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:36:07 -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="TfwS/Uso"; 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]:55912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IUx-00007m-83 for patch@linaro.org; Mon, 04 Jul 2022 05:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8IT9-0008Vo-2V for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:15 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:55230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8IT7-0004wK-DX for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:14 -0400 Received: by mail-pj1-x102d.google.com with SMTP id s21so4229855pjq.4 for ; Mon, 04 Jul 2022 02:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdR2AdXYQcU9MB9eRdNwupFKlHHJUO4XdfGfsX7z9ZA=; b=TfwS/UsoMCEpOkBy7afPC7UzceTeJa/3YpE8VzLntIebEN3wubGA0w9N+s9D/1OiYY TRByuQMJNfyJdkYCF79nV+cDp8PLwbPiTWh7Wta4Qw9Gh4AJbKgRRRFVbsz/s8sOr8vq 5ImeEILEfcWKfq9vQJXi1Fu88FzH/rS/c+yPI59pml88xTzsXo/wfSaEn152Xmq6/Xcn uuMoJE4NMR1a5Wloy/JyEhzn3PNkJOB774iCRr5la199Up4vOeVptJ4aaDXC3p7JUTE8 XKP1XaK4WZ0GhEv6kUKRsF8Yjk0uchcMrQBhERgh8qNz4SyeUEe12cu5Idb5EaCk1rx2 04JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdR2AdXYQcU9MB9eRdNwupFKlHHJUO4XdfGfsX7z9ZA=; b=VrvKakrJCVeHwO6cR5sgcOPwhP3oWDBa3IErpQ7R/hsx8Q01QZSr6xsrPKk6PLMbwW 60oAcN/oh+drfrVN2u5qqxu9fn1acvubBLnL/6iDr8lWrtT4H/FaN1pc5L8U53BPMMPr EZaErKtl+HGm8g5Gs5A12ttIvM7QfQLUlMTY/NutB68BIfU01Z6zne8pppQ5JV9/0Osl GY9Qzej4Z9PbFi1nOlB8A06z/vtzKzrGLPhilMW4Yz8+rdvYz5eISrQqvTbLl0UdJoqx MGORPX74BLGviZvGtSwqfI7Igti1Kqtp7u3YzUIf9se083+D2kwfqFdTwVbPEgzC6K1M g/Pg== X-Gm-Message-State: AJIora/+7Jwe1WaG4l1c1k/QvHeOWmx9U2BGou9Es00WI88kRn0/vy1K VJb2wZJm4bILG30mo9VJoMoU+xmJDPIySJkV X-Received: by 2002:a17:90b:180b:b0:1ed:27d3:988f with SMTP id lw11-20020a17090b180b00b001ed27d3988fmr35646457pjb.170.1656927252127; Mon, 04 Jul 2022 02:34:12 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/23] linux-user: Add LoongArch elf support Date: Mon, 4 Jul 2022 15:03:37 +0530 Message-Id: <20220704093357.983255-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220624031049.1716097-4-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/target_elf.h | 12 ++++ linux-user/elfload.c | 91 +++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 linux-user/loongarch64/target_elf.h diff --git a/linux-user/loongarch64/target_elf.h b/linux-user/loongarch64/target_elf.h new file mode 100644 index 0000000000..95c3f05a46 --- /dev/null +++ b/linux-user/loongarch64/target_elf.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_ELF_H +#define LOONGARCH_TARGET_ELF_H +static inline const char *cpu_get_model(uint32_t eflags) +{ + return "la464"; +} +#endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 163fc8a1ee..1de77c7959 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -922,6 +922,97 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUPPCState *en #endif +#ifdef TARGET_LOONGARCH64 + +#define ELF_START_MMAP 0x80000000 + +#define ELF_CLASS ELFCLASS64 +#define ELF_ARCH EM_LOONGARCH + +#define elf_check_arch(x) ((x) == EM_LOONGARCH) + +static inline void init_thread(struct target_pt_regs *regs, + struct image_info *infop) +{ + /*Set crmd PG,DA = 1,0 */ + regs->csr.crmd = 2 << 3; + regs->csr.era = infop->entry; + regs->regs[3] = infop->start_stack; +} + +/* See linux kernel: arch/loongarch/include/asm/elf.h */ +#define ELF_NREG 45 +typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; + +enum { + TARGET_EF_R0 = 0, + TARGET_EF_CSR_ERA = TARGET_EF_R0 + 33, + TARGET_EF_CSR_BADV = TARGET_EF_R0 + 34, +}; + +static void elf_core_copy_regs(target_elf_gregset_t *regs, + const CPULoongArchState *env) +{ + int i; + + (*regs)[TARGET_EF_R0] = 0; + + for (i = 1; i < ARRAY_SIZE(env->gpr); i++) { + (*regs)[TARGET_EF_R0 + i] = tswapreg(env->gpr[i]); + } + + (*regs)[TARGET_EF_CSR_ERA] = tswapreg(env->pc); + (*regs)[TARGET_EF_CSR_BADV] = tswapreg(env->CSR_BADV); +} + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#define ELF_HWCAP get_elf_hwcap() + +/* See arch/loongarch/include/uapi/asm/hwcap.h */ +enum { + HWCAP_LOONGARCH_CPUCFG = (1 << 0), + HWCAP_LOONGARCH_LAM = (1 << 1), + HWCAP_LOONGARCH_UAL = (1 << 2), + HWCAP_LOONGARCH_FPU = (1 << 3), + HWCAP_LOONGARCH_LSX = (1 << 4), + HWCAP_LOONGARCH_LASX = (1 << 5), + HWCAP_LOONGARCH_CRC32 = (1 << 6), + HWCAP_LOONGARCH_COMPLEX = (1 << 7), + HWCAP_LOONGARCH_CRYPTO = (1 << 8), + HWCAP_LOONGARCH_LVZ = (1 << 9), + HWCAP_LOONGARCH_LBT_X86 = (1 << 10), + HWCAP_LOONGARCH_LBT_ARM = (1 << 11), + HWCAP_LOONGARCH_LBT_MIPS = (1 << 12), +}; + +static uint32_t get_elf_hwcap(void) +{ + LoongArchCPU *cpu = LOONGARCH_CPU(thread_cpu); + uint32_t hwcaps = 0; + + hwcaps |= HWCAP_LOONGARCH_CRC32; + + if (FIELD_EX32(cpu->env.cpucfg[1], CPUCFG1, UAL)) { + hwcaps |= HWCAP_LOONGARCH_UAL; + } + + if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, FP)) { + hwcaps |= HWCAP_LOONGARCH_FPU; + } + + if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LAM)) { + hwcaps |= HWCAP_LOONGARCH_LAM; + } + + return hwcaps; +} + +#define ELF_PLATFORM "loongarch" + +#endif /* TARGET_LOONGARCH64 */ + #ifdef TARGET_MIPS #define ELF_START_MMAP 0x80000000 From patchwork Mon Jul 4 09:33:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587109 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp646532map; Mon, 4 Jul 2022 02:39:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLuFsj+fY9rIKSQhi8rKRVcwphjmjGCuft1EXFLD5hG6vawtNzIHJLalS0x0XuSDY5YxkR X-Received: by 2002:a25:1183:0:b0:66d:4690:418e with SMTP id 125-20020a251183000000b0066d4690418emr29679561ybr.268.1656927543058; Mon, 04 Jul 2022 02:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927543; cv=none; d=google.com; s=arc-20160816; b=WrHI4Zz2so3c56TwVEl7KWIv3Fu4rtQONyJ+qvnfqGIydiTOY6CsctJp2JlXV2B8uy jcgXucRnI4A1bfmVeSA5vvg6+JLEcbQ8mKC/ntFli5wRh6k/6fsN2eOGkwwnar079uGG IQVLKiFW3byKBXGVUh4NX3xhHTTZJ9DVv1bjpPN4CVxZTyryh8Dc9UbnXidobOIT+3UM Yj2aLw6bR2l8jLjUbWeNCd3P1EFiHka4Q1D2c4CenRn0hYZHJPeghp9vp99ov/Yr1DbT xNAxDF+8yp5C6CsMQyutjf6bruSfMns825FlKLpkm4JE77mnxvnVeWkLPNYw6MwzQGp7 XwIQ== 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=xN+6s06civR9FB/frcDV6ntpWJlUKq0c4WMTdJ5r+ac=; b=dHnLrGPiejruEGkxrjG6t4T2kHfn27cOlxKH3JLbdNICB1m3gd+YbfHz0RgY1gO0KF NS+Eu4hRBhTi3Mym7q30L7jAnKgEwe5mjOuE2xEuvLOS35H5FN1QpH0pvj8+5ELJXTRZ c2ZiiLz6+gSvbcHQZYRzPqg5ZiZGgQoTmmRNnMHz5O9AM5w8xHfV5jfwG0tc9wmBGOVn ThSkGo7MNKkZzQnsrGP9XdieZXRwHDhvipdKeFf2xy3ioAbO9Tw3+9yTSYNLS2hgY2sk AoWC3COSJ/rsU+OW6lGqAZieDYyBbDXDWznfjrLsbAAeFpRlQWEba57IYTdKC9ye7Xkh 7NYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o+ne66/m"; 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 8-20020a810a08000000b00317b127c735si38800062ywk.50.2022.07.04.02.39.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:39:03 -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="o+ne66/m"; 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]:35738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IXm-0005mC-Gs for patch@linaro.org; Mon, 04 Jul 2022 05:39:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITE-0000Fs-06 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:20 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:45045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITB-0004wm-KS for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:19 -0400 Received: by mail-pf1-x42e.google.com with SMTP id 65so8442109pfw.11 for ; Mon, 04 Jul 2022 02:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xN+6s06civR9FB/frcDV6ntpWJlUKq0c4WMTdJ5r+ac=; b=o+ne66/mn8VTA8JdpD3J1JamriPB9UBEKZvMk26cbmNT7Hcu0uCs7jiFwfLhWZhl+K NaM3LRO0u7d3uHigrD19W/qYPUERWvsfeNGoSmJrJHXRDmeY5/UlcIu+DnyNCq2tFznB 2KGa1nH/wEx+titYndFDGK+CEkBht6GPryoyrhTEOV5ComJStIBngdklLphzHntIHMvn bG7lbEQpsJyncBzjA85B/rEYLic0WhlYpMNZzKJnW3D8HQLcQ2TSQ8eIWAqKPfzyAHYT siCtZllXqG4FIlta9EB46kcKptGHNYP/ThYo997ocoTtvOli5UH2e5Dhc5geAm18hKY+ xBdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xN+6s06civR9FB/frcDV6ntpWJlUKq0c4WMTdJ5r+ac=; b=iY2MtrMcs6YyxIJGc3biIQFaoqKYFUSGOrm2P8T6yx1rX/SNv52f7pf9jw+yBqJB3a 09lytcHiburpTyMPYZ19W2kAwlV6+5mcFyDKdpFbrT+j0BR4EiXCsY8x0J5mugDkr3JY 1a6tFYRPOGW+fdAuuuvQmwvq3BHmvYM0ERYAztD3em83xLFc2zHvSVNG5Ff+4Ayn5uec xHe3bnWDKFd6sGLhPaRn37b4JOUGgPyvPoiMmRk6PdcIa0b40ozvV/gYuhj5xE/oxheq 7V1qcgO1iPajM0MHvTXQVsLdT7nxFZCY8TqJ6M5Pb1S+hl++MU++iNbv/U5upt3hH70u FWpQ== X-Gm-Message-State: AJIora/BQH5pkRMyeq5c1GHR9JHJqPD7djuADjSpYNdqG+5dPXEdYftN fMRFzbcL7aY4dy9lWjUkialEEx7v+rYAVfOT X-Received: by 2002:a05:6a00:150a:b0:525:3030:fe41 with SMTP id q10-20020a056a00150a00b005253030fe41mr35600766pfu.37.1656927255610; Mon, 04 Jul 2022 02:34:15 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 04/23] linux-user: Add LoongArch syscall support Date: Mon, 4 Jul 2022 15:03:38 +0530 Message-Id: <20220704093357.983255-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220624031049.1716097-5-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/syscall_nr.h | 312 ++++++++++++++++++++++++ linux-user/loongarch64/target_syscall.h | 48 ++++ linux-user/syscall_defs.h | 6 +- scripts/gensyscalls.sh | 2 + 4 files changed, 367 insertions(+), 1 deletion(-) create mode 100644 linux-user/loongarch64/syscall_nr.h create mode 100644 linux-user/loongarch64/target_syscall.h diff --git a/linux-user/loongarch64/syscall_nr.h b/linux-user/loongarch64/syscall_nr.h new file mode 100644 index 0000000000..be00915adf --- /dev/null +++ b/linux-user/loongarch64/syscall_nr.h @@ -0,0 +1,312 @@ +/* + * This file contains the system call numbers. + * Do not modify. + * This file is generated by scripts/gensyscalls.sh + */ +#ifndef LINUX_USER_LOONGARCH_SYSCALL_NR_H +#define LINUX_USER_LOONGARCH_SYSCALL_NR_H + +#define TARGET_NR_io_setup 0 +#define TARGET_NR_io_destroy 1 +#define TARGET_NR_io_submit 2 +#define TARGET_NR_io_cancel 3 +#define TARGET_NR_io_getevents 4 +#define TARGET_NR_setxattr 5 +#define TARGET_NR_lsetxattr 6 +#define TARGET_NR_fsetxattr 7 +#define TARGET_NR_getxattr 8 +#define TARGET_NR_lgetxattr 9 +#define TARGET_NR_fgetxattr 10 +#define TARGET_NR_listxattr 11 +#define TARGET_NR_llistxattr 12 +#define TARGET_NR_flistxattr 13 +#define TARGET_NR_removexattr 14 +#define TARGET_NR_lremovexattr 15 +#define TARGET_NR_fremovexattr 16 +#define TARGET_NR_getcwd 17 +#define TARGET_NR_lookup_dcookie 18 +#define TARGET_NR_eventfd2 19 +#define TARGET_NR_epoll_create1 20 +#define TARGET_NR_epoll_ctl 21 +#define TARGET_NR_epoll_pwait 22 +#define TARGET_NR_dup 23 +#define TARGET_NR_dup3 24 +#define TARGET_NR_fcntl 25 +#define TARGET_NR_inotify_init1 26 +#define TARGET_NR_inotify_add_watch 27 +#define TARGET_NR_inotify_rm_watch 28 +#define TARGET_NR_ioctl 29 +#define TARGET_NR_ioprio_set 30 +#define TARGET_NR_ioprio_get 31 +#define TARGET_NR_flock 32 +#define TARGET_NR_mknodat 33 +#define TARGET_NR_mkdirat 34 +#define TARGET_NR_unlinkat 35 +#define TARGET_NR_symlinkat 36 +#define TARGET_NR_linkat 37 +#define TARGET_NR_umount2 39 +#define TARGET_NR_mount 40 +#define TARGET_NR_pivot_root 41 +#define TARGET_NR_nfsservctl 42 +#define TARGET_NR_statfs 43 +#define TARGET_NR_fstatfs 44 +#define TARGET_NR_truncate 45 +#define TARGET_NR_ftruncate 46 +#define TARGET_NR_fallocate 47 +#define TARGET_NR_faccessat 48 +#define TARGET_NR_chdir 49 +#define TARGET_NR_fchdir 50 +#define TARGET_NR_chroot 51 +#define TARGET_NR_fchmod 52 +#define TARGET_NR_fchmodat 53 +#define TARGET_NR_fchownat 54 +#define TARGET_NR_fchown 55 +#define TARGET_NR_openat 56 +#define TARGET_NR_close 57 +#define TARGET_NR_vhangup 58 +#define TARGET_NR_pipe2 59 +#define TARGET_NR_quotactl 60 +#define TARGET_NR_getdents64 61 +#define TARGET_NR_lseek 62 +#define TARGET_NR_read 63 +#define TARGET_NR_write 64 +#define TARGET_NR_readv 65 +#define TARGET_NR_writev 66 +#define TARGET_NR_pread64 67 +#define TARGET_NR_pwrite64 68 +#define TARGET_NR_preadv 69 +#define TARGET_NR_pwritev 70 +#define TARGET_NR_sendfile 71 +#define TARGET_NR_pselect6 72 +#define TARGET_NR_ppoll 73 +#define TARGET_NR_signalfd4 74 +#define TARGET_NR_vmsplice 75 +#define TARGET_NR_splice 76 +#define TARGET_NR_tee 77 +#define TARGET_NR_readlinkat 78 +#define TARGET_NR_sync 81 +#define TARGET_NR_fsync 82 +#define TARGET_NR_fdatasync 83 +#define TARGET_NR_sync_file_range 84 +#define TARGET_NR_timerfd_create 85 +#define TARGET_NR_timerfd_settime 86 +#define TARGET_NR_timerfd_gettime 87 +#define TARGET_NR_utimensat 88 +#define TARGET_NR_acct 89 +#define TARGET_NR_capget 90 +#define TARGET_NR_capset 91 +#define TARGET_NR_personality 92 +#define TARGET_NR_exit 93 +#define TARGET_NR_exit_group 94 +#define TARGET_NR_waitid 95 +#define TARGET_NR_set_tid_address 96 +#define TARGET_NR_unshare 97 +#define TARGET_NR_futex 98 +#define TARGET_NR_set_robust_list 99 +#define TARGET_NR_get_robust_list 100 +#define TARGET_NR_nanosleep 101 +#define TARGET_NR_getitimer 102 +#define TARGET_NR_setitimer 103 +#define TARGET_NR_kexec_load 104 +#define TARGET_NR_init_module 105 +#define TARGET_NR_delete_module 106 +#define TARGET_NR_timer_create 107 +#define TARGET_NR_timer_gettime 108 +#define TARGET_NR_timer_getoverrun 109 +#define TARGET_NR_timer_settime 110 +#define TARGET_NR_timer_delete 111 +#define TARGET_NR_clock_settime 112 +#define TARGET_NR_clock_gettime 113 +#define TARGET_NR_clock_getres 114 +#define TARGET_NR_clock_nanosleep 115 +#define TARGET_NR_syslog 116 +#define TARGET_NR_ptrace 117 +#define TARGET_NR_sched_setparam 118 +#define TARGET_NR_sched_setscheduler 119 +#define TARGET_NR_sched_getscheduler 120 +#define TARGET_NR_sched_getparam 121 +#define TARGET_NR_sched_setaffinity 122 +#define TARGET_NR_sched_getaffinity 123 +#define TARGET_NR_sched_yield 124 +#define TARGET_NR_sched_get_priority_max 125 +#define TARGET_NR_sched_get_priority_min 126 +#define TARGET_NR_sched_rr_get_interval 127 +#define TARGET_NR_restart_syscall 128 +#define TARGET_NR_kill 129 +#define TARGET_NR_tkill 130 +#define TARGET_NR_tgkill 131 +#define TARGET_NR_sigaltstack 132 +#define TARGET_NR_rt_sigsuspend 133 +#define TARGET_NR_rt_sigaction 134 +#define TARGET_NR_rt_sigprocmask 135 +#define TARGET_NR_rt_sigpending 136 +#define TARGET_NR_rt_sigtimedwait 137 +#define TARGET_NR_rt_sigqueueinfo 138 +#define TARGET_NR_rt_sigreturn 139 +#define TARGET_NR_setpriority 140 +#define TARGET_NR_getpriority 141 +#define TARGET_NR_reboot 142 +#define TARGET_NR_setregid 143 +#define TARGET_NR_setgid 144 +#define TARGET_NR_setreuid 145 +#define TARGET_NR_setuid 146 +#define TARGET_NR_setresuid 147 +#define TARGET_NR_getresuid 148 +#define TARGET_NR_setresgid 149 +#define TARGET_NR_getresgid 150 +#define TARGET_NR_setfsuid 151 +#define TARGET_NR_setfsgid 152 +#define TARGET_NR_times 153 +#define TARGET_NR_setpgid 154 +#define TARGET_NR_getpgid 155 +#define TARGET_NR_getsid 156 +#define TARGET_NR_setsid 157 +#define TARGET_NR_getgroups 158 +#define TARGET_NR_setgroups 159 +#define TARGET_NR_uname 160 +#define TARGET_NR_sethostname 161 +#define TARGET_NR_setdomainname 162 +#define TARGET_NR_getrusage 165 +#define TARGET_NR_umask 166 +#define TARGET_NR_prctl 167 +#define TARGET_NR_getcpu 168 +#define TARGET_NR_gettimeofday 169 +#define TARGET_NR_settimeofday 170 +#define TARGET_NR_adjtimex 171 +#define TARGET_NR_getpid 172 +#define TARGET_NR_getppid 173 +#define TARGET_NR_getuid 174 +#define TARGET_NR_geteuid 175 +#define TARGET_NR_getgid 176 +#define TARGET_NR_getegid 177 +#define TARGET_NR_gettid 178 +#define TARGET_NR_sysinfo 179 +#define TARGET_NR_mq_open 180 +#define TARGET_NR_mq_unlink 181 +#define TARGET_NR_mq_timedsend 182 +#define TARGET_NR_mq_timedreceive 183 +#define TARGET_NR_mq_notify 184 +#define TARGET_NR_mq_getsetattr 185 +#define TARGET_NR_msgget 186 +#define TARGET_NR_msgctl 187 +#define TARGET_NR_msgrcv 188 +#define TARGET_NR_msgsnd 189 +#define TARGET_NR_semget 190 +#define TARGET_NR_semctl 191 +#define TARGET_NR_semtimedop 192 +#define TARGET_NR_semop 193 +#define TARGET_NR_shmget 194 +#define TARGET_NR_shmctl 195 +#define TARGET_NR_shmat 196 +#define TARGET_NR_shmdt 197 +#define TARGET_NR_socket 198 +#define TARGET_NR_socketpair 199 +#define TARGET_NR_bind 200 +#define TARGET_NR_listen 201 +#define TARGET_NR_accept 202 +#define TARGET_NR_connect 203 +#define TARGET_NR_getsockname 204 +#define TARGET_NR_getpeername 205 +#define TARGET_NR_sendto 206 +#define TARGET_NR_recvfrom 207 +#define TARGET_NR_setsockopt 208 +#define TARGET_NR_getsockopt 209 +#define TARGET_NR_shutdown 210 +#define TARGET_NR_sendmsg 211 +#define TARGET_NR_recvmsg 212 +#define TARGET_NR_readahead 213 +#define TARGET_NR_brk 214 +#define TARGET_NR_munmap 215 +#define TARGET_NR_mremap 216 +#define TARGET_NR_add_key 217 +#define TARGET_NR_request_key 218 +#define TARGET_NR_keyctl 219 +#define TARGET_NR_clone 220 +#define TARGET_NR_execve 221 +#define TARGET_NR_mmap 222 +#define TARGET_NR_fadvise64 223 +#define TARGET_NR_swapon 224 +#define TARGET_NR_swapoff 225 +#define TARGET_NR_mprotect 226 +#define TARGET_NR_msync 227 +#define TARGET_NR_mlock 228 +#define TARGET_NR_munlock 229 +#define TARGET_NR_mlockall 230 +#define TARGET_NR_munlockall 231 +#define TARGET_NR_mincore 232 +#define TARGET_NR_madvise 233 +#define TARGET_NR_remap_file_pages 234 +#define TARGET_NR_mbind 235 +#define TARGET_NR_get_mempolicy 236 +#define TARGET_NR_set_mempolicy 237 +#define TARGET_NR_migrate_pages 238 +#define TARGET_NR_move_pages 239 +#define TARGET_NR_rt_tgsigqueueinfo 240 +#define TARGET_NR_perf_event_open 241 +#define TARGET_NR_accept4 242 +#define TARGET_NR_recvmmsg 243 +#define TARGET_NR_arch_specific_syscall 244 +#define TARGET_NR_wait4 260 +#define TARGET_NR_prlimit64 261 +#define TARGET_NR_fanotify_init 262 +#define TARGET_NR_fanotify_mark 263 +#define TARGET_NR_name_to_handle_at 264 +#define TARGET_NR_open_by_handle_at 265 +#define TARGET_NR_clock_adjtime 266 +#define TARGET_NR_syncfs 267 +#define TARGET_NR_setns 268 +#define TARGET_NR_sendmmsg 269 +#define TARGET_NR_process_vm_readv 270 +#define TARGET_NR_process_vm_writev 271 +#define TARGET_NR_kcmp 272 +#define TARGET_NR_finit_module 273 +#define TARGET_NR_sched_setattr 274 +#define TARGET_NR_sched_getattr 275 +#define TARGET_NR_renameat2 276 +#define TARGET_NR_seccomp 277 +#define TARGET_NR_getrandom 278 +#define TARGET_NR_memfd_create 279 +#define TARGET_NR_bpf 280 +#define TARGET_NR_execveat 281 +#define TARGET_NR_userfaultfd 282 +#define TARGET_NR_membarrier 283 +#define TARGET_NR_mlock2 284 +#define TARGET_NR_copy_file_range 285 +#define TARGET_NR_preadv2 286 +#define TARGET_NR_pwritev2 287 +#define TARGET_NR_pkey_mprotect 288 +#define TARGET_NR_pkey_alloc 289 +#define TARGET_NR_pkey_free 290 +#define TARGET_NR_statx 291 +#define TARGET_NR_io_pgetevents 292 +#define TARGET_NR_rseq 293 +#define TARGET_NR_kexec_file_load 294 +#define TARGET_NR_pidfd_send_signal 424 +#define TARGET_NR_io_uring_setup 425 +#define TARGET_NR_io_uring_enter 426 +#define TARGET_NR_io_uring_register 427 +#define TARGET_NR_open_tree 428 +#define TARGET_NR_move_mount 429 +#define TARGET_NR_fsopen 430 +#define TARGET_NR_fsconfig 431 +#define TARGET_NR_fsmount 432 +#define TARGET_NR_fspick 433 +#define TARGET_NR_pidfd_open 434 +#define TARGET_NR_clone3 435 +#define TARGET_NR_close_range 436 +#define TARGET_NR_openat2 437 +#define TARGET_NR_pidfd_getfd 438 +#define TARGET_NR_faccessat2 439 +#define TARGET_NR_process_madvise 440 +#define TARGET_NR_epoll_pwait2 441 +#define TARGET_NR_mount_setattr 442 +#define TARGET_NR_quotactl_fd 443 +#define TARGET_NR_landlock_create_ruleset 444 +#define TARGET_NR_landlock_add_rule 445 +#define TARGET_NR_landlock_restrict_self 446 +#define TARGET_NR_process_mrelease 448 +#define TARGET_NR_futex_waitv 449 +#define TARGET_NR_set_mempolicy_home_node 450 +#define TARGET_NR_syscalls 451 + +#endif /* LINUX_USER_LOONGARCH_SYSCALL_NR_H */ diff --git a/linux-user/loongarch64/target_syscall.h b/linux-user/loongarch64/target_syscall.h new file mode 100644 index 0000000000..8b5de52124 --- /dev/null +++ b/linux-user/loongarch64/target_syscall.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_SYSCALL_H +#define LOONGARCH_TARGET_SYSCALL_H + +#include "qemu/units.h" + +/* + * this struct defines the way the registers are stored on the + * stack during a system call. + */ + +struct target_pt_regs { + /* Saved main processor registers. */ + target_ulong regs[32]; + + /* Saved special registers. */ + struct { + target_ulong era; + target_ulong badv; + target_ulong crmd; + target_ulong prmd; + target_ulong euen; + target_ulong ecfg; + target_ulong estat; + } csr; + target_ulong orig_a0; + target_ulong __last[0]; +}; + +#define UNAME_MACHINE "loongarch64" +#define UNAME_MINIMUM_RELEASE "5.19.0" + +#define TARGET_MCL_CURRENT 1 +#define TARGET_MCL_FUTURE 2 +#define TARGET_MCL_ONFAULT 4 + +#define TARGET_FORCE_SHMLBA + +static inline abi_ulong target_shmlba(CPULoongArchState *env) +{ + return 64 * KiB; +} + +#endif diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 4587b62ac9..85b0f33e91 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -74,7 +74,7 @@ || defined(TARGET_M68K) || defined(TARGET_CRIS) \ || defined(TARGET_S390X) || defined(TARGET_OPENRISC) \ || defined(TARGET_NIOS2) || defined(TARGET_RISCV) \ - || defined(TARGET_XTENSA) + || defined(TARGET_XTENSA) || defined(TARGET_LOONGARCH64) #define TARGET_IOC_SIZEBITS 14 #define TARGET_IOC_DIRBITS 2 @@ -2196,6 +2196,10 @@ struct target_stat64 { uint64_t st_ino; }; +#elif defined(TARGET_LOONGARCH64) + +/* LoongArch no newfstatat/fstat syscall. */ + #else #error unsupported CPU #endif diff --git a/scripts/gensyscalls.sh b/scripts/gensyscalls.sh index 8fb450e3c9..a2f7664b7b 100755 --- a/scripts/gensyscalls.sh +++ b/scripts/gensyscalls.sh @@ -44,6 +44,7 @@ read_includes() cpp -P -nostdinc -fdirectives-only \ -D_UAPI_ASM_$(upper ${arch})_BITSPERLONG_H \ + -D__ASM_$(upper ${arch})_BITSPERLONG_H \ -D__BITS_PER_LONG=${bits} \ -I${linux}/arch/${arch}/include/uapi/ \ -I${linux}/include/uapi \ @@ -99,4 +100,5 @@ generate_syscall_nr openrisc 32 "$output/linux-user/openrisc/syscall_nr.h" generate_syscall_nr riscv 32 "$output/linux-user/riscv/syscall32_nr.h" generate_syscall_nr riscv 64 "$output/linux-user/riscv/syscall64_nr.h" generate_syscall_nr hexagon 32 "$output/linux-user/hexagon/syscall_nr.h" +generate_syscall_nr loongarch 64 "$output/linux-user/loongarch64/syscall_nr.h" rm -fr "$TMP" From patchwork Mon Jul 4 09:33:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587112 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp646951map; Mon, 4 Jul 2022 02:39:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ukgys4rYf8eqfnaGEKJqvYX6NrwAVFKSJpZV06GQENqDXemvU3kcKSfZoeJ8QZwdTLOhpn X-Received: by 2002:a81:2f4c:0:b0:31c:2bee:dfa4 with SMTP id v73-20020a812f4c000000b0031c2beedfa4mr30788784ywv.483.1656927597167; Mon, 04 Jul 2022 02:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927597; cv=none; d=google.com; s=arc-20160816; b=a7KbAlTbL6MchZVLeqxDV+ZqmPCt9LjSCMTsFzk5BtssyLofb+0ULPK7gC7fqb9R9V aHxjkmfRq1wxh5XAZ1pkmkufW8dh5YBkguuM4xyIXgiOhId3VSabml7tT/yG2zYkRq3p vbkCNSekB6XjPBU5kq5VPiRlaCZ1bULlGM+K/ejmCK9rKMYkh/qymq9o/HCpAI69aSMG tkBg5fSp4vaD33xi8k5RRjm9Gb8hevVGgTnyU4BHPxVwuO0KiFtmm1tKlgH24Bn1yMRt vdMQMRBDalpKXPLM3JJCaJmbgFLkpgNIDceMpjsuOW08943oIIrbnQgxo5BfouY32hqk Krcg== 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=gyVKsSKTcz352Hx+z69WvjGNpCZ8RyuObOwnIrxXdDc=; b=ldgpPTJmW3lam0ot4v8ZtdeX+IPsFnNyNSf77D6X/Y0BucMoZBoQqlO6nCYXI2ZT/n yWiBmRJOARPpx2DwFMcqjHxQqhIP/LvqSf8QqQws5fYEsrUQI//xx88CFNSwu/yQrUM8 QveNnDO/5Il/C/QKDi0GqObsxfrU87oLsYL86l7lhz+8mhmw2+yvhNVvXs3fifIYg/O1 KxbR/dXOOhF+RNksBRo/zVtYjUShfjkANP9JaOlYy7eK4gnw2oHJAwILym33zfyPDikU kSp0tZlUl9q2B74oxf5wNcCgv/8Ogn7PtQ5n5BxzX40R/ogbu8US1zw904UcX1W8vo0G 6gSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z7jQJDsU; 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 a22-20020a811a16000000b0031c86b0dd59si6783004ywa.282.2022.07.04.02.39.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:39:57 -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=Z7jQJDsU; 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]:38832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IYe-0007pf-Lf for patch@linaro.org; Mon, 04 Jul 2022 05:39:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITG-0000Ib-Ke for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:24 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:38615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITE-0004wq-1e for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:21 -0400 Received: by mail-pf1-x436.google.com with SMTP id k9so8457389pfg.5 for ; Mon, 04 Jul 2022 02:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gyVKsSKTcz352Hx+z69WvjGNpCZ8RyuObOwnIrxXdDc=; b=Z7jQJDsUzK+zqcnXReJd5ZumLaI/esnzgYHQamsSgMNgcw+d/oUa8vQxMmIFKa7jF3 P7RZsOmuGeW2uvUht0CTGT6SywPD9Kz/ZHkXYsJwQbRh3p1U21mDSK+AbrbFijHb8Hl5 WiBr9TLr63+BkOLiHFHHEDyui+QfiJvDMDcWLfkaiidBJ4EePkM6ns5Xj1ApJZ2k2ca6 +exgM+WbXNKO0XujUSBykJKLQp4xv49SaGaeBMreMKJqN4bDWwvpQQRre3V95sCKwov3 ui7oJB5plXDmHrpoVZjuSpXkChOO3AMiVQkQHIaq6tKIgNiSlSMnR9wzSzm9ZAO3mcpe yBNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gyVKsSKTcz352Hx+z69WvjGNpCZ8RyuObOwnIrxXdDc=; b=CvxLGMCz7xvoejgaMGcyLaDFfcoW623UpCSUdqqNgjaD7wk3e9vhYc6NIG+UZ11ofn VpNbSCxZDldobSL8+UnKfe000W49vmsyU7LIqiKzNlry2KWYEvWGaRDkn2Nw2BK8OCc6 tMeTQA+85G9SNJAq7h07kehuSmF/4WfuImwkW6pdYlOgR0sV/CMYmDvSJ/2x1kHCOqT0 55+/xVS5tnFi2h3s3AmTLRXMfr7p3Z+2jLIRnMxatVneshJzTH/e+bGh28N+lOEHtbIN 4WIDrb39oaBC3t6beLdmQbCZpj8Z8QNpLAGN2497A1+soGQ6J02Bw1oxfJx51ss0X27r uEmQ== X-Gm-Message-State: AJIora+AGwK4VWkJCDfr12DYLW7vW8DygjgObNDjRiHorC45K9nnPYyS YdjGF9IdpXbINGpV/uCpwV12Ome//5b3YWVc X-Received: by 2002:a05:6a00:1489:b0:525:b83f:b32f with SMTP id v9-20020a056a00148900b00525b83fb32fmr35651296pfu.25.1656927258391; Mon, 04 Jul 2022 02:34:18 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 05/23] linux-user: Add LoongArch cpu_loop support Date: Mon, 4 Jul 2022 15:03:39 +0530 Message-Id: <20220704093357.983255-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-6-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- linux-user/loongarch64/target_cpu.h | 34 ++++++++++ linux-user/loongarch64/cpu_loop.c | 96 +++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 linux-user/loongarch64/target_cpu.h create mode 100644 linux-user/loongarch64/cpu_loop.c diff --git a/linux-user/loongarch64/target_cpu.h b/linux-user/loongarch64/target_cpu.h new file mode 100644 index 0000000000..a29af66156 --- /dev/null +++ b/linux-user/loongarch64/target_cpu.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * LoongArch specific CPU ABI and functions for linux-user + * + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#ifndef LOONGARCH_TARGET_CPU_H +#define LOONGARCH_TARGET_CPU_H + +static inline void cpu_clone_regs_child(CPULoongArchState *env, + target_ulong newsp, unsigned flags) +{ + if (newsp) { + env->gpr[3] = newsp; + } + env->gpr[4] = 0; +} + +static inline void cpu_clone_regs_parent(CPULoongArchState *env, + unsigned flags) +{ +} + +static inline void cpu_set_tls(CPULoongArchState *env, target_ulong newtls) +{ + env->gpr[2] = newtls; +} + +static inline abi_ulong get_sp_from_cpustate(CPULoongArchState *state) +{ + return state->gpr[3]; +} +#endif diff --git a/linux-user/loongarch64/cpu_loop.c b/linux-user/loongarch64/cpu_loop.c new file mode 100644 index 0000000000..894fdd111a --- /dev/null +++ b/linux-user/loongarch64/cpu_loop.c @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * QEMU LoongArch user cpu_loop. + * + * Copyright (c) 2021 Loongson Technology Corporation Limited + */ + +#include "qemu/osdep.h" +#include "qemu.h" +#include "user-internals.h" +#include "cpu_loop-common.h" +#include "signal-common.h" + +void cpu_loop(CPULoongArchState *env) +{ + CPUState *cs = env_cpu(env); + int trapnr, si_code; + abi_long ret; + + for (;;) { + cpu_exec_start(cs); + trapnr = cpu_exec(cs); + cpu_exec_end(cs); + process_queued_cpu_work(cs); + + switch (trapnr) { + case EXCP_INTERRUPT: + /* just indicate that signals should be handled asap */ + break; + case EXCCODE_SYS: + env->pc += 4; + ret = do_syscall(env, env->gpr[11], + env->gpr[4], env->gpr[5], + env->gpr[6], env->gpr[7], + env->gpr[8], env->gpr[9], + -1, -1); + if (ret == -QEMU_ERESTARTSYS) { + env->pc -= 4; + break; + } + if (ret == -QEMU_ESIGRETURN) { + /* + * Returning from a successful sigreturn syscall. + * Avoid clobbering register state. + */ + break; + } + env->gpr[4] = ret; + break; + case EXCCODE_INE: + force_sig_fault(TARGET_SIGILL, 0, env->pc); + break; + case EXCCODE_FPE: + si_code = TARGET_FPE_FLTUNK; + if (GET_FP_CAUSE(env->fcsr0) & FP_INVALID) { + si_code = TARGET_FPE_FLTINV; + } else if (GET_FP_CAUSE(env->fcsr0) & FP_DIV0) { + si_code = TARGET_FPE_FLTDIV; + } else if (GET_FP_CAUSE(env->fcsr0) & FP_OVERFLOW) { + si_code = TARGET_FPE_FLTOVF; + } else if (GET_FP_CAUSE(env->fcsr0) & FP_UNDERFLOW) { + si_code = TARGET_FPE_FLTUND; + } else if (GET_FP_CAUSE(env->fcsr0) & FP_INEXACT) { + si_code = TARGET_FPE_FLTRES; + } + force_sig_fault(TARGET_SIGFPE, si_code, env->pc); + break; + case EXCP_DEBUG: + case EXCCODE_BRK: + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); + break; + case EXCCODE_BCE: + force_sig_fault(TARGET_SIGSYS, TARGET_SI_KERNEL, env->pc); + break; + case EXCP_ATOMIC: + cpu_exec_step_atomic(cs); + break; + default: + EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n", + trapnr); + exit(EXIT_FAILURE); + } + process_pending_signals(env); + } +} + +void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) +{ + int i; + + for (i = 0; i < 32; i++) { + env->gpr[i] = regs->regs[i]; + } + env->pc = regs->csr.era; + +} From patchwork Mon Jul 4 09:33:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587113 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp648725map; Mon, 4 Jul 2022 02:42:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1taV5Trhy73CnL+YA4LAUeQvniNcKS1U+DDiWJ0Jx2qDaYgCB2WFru+aKzNnijByta/J+dr X-Received: by 2002:a5b:f0c:0:b0:66e:32ee:2a85 with SMTP id x12-20020a5b0f0c000000b0066e32ee2a85mr8792692ybr.30.1656927743720; Mon, 04 Jul 2022 02:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927743; cv=none; d=google.com; s=arc-20160816; b=X47hleqWjlA+FmKMPT+Fc9ac0255GYazjYa+PwuofCKOzudmbeALgdWs8/tdTgQRCo Tjm51VcGR99OQdunDZkkvxnKmfgYn6iwpVZADjUSS6KI7XFb4EHtH+DHPApLtXhah6s9 LrUaJ0Ulf37hTnw1eYy//XL0IKSp0Hi6z3sg6CyoWk27Iw6DfCUDqWKI829x73PPz+r9 BVipsaKS8VLhrE/gf4DDSXGoG/FUS1dCw3JZHgQmyvqMcyIeZFrVhtnhjSmOaZsIJdWr fEikeCQ/0hy1rdEYnrxu2K7OpR3DsydY5D/siMkOb1c+oGRavkzQXhIVnHInB/9snnVK z77A== 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=pR1kqzu7xwtxnUko8pBi5w8sHK9mw7vU5UGn6K+yNzI=; b=S+qjR6dM2iH6m7vp5Od4QY1g0IE4NMGrzbENA/cQpPXDTlPGWRALxNY4n+XmbV5BQk VUEZKPS3UykeYnurFPak3pMDTmcdv3+CikhVT4XMyaBoppYL1IqboJQrORQWeORK2GvJ BYT5T6/dpy0jbM74c+wQI7cIq1UYELCB5nmpvzNrIxQYq0Yz1zsnDBEz5/HgRrw44Uvd 7G4lnp89n38P06nuls6TS224HU7GQe5OYf3YiwldlB7n9Rg9USh4YWKKw6IzVpazjN9X xElSuSJdlIog4lWansOIeMFYoQ1GofZXis2feMSDkXOCZvwKUK2R/XXy+wEgKgspLMcv sOqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YDLM+t8j; 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 23-20020a811217000000b0031c915158b1si4770142yws.104.2022.07.04.02.42.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:42:23 -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=YDLM+t8j; 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]:44378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Ib1-00039S-6M for patch@linaro.org; Mon, 04 Jul 2022 05:42:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITH-0000Ic-RA for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:26 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:35538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITG-0004xB-DL for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:23 -0400 Received: by mail-pf1-x42e.google.com with SMTP id x4so8469442pfq.2 for ; Mon, 04 Jul 2022 02:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pR1kqzu7xwtxnUko8pBi5w8sHK9mw7vU5UGn6K+yNzI=; b=YDLM+t8juK28vWXHYDwK8oJK3P1dz6deSepRcCQcpEntdO+rK8TtX8Sl0YPJDUGNYn ye5oLc0hYESnDy2RoNo2s6mHW2l9NsiAr53ij7fjBFhQacRB381gVRHwiTA0Hl5pq3E8 Aj/FSnLHJGt2ap//ICunmO0LYEZd4gWVtw43pgopRikJ8nb4YXW0QprGSFJfJ2RxNiQt x7gIUV43Ozr6JmPySmr+75Oos+D19Q+UVmkhaDPsFc+EqspDsakdyjJT53mHuPorXRFa yRTn/GmAKcM5vvfK4IQVQwcIVhQBhHqzOsfB29bZxsRQVkd499HAhDhx1S8kekaEwk78 KxZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pR1kqzu7xwtxnUko8pBi5w8sHK9mw7vU5UGn6K+yNzI=; b=2ersxYi30vAkDBHdVJ3m5qFKJ8FinYMZyb6V6gnF/vRQeimIa8AU7wdHOAD2mreEME ifOQmjYnMt+vNmQJGdv2Ycj9FAJevsGpWo1gECClt6iCZGXviuTkNXb4BvlrK2PW4+t1 7VwM9wNXl0KlAGMLnETsm2tmw9jjmz+BeAVeMgxOqqRK/uACE5tx1BMLtmAo2f/6GxZi 1qOa7Bsp9JjUiYtS3wTkEFWRf6KkhpEvucSG9HeaC3/COfB5/6lI68038rTD4SjruqSh yPinlj3Lfh4JN43B0lWU37YVgXOBONawU2yHbdOCnArQYlgCKr5vGphOWxbSooKIxPuC 0Q2w== X-Gm-Message-State: AJIora8sgTCSfccXganCbALV/e56emWc7RIGsQTGo4dDnEFtUT0X8UGN K95/C++jVnSqczxwLcnVvA+ALl+41K9VWfYy X-Received: by 2002:a63:4d5f:0:b0:412:12cb:b09f with SMTP id n31-20020a634d5f000000b0041212cbb09fmr8964166pgl.26.1656927261015; Mon, 04 Jul 2022 02:34:21 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 06/23] scripts: add loongarch64 binfmt config Date: Mon, 4 Jul 2022 15:03:40 +0530 Message-Id: <20220704093357.983255-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-7-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- scripts/qemu-binfmt-conf.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index 9cb723f443..1f4e2cd19d 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -4,7 +4,7 @@ qemu_target_list="i386 i486 alpha arm armeb sparc sparc32plus sparc64 \ ppc ppc64 ppc64le m68k mips mipsel mipsn32 mipsn32el mips64 mips64el \ sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \ -microblaze microblazeel or1k x86_64 hexagon" +microblaze microblazeel or1k x86_64 hexagon loongarch64" i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' @@ -140,6 +140,10 @@ hexagon_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x hexagon_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' hexagon_family=hexagon +loongarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01' +loongarch64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' +loongarch64_family=loongarch + qemu_get_family() { cpu=${HOST_ARCH:-$(uname -m)} case "$cpu" in From patchwork Mon Jul 4 09:33:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587111 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp646606map; Mon, 4 Jul 2022 02:39:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sO6HC4cMgb/M8kw9Kverof6R+/XmG0UwVcC7zb/zdvBGFHTStBS2i6zdSfEyKOKB1/QVOL X-Received: by 2002:a81:9b01:0:b0:31c:8dae:a94e with SMTP id s1-20020a819b01000000b0031c8daea94emr6563961ywg.237.1656927552186; Mon, 04 Jul 2022 02:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927552; cv=none; d=google.com; s=arc-20160816; b=hHd790K4p9cdU+RZd8CJ8bi3Ah8gwYWp9Bes+mPJts2T0S46NqYXFFgFhMnc7SfHb1 tfjtgKsghFZJdL/zljWQh/mnyiDMm0RoJaynPHcO7C/MPFgR03PqyCIRAITGjTuQyq4k Z+JCfwlKZ3xnjt1vj058rd1qmkPUw5n/1S7fReuXxEyRm4EOByoFSoxW3OBOTJqwWVCb bRE++NvfDCbvt9+BH2VdQa/DO9Ecl9fJQ/vCoI3YCCnVNMVa5OQXpX5CcTQh8YoXGZ02 3A0WXOfjlefBKHDuF52n2bis1ZImiO+SnErTIXfpw6SO4ijrQqzIR6AzReIi1uFh14lj sgNw== 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=21yVEfcVUBo097kH9wR354mUzWjfCDzfOMaCfmjHzQU=; b=OBub7exjK717ZKpFxb4jX4DsMsOObCi0QF222k8b5SPuoELzpJM4eBdfmGp/oi09wc AAltSK5HAexrDDwGMbol7adsF9eVCWLCbaC9ZU/FiL3rjxDyNCh4k5pWKUuI7UqURYgu jOSwlS+gJi9ZjQ0+rvXLb7FxLVwHMjpZr2HFRzxpw2sx8owsbkiSlA3e/bUOKGg1gUyU tnql1qK2ztzIePt7Ar9Dkr5jW+2rFGqa53N/QK+EglxGSppamWsqggBHFVOiPF/6XpTZ hkHS7nVdA0Z0txQJxQ7Hex2kxwiu3CpZluwrynKPZgvXMX/sNeqMGqmVOzVckr3AqM5A WedA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l4Oe3Z+K; 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 82-20020a811655000000b0031c7baf3b0dsi10122985yww.86.2022.07.04.02.39.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:39:12 -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=l4Oe3Z+K; 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]:36552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IXv-0006I9-Lz for patch@linaro.org; Mon, 04 Jul 2022 05:39:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITL-0000Kg-7I for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:28 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]:45570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITJ-0004wB-PC for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:26 -0400 Received: by mail-pj1-x1036.google.com with SMTP id g20-20020a17090a579400b001ed52939d72so8994666pji.4 for ; Mon, 04 Jul 2022 02:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=21yVEfcVUBo097kH9wR354mUzWjfCDzfOMaCfmjHzQU=; b=l4Oe3Z+KPdbGNFsI0apAcyoE4oqXnpZhG6BF/rDMH8CFCyGt2svfkqdD39lV3FVU+m DryDsln4KQHIfTriu+KyYVdDzjxoliRCFnQQ1uEGlG9MkH0BEqTBojX7Zj+u8AIcusSp p6yd6oScHkA8jG1nlNgahLGBv1aveONx7UMTKbFydrA5roj1BvAA8tfJZR4krsG/ew+4 kI2KBPoXDSaRdogrK7msuNFSWMzjGlxLSl0+EDvsDCxOEuBJyBBTrdThUmiJGsFZSmUm mul4+Vd0TZf6RC27LH2FlS30Ws4P5uuo+AAdl3WJdongWTchy+XZIf3KTiZfOO7ey63C cHAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=21yVEfcVUBo097kH9wR354mUzWjfCDzfOMaCfmjHzQU=; b=eIKhlk/AxJUBkWgn78SXBbKy5fE00s/ExsTmQV9hKSXJXCvaFIAubzzYWzhcZOtetw o3M0sN0MOpvPjC5Zj0wiYzbs/xuZntv2l+jAU27cGnXTAFMH8895jZ1Tc9HAgOh6GbXT Dzw/3+CqRr/mJy3F8iibdDJ04DNLa6zfc72gGKAH9PhYZglOK4+XoS3clEVxjmCGkCXo BmUrq3xAszpscG2VYQxkLWEDwqR4YffyTVwaY7qQcLe+0Bw4JKvpQoPwBziZTPdTAyrw pPen6LGrxpTAxxDSvn+gjtyuaTc/xpFMiEJ5R/Y8weOvd/17yUtv5U7AKSCV99UmtVK4 CKDg== X-Gm-Message-State: AJIora/hSVAZQaN/b7xEp3rhxLeezlWJIQNin7teLgnsIOyXmXKALgMm CN+RgfmX/qoY7EGS0+gP/EMo0ymhIXQKmP6F X-Received: by 2002:a17:902:e541:b0:16b:89b3:5848 with SMTP id n1-20020a170902e54100b0016b89b35848mr33250995plf.39.1656927263983; Mon, 04 Jul 2022 02:34:23 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 07/23] target/loongarch: remove badaddr from CPULoongArch Date: Mon, 4 Jul 2022 15:03:41 +0530 Message-Id: <20220704093357.983255-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao We can use CSR_BADV to replace badaddr. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-8-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.h | 2 -- target/loongarch/gdbstub.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 71a5036c3c..4b4fbcdc71 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -246,8 +246,6 @@ typedef struct CPUArchState { uint64_t lladdr; /* LL virtual address compared against SC */ uint64_t llval; - uint64_t badaddr; - /* LoongArch CSRs */ uint64_t CSR_CRMD; uint64_t CSR_PRMD; diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 0c48834201..24e126fb2d 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -21,7 +21,7 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) } else if (n == 32) { return gdb_get_regl(mem_buf, env->pc); } else if (n == 33) { - return gdb_get_regl(mem_buf, env->badaddr); + return gdb_get_regl(mem_buf, env->CSR_BADV); } return 0; } From patchwork Mon Jul 4 09:33:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587115 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp648814map; Mon, 4 Jul 2022 02:42:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u24BMK3yvZ2kXn8dISKpttO6QmQdVBoUkk9xbEThClTZGVcRoRYPCIIwS96hgeu6Kk97AX X-Received: by 2002:a25:3c41:0:b0:66d:fb11:5548 with SMTP id j62-20020a253c41000000b0066dfb115548mr16624997yba.64.1656927750143; Mon, 04 Jul 2022 02:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927750; cv=none; d=google.com; s=arc-20160816; b=xf1lweagg3Diix9i/S3onauLAePitxh52R0lv1qkCBjqsXu3DnBBWbLKI7kaj2sx6V LmFTJ7NDs00ANKLyp3aUFX/RM81s5DSWFqhIZOEdc3ntyY2/cmQqLPahCJ93F+KW5gyX 1ynjsKmQMdWutJdvUTKd8t0qUsLz3wON9lcl7AkqJ4zhvw3Uap4VPUkWEUZpEjHpxrpb xrkpfOssRGzRpOlNvep/Ku2ANx1e/F9sFE7bfC9sT+r5HiOEGCnBPDi+40PLEOnFbZ8B oMcfWBOpivWOwu/nWesiahwelpHNwrOiIxuaLHIaS+CVhPffe13qHjjDMrBy8EYPXCx2 RHHA== 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=KtmNbu9yExeJxvfDUNJQ5c1VHDhvr7IbviTyJY19R0g=; b=tDCg0wQiELK4JIf1r2pke5TirqnXzxgU9AqZStODHTbj/cqX25QRG6h/iG22OUAwYm O2r1tCm3c1MlZBq4fUhiTfX0sKk+k4PyhtaVOhCvGxs36QrNA03p3zuOG64q8T3CmkTV NOuT6GR4yixm/9UWGm2jeJfdF7t1PaGPKQRpNvs8QDkJh7+YkSl61Kax+YOCvpiA4y+m osBZTgATtSsQjhCJz6O69N7l/zn/cVGm23EPnHQqWkC+xlcCMTE3zugDgePWJXvA0+fG ZjLDqRO2kJ+f4L/LVuxuYyAuyBwf/w811yHpaKjrhkQM7xZfa6diWiUH5CMLwPg0N8un zqdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JkbPHVE2; 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 r7-20020a254407000000b0066e4ef5b518si1669267yba.78.2022.07.04.02.42.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:42:30 -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=JkbPHVE2; 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]:44950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Ib7-0003YE-KF for patch@linaro.org; Mon, 04 Jul 2022 05:42:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITN-0000Le-0o for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:30 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:38615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITL-0004wq-HZ for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:28 -0400 Received: by mail-pf1-x436.google.com with SMTP id k9so8457623pfg.5 for ; Mon, 04 Jul 2022 02:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KtmNbu9yExeJxvfDUNJQ5c1VHDhvr7IbviTyJY19R0g=; b=JkbPHVE26B6Uuawwrbljc5T/BHUuBry4VSmAQTSUp5OzR644PWjI/D1rilq/9ugw+5 G2aGbF+tsJgH4a5gMgecYJoeWEvodJTullDsZRLYi/avRuLoREJjQXZk8cqX81KPDHvU qbk4dgBNmIJlKOiBWkRhddD+FkzaGarIemQqRXGDgwjw3GOIY8C/mNHnM01lZLDpcNRL CCe/FU0qLxyE7rYbEMwCFsS89GGUD6s1xUOjkmLB91w2S9uxYKLLZhdq/trJBj9XQjTt fKaP/zLl0lXdGgMeHe5Yv1RmVDT3O7FgyDXwmUPXRmc6qXF3/JxsgjiFOgln02QmSbWz LjHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KtmNbu9yExeJxvfDUNJQ5c1VHDhvr7IbviTyJY19R0g=; b=HphdnyK2ZiyNOkEjjVfhGASQqcmk5eDSulUqJBvDk2fr9Z/QryTpXZ6hR4tYeT0AGz gH7sYMToL3iVqydskfSlKbMO2UJ5wwGV9SbBZwwXDsrpF+wigDhgJ3eKpBnX5YS4ldoe NLC6E7qPlzAWfuIyEBjSb2rz4VkUnPJugB/Mr8xZS4NyMZW61EnKQ+HYWLUeiemCqMRH hFiOlrgD2hFtmuSaNbCOsihHcw04WQfMiMrgUtYpFWgwf2T6SFFvnzAB+DSxhk8k8N7S zC93EsQmoyXQFHhA7JKPedGDoiRLuw7YmTdjMVItyWP1oAWMRegynLGS7OfOSEU9wvu0 snqA== X-Gm-Message-State: AJIora8/aOd9fwL6YmfxzSJAxEtcs2iBuNNkKv3xeYpdMHx6hav7OdFB R0gBVaYGTzGlmpMFaQPreS4rByzo49JFPQyS X-Received: by 2002:a63:6c42:0:b0:3fe:465:7a71 with SMTP id h63-20020a636c42000000b003fe04657a71mr24153697pgc.101.1656927266792; Mon, 04 Jul 2022 02:34:26 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 08/23] target/loongarch: Fix missing update CSR_BADV Date: Mon, 4 Jul 2022 15:03:42 +0530 Message-Id: <20220704093357.983255-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao loongarch_cpu_do_interrupt() should update CSR_BADV for some EXCCODE. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-9-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 4c8f96bc3a..e32d4cc269 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -171,18 +171,20 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) cause = cs->exception_index; update_badinstr = 0; break; - case EXCCODE_ADEM: case EXCCODE_SYS: case EXCCODE_BRK: + case EXCCODE_INE: + case EXCCODE_IPE: + case EXCCODE_FPE: + env->CSR_BADV = env->pc; + QEMU_FALLTHROUGH; + case EXCCODE_ADEM: case EXCCODE_PIL: case EXCCODE_PIS: case EXCCODE_PME: case EXCCODE_PNR: case EXCCODE_PNX: case EXCCODE_PPI: - case EXCCODE_INE: - case EXCCODE_IPE: - case EXCCODE_FPE: cause = cs->exception_index; break; default: From patchwork Mon Jul 4 09:33:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587117 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp650440map; Mon, 4 Jul 2022 02:45:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ttxGwwMK7/TPGGLqIDMkqPj0yCl67NyiHfQ2+HGQ+LaN5uwZOgamrNq8eFMyWv7izahGOE X-Received: by 2002:a25:2744:0:b0:66c:a759:7046 with SMTP id n65-20020a252744000000b0066ca7597046mr30069032ybn.575.1656927908539; Mon, 04 Jul 2022 02:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927908; cv=none; d=google.com; s=arc-20160816; b=nD4puPO/zQx1xBViNe3UG3m4qAVUbM+YGhMBXYPfEJHC8B9jcrEcnzKXwoBfcdT20c fay1qeQOy6ruIFJMIs5RXzTUXBW6Op5p4C3QvzAXC4gxWvsZJQ/ahLImxeJ7c+YMv6W/ RR89Zu9Z6Iqi+cJJGrV73J2oQdaxPq9gVLOOzH581iiGWZTublfAo1tuDCgCCaKGu/ML n5K2io6q0vv8iQwzE/AltPnDiY+OjzFsLDmgKSbla7e/o9kvxE3275QZkq6R2wKon1FB jceI028Zg6GHh8ZNhcMqj9ysW1waSA/7K9pIH+71Vmo6b/QZY8PK1iJghXS/NqMd5ea7 y2jw== 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=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=L9ukQdISVYP6g0Kl1I+F64RNtl8PWjDaCPNNHjanMr5Ah01JIiSYpYnnrjXSern6Av AT36siU8eN1cBx+Nhg4eXCP+3FyhnsNeAvu//oq4k5+XEXhlzZa7GdXWDTBEI4OH8rso B7ZKJdJAdda7OFp4Dhngz1YhSVCZrFCjul3bHiope1c7ZfAfnXxjKhtFDpBaUt1vjdAo ACxAJUbNCyFeV90fkHizMhpzakHcQPHN2OWR9S6JxKemqIu9Va9a2YSg9qcrYegxSZ6z HheKE2h4wp0yadT/hJQnETNiyT3nunoGQpt3xdjV7c+5XxHtJNjpgA4LHGAW5tTAgFdB 8RWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MZC5xess; 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 139-20020a810c91000000b0030c33b98042si38568349ywm.306.2022.07.04.02.45.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:45:08 -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=MZC5xess; 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]:52832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Idg-0000VM-0g for patch@linaro.org; Mon, 04 Jul 2022 05:45:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITQ-0000OJ-7w for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:32 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITO-0004xx-LE for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:32 -0400 Received: by mail-pj1-x1035.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so13077932pjl.5 for ; Mon, 04 Jul 2022 02:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=MZC5xessgLibTj1DyM1GrdqcCdAuIcTfGALeC2gX+5ZYPiVgMzHxvxtR5Xt2Rfga/F i8HMYRBBVsrq5lUenyYyEb7XTq2WcwwSM6IIk7wlVNmu9zuM0263FBwWqFSsZJlW/qqD ALWJOfclCqL8G2ZoC1E7efADOOfsgYClAHJn7spm3iWkjDzwAVn5JWrpp1MBQs8fpKw0 4AtTfPmlK9TqEyEfXaL8VphErhmqQ/Y1XS/hoashCuiJP32JP+zDsKV+zHoouOHG9dXt SUVVr5xy6b2L/Jcc44mqyroedxKT5gGTThgBMvExjcQ59QuluSq3C78+WYk458OnGYU4 vSUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQeBQJaJ2cUJJgh8YFxOAc0hMFwb7DTvcTB5KsIPLmU=; b=FNjpo+jCKtu7ReNu32gKc2a/oqbJuPeI5YvOISXZUAty73bgSecV+gJ0lI67do3VqL wgRXHRNDcl6KURcdepD1Z8rWPH9yGjXglHj8j+lFXX+57fYdR2kEOrz9bJa63aMyhvfz M6pJXF2Cr4SLsQpPltwWJvzC9obb9sJ1DGXEYlj71jyoLQ4+XXH6ZE6jW0AwLSrJuoYn RlstjvHDm4ofEzyP9UerKNdlIh6HCPQxP7gvPpGagaQECrA4P6qUh+2Ql9gZJQOMll/W nR+E+gYrORXFsW4bHxZlH0x3ylGSl7oNTl2qHxxrgGsdDzBwN3XgZBrUWqF0DMC4VNTb mjWA== X-Gm-Message-State: AJIora8fMdifitkUvgf9Odjc+NDFyZTUfqDOjqpeqAdTJ4s3frD9anv2 MemOJ2Z4RQ/xHtZ07ip87RdMDbdTfeSUdtn+ X-Received: by 2002:a17:90b:3648:b0:1ef:7c45:62cb with SMTP id nh8-20020a17090b364800b001ef7c4562cbmr11293046pjb.132.1656927269368; Mon, 04 Jul 2022 02:34:29 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 09/23] target/loongarch: Fix helper_asrtle_d/asrtgt_d raise wrong exception Date: Mon, 4 Jul 2022 15:03:43 +0530 Message-Id: <20220704093357.983255-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Raise EXCCODE_BCE instead of EXCCODE_ADEM for helper_asrtle_d/asrtgt_d. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-10-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 2 ++ target/loongarch/op_helper.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index e32d4cc269..0013582a3a 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -51,6 +51,7 @@ static const char * const excp_names[] = { [EXCCODE_IPE] = "Instruction privilege error", [EXCCODE_FPE] = "Floating Point Exception", [EXCCODE_DBP] = "Debug breakpoint", + [EXCCODE_BCE] = "Bound Check Exception", }; const char *loongarch_exception_name(int32_t exception) @@ -176,6 +177,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) case EXCCODE_INE: case EXCCODE_IPE: case EXCCODE_FPE: + case EXCCODE_BCE: env->CSR_BADV = env->pc; QEMU_FALLTHROUGH; case EXCCODE_ADEM: diff --git a/target/loongarch/op_helper.c b/target/loongarch/op_helper.c index d87049851f..df049cec59 100644 --- a/target/loongarch/op_helper.c +++ b/target/loongarch/op_helper.c @@ -49,14 +49,14 @@ target_ulong helper_bitswap(target_ulong v) void helper_asrtle_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) { if (rj > rk) { - do_raise_exception(env, EXCCODE_ADEM, GETPC()); + do_raise_exception(env, EXCCODE_BCE, 0); } } void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) { if (rj <= rk) { - do_raise_exception(env, EXCCODE_ADEM, GETPC()); + do_raise_exception(env, EXCCODE_BCE, 0); } } From patchwork Mon Jul 4 09:33:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587110 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp646589map; Mon, 4 Jul 2022 02:39:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTgSHoLzbsC3nBYkaEkoqGKaFR+0/8gJk2dzuSBIPqnIzr/90XJcnnM8KAlscn3Pl6pX/y X-Received: by 2002:a25:1c44:0:b0:66e:26f7:1cda with SMTP id c65-20020a251c44000000b0066e26f71cdamr12387794ybc.614.1656927549988; Mon, 04 Jul 2022 02:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927549; cv=none; d=google.com; s=arc-20160816; b=ky95TWAKJQDdSsoC3ZY4ICKdbFq+WJKc7Ry3+mpdB+CP746fiuRW7Am01JOguZJ2oi 4Grbfz3es4z0GJKI0UbK3w1MJ7JNhawrNFsJDAYTtERJK9Tsnld4kQ7zg9DOLDie/bnT UEF6WV9/h2wze5nxcLQ+0lIQWbaFnVLQv8F21jC3VqmPFc4j8jaErmToNwFOUrXpzMq3 Fr6vyW9Pw8KV/wKxf7bhbAEvORr/NdpTB68JUvNCZp1GlJVr71ThMqgipCctIcD6Gth7 41pMI2Kso/HXKLgRjvZiBife7iOK/fBJDyqwCxGYPLJ/GFE8Lrwa4+kKRUu8DVC+tivR 9/WA== 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=7miE1J32cGCfgzDoEjdy1xniOQ1sdRcJ/+h0R/nm0Nc=; b=k1RW6yznstN3DzuFFcagejeHz5NlO8qV6cpQsYAy+zskFBbAkI6KEWJjr3f3hRxtsJ XF4bvlUULhpwZIY9T11sLEifoMcpnm7qv7dQ77xSeyjs+VbFDQjTirKmDP0U5lllgqGH N6WBvIqgN3pt0TP9BW7bDFnab+Kqv3LmDoGlehSyQTiTpWsfb2dP8WLhJ4fnMMZi3Hjh co6uF6N/eUxtLVJKJ5dRL8eukkVShG6MEqurp1X11+H8CQVY7BJcge/MCJrOhAxQdB0S Ri3wo1GZKaqi11pPdiApL0fgl55xbPfGHdtZSvwUYdefvogIctFb28f/tcL4Ix5A8VAv q3Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O0HnH+Z+; 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 139-20020a250491000000b0066e2a5c2667si8022437ybe.215.2022.07.04.02.39.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:39:09 -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=O0HnH+Z+; 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]:36210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IXt-000644-GE for patch@linaro.org; Mon, 04 Jul 2022 05:39:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITX-0000SH-Ob for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:40 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:43801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITW-0004y9-Bq for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:39 -0400 Received: by mail-pj1-x102c.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so4478108pjf.2 for ; Mon, 04 Jul 2022 02:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7miE1J32cGCfgzDoEjdy1xniOQ1sdRcJ/+h0R/nm0Nc=; b=O0HnH+Z+A7vv4LHhPkGZ9md2+ivvCB+YdOmAOrZIdcn3Ir9ZITVAyKQPa7YPmeQs6n GItaWZlq4tOvlShoK3CIPxWbnSXUkD2g0GMMtJlnjTGvd2o1EBxcUl6VSBR2trrO3D5S QdIzFbWVYYPJhn+9NJKuYxBY8b6NreSquJ5XsLy7/AYxtQ9iyL86FCLrYEwCC/f1pxA3 5ISRNBaMYF+ZwyM55OxJU/OnFt/Xpw/lp++EDDoA81/28HskaBQJpZFqSwbXDPgb3OQ6 q+Y9v4/vPrzu+Bswz2yCCrUSjhUG4jN97m8v7cuq2s0GVDcwRtrS6Dt9xu0x6BJxPqJz MbEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7miE1J32cGCfgzDoEjdy1xniOQ1sdRcJ/+h0R/nm0Nc=; b=njLFu3Xapi+TpHjoigFss99dSlYnQ8SgYQ0ToDTwxOOoAvHkN11Vo6uy8CZfzpaquv tRCKrqduQp1qnvTE3GznsJchzDEIgEj+4FSIuJtHmCMShHHtWeP8c8Ly9+TBCKE+oA+Z 9SQNDMoUPCPZefMWaXyNFE+CiVvE2fN6ZW+4MVOPSLRSqhLHka4x/TQxtsXBlEgKSCu6 mem6qexCpUF+zL10MKGEpe/RF7MHxH/XWlVXhl5cG+rE+J9Tdg2aMBopEOE72eRnRK7j qYJllW4cUw7+skX+aSWQQjc89AGhuIzsP/HiFK/PedCF3i/klFeW0w8nyQZGR3YU2zOY hQrg== X-Gm-Message-State: AJIora+eQnBKY1FxQ+NRlcHzVw5hLkEOeABZfhKs0L6+jwUqHNeTch61 FpV9CDvwR0FGDJ8jGlUcc36ntSIMlTw4qy+y X-Received: by 2002:a17:90b:1bc7:b0:1ee:ffbf:95ad with SMTP id oa7-20020a17090b1bc700b001eeffbf95admr36505824pjb.37.1656927271992; Mon, 04 Jul 2022 02:34:31 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 10/23] target/loongarch: remove unused include hw/loader.h Date: Mon, 4 Jul 2022 15:03:44 +0530 Message-Id: <20220704093357.983255-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-11-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 0013582a3a..bf163a8dce 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -18,7 +18,6 @@ #include "fpu/softfloat-helpers.h" #include "cpu-csr.h" #include "sysemu/reset.h" -#include "hw/loader.h" const char * const regnames[32] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", From patchwork Mon Jul 4 09:33:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587116 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp649099map; Mon, 4 Jul 2022 02:43:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbO6GO2HicI97NbgrYyYlKwdYW6u0hki9LOAPTLuLVoSslw/SIRxZ8LQeCCGvk86gMVcAs X-Received: by 2002:a25:e093:0:b0:66e:5f61:d0bc with SMTP id x141-20020a25e093000000b0066e5f61d0bcmr682693ybg.506.1656927783036; Mon, 04 Jul 2022 02:43:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927783; cv=none; d=google.com; s=arc-20160816; b=uy1T1Odl0aY3kn53LATIoEzVymDL0WJXvZWYzA1/X9xdh+i8WjTIOdIiR0jnzsgMVN r14Nhc2cfkZT5uCKkBdQKV87fkN8/qMVGtQTQ0vyDW2Q2w+2qmaTEK/TE+p9dSYpIREQ kb6K67l4aZJcXZqs8P3u+igbHzg4HIk7x6OSMo6j9IMmc2YO2SL4evmolYpBcqLVTXmy YaLY3XsQJ5Vg+PT5UviJ1u6J1tDjn7Ye/dSfX1jhAJ9NcvTTPDrKAMWx0wQXoiXl+RJ9 lNx1UUeviv8tIDA6JjlGw0lmQAzpg7dAS//FNDbj2ijTHSGzBh9dj0mwsYBhu4lW1a82 eHhA== 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=HHZ8mZXSfbHbPb+0SOnZD/cO7fq4POJ4YzIOL2R+a6o=; b=YoA96oLOdZ8l8zmozsNgwvgZAdntlYh2wgPY9gNFfQuKP40QcvCrEq3xuD0aG5gBPI on4RCITb5TjPs5xPE8Vb0Nv+QrDUg8x4n5/akHfo7od6KiMlZOgdonE0E9Kh/D7xySlx iUetPLu4KdJnBvkLxTCXY4bD7pLbe50CUuzQaY1A3VxySEoZLuHnAtQLojenHWWO/5ol mP+JSc3kaiUKZJPHI8B/tFaxWYEvsWwuat6xY/BHi61JxO11cMobGi1dTajcDXivVGNx AzRAuWOzqEMpRLZmery7CtFbUO27R6sA/reOwOSqj/ZnrQqLamr9B9LCI4YPViJokPYy oMmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U9dsbt5m; 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 3-20020a810403000000b0031cb01f584bsi648137ywe.209.2022.07.04.02.43.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:43:03 -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=U9dsbt5m; 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]:47408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Ibe-0005CM-G7 for patch@linaro.org; Mon, 04 Jul 2022 05:43:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITY-0000Ss-LW for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:40 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:51726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITW-0004yF-C5 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:40 -0400 Received: by mail-pj1-x1034.google.com with SMTP id o15so4289737pjh.1 for ; Mon, 04 Jul 2022 02:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HHZ8mZXSfbHbPb+0SOnZD/cO7fq4POJ4YzIOL2R+a6o=; b=U9dsbt5m2eaUWxCTm2MyPFjUXSoDIYWNiYfpM/ldttQeWIWImTvo33owmVO0zhR4D0 VDHpaR4kCVGoAGMglM85sR9X+XsNZuxBX/OljlrLMfGd4aH0A2MYMcAuOZY7h9nmZVDB totnMcBxAvwlRouIa59G3rAaxEsxE/QRjROeKAk5vKjbqd9ZLy+CqQWX2Xr/2knI65yr XnEqslKAFBlGHsUa4e3+KrI8n022nO55IxgfYOvO4yjjm4AySCaV6Mu3i9p+12ppcP1l /pyVugfqbuzSgdPyB9ZreIy2O3JoC9OMpJAB17GBGb+vHxRTLnRrba9sdw6spytMdWsR xmKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HHZ8mZXSfbHbPb+0SOnZD/cO7fq4POJ4YzIOL2R+a6o=; b=abffgnBbharuS+kkVlKyTTlG6waWmq3s78YdQiT/wb2NoUF6/CQTJqgnLm1M9VZXEb r2qHaqFjX3dj4DBHyQBZBkjXH361fBzq4pz495VeYDIl0CnxdWzhudZc7/1RICZ3YNfp VvQRooAY/A66vQOIIJsdTEN1wV7Y5tSsDZg4d06ZXpd7vJpTiM9HV0OYyG0AvT3HUglx yPlLmiZJ7Iwojaq2v4vduAflnG3evM+RuW7MMxv+AOi03oI5uy4UTeYTGbSvaHBcP9v0 RU17y7yXHNCH9dWQJD2CIHk8n0hQi4p2Z2EZAIn3vIPLlemWRv8Pi5/LeyMr1Fd0MjMO N2Ww== X-Gm-Message-State: AJIora+/Wc+upjht/ebqR1sEE70kgrK1EWBTUc/CxXYj1ZtNjieOX7VA SOtShPc4R19OKOrXYs79w8C8UEhUhAz4a003 X-Received: by 2002:a17:902:bf01:b0:16b:e24e:1d2f with SMTP id bi1-20020a170902bf0100b0016be24e1d2fmr5046717plb.46.1656927274773; Mon, 04 Jul 2022 02:34:34 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 11/23] target/loongarch: Adjust functions and structure to support user-mode Date: Mon, 4 Jul 2022 15:03:45 +0530 Message-Id: <20220704093357.983255-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Some functions and member of the structure are different with softmmu-mode So we need adjust them to support user-mode. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-12-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.h | 6 ++++ target/loongarch/helper.h | 2 ++ target/loongarch/internals.h | 2 ++ target/loongarch/cpu.c | 21 ++++++++++- target/loongarch/op_helper.c | 6 ++++ .../insn_trans/trans_privileged.c.inc | 36 +++++++++++++++++++ 6 files changed, 72 insertions(+), 1 deletion(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 4b4fbcdc71..d141ec9b5d 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -301,6 +301,7 @@ typedef struct CPUArchState { uint64_t CSR_DERA; uint64_t CSR_DSAVE; +#ifndef CONFIG_USER_ONLY LoongArchTLB tlb[LOONGARCH_TLB_MAX]; AddressSpace address_space_iocsr; @@ -308,6 +309,7 @@ typedef struct CPUArchState { MemoryRegion iocsr_mem; bool load_elf; uint64_t elf_address; +#endif } CPULoongArchState; /** @@ -358,12 +360,16 @@ struct LoongArchCPUClass { static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch) { +#ifdef CONFIG_USER_ONLY + return MMU_USER_IDX; +#else uint8_t pg = FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG); if (!pg) { return MMU_DA_IDX; } return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV); +#endif } static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h index 85c11a60d4..cbbe008f32 100644 --- a/target/loongarch/helper.h +++ b/target/loongarch/helper.h @@ -95,6 +95,7 @@ DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_1(rdtime_d, i64, env) +#ifndef CONFIG_USER_ONLY /* CSRs helper */ DEF_HELPER_1(csrrd_pgd, i64, env) DEF_HELPER_1(csrrd_tval, i64, env) @@ -128,3 +129,4 @@ DEF_HELPER_4(lddir, tl, env, tl, tl, i32) DEF_HELPER_4(ldpte, void, env, tl, tl, i32) DEF_HELPER_1(ertn, void, env) DEF_HELPER_1(idle, void, env) +#endif diff --git a/target/loongarch/internals.h b/target/loongarch/internals.h index 9d50fbdd81..ea227362b6 100644 --- a/target/loongarch/internals.h +++ b/target/loongarch/internals.h @@ -33,6 +33,7 @@ const char *loongarch_exception_name(int32_t exception); void restore_fp_status(CPULoongArchState *env); +#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_loongarch_cpu; void loongarch_cpu_set_irq(void *opaque, int irq, int level); @@ -48,6 +49,7 @@ bool loongarch_cpu_tlb_fill(CPUState *cs, vaddr address, int size, bool probe, uintptr_t retaddr); hwaddr loongarch_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +#endif /* !CONFIG_USER_ONLY */ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n); int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n); diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index bf163a8dce..47c0bdd1ac 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -82,6 +82,7 @@ static void loongarch_cpu_set_pc(CPUState *cs, vaddr value) env->pc = value; } +#ifndef CONFIG_USER_ONLY #include "hw/loongarch/virt.h" void loongarch_cpu_set_irq(void *opaque, int irq, int level) @@ -295,6 +296,7 @@ static bool loongarch_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } return false; } +#endif #ifdef CONFIG_TCG static void loongarch_cpu_synchronize_from_tb(CPUState *cs, @@ -309,6 +311,9 @@ static void loongarch_cpu_synchronize_from_tb(CPUState *cs, static bool loongarch_cpu_has_work(CPUState *cs) { +#ifdef CONFIG_USER_ONLY + return true; +#else LoongArchCPU *cpu = LOONGARCH_CPU(cs); CPULoongArchState *env = &cpu->env; bool has_work = false; @@ -319,6 +324,7 @@ static bool loongarch_cpu_has_work(CPUState *cs) } return has_work; +#endif } static void loongarch_la464_initfn(Object *obj) @@ -467,7 +473,9 @@ static void loongarch_cpu_reset(DeviceState *dev) env->CSR_DMW[n] = FIELD_DP64(env->CSR_DMW[n], CSR_DMW, PLV3, 0); } +#ifndef CONFIG_USER_ONLY env->pc = 0x1c000000; +#endif restore_fp_status(env); cs->exception_index = -1; @@ -498,6 +506,7 @@ static void loongarch_cpu_realizefn(DeviceState *dev, Error **errp) lacc->parent_realize(dev, errp); } +#ifndef CONFIG_USER_ONLY static void loongarch_qemu_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { @@ -532,13 +541,16 @@ static const MemoryRegionOps loongarch_qemu_ops = { .max_access_size = 8, }, }; +#endif static void loongarch_cpu_init(Object *obj) { LoongArchCPU *cpu = LOONGARCH_CPU(obj); - CPULoongArchState *env = &cpu->env; cpu_set_cpustate_pointers(cpu); + +#ifndef CONFIG_USER_ONLY + CPULoongArchState *env = &cpu->env; qdev_init_gpio_in(DEVICE(cpu), loongarch_cpu_set_irq, N_IRQS); timer_init_ns(&cpu->timer, QEMU_CLOCK_VIRTUAL, &loongarch_constant_timer_cb, cpu); @@ -548,6 +560,7 @@ static void loongarch_cpu_init(Object *obj) memory_region_init_io(&env->iocsr_mem, OBJECT(cpu), &loongarch_qemu_ops, NULL, "iocsr_misc", 0x428); memory_region_add_subregion(&env->system_iocsr, 0, &env->iocsr_mem); +#endif } static ObjectClass *loongarch_cpu_class_by_name(const char *cpu_model) @@ -615,18 +628,22 @@ static struct TCGCPUOps loongarch_tcg_ops = { .initialize = loongarch_translate_init, .synchronize_from_tb = loongarch_cpu_synchronize_from_tb, +#ifndef CONFIG_USER_ONLY .tlb_fill = loongarch_cpu_tlb_fill, .cpu_exec_interrupt = loongarch_cpu_exec_interrupt, .do_interrupt = loongarch_cpu_do_interrupt, .do_transaction_failed = loongarch_cpu_do_transaction_failed, +#endif }; #endif /* CONFIG_TCG */ +#ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps loongarch_sysemu_ops = { .get_phys_page_debug = loongarch_cpu_get_phys_page_debug, }; +#endif static void loongarch_cpu_class_init(ObjectClass *c, void *data) { @@ -642,8 +659,10 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) cc->has_work = loongarch_cpu_has_work; cc->dump_state = loongarch_cpu_dump_state; cc->set_pc = loongarch_cpu_set_pc; +#ifndef CONFIG_USER_ONLY dc->vmsd = &vmstate_loongarch_cpu; cc->sysemu_ops = &loongarch_sysemu_ops; +#endif cc->disas_set_info = loongarch_cpu_disas_set_info; cc->gdb_read_register = loongarch_cpu_gdb_read_register; cc->gdb_write_register = loongarch_cpu_gdb_write_register; diff --git a/target/loongarch/op_helper.c b/target/loongarch/op_helper.c index df049cec59..4b429b6699 100644 --- a/target/loongarch/op_helper.c +++ b/target/loongarch/op_helper.c @@ -86,6 +86,9 @@ target_ulong helper_cpucfg(CPULoongArchState *env, target_ulong rj) uint64_t helper_rdtime_d(CPULoongArchState *env) { +#ifdef CONFIG_USER_ONLY + return cpu_get_host_ticks(); +#else uint64_t plv; LoongArchCPU *cpu = env_archcpu(env); @@ -95,8 +98,10 @@ uint64_t helper_rdtime_d(CPULoongArchState *env) } return cpu_loongarch_get_constant_timer_counter(cpu); +#endif } +#ifndef CONFIG_USER_ONLY void helper_ertn(CPULoongArchState *env) { uint64_t csr_pplv, csr_pie; @@ -131,3 +136,4 @@ void helper_idle(CPULoongArchState *env) cs->halted = 1; do_raise_exception(env, EXCP_HLT, 0); } +#endif diff --git a/target/loongarch/insn_trans/trans_privileged.c.inc b/target/loongarch/insn_trans/trans_privileged.c.inc index 53596c4f77..9c4dcbfcfb 100644 --- a/target/loongarch/insn_trans/trans_privileged.c.inc +++ b/target/loongarch/insn_trans/trans_privileged.c.inc @@ -7,6 +7,41 @@ #include "cpu-csr.h" +#ifdef CONFIG_USER_ONLY + +#define GEN_FALSE_TRANS(name) \ +static bool trans_##name(DisasContext *ctx, arg_##name * a) \ +{ \ + return false; \ +} + +GEN_FALSE_TRANS(csrrd) +GEN_FALSE_TRANS(csrwr) +GEN_FALSE_TRANS(csrxchg) +GEN_FALSE_TRANS(iocsrrd_b) +GEN_FALSE_TRANS(iocsrrd_h) +GEN_FALSE_TRANS(iocsrrd_w) +GEN_FALSE_TRANS(iocsrrd_d) +GEN_FALSE_TRANS(iocsrwr_b) +GEN_FALSE_TRANS(iocsrwr_h) +GEN_FALSE_TRANS(iocsrwr_w) +GEN_FALSE_TRANS(iocsrwr_d) +GEN_FALSE_TRANS(tlbsrch) +GEN_FALSE_TRANS(tlbrd) +GEN_FALSE_TRANS(tlbwr) +GEN_FALSE_TRANS(tlbfill) +GEN_FALSE_TRANS(tlbclr) +GEN_FALSE_TRANS(tlbflush) +GEN_FALSE_TRANS(invtlb) +GEN_FALSE_TRANS(cacop) +GEN_FALSE_TRANS(ldpte) +GEN_FALSE_TRANS(lddir) +GEN_FALSE_TRANS(ertn) +GEN_FALSE_TRANS(dbcl) +GEN_FALSE_TRANS(idle) + +#else + typedef void (*GenCSRRead)(TCGv dest, TCGv_ptr env); typedef void (*GenCSRWrite)(TCGv dest, TCGv_ptr env, TCGv src); @@ -464,3 +499,4 @@ static bool trans_idle(DisasContext *ctx, arg_idle *a) ctx->base.is_jmp = DISAS_NORETURN; return true; } +#endif From patchwork Mon Jul 4 09:33:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587119 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp650609map; Mon, 4 Jul 2022 02:45:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tr2btGqbmfe+1derJ6ELLV7OjcuIpAHSbrhEKNL8SN9olyxjti+Hm7bWdL3A9ks6OcxUUb X-Received: by 2002:a0d:e586:0:b0:318:317e:b4e8 with SMTP id o128-20020a0de586000000b00318317eb4e8mr32411034ywe.291.1656927923218; Mon, 04 Jul 2022 02:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927923; cv=none; d=google.com; s=arc-20160816; b=NRXL/ioHQtH94N2FM597LqgGchTlFPKMYWWCg/5praG3rzE6CeUb2IW2ciM8Y2F0JC oJr3bHggioWqWVrmCEuNdOEp7Xb+2HgF5uUhx8zbeKriwCnx2mevMuT21kE1Lxzmf7pL XPNh9fGayMfsEjGJG+tQ4uZHjwuQ1nlLjqYEM413Ptri9x4AlFyjiLDaAN7QKHo7fPtV EmQqaNl2x9xWAnT7iyPEVmd1D0LCxxm/+aoL2BFMdnJHXVP1lEP9C0ylRj+IO09HUrgy JGKphdDZ9JUFDCTFb+kpN8WMa3FVvVf2vdkvmguJZ/2BWHy2lQxzkz5AJTjA1N7I0kWe 1kLQ== 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=0b/YbMxnm80Cwom01Lw/iY4YJnZmRZ4e/YON8i35GFw=; b=oY8JwjttqB4hgGp74aSSMmd9G+U3CTgL4w8UTVNd5RdxLl4iySLd9zo5een9jAl5eF N+kh34Lmv+v8ejtPAhocxlvRqboZgsDpYOqjVTcVURj2riVNEqReNOgm/GWKP4Ez8DjE Kv5KBvHFqMFswRzy6ZnA5ZSJV8TCdj5T9xp4Wvij4acH4wtwG9Yd+vpEPCMEUqqzXq8Q b3RuZn1Zwmq8aIJsMlxST3I9BfAXmfzAJHEnLWAsXNsRl13fX1aDo3vTJTf+bSS0K+2/ STZJYuv3dJNd5Lwi9UYyZ74Z6uTu769mkwNAdQ4prVtA12rOVKjZ8Cg2bwNmxQGPHag4 UHeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CRY6Rshi; 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 131-20020a250389000000b0066e2f5edc90si7241179ybd.94.2022.07.04.02.45.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:45:23 -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=CRY6Rshi; 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]:53456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Idu-0000tF-6Z for patch@linaro.org; Mon, 04 Jul 2022 05:45:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITa-0000V0-11 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:42 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:45809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITW-0004yT-RL for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:40 -0400 Received: by mail-pg1-x529.google.com with SMTP id 145so8417554pga.12 for ; Mon, 04 Jul 2022 02:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0b/YbMxnm80Cwom01Lw/iY4YJnZmRZ4e/YON8i35GFw=; b=CRY6RshiwBLlnl9QYYQfwEFnz4yi/NVT4UtEzszm+gIX3dbeUaZPY2OQ95s559FOlL jl+SyuVBsX1cPBS/+nC49tYXQL4QzgaxZbGEI0VSoOTDxKQKke2noEPCiLO3PJeb2Bxg sXrce5t/ExBeDWXFvBmEvBIEL3pwVdJl+v5ys7YqpD8qbcZvMttvQ7NMaFaSfVeoQSZy HgkpugZVzxiAh4Zz4CtEB1eUomddKM3t9Cs7VpfoV6C3pXfFjCGtHs9QnAsmyvVfSqUx y8oT0HRanyhDR6TZxpr7NSX+gibRZOU8EFyAzjANwkayW8wJenkoL/CWO0+ByAYo8Quj aGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0b/YbMxnm80Cwom01Lw/iY4YJnZmRZ4e/YON8i35GFw=; b=fJ4C1fNfNhJm7enXFWHxlAqnWw7vp4UZ+CkBwODauVpn/Jg3wlVm1GIfllaOzXibHn RIfx7wwWecX1N2jGAG0FfOZ63rw74BXIhEXjYJXCnKBjYCnbHbLbM1FPO3raE2IRAaGB 7bo9djd8eL3uEp5+UZtN5ZtgLOPPy+LDePgRQzAfX00vhSrEYDoODQyjDAO9DJNKp7fg /hm6E/KktjSJlbFNXNPGrEDPKhbwpHNcDqjtkzgFXXha6glzI1KpYtBcJcgmznPqZxIG Lx7J3Cw8KC1HsktTFPa65LNiAOIonQrWTrwxFxhTvYA0doju8eOjgFb3dHZTmYixbubP oMOA== X-Gm-Message-State: AJIora+VXRSYyRJUtLLZSYg0ym7CH5xMYYWz+Y6Fe8pID69W7pzhdAFX catAyj8Gtqy4h3Vkt5QiXGa2aQRmgqRUA8Ar X-Received: by 2002:a63:2bd0:0:b0:412:2f70:f0ac with SMTP id r199-20020a632bd0000000b004122f70f0acmr5506971pgr.465.1656927277496; Mon, 04 Jul 2022 02:34:37 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang , WANG Xuerui Subject: [PULL 12/23] default-configs: Add loongarch linux-user support Date: Mon, 4 Jul 2022 15:03:46 +0530 Message-Id: <20220704093357.983255-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao This patch adds loongarch64 linux-user default configs file. Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Reviewed-by: WANG Xuerui Message-Id: <20220624031049.1716097-13-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- configs/targets/loongarch64-linux-user.mak | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 configs/targets/loongarch64-linux-user.mak diff --git a/configs/targets/loongarch64-linux-user.mak b/configs/targets/loongarch64-linux-user.mak new file mode 100644 index 0000000000..7d1b964020 --- /dev/null +++ b/configs/targets/loongarch64-linux-user.mak @@ -0,0 +1,3 @@ +# Default configuration for loongarch64-linux-user +TARGET_ARCH=loongarch64 +TARGET_BASE_ARCH=loongarch From patchwork Mon Jul 4 09:33:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587121 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp653004map; Mon, 4 Jul 2022 02:48:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sSV1mYfyikbDUn/H8t67VfpJ+DQavib99smQ9xMNHAOg6ySTRUtR5rOlp5R+d8JCsAN7rJ X-Received: by 2002:a81:6384:0:b0:317:e066:caf4 with SMTP id x126-20020a816384000000b00317e066caf4mr31793888ywb.180.1656928131582; Mon, 04 Jul 2022 02:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928131; cv=none; d=google.com; s=arc-20160816; b=fb7XKi0TpvuOgHGaUMBdGBmk/GswZDPnFr7GtiBcVr7KkXvHCsFIc+rnp/QGl44GlW XWCvOeWmAP2muZ+V7ohG5O+8Uty6Bx1ruKydRloD0QQfNFUVaYe5fRZGzh522TewtEsv WATTBYWaTPqFAIsCaAwFEMgBaL537gqy33AT31voP891AfCwomSlcWLQjqgzYH/z2ltI l9WIn/O6vBYqbHRx9fdbaDc0K/IGn1nF+JoyDP+/QksvSiMU4yMsEXEa0dChuVAsp0mt erEbICdTwCPHY8xY9s/kXqGqSJIm8jg6KM1YKHFeG+aQBh8ISzZCxuIS6+gzpZLQnpm1 wK0Q== 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=ZpM2xT691aOsaTZd6sDap5X966f+8/CDqP5hDIUEL28=; b=zPQF7qAxMsUGSMMj7i5GhZQSwuAyR+rQDBqDPa2DHGMsgyuUW3RXE2ETmAbsmeXx4v nKRkaMvRWhSIFVLpX6DqoyuQ34obIc/HrOJs2Ua6I8EQWiB84qydwBMVmXfZnZkEIM/q IfyuNtRXSTtfkJGpF9dGF3mMC1Xq8VRERHsXKZ448gbLJEKbCXyLrENFxlQ8HVXGAUDR kFGE8iYCCanLabRZAf0mBMpqSVesnteWXS3QTBF3FQaO2GjqDRxfM/X+8iLS5W9Da2bb dWuuuz5nmSurBGfDMTBJktVtAJDLO/zIThIlSI7gFSLCoRaKPRMPg/Ka7wteQVPFk8/v otKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iWuCx4Vp; 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 130-20020a251688000000b0065ce3a59b0bsi34343829ybw.359.2022.07.04.02.48.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:48:51 -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=iWuCx4Vp; 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]:33096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IhH-0006Kf-21 for patch@linaro.org; Mon, 04 Jul 2022 05:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITf-0000rf-V1 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:47 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:39526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITa-0004ys-Fa for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:47 -0400 Received: by mail-pg1-x529.google.com with SMTP id q82so1268027pgq.6 for ; Mon, 04 Jul 2022 02:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZpM2xT691aOsaTZd6sDap5X966f+8/CDqP5hDIUEL28=; b=iWuCx4VpqAeKD5SFKHBUshW6V0ZF2Cfbp2smIhfW/cvO6S+SfPXGOq2EsQQF6t/5yk I3rPwBtOKgkcJmiY1pXEYWZIpjL4zEVOByuc+nFG11RP2hs2EqZsvcuooLFvI1dOBKPM Fq6r6twd4jyx0+nzc0SJ7f/9FnUxaqLFQwn6/ug0OR6XAfTINCmfaorstsFL85s059FR PgkqkOEYC5XdVx4rbgdNI6IJ1IabRh/IASoQdX1pHEXnwr1X59L6HprbG12lfJsh2UOL QJv5pRI63c4tWZP/RywvnH7ZJpYGKlsP0M361pIS5Xf53itGLgmZV5v2lzGrsyRynvlW YLpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZpM2xT691aOsaTZd6sDap5X966f+8/CDqP5hDIUEL28=; b=hZdA9i5Efd8gpxEC/Z+6brs/20DT5paxKp+gBNhKyFGRxVSiCbkekhTQuckHyzPfuD 1XrOMTWEcx5RVlfiz2DhHsMKJU0xPupo//SD+NtpR5/5pvi/bB8D9G/peI+sl23R5oHN rcRqgnzxi1odDN9Esg4J4VIfNTxJikMcf9FkqmrYNJQzi9w0c7NnM6gAwnX0GFUwQ0BC /5QXuRcdDGBKpjK+5fsmAuLzaOZvyidCrs8k1wMi3ikPq0XZ9M00oOGLbswbBsv8fR/Y WcK3EjdqgiHVzT9xtgt15ekPkp5xowNBfoxjhjAF7yWJiifxyxc4TOPh6RKVYLXM1Tfn ARgg== X-Gm-Message-State: AJIora++uCrihRntgTm+EK/Nj8XAWkp1FZiL+gQ9tKXbPBM3+tup97tr afqSa30UmaBDs+UBkap4bAESbm/kpiVhVM/L X-Received: by 2002:a63:f70c:0:b0:412:1877:7e1c with SMTP id x12-20020a63f70c000000b0041218777e1cmr8859077pgh.621.1656927280233; Mon, 04 Jul 2022 02:34:40 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao , Xiaojuan Yang Subject: [PULL 13/23] target/loongarch: Update README Date: Mon, 4 Jul 2022 15:03:47 +0530 Message-Id: <20220704093357.983255-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Song Gao Add linux-user emulation introduction Signed-off-by: Song Gao Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220624031049.1716097-14-gaosong@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/README | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/target/loongarch/README b/target/loongarch/README index 4dcd0f1682..9f5edd10c8 100644 --- a/target/loongarch/README +++ b/target/loongarch/README @@ -24,9 +24,9 @@ Download cross-tools. - wget https://github.com/loongson/build-tools/releases/latest/download/loongarch64-clfs-20211202-cross-tools.tar.xz + wget https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz - tar -vxf loongarch64-clfs-20211202-cross-tools.tar.xz -C /opt + tar -vxf loongarch64-clfs-5.0-cross-tools-gcc-full.tar.xz -C /opt Config cross-tools env. @@ -60,5 +60,40 @@ ./build/qemu-system-loongarch64 -machine virt -m 4G -cpu Loongson-3A5000 -smp 1 -kernel build/tests/tcg/loongarch64-softmmu/hello -monitor none -display none -chardev file,path=hello.out,id=output -serial chardev:output +- Linux-user emulation + + We already support Linux user emulation. We can use LoongArch cross-tools to build LoongArch executables on X86 machines, + and We can also use qemu-loongarch64 to run LoongArch executables. + + 1. Config cross-tools env. + + see System emulation. + + 2. Test tests/tcg/multiarch. + + ./configure --static --prefix=/usr --disable-werror --target-list="loongarch64-linux-user" --enable-debug + + cd build + + make && make check-tcg + + 3. Run LoongArch system basic command with loongarch-clfs-system. + + - Config clfs env. + + wget https://github.com/loongson/build-tools/releases/download/2022.05.29/loongarch64-clfs-system-5.0.tar.bz2 + + tar -vxf loongarch64-clfs-system-5.0.tar.bz2 -C /opt/clfs + + cp /opt/clfs/lib64/ld-linux-loongarch-lp64d.so.1 /lib64 + + export LD_LIBRARY_PATH="/opt/clfs/lib64" + + - Run LoongArch system basic command. + + ./qemu-loongarch64 /opt/clfs/usr/bin/bash + ./qemu-loongarch64 /opt/clfs/usr/bin/ls + ./qemu-loongarch64 /opt/clfs/usr/bin/pwd + - Note. We can get the latest LoongArch documents or LoongArch tools at https://github.com/loongson/ From patchwork Mon Jul 4 09:33:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587120 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp651929map; Mon, 4 Jul 2022 02:47:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uVbHVnnP6QSm8BwyXTwhXpTteGcZw68uIYxVn4883rhYbzJbR46NRByOuFjfygCvxCKQNx X-Received: by 2002:a05:6902:150b:b0:66d:38bb:b04a with SMTP id q11-20020a056902150b00b0066d38bbb04amr29799263ybu.584.1656928027363; Mon, 04 Jul 2022 02:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928027; cv=none; d=google.com; s=arc-20160816; b=TWAX8oomtoAH2wXO+jYBO1UJXix7cc80k6xFVMfk24+oFbHKnjnGqpabbr5alcYjFh ossEHdFb8C9WrjxjlMiciKmUAxggZ9EAn80hnsGtneelzEU9QsTreXw/RQ8T4m/m/zXX s3vIgzOkEi16VLdIG/jmehQApeMl6w5Gi5G2M9XQM6PTQpY6lQiDEd20V+fYazT62JJw iQrb1RVZT6LP2vpupwESRevO06kjhUOuAsQ9wlJhcgp1pk1wzTo5ND0eAiiQ2FMU6dxV +3iGj16Cswu+z7oblnbXIf4e2/wI1SJr4LnY2Y7plMpmo1vOUkLpgL7s5mBm9xECZ+UD xfWQ== 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=G3YYIcUnrqd5oHhpbi/6tYWybx050Cnw/0reTDM7VDw=; b=g1jEasvkB1lIVR4kCt7WGrj11yrahJ03arfkojwwi5bIqg+X+AgUdpZUT+38NZWJD0 vDURVS35bdcUp3CkwxrGI9h6VfRY/LTLRc5wMtV2zcomYs1bCzgloNfwi7C6uwUhNVmN VElYGEZDhmteeXPjIvUWMewuKEcb5sKVG4p5bzstl4bhbkLprF/a7cPuEKAqxrFXp61/ WL47UhR+3lSD3Q0VhXLrKT6UrZ2opEDWeKtp0dZqVRbUb2OYoX3srjuM7DRHNR50RKsh 16LNjkPyRyasZ5bMn5qUJNZiXceOYxz6UTv7lcJG1QNzWEKTD05mjCs1FjTz6i9l11wc /kZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRI917d9; 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 j200-20020a2523d1000000b0066e62e7deffsi149614ybj.456.2022.07.04.02.47.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:47:07 -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=cRI917d9; 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]:56026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Ifa-0002gd-RL for patch@linaro.org; Mon, 04 Jul 2022 05:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITg-0000sV-5R for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:48 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:35534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITb-0004z5-Ri for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:47 -0400 Received: by mail-pl1-x62f.google.com with SMTP id y18so80327plb.2 for ; Mon, 04 Jul 2022 02:34:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G3YYIcUnrqd5oHhpbi/6tYWybx050Cnw/0reTDM7VDw=; b=cRI917d9EF7H0tnPAS8QeSKiJEj1Gdl3YxJCXt3auSsTMZkipfmNCLapfX3B3MGezb zMu+0Akah70W47/0sVc7/awfyKe2tqQL1RyiJfTBAV0YtSHTOwHlA9zfO41lcv1fNMLY PGBfQOhpK2acvR9E42aea0y7Ltape8+1PoiA54RyWgAH/wciivrkgz/5gQ8CYjV02sXk nS35RtIk3KrRVz38TN/r796WIwsPygu7Yy/buG9fS0oENkFJvMZMI9YExVwZ2FOBPWg9 fCK+iJoxb66SjQmMcEgdjVyPc/YP3d+DhWwNwZOXswmQeskAZLcUbZYGA9RPFwan86BQ 1K/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G3YYIcUnrqd5oHhpbi/6tYWybx050Cnw/0reTDM7VDw=; b=EHaWoKUumugeMZTGTQXG4m9pCYGMQiEZNWS+u4MxFcqOlaIuR7fDYaoCowzSbgskUo /K99NDV/T2EZl4OUR2IMT4r3bc+jqHVGJd+S/lw+JenStfzh9tiyCAvmgYqSvAowtQNZ 9Ngef+e4hjEIeWf9eYjM1s3J+JbVt5J45ZjlEZykgCsYpd7Ee0/K50N0KQDErKLijJQm C9FJ8PkLzsphHeuZIhRWXQrthRv2/MUXkU5XBdIHSGC05qTTfDI7bRsmShfYsqivpU0o /y3XMgNxiD+nf34FeWLxRyVNEqy0PBIGsM5Q1ykmks2IP1iMv/6sbPQGIEEvtPQdSoJZ n8oQ== X-Gm-Message-State: AJIora/8pEExLLwU12y10/pGzlB17FLjjhTAN4pYNsBCEZCtlKKCamEa tA8hFO1fP4sN6CCIk72nEbPtl39moUgdvkn/ X-Received: by 2002:a17:90b:38c2:b0:1ed:474a:a668 with SMTP id nn2-20020a17090b38c200b001ed474aa668mr33517579pjb.201.1656927282644; Mon, 04 Jul 2022 02:34:42 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mao Bibo Subject: [PULL 14/23] hw/intc/loongarch_pch_msi: Fix msi vector convertion Date: Mon, 4 Jul 2022 15:03:48 +0530 Message-Id: <20220704093357.983255-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mao Bibo Loongarch pch msi intc connects to extioi controller, the range of irq number is 64-255. Add a property for irqbase, so that we can compute the irq offset from the view of pch_msi controller with the method: msi vector (from view of upper extioi intc) - irqbase Signed-off-by: Mao Bibo Message-Id: <20220701030740.2469162-1-maobibo@loongson.cn> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- include/hw/intc/loongarch_pch_msi.h | 2 ++ hw/intc/loongarch_pch_msi.c | 22 ++++++++++++++++++++-- hw/loongarch/loongson3.c | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/include/hw/intc/loongarch_pch_msi.h b/include/hw/intc/loongarch_pch_msi.h index f668bfca7a..6d67560dea 100644 --- a/include/hw/intc/loongarch_pch_msi.h +++ b/include/hw/intc/loongarch_pch_msi.h @@ -17,4 +17,6 @@ struct LoongArchPCHMSI { SysBusDevice parent_obj; qemu_irq pch_msi_irq[PCH_MSI_IRQ_NUM]; MemoryRegion msi_mmio; + /* irq base passed to upper extioi intc */ + unsigned int irq_base; }; diff --git a/hw/intc/loongarch_pch_msi.c b/hw/intc/loongarch_pch_msi.c index 74bcdbdb48..b36d6d76e4 100644 --- a/hw/intc/loongarch_pch_msi.c +++ b/hw/intc/loongarch_pch_msi.c @@ -23,9 +23,14 @@ static uint64_t loongarch_msi_mem_read(void *opaque, hwaddr addr, unsigned size) static void loongarch_msi_mem_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - LoongArchPCHMSI *s = LOONGARCH_PCH_MSI(opaque); - int irq_num = val & 0xff; + LoongArchPCHMSI *s = (LoongArchPCHMSI *)opaque; + int irq_num; + /* + * vector number is irq number from upper extioi intc + * need subtract irq base to get msi vector offset + */ + irq_num = (val & 0xff) - s->irq_base; trace_loongarch_msi_set_irq(irq_num); assert(irq_num < PCH_MSI_IRQ_NUM); qemu_set_irq(s->pch_msi_irq[irq_num], 1); @@ -58,11 +63,24 @@ static void loongarch_pch_msi_init(Object *obj) qdev_init_gpio_in(DEVICE(obj), pch_msi_irq_handler, PCH_MSI_IRQ_NUM); } +static Property loongarch_msi_properties[] = { + DEFINE_PROP_UINT32("msi_irq_base", LoongArchPCHMSI, irq_base, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void loongarch_pch_msi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + device_class_set_props(dc, loongarch_msi_properties); +} + static const TypeInfo loongarch_pch_msi_info = { .name = TYPE_LOONGARCH_PCH_MSI, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LoongArchPCHMSI), .instance_init = loongarch_pch_msi_init, + .class_init = loongarch_pch_msi_class_init, }; static void loongarch_pch_msi_register_types(void) diff --git a/hw/loongarch/loongson3.c b/hw/loongarch/loongson3.c index bd20ebbb78..403dd91e11 100644 --- a/hw/loongarch/loongson3.c +++ b/hw/loongarch/loongson3.c @@ -267,6 +267,7 @@ static void loongarch_irq_init(LoongArchMachineState *lams) } pch_msi = qdev_new(TYPE_LOONGARCH_PCH_MSI); + qdev_prop_set_uint32(pch_msi, "msi_irq_base", PCH_MSI_IRQ_START); d = SYS_BUS_DEVICE(pch_msi); sysbus_realize_and_unref(d, &error_fatal); sysbus_mmio_map(d, 0, LS7A_PCH_MSI_ADDR_LOW); From patchwork Mon Jul 4 09:33:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587124 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp653674map; Mon, 4 Jul 2022 02:49:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tEXmie37HW+deZzadqVpH75MT4RrITp/KEbDf/FqbAhsNOtEktgwT5pEl+s3YT9liDVnAO X-Received: by 2002:a0d:d1c3:0:b0:313:eca0:bf42 with SMTP id t186-20020a0dd1c3000000b00313eca0bf42mr32766736ywd.369.1656928190842; Mon, 04 Jul 2022 02:49:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928190; cv=none; d=google.com; s=arc-20160816; b=I+dM7jxlArbaZaMdaPssFvHQkIcgDe+1ACiS5JJZdfk4Fr+8TfkhQciwz1gCSYUIyL WM7kjvoAtvPLhKJd/cLuBiJpeLi3Jx0iQOLM+aPZ6TcpDY4MN5h0J5RzuV3Nlo9GO1En +TwZKxGTOVrkxf4anokJ4IBbkaO96Lc8IMmYcOMDLOmmiXVitFMtOeaKyOacsCdQqQKH XkBTK66SrYXOAi96PA1/3OYQDOICHH3EJ55PEHy3wJwGocnkR1y6aUiuAVo2iXqO/J0w eMRA0wbwVeU85w7olFzpOeWsU7WQmiTv05R4Ws0tTxkjOYKWnO9092SGXJhFtQvtiSDE 97Cw== 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=PPqUahiWt2M7Eg8LZ9lJoQvj046orfAZ2qStTlP4KlU=; b=MYtfZdwDno4eUZrsQ9eP0ZC1qQ9L4P4gPzXSjJ9ZvSk7787M7XJylx30cvar9YUV02 pOyqls0+fi6aXOQyHEtxcqZan5zQOCMLY7GhGPrbEQmWaLOT0bCUqTW5E11CO7Zifc5F mY/4w3fuwMxQwOerv9/Fc+2KAVw9kiX2b33taSlFHWm+DPFYlIpcjbp5Xjmh0vFsM8QH TtdY++k0zhZ/lmCpaqc3Wxn3wCOXmxGUTqbVzdozm3F4tYZtJPKKMSe2ITJKzAZFiXu2 vUoe/XWFb1ZKRURRK1onc7q1xtYqu4myTyM5QUkRwvKX+gYwmwLJ+HkFgCfWR2hJKjbp uBMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SNJ9yR7w; 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 l203-20020a8157d4000000b0031c86fe3698si7214853ywb.20.2022.07.04.02.49.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:49:50 -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=SNJ9yR7w; 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]:36412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IiE-00007v-CX for patch@linaro.org; Mon, 04 Jul 2022 05:49:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITh-0000wt-Cm for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:49 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:37668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITe-0004zB-97 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:49 -0400 Received: by mail-pg1-x52d.google.com with SMTP id bh13so2501996pgb.4 for ; Mon, 04 Jul 2022 02:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PPqUahiWt2M7Eg8LZ9lJoQvj046orfAZ2qStTlP4KlU=; b=SNJ9yR7wXI0SCMwatGbuW+9FViL3qfuFIcOlajfZJRnR1DJgCFECPJhezGtO4Fx38a L0gqZNbNG+2jjmrUtUJAOLn5dzQX3NpP5FKJERrfc9znWANV+n/fCirUDDA4MjKibxmN 2n/Ao/WGowEoutFeAgw96cFrIVDIA42LdUKk9m9SujuLS9gSIvO4yGUIxZLwX5TEjba2 Gq0x6UQblTB2//s6DSPWlhZmOIhn6oYrgd1X/ttH9PH+M6ARYFzpd4n/2vFX7kXo8TrW rDZpjqfo2CAKbliSoDWcXpQP8v4I/jHklFjDVXFuvs3hx+/W8zR+MR1WUnJCZm00Goj4 W6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PPqUahiWt2M7Eg8LZ9lJoQvj046orfAZ2qStTlP4KlU=; b=4sDpzlFp98GbHZT8e6vWdepPE2sqBZcQ8qHKOCu9u75XY2wLMC0SiPdhb6Gxfr0bpJ 0MbCx9bLVBUmlvH5WIE+VRSgAgFGsnDPrA3mfvBG8qOBzblVFtLPa0cTzBW+VOrDUMpP lE92KwH4gH9pLgtKFXwmwgkzIH1BJ60FKcX3v4AXtNMeCN9013Rv7Vq276BKE1QKwjp+ TVcdKSYkkA6yvIx0o6lzHuXlGuKh8XXp0AQ90gia42K3OxrDe0eIrRNAYLkjv2xpCmM5 lcNC5eJfJ1lxY64easymDRcEaer4XtgxLWhVkU/w5N9WqITkn6QoJOG9TwXCqBNfHeKM 7BWg== X-Gm-Message-State: AJIora83X4suBHOFPUNxFDS4l+JA4/M1jvETBX18voG4Nsiss4CUSP8o 6XzpnI1u0YRPgcVdJo9q9RD/J2k34JNbWvM9 X-Received: by 2002:a63:90c7:0:b0:40d:3c0d:33f4 with SMTP id a190-20020a6390c7000000b0040d3c0d33f4mr24329021pge.334.1656927284947; Mon, 04 Jul 2022 02:34:44 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 15/23] hw/rtc/ls7a_rtc: Fix uninitialied bugs and toymatch writing function Date: Mon, 4 Jul 2022 15:03:49 +0530 Message-Id: <20220704093357.983255-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang 1. Initialize the tm struct in toymatch_write() and ls7a_toy_start() to fix uninitialized bugs. 2. Fix toymatch_val_to_time function. By the document, when we calculate the expiration year, we should first get current year, and replace the 0-5 bits with toymatch's 26-31 bits. Fixes: Coverity CID 1489766, 1489763 Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-2-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index fe6710310f..b88a90de8b 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -148,8 +148,9 @@ static inline uint64_t toy_time_to_val_year(struct tm tm) return year; } -static inline void toymatch_val_to_time(uint64_t val, struct tm *tm) +static inline void toymatch_val_to_time(LS7ARtcState *s, uint64_t val, struct tm *tm) { + qemu_get_timedate(tm, s->offset_toy); tm->tm_sec = FIELD_EX32(val, TOY_MATCH, SEC); tm->tm_min = FIELD_EX32(val, TOY_MATCH, MIN); tm->tm_hour = FIELD_EX32(val, TOY_MATCH, HOUR); @@ -158,17 +159,18 @@ static inline void toymatch_val_to_time(uint64_t val, struct tm *tm) tm->tm_year += (FIELD_EX32(val, TOY_MATCH, YEAR) - (tm->tm_year & 0x3f)); } -static void toymatch_write(LS7ARtcState *s, struct tm *tm, uint64_t val, int num) +static void toymatch_write(LS7ARtcState *s, uint64_t val, int num) { int64_t now, expire_time; + struct tm tm = {}; /* it do not support write when toy disabled */ if (toy_enabled(s)) { s->toymatch[num] = val; /* caculate expire time */ now = qemu_clock_get_ms(rtc_clock); - toymatch_val_to_time(val, tm); - expire_time = now + (qemu_timedate_diff(tm) - s->offset_toy) * 1000; + toymatch_val_to_time(s, val, &tm); + expire_time = now + (qemu_timedate_diff(&tm) - s->offset_toy) * 1000; timer_mod(s->toy_timer[num], expire_time); } } @@ -223,7 +225,7 @@ static void ls7a_toy_start(LS7ARtcState *s) { int i; uint64_t expire_time, now; - struct tm tm; + struct tm tm = {}; /* * need to recaculate toy offset * and expire time when enable it. @@ -236,7 +238,7 @@ static void ls7a_toy_start(LS7ARtcState *s) /* recaculate expire time and enable timer */ for (i = 0; i < TIMER_NUMS; i++) { - toymatch_val_to_time(s->toymatch[i], &tm); + toymatch_val_to_time(s, s->toymatch[i], &tm); expire_time = now + (qemu_timedate_diff(&tm) - s->offset_toy) * 1000; timer_mod(s->toy_timer[i], expire_time); } @@ -352,13 +354,13 @@ static void ls7a_rtc_write(void *opaque, hwaddr addr, } break; case SYS_TOYMATCH0: - toymatch_write(s, &tm, val, 0); + toymatch_write(s, val, 0); break; case SYS_TOYMATCH1: - toymatch_write(s, &tm, val, 1); + toymatch_write(s, val, 1); break; case SYS_TOYMATCH2: - toymatch_write(s, &tm, val, 2); + toymatch_write(s, val, 2); break; case SYS_RTCCTRL: /* get old ctrl */ From patchwork Mon Jul 4 09:33:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587114 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp648757map; Mon, 4 Jul 2022 02:42:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vGfscL+zOpS3ez0o3/SxTLZHo3uZ+604boqM+dmTUa8CgwEUJwg9woymvYNMVfOcNrGcYR X-Received: by 2002:a25:248:0:b0:66e:2a2b:4a5c with SMTP id 69-20020a250248000000b0066e2a2b4a5cmr11318352ybc.109.1656927746085; Mon, 04 Jul 2022 02:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927746; cv=none; d=google.com; s=arc-20160816; b=vm/q7rMFnd4fILNfV6Ioqs7fxAnlEvMHBiV2AZlPcaFhV/ODbgFi5B9kN8PZ1IJObJ i00Ly7VW3CVRjAEZEr4pe/bcksHrSGObcwRvlrzQqS2CVG06KfbR4DVPSP0c4gBbF7FO GUF3aF7lzVlqAJHXK6fs7FSOPsJu5UHfReuFnrUGUdV9XWMN4R59arDbBisTLPAPPSH3 lhQhlbWwoWJdwYQD9Wcub+rQjtfEizbejY+M9SBaMwzfsrLGfkAZL/0xwByk8XAINcbC Rn8CVXzcB+y2iqyHBGh6QJPfVe1gQy+0JLIBmCBHmrgstQQTtn9gZ9sHPFqa/GElL0Wd JSUA== 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=DK+o36Kb2qI9WXT+tA4Mnr7sNiWthsvqHNWaprqXJrY=; b=KEwmWh/PAF2zVuIuNYkFvvAG0iGcuocPtF8LYYOhOnKaJ6NH2FmtSRg9jx7MFFUdIN jwdrz85xkZIKgc9+uEVJhuXjpUP9tqd9yxs0y8X5mPMD02QE9u8srA+jVySdUm1SJuMf 9K/x1Ma+c/h3W/AyDBZJIVDUglpKmamssRNNLTPbncN5PKvSy1yJD2EfZt7ILnmrvWPn 74meDOWbzzkJQnuMk6JDmJ5RDyOQ0SHgj+TY1Flvk2kymJ7bg7vQsTaHeaH5hg4FyhMG Ut+kAF0Tf3hhMEv8seoFv3hpQp2tcY6Dz5UqxcTOIdiZYBZ56eaxo2X/aVHZRuu/Qy5M I+RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xz+lRHRz; 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 h127-20020a813a85000000b0031c7225ab98si10844064ywa.472.2022.07.04.02.42.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:42:26 -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=xz+lRHRz; 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]:44592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Ib3-0003Hg-E4 for patch@linaro.org; Mon, 04 Jul 2022 05:42:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITi-0000yC-Tj for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:50 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:40555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITg-0004zX-Gk for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:50 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 9so8441175pgd.7 for ; Mon, 04 Jul 2022 02:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DK+o36Kb2qI9WXT+tA4Mnr7sNiWthsvqHNWaprqXJrY=; b=xz+lRHRzVw3nsEdp2BMdCv0SlEaF53WHj/gSEc3giXJkAjs5fw94wofm/zKp7z3QKZ qnjERsowGhY/zoEf9AubwYHtdGsHSgFgsuy1KstTj6iEQnPc86C8EwU3QjDtKB5T9JqN DAp4sPXSgOETzhp8h6uKNdNKFujmLksqyhZEv/wUtdofpkAcysqXmdPxdPmGMzRcK0Zv p6kDVm1vHK3Boy0CoaqhptE2sWvpNgWIpHbodGK4/8xRbl2M8UcYsPRjw4UCG6/JX7U0 +NAF5pechy3pEgOt1GmkqNkh69WQtmpZDAZ9DDB1FqyR86BLokwy3TvsZh5rhdz1wp0Q /OeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DK+o36Kb2qI9WXT+tA4Mnr7sNiWthsvqHNWaprqXJrY=; b=1ye+9zRUG1mqCJON22Rf/0j6VVE8W0nh7RAfy2BH0atAMeJOq03DNn41KG9WlJfZnu jndIpIlPKGl94kyxWd4Fw1crtpU/RslNbeif3EvEvcx0sudMxuVv4U4SDr4rUSN6cJpf 3kOxZztpwQDynNjv3lVYhyCVOwiWhmxzOn28NncUGxLvKMkwfCWm1VNAouMW3W6bOd3Q Iny1At3YxP9jSwtsh5Wtep+ghH2RE1IPqlfjfWbL5FPZMJQpdvx9aPkXm3muyOxFucgh z5VSmzqtoZHvrkSdWaZO7rj2UDvmNc4IJUygrwVwT+CkK66d6WwzRKiPXpKk7Zx+s4lV lFMA== X-Gm-Message-State: AJIora/hYTIOjl8DlejxlXdsFSXI3nYjhUtGgBiDfEtoDdrsJbydeXPg Kua/1m6UthOqhKuhlusYBkuyi+fEYah3SeXI X-Received: by 2002:aa7:910b:0:b0:524:f8d9:a4c4 with SMTP id 11-20020aa7910b000000b00524f8d9a4c4mr36336103pfh.5.1656927287219; Mon, 04 Jul 2022 02:34:47 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 16/23] hw/rtc/ls7a_rtc: Fix timer call back function Date: Mon, 4 Jul 2022 15:03:50 +0530 Message-Id: <20220704093357.983255-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Replace qemu_irq_pulse with qemu_irq_raise in ls7a_timer_cb function to keep consistent with hardware behavior when raise irq. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-3-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index b88a90de8b..780144b9da 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -425,7 +425,7 @@ static void toy_timer_cb(void *opaque) LS7ARtcState *s = opaque; if (toy_enabled(s)) { - qemu_irq_pulse(s->irq); + qemu_irq_raise(s->irq); } } @@ -434,7 +434,7 @@ static void rtc_timer_cb(void *opaque) LS7ARtcState *s = opaque; if (rtc_enabled(s)) { - qemu_irq_pulse(s->irq); + qemu_irq_raise(s->irq); } } From patchwork Mon Jul 4 09:33:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587125 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp655497map; Mon, 4 Jul 2022 02:52:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sTZSEEMujZS2R8tYieL/7bqdGOuihDfjzzC2NIOZLnWQz4XUx+KHkZl9rl/+F+Tf6X2/BY X-Received: by 2002:a81:4e0d:0:b0:317:a8d4:abdf with SMTP id c13-20020a814e0d000000b00317a8d4abdfmr32463179ywb.108.1656928336172; Mon, 04 Jul 2022 02:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928336; cv=none; d=google.com; s=arc-20160816; b=pqcZzblFuN5qiDXy1rTPKpJk4M3q8u35jy72cyzVGC8W87LHvKqLy/xP43roEyzXJu DsLwwAv49BsrlkchHZBYiboqWgzy/7uw/5CMSIQ4U7bI2awwndXEHK0yVCcMrqWupZpI 7gzZS5L+R+rYiGuVYhjoz0YDrsgJDExp80srU6FBIfcFEGs4sDBlGJDUNxL9fuxanHI5 k8m09j3GD0censp263wbA4bO3Q8ysHnpq2Hdw+J6uia9JY85UOu8QFy9F5YJDNb0/XDT JFmYA1FeMy1mxXiH0qOdPd+4byxCTZaejiY8H016jNdScn+XlAaEs6ZgQuN/U13+DiXs khiw== 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=2U8gGwGi459tJBiJfuXez6/qhKpO3scBOa8Znkp50V4=; b=O9B7ekIa1mwAYq5WwpT1UCRVqWH7xcS8N+id7BSOU3IQor50KqwMFe6m2tBk+tnIWa pKztFozmvnhV+gZN3dZqNg19oere6WuXB1cj3eX8nMOaJaXLTldjkiYxAtryTEeFJrrZ Bq89bVw9K+EjafHLpIEqM6MRAB/LMRWtIa7aIshIHnTHpBCzkawGP++JOMYJ73lyuTLN tXJecq2L5oaQ7q+7RzHksP2IvtWR+9DAo27ckDZEwhn6XSTwFZttt/WDTWQQ4yIj/sm3 wmFrKLsNvOQbQ8Do3kJ4621v8SkB8NcU91K69MH0oVwY/2xXjHlI+h3P/klbyM4oHQxR St/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i9rNdrN+; 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 e67-20020a255046000000b0066e25df37e9si9434281ybb.395.2022.07.04.02.52.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:52:16 -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=i9rNdrN+; 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]:41398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IkZ-0003gD-La for patch@linaro.org; Mon, 04 Jul 2022 05:52:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITk-00014r-UT for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:52 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:39526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITj-0004ys-CO for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:52 -0400 Received: by mail-pg1-x529.google.com with SMTP id q82so1268419pgq.6 for ; Mon, 04 Jul 2022 02:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2U8gGwGi459tJBiJfuXez6/qhKpO3scBOa8Znkp50V4=; b=i9rNdrN+8YtGAAVY8MC8WNSeKADfefcc+qHEHAz9IlmKekUI0U7Q4mM3OcdL85FGoc AD/SSzl25Fz+E7iiNm9wVRz2mhQo98GBgSMuXX7LmSWJ6QTHpmV3GewpTGJUvziHpczw MSfspMsMNX8tvQc1KJvFXqNU7kzs6HwfvoXI/bTTCHJp+oCZJfncAW3qAr+8SIrLskP6 1I37P6w9L+7B8oaDxzfMxlFMe+Azpkeg3MZG4/YlM3VD6DiwtZ3SWPwqkj9AhoaITzaH x/UVlYY9j3KhAKL5HADKmIt2pj6X096r4EtSbPl0FMZEki+bUjDt+ymCjFx3PwrAyaqQ WxfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2U8gGwGi459tJBiJfuXez6/qhKpO3scBOa8Znkp50V4=; b=Psbr8ywQV4/cAsakvt0v9c6Zwqj4KfDoulhRI432P4Nir6BMyH9CuigZsy6WorjuBF y2pomJ4of62zdRxUUuw1R8RzyZ3NlBes62JIDLj7bpXQ6J3/IS2o9Sz6qE4WkLgMF7UW XZYuRTe61KZrJ1W8rfXGzmpvEeEepytnlQLuP7Abs+K5TTwrmXADSCtXNfay1VWn0lV7 3js/nWxyOUQWrN1BrthJGroBXvzLhm3EyPKjRededKUO+xV39YInjVaZRSSBwjkdZRl5 UPAAbiQ9ThHOgRwLChZgOIFMrT2ainkdBftPZ7hO1Px74iRrejS6ra5ZHJjo3LD0bREb 1Gzg== X-Gm-Message-State: AJIora8v0D5UdcDNrJ/gEo9e3N8uDAu1+NBOqHGhkNpsEk9vxt3s1G18 cYNNedRnvPoXEGz2fq9qhO/51C8NlyFK8dGr X-Received: by 2002:a63:8c5c:0:b0:40c:95c3:8c02 with SMTP id q28-20020a638c5c000000b0040c95c38c02mr25371391pgn.419.1656927289624; Mon, 04 Jul 2022 02:34:49 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 17/23] hw/rtc/ls7a_rtc: Remove unimplemented device in realized function Date: Mon, 4 Jul 2022 15:03:51 +0530 Message-Id: <20220704093357.983255-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Remove the unimplemented device when realized ls7a RTC, as it is not uesd. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-4-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index 780144b9da..f1e7a660e9 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -461,7 +461,6 @@ static void ls7a_rtc_realize(DeviceState *dev, Error **errp) d->save_toy_year = 0; d->save_rtc = 0; - create_unimplemented_device("mmio fallback 1", 0x10013ffc, 0x4); } static int ls7a_rtc_pre_save(void *opaque) From patchwork Mon Jul 4 09:33:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587118 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp650507map; Mon, 4 Jul 2022 02:45:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxfx0IQsdjetCD2OooPtRBkkfwb2CkBR0NyoIoxu36xFq0U8341/0cR86VPeXFfmyzIiDe X-Received: by 2002:a25:eb08:0:b0:664:3fbd:f9c9 with SMTP id d8-20020a25eb08000000b006643fbdf9c9mr29947579ybs.88.1656927913368; Mon, 04 Jul 2022 02:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656927913; cv=none; d=google.com; s=arc-20160816; b=fkZPjCXtkC4mEHwvNWIgQ7pj7LS/BYrs0XVl/aBNLClI8Faql/KN6M9Cr63KdafB4x D9zTqBIe7d+Ib9Kj7qqWwZ4Gx2+p+qBbA4rti+TNU8kRuFBILNvXavZF6hPomrs7GaCV nf2aFOkdNXqF3G+ocdDCTUBge03Zi8iyC8epp+jeT6QL5PddBmN53N+x1EnlYVVgez/P 7Pi+46R10mJCBnA3ZoeH2wEIjCrBOlDbNJoRmUBsUmwXjkZdD8LVMiwiJax2w7uYcYsR NjZ4a/PKw25i/pj/0AILoL4vgwrVJARwJtgC98qBSKBuTbz5k/Wt2/efcOiHjU3oYE7G GtaQ== 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=xRn3dlMBTLw7s8LlUcFJIo3Piu/j8Godlc8+nn+z6/k=; b=KHkRMMJxm4XidoEJ/B9IAJ4tJOcWUstf/jyaJFAqGmYOT/+Qh3gQ61W6GKAbeQ5Wvb D90B1ysUuklZTWTSkdr6F6yNCW3ULZ2f/mX01bk6oogf00wLkVMk11quzKY1Zi2Oszcj Y8dk1ZmX7cAP8g7WlFD7MPjMxt4hJAJFLFHlGX5tz7GOdfhai4n6Zw2AE51PQDzJh2Yy QoJXHDsNixr5+qn90kJXlCDZXbLvz8U2YZmH7l8G903HDo4pM7Tv+YVZvSwJe57MOhHs wa94pg4F2k98iRH7Y5k81R0qn1WpzqkwK6DSiKC5NWYDADvXFJXKJr3mF+d5FhGAq5Xg pICw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mxpuontj; 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 64-20020a810943000000b0031c980c30b4si3635008ywj.525.2022.07.04.02.45.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:45:13 -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=Mxpuontj; 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]:53086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Idk-0000ex-RS for patch@linaro.org; Mon, 04 Jul 2022 05:45:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITm-0001AX-Tq for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:55 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:44918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITl-000504-B0 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:54 -0400 Received: by mail-pl1-x629.google.com with SMTP id l6so8059279plg.11 for ; Mon, 04 Jul 2022 02:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xRn3dlMBTLw7s8LlUcFJIo3Piu/j8Godlc8+nn+z6/k=; b=MxpuontjrktHYdZuYoznkc5z6olhgKsQX0MWYBZY6hn8dg8kHRVOQbai+DXGJwonJw zuYjSLZnSTOc7ySkdr2j/013N4PwhstwfsrrU6GR9/tU8jk2FQk3TVsvpYc3a3p21ms1 CZ9h3mwel6vP0RlS0bHh8hM9f5UZYGjfLhZAmtBR1JGqi4exySmFTg+8hFvqU4pEUpDV NM8mA/bnGySY82SV8ARMeM48I6rJ4TJfHjcx9rw/yFIh8ChLR+9zHA1gJZ34QbsI2Ddt 7t/PemsVVo5U5h0P6vBHAIphODEE5LWwucc4OhGgpt1I61eIX4kq9mlnNQ3vZ+XCtK+L UxQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xRn3dlMBTLw7s8LlUcFJIo3Piu/j8Godlc8+nn+z6/k=; b=mCP7JiUrco2zG1MQw29erTuMRl5+RztJo2/sQ++geGr6Zv/uPKgVegyySHReurLOpe EMSopl9BJIn2b7/MjvLbYoieH8yxqLV/lTh8mc64Rz4UyGtHYzn0ag9vtrPfZ7Do9gv1 tYXG4JM/+AWA1svCRLkhdo96Obn5D69UkcxswMtDMFXZqTgIvzetCiMrcrSDPWieBO00 1kH+KsGAUIkXmedVN0UMzPAO1SvbUlLcv1zKRQAauXGh4WUhYdZMejsTpk6ANyK9WJBa nYIaYZKx8jxMixKA5q39dXT4wuvFzqvzt6d9jJsQEfCkRmW8uFbD1t50kR58vXv9aGj9 jdww== X-Gm-Message-State: AJIora8RCtemUu9F5DwbTKObOiwnqhQmvlfir90dSWUB4shHHe1hLnyo 8fxVsRykWQ0qrP6N9TAww/Ntux5OwB+S8TWd X-Received: by 2002:a17:902:cf03:b0:16b:e692:c104 with SMTP id i3-20020a170902cf0300b0016be692c104mr2717340plg.134.1656927292026; Mon, 04 Jul 2022 02:34:52 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 18/23] hw/rtc/ls7a_rtc: Add reset function Date: Mon, 4 Jul 2022 15:03:52 +0530 Message-Id: <20220704093357.983255-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Add ls7a rtc reset function to delete timers and clear regs when rtc reset. Signed-off-by: Xiaojuan Yang Message-Id: <20220701093407.2150607-5-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index f1e7a660e9..eb10cdb451 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -463,6 +463,25 @@ static void ls7a_rtc_realize(DeviceState *dev, Error **errp) } +/* delete timer and clear reg when reset */ +static void ls7a_rtc_reset(DeviceState *dev) +{ + int i; + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + LS7ARtcState *d = LS7A_RTC(sbd); + for (i = 0; i < TIMER_NUMS; i++) { + if (toy_enabled(d)) { + timer_del(d->toy_timer[i]); + } + if (rtc_enabled(d)) { + timer_del(d->rtc_timer[i]); + } + d->toymatch[i] = 0; + d->rtcmatch[i] = 0; + } + d->cntrctl = 0; +} + static int ls7a_rtc_pre_save(void *opaque) { LS7ARtcState *s = LS7A_RTC(opaque); @@ -511,6 +530,7 @@ static void ls7a_rtc_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->vmsd = &vmstate_ls7a_rtc; dc->realize = ls7a_rtc_realize; + dc->reset = ls7a_rtc_reset; dc->desc = "ls7a rtc"; } From patchwork Mon Jul 4 09:33:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587127 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp657119map; Mon, 4 Jul 2022 02:54:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t9dUWSD5+uylBBKyR5kCL6TxUKN/8TzxKauGlaFUDbL/Gl6vy74n+7sefOLxYjmlVrFCgj X-Received: by 2002:a25:1583:0:b0:668:e74a:995f with SMTP id 125-20020a251583000000b00668e74a995fmr31381516ybv.1.1656928481808; Mon, 04 Jul 2022 02:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928481; cv=none; d=google.com; s=arc-20160816; b=ktELrTEuTa21AincE0O8EX4n8MD5G2i2XhvyLxOm/yg8eBqmDWDMAmnXmm/Hq4f6qZ pTSkFrOWE/btXWPTYEIhPvgbAdB6xgHN/xRzOGSX7yINbLQXzr3ITgwPKoktHmbqwkt6 mt8MWOFYkWCvGYK6Qp4PEX/NPjXrxNJk9QThDKqjqm1YkhxDdqyKIyCbWqoS6SWOSZ/l htOc35f9EVnbQWGZEB9GMLoBc4FdIczoEgIuhSR/iIygZHk3QRyIUkvoUPcBFwTDGX1d M7Ixq4TRSEq6WbIS5m1uKDLb9shVagiVC4zX4mcovzp3uC+WDifHe0mXArSLj8py7rCV xzTA== 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=osLJKyNmPqnc7lVA+B9CIUOXsndu+uo/6mM5gEQ/mGQ=; b=juse4rAWzobrLZKlgez4bf6llDFjMOkW+ehtgGfawet/YWuuy2OKUf5kL9TuR4H64W kUw5M5FUEDaMCBlVvDzx3+kha0RS9d07QaCUXbnEgomTGHcoSHqwQyQggM7sLZKl5Kvl 7C0yVw7SbsZGojaRjcGNfrx4LkiseGH6toXy4os1GkIugUqzx56FBQp4WSvHlIo4lTNA u1sdZmhHBgMEMPr7xnFSx5aG5uMFrQK8kMRe4c93s/6pkMhuUpMToTr56oiWmfeRK+lS TVDFIhz5RYfY3ocasXOeRbQemod93zsZoj5HY8Z1K+ETs2U4WfCYtU42fjrYOni4F/z7 DyHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MdlDS0+o; 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 195-20020a8101cc000000b0031c9d6bb1c5si2030361ywb.324.2022.07.04.02.54.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:54:41 -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=MdlDS0+o; 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]:49490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8Imv-00016Z-8Z for patch@linaro.org; Mon, 04 Jul 2022 05:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITp-0001Go-54 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:57 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITn-0004xx-CG for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:56 -0400 Received: by mail-pj1-x1035.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so13079048pjl.5 for ; Mon, 04 Jul 2022 02:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=osLJKyNmPqnc7lVA+B9CIUOXsndu+uo/6mM5gEQ/mGQ=; b=MdlDS0+o4mb0+1uUOVR7Sl3ruOuGpMu1Gb/tvgcklsk9OL17JOOq9545SnJwNYANhC JBEWphkxflO4twyV0CzFcDxDgl2jwXBOa2rsx246NlNM4C7e/AWBy61xZwEiqMec193Z n7RUuTXmmY0TE7oNotgQBecR4xO3nJw2dy3u65BHS6NHrXzVH9zX7aRSUiEZ5X46Gtjy jsA5AfuF9NfM+8mYGN6Mvdg1o08g11eePvg3qufjn3FvPKsY60FNk1/T2lvB39gb5/aE f5aZnsQjVVSchI/CevJCC4/aKyTbdguOh3DPMgB2LN3jEKs7/0BDvssLuMJlR+0ToqGM Yu3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=osLJKyNmPqnc7lVA+B9CIUOXsndu+uo/6mM5gEQ/mGQ=; b=Jk/S0Axyw6RmXqpdhkORHiD+3eZ8ezSLVpnwuH2R0daH+1NhF+xG3bAAMCOH+3fvw3 FXVXNY2IDnMmUwzyTTnfR2yHYhT6GEDwXgLvZV4UFlCfnsuSJTKMEoCohPc0O3HRcxSA u4v7tq9Hx+Uj3qDrJqfUThKtDBjny3XrvZfIMzrw/VUmvjT+Z4ofc0ylW7kFGi4mEtWB FPzMuO8aR3j0tY6BAyzgXNj8qDcsNJXKJkn1yEzaGXDBP0u2jdrsDzcKZimneR4QZqaC 9nGYHm9fFRqtUVYzPN4eDu9s4YkkD5xjEHX3AT2+R6sYe4zF/s6eQWBxVMV4ptEheuGa SJqw== X-Gm-Message-State: AJIora9n9Pr9FpzawmCITf3KT07yJNleWvH9VZZ4g9P1MYjR2Sm/CK1y zbZCNRhC7MOT3zG7OR6yJsx0X7m6hJPfB5Mv X-Received: by 2002:a17:902:e5cd:b0:16a:6f96:eb9 with SMTP id u13-20020a170902e5cd00b0016a6f960eb9mr35392888plf.69.1656927294537; Mon, 04 Jul 2022 02:34:54 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 19/23] hw/rtc/ls7a_rtc: Fix rtc enable and disable function Date: Mon, 4 Jul 2022 15:03:53 +0530 Message-Id: <20220704093357.983255-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Fix ls7a rtc enable and disable function. When rtc disabled, it do not support to read or write, but the real time is still continue, so we need not neither save the time nor update the rtc offset. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-6-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 60 ++++++----------------------------------------- 1 file changed, 7 insertions(+), 53 deletions(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index eb10cdb451..a36aeea9dd 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -72,9 +72,6 @@ struct LS7ARtcState { */ int64_t offset_toy; int64_t offset_rtc; - uint64_t save_toy_mon; - uint64_t save_toy_year; - uint64_t save_rtc; int64_t data; int tidx; uint32_t toymatch[3]; @@ -140,14 +137,6 @@ static inline uint64_t toy_time_to_val_mon(struct tm tm) return val; } -static inline uint64_t toy_time_to_val_year(struct tm tm) -{ - uint64_t year; - - year = tm.tm_year; - return year; -} - static inline void toymatch_val_to_time(LS7ARtcState *s, uint64_t val, struct tm *tm) { qemu_get_timedate(tm, s->offset_toy); @@ -191,14 +180,6 @@ static void rtcmatch_write(LS7ARtcState *s, uint64_t val, int num) static void ls7a_toy_stop(LS7ARtcState *s) { int i; - struct tm tm; - /* - * save time when disabled toy, - * because toy time not add counters. - */ - qemu_get_timedate(&tm, s->offset_toy); - s->save_toy_mon = toy_time_to_val_mon(tm); - s->save_toy_year = toy_time_to_val_year(tm); /* delete timers, and when re-enabled, recaculate expire time */ for (i = 0; i < TIMER_NUMS; i++) { @@ -209,11 +190,6 @@ static void ls7a_toy_stop(LS7ARtcState *s) static void ls7a_rtc_stop(LS7ARtcState *s) { int i; - uint64_t time; - - /* save rtc time */ - time = ls7a_rtc_ticks() + s->offset_rtc; - s->save_rtc = time; /* delete timers, and when re-enabled, recaculate expire time */ for (i = 0; i < TIMER_NUMS; i++) { @@ -226,14 +202,7 @@ static void ls7a_toy_start(LS7ARtcState *s) int i; uint64_t expire_time, now; struct tm tm = {}; - /* - * need to recaculate toy offset - * and expire time when enable it. - */ - toy_val_to_time_mon(s->save_toy_mon, &tm); - toy_val_to_time_year(s->save_toy_year, &tm); - s->offset_toy = qemu_timedate_diff(&tm); now = qemu_clock_get_ms(rtc_clock); /* recaculate expire time and enable timer */ @@ -247,14 +216,7 @@ static void ls7a_toy_start(LS7ARtcState *s) static void ls7a_rtc_start(LS7ARtcState *s) { int i; - uint64_t expire_time, now; - - /* - * need to recaculate rtc offset - * and expire time when enable it. - */ - now = ls7a_rtc_ticks(); - s->offset_rtc = s->save_rtc - now; + uint64_t expire_time; /* recaculate expire time and enable timer */ for (i = 0; i < TIMER_NUMS; i++) { @@ -271,23 +233,21 @@ static uint64_t ls7a_rtc_read(void *opaque, hwaddr addr, unsigned size) switch (addr) { case SYS_TOYREAD0: - /* if toy disabled, read save toy time */ if (toy_enabled(s)) { qemu_get_timedate(&tm, s->offset_toy); val = toy_time_to_val_mon(tm); } else { - /* read save mon val */ - val = s->save_toy_mon; + /* return 0 when toy disabled */ + val = 0; } break; case SYS_TOYREAD1: - /* if toy disabled, read save toy time */ if (toy_enabled(s)) { qemu_get_timedate(&tm, s->offset_toy); val = tm.tm_year; } else { - /* read save year val */ - val = s->save_toy_year; + /* return 0 when toy disabled */ + val = 0; } break; case SYS_TOYMATCH0: @@ -303,11 +263,11 @@ static uint64_t ls7a_rtc_read(void *opaque, hwaddr addr, unsigned size) val = s->cntrctl; break; case SYS_RTCREAD0: - /* if rtc disabled, read save rtc time */ if (rtc_enabled(s)) { val = ls7a_rtc_ticks() + s->offset_rtc; } else { - val = s->save_rtc; + /* return 0 when rtc disabled */ + val = 0; } break; case SYS_RTCMATCH0: @@ -457,9 +417,6 @@ static void ls7a_rtc_realize(DeviceState *dev, Error **errp) } d->offset_toy = 0; d->offset_rtc = 0; - d->save_toy_mon = 0; - d->save_toy_year = 0; - d->save_rtc = 0; } @@ -515,9 +472,6 @@ static const VMStateDescription vmstate_ls7a_rtc = { .fields = (VMStateField[]) { VMSTATE_INT64(offset_toy, LS7ARtcState), VMSTATE_INT64(offset_rtc, LS7ARtcState), - VMSTATE_UINT64(save_toy_mon, LS7ARtcState), - VMSTATE_UINT64(save_toy_year, LS7ARtcState), - VMSTATE_UINT64(save_rtc, LS7ARtcState), VMSTATE_UINT32_ARRAY(toymatch, LS7ARtcState, TIMER_NUMS), VMSTATE_UINT32_ARRAY(rtcmatch, LS7ARtcState, TIMER_NUMS), VMSTATE_UINT32(cntrctl, LS7ARtcState), From patchwork Mon Jul 4 09:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587126 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp656064map; Mon, 4 Jul 2022 02:53:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vuGFEzsnIShMJus4RyDlDD+3PeEjnj9gdEwgM5/a+oSzh0INDzggXNS4symqiUe4mEMTPD X-Received: by 2002:a25:508:0:b0:66e:2cb4:dedb with SMTP id 8-20020a250508000000b0066e2cb4dedbmr11174891ybf.554.1656928390612; Mon, 04 Jul 2022 02:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928390; cv=none; d=google.com; s=arc-20160816; b=VXqxuF5VVx3WrrIrCxFjQPqS/e+rO3xQfqxjsJDe0prv2HX71vFhrH8NZRuV1posne ioswUVgAjktgUKl0FjS09hjeI+LxCbPkUPSabom4LPHWp4CIJRTRMppyVpJfUWEl2KkF A6aCaX+LWeKD3cG6PfBTr2ahY8p4j5hiTKTOwjoO26m0hy+APLFKUOprsodGdA79CtRz +pJa6a50PC0mIwTgpsFzc3P2a5ZKdOU+ITuD0E4soeL+DOWIWk9gdPLNxWFMuovgZF58 zc4WO9JSKfKC7w/frdKYeXqmArU3en6bXqVxqp58IshWIRlnBHZnl6kB0gFb+VsMdqLC +JUA== 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=XqfUuTLR19PvXQJ4YSvSIGy6d7v7mkyGFUM5EeTHK+4=; b=SuWFH94Co7FBnsMM4N1gxgq6AtpYmKO5cotm5ooJe3uQN7pFfmRGEY5F6iZeHTtz6e rAeryUj/44O35XR8k2X2nJ29yxYb/fJ/l88Rrw3STAFHemvHlPvvXC/NZn8NOmqVFoEB IQVirg7Dkhvoyzl6yUVpM5ZeMqdJQyoiVViFwu5TGWyOlmnqC8WQxA5af17dlWAajJfh Zi5YYZaVnEqPohXWuX1PEbSvHdsu0lejX3sDZRThC8WPPg5EQJkVJyk+X0LXTGlu1aSi RNcvot1720dz027hvYGzpdVSVxk72mZ5F5URQRQXdfL91RDnMoscYoqT/xmnSJ6/ANey LrpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r6bjWJ8N; 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 205-20020a810ed6000000b003136083a248si39064813ywo.528.2022.07.04.02.53.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:53:10 -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=r6bjWJ8N; 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]:44656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IlS-00064u-3F for patch@linaro.org; Mon, 04 Jul 2022 05:53:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITr-0001Rq-SZ for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:59 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:42713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITq-00051p-5O for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:34:59 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d17so8444601pfq.9 for ; Mon, 04 Jul 2022 02:34:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XqfUuTLR19PvXQJ4YSvSIGy6d7v7mkyGFUM5EeTHK+4=; b=r6bjWJ8NikaISdJMDSV3J0g7/0+uQvtuknVFPXutFSNsFli30xDrSC7guGT/jwYWOy CcZWjyvysMupkVPozyE5zmd0azZzwyXXsPRWlrD5YWVpC8AvvgT0JxTBsIQYFTi0c66A IH/HlFqzPDzanS4igowAUZeL53jDDDLftsj7y/xYrwj7Bxs/4vwU0axYibk7Opaor6f1 TCxrZ3OPr1M1dmW47BEOOZYXjbzpTC/BAmrkAwR/eq5PkoQHYmHa6MPAE/UdauON1xt4 cagyIib6xq3sE3I+gsW0ys+44VpKoDaAXFifXZPSVFxrvm7S4U0tVzsEdgMoEnd6gELH CapQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XqfUuTLR19PvXQJ4YSvSIGy6d7v7mkyGFUM5EeTHK+4=; b=vS+3WM7ldU3BXBdr5E9hFztq8L3G8iBUims/r69N/XTCR/vANQhF+LV4tjpMCu73dN PBoPWTlv2cspb8u4tNuD9/0zy9fZAHlz0KGCmI11B4VB6R5Gyk9EnmL+QXosDCCGJc73 0e7sMlKV681M9MSx8e+WhztPdCNskCdkt5DWX58h3WHfo/T2gZIPpUfbk0n/XEw/yU9D WKJG9OxR20UydoZwvnhjBRpoayjwF1fNo//f9j1UcBfftcHste9WxZodcIJ5W0BcbMZc Pga53HBZZLGkECair5LNrktldsA09lWSS0wZdJWK10kjbdBJvWbVJKWLxVdn1Lr/396a xOrA== X-Gm-Message-State: AJIora87V547lorEmfNf71Mb7TXJxXSS9CUdA5a2uU337DPzR6LNmutp 9aVOe4QqHzs1gEfl2biMnUvlJ+O27ajWb5xb X-Received: by 2002:a63:bf4d:0:b0:40c:4060:f6d with SMTP id i13-20020a63bf4d000000b0040c40600f6dmr24843481pgo.254.1656927297027; Mon, 04 Jul 2022 02:34:57 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 20/23] hw/rtc/ls7a_rtc: Use tm struct pointer as arguments in toy_time_to_val() Date: Mon, 4 Jul 2022 15:03:54 +0530 Message-Id: <20220704093357.983255-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Use pointer as arguments in toy_time_to_val() instead of struct tm. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-7-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index a36aeea9dd..85cd2d22a5 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -125,15 +125,15 @@ static inline void toy_val_to_time_year(uint64_t toy_year, struct tm *tm) } /* parse struct tm to toy value */ -static inline uint64_t toy_time_to_val_mon(struct tm tm) +static inline uint64_t toy_time_to_val_mon(struct tm *tm) { uint64_t val = 0; - val = FIELD_DP32(val, TOY, MON, tm.tm_mon + 1); - val = FIELD_DP32(val, TOY, DAY, tm.tm_mday); - val = FIELD_DP32(val, TOY, HOUR, tm.tm_hour); - val = FIELD_DP32(val, TOY, MIN, tm.tm_min); - val = FIELD_DP32(val, TOY, SEC, tm.tm_sec); + val = FIELD_DP32(val, TOY, MON, tm->tm_mon + 1); + val = FIELD_DP32(val, TOY, DAY, tm->tm_mday); + val = FIELD_DP32(val, TOY, HOUR, tm->tm_hour); + val = FIELD_DP32(val, TOY, MIN, tm->tm_min); + val = FIELD_DP32(val, TOY, SEC, tm->tm_sec); return val; } @@ -235,7 +235,7 @@ static uint64_t ls7a_rtc_read(void *opaque, hwaddr addr, unsigned size) case SYS_TOYREAD0: if (toy_enabled(s)) { qemu_get_timedate(&tm, s->offset_toy); - val = toy_time_to_val_mon(tm); + val = toy_time_to_val_mon(&tm); } else { /* return 0 when toy disabled */ val = 0; From patchwork Mon Jul 4 09:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587122 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp653012map; Mon, 4 Jul 2022 02:48:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t7YkV1cjKvH70odQGmHGN7Pxpps1moA98PyHzQedE/cvrmUl+yWZoA5FvVvuY6cmuKANgZ X-Received: by 2002:a25:e7d4:0:b0:66c:899b:49c6 with SMTP id e203-20020a25e7d4000000b0066c899b49c6mr32372711ybh.291.1656928132183; Mon, 04 Jul 2022 02:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928132; cv=none; d=google.com; s=arc-20160816; b=ptU5GMQhC73uPvPG7wPdA9dPS9Yex7BDqnJDpKLInrlh2G+X9iMnLksOKVDtM5CgKZ pi0qi50sZuqcdNnc1iYptULW0vXg4DbbafOSK0ycPTdZcDxRaT+saVBof0LIFjFwedCT SVGyKZIyw1hJ1ojzpIDKs3SLYgIfThEE1gB/Epz4n1LDeB8On4pTgRjArTd+sqT4QcEK DcqLCnervQyHmaWKhouajCm1KnzM//y/CutJM3Kunb6xez0BVdin9ofQ/NLpE5n757Hz qkDtNKJwDyLsE5tUe5VSFwH2IxJFA9fs9OWTsPiP2XK/EcHfISKvArhRVJ/TWDh3fLbu Iohw== 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=KLxJ4chZNuNpDDQM5NlCpPKbylj0kM6OFqhANtAh+c4=; b=kelTllgMlN5BoXswon2CV93glb1hE3oHWVhyL123r0yWnfQ1f8zT84GQauUqaYTLb5 dMD/Sdo7gfXYzcjEulr3lJ/MQ0P1wFUAPhC/5g8SWFSgNWt1Q2ZFWEXag5asEqM5Oo76 oezjv1t2yHhXG0WIVhkAyuWPtJsJfb6KAhc9pqiIJNHxXLo9UzgEHhU/bR39RIv/AbSt 8mnY3/4/Luow/ka0uIZbp6HoKydYzE0a+sT602srwiofyT59WbKvTFH9nLO6EgPJo1PO n79GvZElKTaMLr4ZHcm2cDwrKEufvQG1SB9Jk/QM2HCeLnQvicZI2oaiHG+VtrEYUUDG +F5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tfJnwHHO; 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 n125-20020a255983000000b00668222552f7si36529955ybb.40.2022.07.04.02.48.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:48:52 -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=tfJnwHHO; 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]:33242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IhH-0006Qc-Ll for patch@linaro.org; Mon, 04 Jul 2022 05:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITu-0001dK-7E for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:02 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:35540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITs-000521-HB for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:01 -0400 Received: by mail-pf1-x42c.google.com with SMTP id x4so8470729pfq.2 for ; Mon, 04 Jul 2022 02:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KLxJ4chZNuNpDDQM5NlCpPKbylj0kM6OFqhANtAh+c4=; b=tfJnwHHOcW4hxiHZB+asP7qW8X2X0KhPR9yVoKGchdafW57f8TfNhqGo/hgB/Qft1I oVJpspguugYx6VGOqXre48GcIVnpI5p/LJRE4ZRd4g2CChp2luMsLiL2IjbBg7Wv2c4D qtjp5U4nHxBy33EJBQMxkRWammOVTKqrKeMiAtIT0fnlnUqUSl21KbXpp0RVEqRftUYj GRQh9Cpfi4JjDhDrsyNIZDM9pxlaXkvbfm3b1EDeuUgp82jaOXPl6NgpfKiaZi9YGYAA K1FR1AHyN1i5PKFKv8314AErGV8zneTaIjs1m0R5JZKIBisuZo0lCljCIofNFvhrSSg7 ZUSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KLxJ4chZNuNpDDQM5NlCpPKbylj0kM6OFqhANtAh+c4=; b=NoyA3xTQcuPCFTwUWPnRLCbkqAKna7rf/yyqZxC0bNrLwYZkYQoDl4QqvbK3nfJ+Is iM3/HPgNu9nbWNXL2oY8gP1yX6kKH3C8PzdaBvqvfikCDjdVrQiv5T5fOZYCiOX3o8Ll 5e2+S2sP3sHgb4XJ3+AKlzAV7hljHEaly4KRUWPYV1MvTDCXlf+T3dp5+JOCyhIt5wUB 5S7sH30xxYlSnOS7PcKcRlLpOCjMh1GJfL3puWCY+9xftISMkVLMdUjUQxzlBuMdEnGx 3guFvO+EkW2kfi379kw4ygRK9AKU3RCEwanUJDnzIJz++DdiDpJ4tLIEex7mvH2mExNl 9MuQ== X-Gm-Message-State: AJIora8aXXdvP9oQJS6mvhC78R5AV7b5ghp6paSS2ugrD68ZeDfnGl4o oiqMjyIAoiNZfvScT6AUh4pEA/uZ47bpkRiE X-Received: by 2002:a63:106:0:b0:40d:2db:1c92 with SMTP id 6-20020a630106000000b0040d02db1c92mr24748337pgb.571.1656927299234; Mon, 04 Jul 2022 02:34:59 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:34:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 21/23] hw/rtc/ls7a_rtc: Fix 'calculate' spelling errors Date: Mon, 4 Jul 2022 15:03:55 +0530 Message-Id: <20220704093357.983255-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang Fix 'calculate' spelling errors. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-8-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- hw/rtc/ls7a_rtc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/rtc/ls7a_rtc.c b/hw/rtc/ls7a_rtc.c index 85cd2d22a5..e8b75701e4 100644 --- a/hw/rtc/ls7a_rtc.c +++ b/hw/rtc/ls7a_rtc.c @@ -156,7 +156,7 @@ static void toymatch_write(LS7ARtcState *s, uint64_t val, int num) /* it do not support write when toy disabled */ if (toy_enabled(s)) { s->toymatch[num] = val; - /* caculate expire time */ + /* calculate expire time */ now = qemu_clock_get_ms(rtc_clock); toymatch_val_to_time(s, val, &tm); expire_time = now + (qemu_timedate_diff(&tm) - s->offset_toy) * 1000; @@ -171,7 +171,7 @@ static void rtcmatch_write(LS7ARtcState *s, uint64_t val, int num) /* it do not support write when toy disabled */ if (rtc_enabled(s)) { s->rtcmatch[num] = val; - /* caculate expire time */ + /* calculate expire time */ expire_ns = ticks_to_ns(val) - ticks_to_ns(s->offset_rtc); timer_mod_ns(s->rtc_timer[num], expire_ns); } @@ -181,7 +181,7 @@ static void ls7a_toy_stop(LS7ARtcState *s) { int i; - /* delete timers, and when re-enabled, recaculate expire time */ + /* delete timers, and when re-enabled, recalculate expire time */ for (i = 0; i < TIMER_NUMS; i++) { timer_del(s->toy_timer[i]); } @@ -191,7 +191,7 @@ static void ls7a_rtc_stop(LS7ARtcState *s) { int i; - /* delete timers, and when re-enabled, recaculate expire time */ + /* delete timers, and when re-enabled, recalculate expire time */ for (i = 0; i < TIMER_NUMS; i++) { timer_del(s->rtc_timer[i]); } @@ -205,7 +205,7 @@ static void ls7a_toy_start(LS7ARtcState *s) now = qemu_clock_get_ms(rtc_clock); - /* recaculate expire time and enable timer */ + /* recalculate expire time and enable timer */ for (i = 0; i < TIMER_NUMS; i++) { toymatch_val_to_time(s, s->toymatch[i], &tm); expire_time = now + (qemu_timedate_diff(&tm) - s->offset_toy) * 1000; @@ -218,7 +218,7 @@ static void ls7a_rtc_start(LS7ARtcState *s) int i; uint64_t expire_time; - /* recaculate expire time and enable timer */ + /* recalculate expire time and enable timer */ for (i = 0; i < TIMER_NUMS; i++) { expire_time = ticks_to_ns(s->rtcmatch[i]) - ticks_to_ns(s->offset_rtc); timer_mod_ns(s->rtc_timer[i], expire_time); From patchwork Mon Jul 4 09:33:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587128 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp658159map; Mon, 4 Jul 2022 02:56:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u4+jjFF4JF6ktr+GAqzqBvooeDTdjXNS+pPY0JJJFRoxEoCeI+ot7Ba3wxlifM2HBpKXwO X-Received: by 2002:a25:33c4:0:b0:668:cc8d:bc43 with SMTP id z187-20020a2533c4000000b00668cc8dbc43mr29627343ybz.467.1656928565742; Mon, 04 Jul 2022 02:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928565; cv=none; d=google.com; s=arc-20160816; b=kPPYYjCEl81iVMFT1k2+35wzPOGqx1PLxDvGSXJEaLpoetthoJJDL3oHcdd1dtifkA IbcLhH+vmIKmCUVzuOqMUrxtQxj2eAJEJRBe1eQ0l/iZ3s826XZGu/aWNC0cdlgOOUlg zjEONPerfmbxeN8YfYSgZwrt+GM2doJxJOgHAkoXBBTM6c3LfomWXjbUCG4Z82FAwug+ BoGBav6I9t5MQuIfd2wp3Smsb2x3j0vsbVBjj5URr+0jWWInSBvCsZWK2xt2xVtgOaMJ P4YXC/ICaFtkfL5irVXLwiycKY9evvGNGd2HRMZcWglTTDik1Hr7E8trh5tBLBgg8uBW g5FA== 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=pC1o5dIEfj/X0ZzHAPo5CQX3pETnqwqvqekF8ivkFYs=; b=mAeVPA/7jFsKjlXlUnvQOsx1MinHeOLcPm9dP9PXbrATO4aCJOTVB8t9FzfplbGNuO A2d4/6yzcuMdGOv1aBkRy0ozpmCZB0LGnJCfCAfGYv7GlzwQE0utLBTC3AyireVGZbNu 40rSvFrhIe6t33sttUHTBimZVaY87eV+WDmSagyl98REbb6a+VMWurtp/7hKrE0Keiqp Fb1eAjViZTHWE1Qj+y9Ori6Fmimhs2l+v3L/DFoJ+VtMRVRBBFmGvUsjRN4dsL4iEg0n 0Fw7/rUnL2ijtdbIM8WGN5wDsZ+oisoXsN918cIhOmpXKfcZZzNC+O57ybV8nQ72qUQy L9Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K1gBmBhG; 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 s66-20020a818245000000b002fedebec3basi41620469ywf.459.2022.07.04.02.56.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:56:05 -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=K1gBmBhG; 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]:52212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IoH-00035b-8O for patch@linaro.org; Mon, 04 Jul 2022 05:56:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITw-0001kD-5c for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:04 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:35534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITu-0004z5-KF for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:03 -0400 Received: by mail-pl1-x62f.google.com with SMTP id y18so80928plb.2 for ; Mon, 04 Jul 2022 02:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pC1o5dIEfj/X0ZzHAPo5CQX3pETnqwqvqekF8ivkFYs=; b=K1gBmBhG8cUNb3sUn5EzyKsvx3RvAjmTm3O+OiVXlr1u68WkSg5x3R1/L57j1+pmqV X9p4vr1/+ryPyBZihmpXwK99hcUnOXycuYXA8vW73Xsax3pe3UxvA44LhdvRK41PwLjM muMrD5cNy976MPPKZjnXMeoO0BPhSFHbdvBJvzW2RpLV/OzVcfeQToOO1i6XGwIFSYhi lsoMt8llA2ICXScAdEw1lFDWT7HLrG4MO5jsJB+CIQBd57hQdJgGBy8J5+aP+WKb+OBn 7tbNbSe96uCfYnXV1IkC1KGfaRSPyWn3HLpr1QBcrZl12rBOqkefuJhULrkksNwPAdko 1pDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pC1o5dIEfj/X0ZzHAPo5CQX3pETnqwqvqekF8ivkFYs=; b=iQVqHEyAcNZadeMPkCk1mbP7ZGxCyVyDKf9CtCgeGr913VK/AmlEIqpJvay//veZrk A7kn30vpqeAa1zNqzSl41XNjo5UEG4++U/A9FEE0CmLSrZ9vvSwEEdf/+XVIf/x/pybh jQn6dj1gNdk9BDiAE5WdLH612cvdotXmUPziInzftEEYaLg3fFn3AbF8ZS/5Ru0fK41t sTUi9Cngce127SsBifDesA3eEvsfEiBZyfKIo5UZyA88pk9dkF0G8dTSFOVu8AAQDKNf tdmnnzIQuEaViaNy2CZ+jVNkkm55VdnNAkFsNDpxKZzPdhfu5F1aMrzFaPnaeQSL2ER0 TdQA== X-Gm-Message-State: AJIora+7eFWzYy5FKE/D3EPY+A6d9FEPbDzpyhuuxodC3zSKFJtCWHvO o0I+2ENvAdjFhf+p9WmJ6FC4URIo/Ts+HfYm X-Received: by 2002:a17:90b:1e02:b0:1ec:d979:4a8e with SMTP id pg2-20020a17090b1e0200b001ecd9794a8emr33195636pjb.181.1656927301818; Mon, 04 Jul 2022 02:35:01 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:35:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 22/23] target/loongarch: Fix the meaning of ECFG reg's VS field Date: Mon, 4 Jul 2022 15:03:56 +0530 Message-Id: <20220704093357.983255-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang By the manual of LoongArch CSR, the VS field(18:16 bits) of ECFG reg means that the number of instructions between each exception entry is 2^VS. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-9-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 47c0bdd1ac..d2d4667a34 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -223,6 +223,10 @@ static void loongarch_cpu_do_interrupt(CPUState *cs) env->CSR_CRMD = FIELD_DP64(env->CSR_CRMD, CSR_CRMD, PLV, 0); env->CSR_CRMD = FIELD_DP64(env->CSR_CRMD, CSR_CRMD, IE, 0); + if (vec_size) { + vec_size = (1 << vec_size) * 4; + } + if (cs->exception_index == EXCCODE_INT) { /* Interrupt */ uint32_t vector = 0; From patchwork Mon Jul 4 09:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587123 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp653048map; Mon, 4 Jul 2022 02:48:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uXUaG3lxBhpa2goRZNOaKWMIQEUrPNSdemP/rFNRhwxi77loiP54awJLSSsqJ8azzK089C X-Received: by 2002:a25:858e:0:b0:66e:4898:63e2 with SMTP id x14-20020a25858e000000b0066e489863e2mr5165663ybk.296.1656928137314; Mon, 04 Jul 2022 02:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656928137; cv=none; d=google.com; s=arc-20160816; b=w6wfIZ+D+Nsk45NlAGhc2XM/Ib6HxGN4f/y9BYaodUEZdC8W01IWuB0xhboxaYMr7c Vx40GslFWCnDa4Upfxahp02D6XCzhTSKcK8/hcTnA2wYPsV+QLFtoWPwFm0r5bwxGBjO KanA9RDde4E0qHohv1KmsyUF+PU1uRDnAtvh2g8AL4OLkpJu2O8ZvVwbGJrDS154aMch zBasLO5iC7EpKbwXD3WwtHvMJUTEUxysw4bCSXOyfWKZts05fe+6sHaAZ4Gis1Jv9DvU voRHH9vWllA1c8TQgbcEztFgHmn8lILwWsWuEPK9I1gh0bwQpW+hpLbC1LL5Wb5+g359 qlBg== 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=3lzEaDmfWBOIKO+QxHmwCzDxckFSDPKrWYW1q3Ynj7E=; b=ORvhtvNe1HEYewvjXjbPaOWYqvU24cDCOtmUPCklUiyX4g9qr1Q3mqrKJWF+ljYRZj 3XzkmtNh1FywQl+Cwtg06K78lX16B4CEGP5VkRVKfRTGKr8nM7Q6RDuYBElSMm9K/91G vC7zD2OLxYde5bfOKr/yMT/lZngLjwLTL3Hp6BcaUjHMcLF4IOPyC7VoKp2eCsZxoSWS jaxfJQlbIlIqphQOyHadH7m68pKI6z0UEIp/aAH4BeWnPbGbHHX3gpatr4pZsCtgg0Uh MtZtlHhi5xTMiwSFHWqD2i9q+QEp0Ky0kHFNKV30lhaM2CES+dGXJOxQ7Iu2u7fA2Mf7 BMLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eji8bBRY; 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 81-20020a250554000000b0066e472f64a7si4055758ybf.54.2022.07.04.02.48.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 02:48:57 -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=Eji8bBRY; 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]:33608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8IhM-0006g7-PE for patch@linaro.org; Mon, 04 Jul 2022 05:48:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8ITy-0001pd-F9 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:06 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:40854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8ITw-0004xx-Sa for qemu-devel@nongnu.org; Mon, 04 Jul 2022 05:35:06 -0400 Received: by mail-pj1-x1035.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so13079435pjl.5 for ; Mon, 04 Jul 2022 02:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3lzEaDmfWBOIKO+QxHmwCzDxckFSDPKrWYW1q3Ynj7E=; b=Eji8bBRYDTWYJYdbImHik9kX9A5g4ldA1bHlcaq/Bey9J4vuTJ6EQUP6WGnCCyfwv0 hpTw48oP/NSspwJFuyFnKZ4SMbOGMoNEXfxrxBrztyg458zV9qQ/HTjcmsufj4MXLruv LxKcsKUUTcZycejD3rB/P06XL0I8pY0WogiT4VuZK6nvpMsBdcI+u6xGGsf09g2jQOPJ P3Xfh2em8Dfedt/hecphxIX+wepqeCQucv/ud9t6HlLGEsg6q9ZLjmWx76tfObJc/AzP UAG184utEeRzGmQE0EicfUPmrZKbgM28ahIyelyM70LuWvm+/wfy/5qv0h63JQv7JTiT 6ixg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3lzEaDmfWBOIKO+QxHmwCzDxckFSDPKrWYW1q3Ynj7E=; b=bPBe0nduQpHP5Lbt7uY0n2uykI/wWWSmxLBD4MisvJ3/KgL9Gy9jLvrrIuDeRW041a DBxEpOvw04WGGLEXTgoHeFDxxQHk1bwDEy3U670thx14xiii08E8T2lDk4AVMDNHlLGq jpfUESFMjxkCM5jvuFmbEjgnrskji0Er11o2ijssorhXh20ng2lq5dtWgaCcgefRWH8J 6hlxyXqKt5lZE+kH11U2hR35iuJ07jyAY6cgT1dZcVIKYAcvP5LxZBklNaV9Ro5fb38D kXlkVMEdz9kzkvEAJOXr4rco31WHZvcVOEbEUL4s7F20uBys5E5DE+qOOd3ignAVIC7G 3KMw== X-Gm-Message-State: AJIora8wCSUloTulMyDGevCXG/Aq1L/8vCFy8M/bNxhE/tUALsNOT/H7 0qZrfBT3a4cZtzgKvDTNME4JMrVv/QSYdnKs X-Received: by 2002:a17:90a:8b8f:b0:1ef:9130:f96c with SMTP id z15-20020a17090a8b8f00b001ef9130f96cmr113627pjn.20.1656927304149; Mon, 04 Jul 2022 02:35:04 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id z5-20020aa79e45000000b00525b7f3e906sm15353355pfq.27.2022.07.04.02.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 02:35:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Xiaojuan Yang Subject: [PULL 23/23] target/loongarch: Add lock when writing timer clear reg Date: Mon, 4 Jul 2022 15:03:57 +0530 Message-Id: <20220704093357.983255-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220704093357.983255-1-richard.henderson@linaro.org> References: <20220704093357.983255-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiaojuan Yang There is such error info when running linux kernel: tcg_handle_interrupt: assertion failed: (qemu_mutex_iothread_locked()). calling stack: #0 in raise () at /lib64/libc.so.6 #1 in abort () at /lib64/libc.so.6 #2 in g_assertion_message_expr.cold () at /lib64/libglib-2.0.so.0 #3 in g_assertion_message_expr () at /lib64/libglib-2.0.so.0 #4 in tcg_handle_interrupt (cpu=0x632000030800, mask=2) at ../accel/tcg/tcg-accel-ops.c:79 #5 in cpu_interrupt (cpu=0x632000030800, mask=2) at ../softmmu/cpus.c:248 #6 in loongarch_cpu_set_irq (opaque=0x632000030800, irq=11, level=0) at ../target/loongarch/cpu.c:100 #7 in helper_csrwr_ticlr (env=0x632000039440, val=1) at ../target/loongarch/csr_helper.c:85 #8 in code_gen_buffer () #9 in cpu_tb_exec (cpu=0x632000030800, itb=0x7fff946ac280, tb_exit=0x7ffe4fcb6c30) at ../accel/tcg/cpu-exec.c:358 Add mutex iothread lock around loongarch_cpu_set_irq in csrwr_ticlr() to fix the bug. Signed-off-by: Xiaojuan Yang Reviewed-by: Richard Henderson Message-Id: <20220701093407.2150607-10-yangxiaojuan@loongson.cn> Signed-off-by: Richard Henderson --- target/loongarch/csr_helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/loongarch/csr_helper.c b/target/loongarch/csr_helper.c index 24a9389364..7e02787895 100644 --- a/target/loongarch/csr_helper.c +++ b/target/loongarch/csr_helper.c @@ -81,7 +81,9 @@ target_ulong helper_csrwr_ticlr(CPULoongArchState *env, target_ulong val) int64_t old_v = 0; if (val & 0x1) { + qemu_mutex_lock_iothread(); loongarch_cpu_set_irq(cpu, IRQ_TIMER, 0); + qemu_mutex_unlock_iothread(); } return old_v; }