From patchwork Sun Jul 3 08:59:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586866 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2946850mab; Sun, 3 Jul 2022 02:43:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXCKFUyV/XEanMaDWAcZZNFC39JcfzwU4dDmGiYWtxJAgnLT7ls5lEAkqSjwHGDl+8uMAg X-Received: by 2002:a25:2e50:0:b0:669:9a76:beb with SMTP id b16-20020a252e50000000b006699a760bebmr24510904ybn.597.1656841406842; Sun, 03 Jul 2022 02:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656841406; cv=none; d=google.com; s=arc-20160816; b=Aotn8fFEFN+TDXsGn15ZxYg857oXWYw+oW4cf/gijICTaZrLeLfiZ4br0kMqPnN1Y1 +0BgWbXJq6R6d13hkkI6suStfVH5EFTsFeBX6AmsKuYEJapxuP8oNR940xzpR6znvqQj 63AQpQyBbNJuxFtUI2dh65E6JLS2roTmDmbRAxkCqG0m/avnrFx8uGVV+sYyYSdB8m8P O/ttlHKNPkTOX+5Vp1Qpc4OcKtMKLeGALbEp0jx6YlzLa8y7suiWA8Y3AgrMKCoCA7Dx ue8DEXBIJo5Zr2Hb2Z4KIeLasn8XZnx/sVEQ+wkg3tKW3264Gh1or2QBYAd16K6FAuO9 uCkQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=oTKGpo4k1nelxM20A4Ut5wSWoWhFNq272y6n98pFD9w=; b=jF5XvNrLT4gQc1cQjL187J9lZ4yipSNwoAN2QL15getsVyYXz0dGe1NxjlGdZkNmoJ eyMqeQrd6lTtQhylkGZ4SHV2NBqX+kq7V7Vt/kN0xxzWmnSCG1ZVtqock+ReO97GBuWy vUPjuGXrirOkhdsiCr8bAqmbw9Iti1LGv0fniJ5U/SXGR0FA0d3YaEy5a+D4dFWB9Hu/ aYZ5JfReH4FEXN0MItWO/LEBx1QGv2TwRp0InG303IkyweuNuhNU4UZkP7IuB85cPjBN PJNDHqVXQ+WPnIIlU3O0jW1kSAKdLJFnRrLjErvh8I90EeH8cH2gOnPySJ67f40fmIS/ OYoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AAQz8GRB; 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 h193-20020a813aca000000b00317be060ab1si35796380ywa.63.2022.07.03.02.43.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jul 2022 02:43: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=AAQz8GRB; 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]:50760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7w8U-0002ok-AN for patch@linaro.org; Sun, 03 Jul 2022 05:43:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7vRq-0003eU-Gc for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:59:22 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:38435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7vRo-00048N-Nt for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:59:22 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so2344962pjo.3 for ; Sun, 03 Jul 2022 01:59:20 -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:mime-version :content-transfer-encoding; bh=oTKGpo4k1nelxM20A4Ut5wSWoWhFNq272y6n98pFD9w=; b=AAQz8GRBPbsaCbzTOXlPhm+XscXROeMZOOHQBOHfEGGoS8LDPq52fbePLxXassJnxA k4+0ScBUkelIEpg8IsIcajaN9Gv0D3slVrFifRszKl6640wxth9Bj+loyVHml/WFVeAl lVwpwWX65waqdauz+MLCwcfHnBkYidi9VyXvDfIs3YrlkDoaSMd8ECQpNnAzoM8BFa5k +Ah2ZLuhH7rqXdoQrd6ohzDTnEnjuceAMKFUEAlqqTDUA4i8bkRvbGC5QlGMxMGyzJu8 tNbfP2DcdyuAQKaEhE3M1H7kqx5zqaoaj6wdhcmXKOPaizCUtOvz66zzCAqbAfUwBpdC CU3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oTKGpo4k1nelxM20A4Ut5wSWoWhFNq272y6n98pFD9w=; b=3Aa3QSmXKd+5VvAm1Jn61KeFNbPd3IBxYpNLjn5Woek2Bl/fsmHTEbbC3DtNg4iNjy czuNq6Ptxh+WVn2C6Bf/d0MMJ89F+9JFUZMxQ5WfKOOcVae8N1rH5TbgI5liOyPAmLoq JoxOvW6rrsc0C1w0VVsk1SC06//1kaHh/UGiLZw6L0CSTy4dHOMGQZqplQE/C1/eDoLI SCWzB0dol8ztaXMsJtKEOwAtyWro/SVp9gdnVXXmWapBdyjBtRjjpTIWZg272C1JDbVR c72jUtwJLsJe/DayVI7owb1CAZZ63HoIRF8WmuWymlB2JsEbaTpCdOCTNHwit4k2hY3I zExg== X-Gm-Message-State: AJIora/Lj7OFTZAvcUt+aVC0zaV80H92MSfXknG582xTpFJ784rLBl02 4GspbwdK136kB/s/X9GZtzwMWZkAFiXbEdBc X-Received: by 2002:a17:90b:344f:b0:1ed:9f:a2de with SMTP id lj15-20020a17090b344f00b001ed009fa2demr29143470pjb.174.1656838759256; Sun, 03 Jul 2022 01:59:19 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id cq16-20020a056a00331000b00518764d09cdsm18777593pfb.164.2022.07.03.01.59.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 01:59:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu Subject: [PATCH v21 00/13] Add LoongArch linux-user emulation support Date: Sun, 3 Jul 2022 14:29:00 +0530 Message-Id: <20220703085913.772936-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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" Hi. This is Song Gao's v20 [1], with patch 2 extensively rewritten so that it handles lock_user properly. It compiles, but I need to update the docker image we produced last year so that I can properly test this. In the meantime, Song, can you please test this? r~ [1] https://lore.kernel.org/qemu-devel/20220624031049.1716097-1-gaosong@loongson.cn/ Song Gao (13): linux-user: Add LoongArch generic header files linux-user: Add LoongArch signal support linux-user: Add LoongArch elf support linux-user: Add LoongArch syscall support linux-user: Add LoongArch cpu_loop support scripts: add loongarch64 binfmt config target/loongarch: remove badaddr from CPULoongArch target/loongarch: Fix missing update CSR_BADV target/loongarch: Fix helper_asrtle_d/asrtgt_d raise wrong exception target/loongarch: remove unused include hw/loader.h target/loongarch: Adjust functions and structure to support user-mode default-configs: Add loongarch linux-user support target/loongarch: Update README configs/targets/loongarch64-linux-user.mak | 3 + linux-user/loongarch64/sockbits.h | 11 + linux-user/loongarch64/syscall_nr.h | 312 ++++++++++++++++ linux-user/loongarch64/target_cpu.h | 34 ++ linux-user/loongarch64/target_elf.h | 12 + 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_signal.h | 13 + linux-user/loongarch64/target_structs.h | 11 + linux-user/loongarch64/target_syscall.h | 48 +++ linux-user/loongarch64/termbits.h | 11 + linux-user/syscall_defs.h | 6 +- target/loongarch/cpu.h | 8 +- target/loongarch/helper.h | 2 + target/loongarch/internals.h | 2 + linux-user/elfload.c | 91 +++++ linux-user/loongarch64/cpu_loop.c | 96 +++++ linux-user/loongarch64/signal.c | 335 ++++++++++++++++++ target/loongarch/cpu.c | 34 +- target/loongarch/gdbstub.c | 2 +- target/loongarch/op_helper.c | 10 +- .../insn_trans/trans_privileged.c.inc | 36 ++ scripts/gensyscalls.sh | 2 + scripts/qemu-binfmt-conf.sh | 6 +- target/loongarch/README | 39 +- 27 files changed, 1144 insertions(+), 15 deletions(-) create mode 100644 configs/targets/loongarch64-linux-user.mak create mode 100644 linux-user/loongarch64/sockbits.h create mode 100644 linux-user/loongarch64/syscall_nr.h create mode 100644 linux-user/loongarch64/target_cpu.h create mode 100644 linux-user/loongarch64/target_elf.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_signal.h create mode 100644 linux-user/loongarch64/target_structs.h create mode 100644 linux-user/loongarch64/target_syscall.h create mode 100644 linux-user/loongarch64/termbits.h create mode 100644 linux-user/loongarch64/cpu_loop.c create mode 100644 linux-user/loongarch64/signal.c