From patchwork Sat Jul 8 05:36:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ruibo Lu X-Patchwork-Id: 1805153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QyfNV3kSCz20Nq for ; Sat, 8 Jul 2023 15:44:42 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qI0k2-00035I-2q; Sat, 08 Jul 2023 01:44:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qI0ju-0002JT-2D; Sat, 08 Jul 2023 01:44:14 -0400 Received: from mail.hust.edu.cn ([202.114.0.240] helo=hust.edu.cn) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qI0jr-0002Ec-Fi; Sat, 08 Jul 2023 01:44:13 -0400 Received: from localhost.localdomain ([10.12.190.169]) (user=reaperlu@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 3685giX2008244-3685giX3008244 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 8 Jul 2023 13:43:10 +0800 From: Ruibo Lu To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, luruibo2000@163.com, alistair.francis@wdc.com, liweiwei@iscas.ac.cn, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 1/2] target/riscv: Remove redundant check in pmp_is_locked Date: Sat, 8 Jul 2023 13:36:30 +0800 Message-ID: <20230708054236.18353-1-reaperlu@hust.edu.cn> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-FEAS-AUTH-USER: reaperlu@hust.edu.cn Received-SPF: pass client-ip=202.114.0.240; envelope-from=reaperlu@hust.edu.cn; helo=hust.edu.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org the check of top PMP is redundant and will not influence the return value, so consider remove it Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1733 Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Ruibo Lu --- target/riscv/pmp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index 9d8db493e6..1a9279ba88 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -49,11 +49,6 @@ static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index) return 1; } - /* Top PMP has no 'next' to check */ - if ((pmp_index + 1u) >= MAX_RISCV_PMPS) { - return 0; - } - return 0; }