From patchwork Fri Aug 18 17:20:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 714680 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp632567wrs; Fri, 18 Aug 2023 10:21:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8AUm3XMnsS+80TSBpAS2aNFQ8bOe+HP7aIDInOV3qlsDyoHAb+smL8YrjKkYLSnxSayk8 X-Received: by 2002:ae9:e107:0:b0:767:6c4:add1 with SMTP id g7-20020ae9e107000000b0076706c4add1mr3252392qkm.45.1692379294755; Fri, 18 Aug 2023 10:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692379294; cv=none; d=google.com; s=arc-20160816; b=WMwaaBRTNrS89NF8+7VJ+xzgmIOghZsEM/MZgvbTbhflEM3jCk+FobEf9rDTifX6te Zkcg2Zc56HrQepTfmrLJLYuBm7UpnN10PIgQm5a+rxs8VPCs8N1eBjN9E62ject7ZbJo swAGHr+QRUO83A3+nkvEUPDBF0s39Q0Jxx39/1EHF1t7XuAWan54FsCzouV5+LLxOojd XQbsge3BaVdX7phLOVGtdXnwuLuqTJZbHxNTKjBE4kpVhd+YK2Pu4dwHalWX8hjNruvM +7ty/v3kxwbyQ/DCWwKpnUawXZZe/8ZIjjZ/L+PNBUOqig+xfdjvk0UueaewZhbA4kQn +3+Q== 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=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; fh=r/JHKP8J9R2uTR7nHOCSLBWmfdDcyFCnoeAYTYM6zJY=; b=F2y8Pi/+SqKHV9MzrLvvmGV1DmZeemWa9N/xzKtjmBxr1BxyVjhXcX3chy6i7cUHBi fgBPggPTpyc2IJ+60LzEhJ5I6xpPFlajlseD45nGp3b4ma9euBrhDdE4U1Fyu2tWMXpA 4AWTz5VTK/+JOe+V9PLEqHBcU57Qnu/QYxhHvvmu3qnOTAgbU3RaewBYe5I4ZN4UOIxR VmRjUaemKhQBmv0p/B2Pr9meYgbfp49YoF3XF9bgO49s2gxBtPlD2rNriJc2syMz2GKJ 7x2z39K2Yqnb7RhV3iKChwqoU0Lo4j89f5PhUUvS4Zw8gW671KfewDzO/9iqfy3WGE36 OUgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dA5WUZ0S; 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 tn22-20020a05620a3c1600b0076ae74a264bsi1380268qkn.136.2023.08.18.10.21.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 10:21:34 -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=dA5WUZ0S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39k-0005qZ-JE; Fri, 18 Aug 2023 13:21:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qX39i-0005LL-Cg for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:02 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39g-0001sv-3i for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:02 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-52164adea19so1484827a12.1 for ; Fri, 18 Aug 2023 10:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379258; x=1692984058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; b=dA5WUZ0S2vTnGslEVMRBUVx8KNBdTrZlqN6x0N26Np0kJQgNcU4UVvnJY7vIzAuX/p qCxXh5HjvHI6MeFX+tdEpPNXZInZIt/h7CFq627e2CnrKPZH4dDQLAbrwPu8GG2IKNcO DxSac0kvsiRip9kVMNMURH5MKQgNpfw8BrnsTAlux0A6mmg8vo8bG3yBPD40YxYvfdqm LTjsuId/Z1rxRxrMDHEOFYgE45JfWvF6KoO8z/CY6ZsNmZrjyhqUqBb7gOD60rDXXNy/ KNHPLjyjtQ8gl8UUIqN/D1Lyr+ZPot7sttOUauq+jVS+L9HQwRDhpR1n4QaSz7Hjm0ue x4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379258; x=1692984058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; b=dQ+EHAWDH8Mwtz2JrsYl5ypI5rn0kQqoWk11V4OgTI97pfO4SMaDtjhx+hjGsX6PVO ZI2Jx8BefJ5PlPaqYg2gMt9gC6YpuaWB6OhXJkgqGXqDrDCbfX09RMfXVXGaIqdNbN9f uHovsik6ot5kw7H84XNrJGiOMNp0SMMXlUbu4UBYQzxqLKUbVHuxiRg1DwAVIXnl04Jj 5FDyzEV6LMPXZE2wzmN5U/AfbaB39CVJEbPMuJqbBi0ZtROE2HxhCmvgfKHaHvYFltL0 1LfvD5OMC11tFWXn21rRsH6z7SqEzW6UCQiJw8iB3X/soNYyWPv9fNb2VXgVub5nV0X9 WR+w== X-Gm-Message-State: AOJu0YyzRhIYcUL60ANlHz3gGN9BNPUfDaXfilE6qyglYdKW/ZEtBcu1 BJpCbiO42wUcdD8zeQhkBw5DY+iPkny/mDmLZoQ= X-Received: by 2002:a05:6402:104f:b0:525:65f7:60 with SMTP id e15-20020a056402104f00b0052565f70060mr2883752edu.29.1692379258514; Fri, 18 Aug 2023 10:20:58 -0700 (PDT) Received: from m1x-phil.lan (cnf78-h01-176-184-27-79.dsl.sta.abo.bbox.fr. [176.184.27.79]) by smtp.gmail.com with ESMTPSA id w9-20020a056402070900b00525683f9b2fsm1289223edx.5.2023.08.18.10.20.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Xiaojuan Yang , =?utf-8?q?Alex_Benn=C3=A9e?= , Jiajie Chen , Song Gao , Richard Henderson Subject: [PATCH v2 6/8] target/loongarch: Add function to check current arch Date: Fri, 18 Aug 2023 19:20:14 +0200 Message-ID: <20230818172016.24504-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230818172016.24504-1-philmd@linaro.org> References: <20230818172016.24504-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.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 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-bounces+patch=linaro.org@nongnu.org From: Jiajie Chen Add is_la64 function to check if the current cpucfg[1].arch equals to 2(LA64). Signed-off-by: Jiajie Chen Co-authored-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Song Gao Message-ID: <20230817093121.1053890-2-gaosong@loongson.cn> Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index c50b3a5ef3..3235ad081f 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -132,6 +132,11 @@ FIELD(CPUCFG1, HP, 24, 1) FIELD(CPUCFG1, IOCSR_BRD, 25, 1) FIELD(CPUCFG1, MSG_INT, 26, 1) +/* cpucfg[1].arch */ +#define CPUCFG1_ARCH_LA32R 0 +#define CPUCFG1_ARCH_LA32 1 +#define CPUCFG1_ARCH_LA64 2 + /* cpucfg[2] bits */ FIELD(CPUCFG2, FP, 0, 1) FIELD(CPUCFG2, FP_SP, 1, 1) @@ -421,6 +426,11 @@ static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch) #endif } +static inline bool is_la64(CPULoongArchState *env) +{ + return FIELD_EX32(env->cpucfg[1], CPUCFG1, ARCH) == CPUCFG1_ARCH_LA64; +} + /* * LoongArch CPUs hardware flags. */