From patchwork Thu Apr 21 06:36:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 564312 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp200967map; Thu, 21 Apr 2022 00:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqsSJWwiVwGrpBeqvtLPMEiP66hWmH3zn81jEIBtyrGBu1fM7LdVOtg5jPqey+GcX4929a X-Received: by 2002:a05:6214:2623:b0:446:480c:a6fb with SMTP id gv3-20020a056214262300b00446480ca6fbmr17207993qvb.74.1650525567773; Thu, 21 Apr 2022 00:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650525567; cv=none; d=google.com; s=arc-20160816; b=YAT2zZA5kzLj5Gl11l7dai/OfboPjfG/5DOdpUrEJR6y9Ve14dyKDPeyy4ruOuVAvv byXZzAdifNbT+ep39l0/wvFS8tT2x2kHUNeT34BjPJT7DY3mjDzYUkXpXJeDwAMYJqzS dcAL9ohCGUUPTSmdH1GBQSH9SSGVsb2hV25DQEy8uQXwTv8pRhNf6wRVidVcya0zU4rL b71XfFrkc95xLpWRmDV+2b8yVY/WFDyJpXGe35X2AefX7ugxkSae0jrAPlc/KnTYm54L neAzU+jatXO+V/MHn4IibYQLwDpvvi3COpb0KPJNzrQ0gd9IVTzK6b0K9Rk2RwmbII8x qvRw== 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:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=lb52HKSInIIIVDF+q0v21pG3CUXFR3GBvm5uBTlMNJM=; b=DL1FXOAnV04xZ1d0XTSHxxDvrgUYcDkoxlE3Smbd5mqLUvC6Rjwo8pkJVy+9I0mFfo I08910XM4/Q3K/W7WBE9mrr0pFoshDetUYWzh1V8FRrfYDSAuNqYj3DbrW5wmmpTVIEB hHa+qpKu3VuHm8fDev7kr2h1KaRtTTRoCVeEhlgu59vz1/pgA7vo867ORmh4oHp12e4n TOPToi9DQu8EKSjbAXsYIp0VrvCjLRJv+CKgQk4ssTAVU4zKjLwcYUUrYVeGIJ8UIprC VrG+7KQNgd/qxf/P0i7dOYX4ozTFqA7I38HRQtQG9r9i/48tvYFN/DQf04MfcNjdlMk7 tF2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=Kvd9JmsD; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="VA4h/Y1P"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gw15-20020a0562140f0f00b004467b3b98d6si1115525qvb.431.2022.04.21.00.19.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Apr 2022 00:19:27 -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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=Kvd9JmsD; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="VA4h/Y1P"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: from localhost ([::1]:59206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhR62-00032o-5S for patch@linaro.org; Thu, 21 Apr 2022 03:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhQRx-0005Zb-F0 for qemu-devel@nongnu.org; Thu, 21 Apr 2022 02:37:57 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:13363) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhQRv-0007yk-2A for qemu-devel@nongnu.org; Thu, 21 Apr 2022 02:37:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1650523074; x=1682059074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YWQm8OJGwY9DyLYO16rmNKLkbJlmv5Jq1hk2A+TppXg=; b=Kvd9JmsDdgj47s/uUc8MIGvddUgew16KLm0UnrandUitUO8Wd5RlxgxV XjlQzLhHLeVDSyxDgUDB2SWKCvp4MljLFbezuaRPevc2h2ulA0+1PvrL7 LRQdZtEgDxBscYrSYdOLJ9dNmWRHI9Mnw/6ntVUDNpo4OxzghkAhAiN9a dURKdN6XNnGoF5hygJR86TyJqy1ztkZFrF1IMMwjVFp1l1y3h7THdYgQx fBxuQ+eSjYBys4HxTurLhJIpoplyJ+vGM64A9GXDwqPNQEt+p9iCiAMCA qc9jOXou7gp3KAorYXH+ZXwCkHAVKbgARRXJJhmusLxTC7mUjwY6Yy5iO A==; X-IronPort-AV: E=Sophos;i="5.90,278,1643644800"; d="scan'208";a="302639996" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 21 Apr 2022 14:37:39 +0800 IronPort-SDR: CTuYuSa0/3iO17CroMjhRgknGQNf5jNB0NgiwYKTd+VXlyjhIY3Mnrc5hHzFYbJfOh/9gv402K rPMwn7cdp8xs87ODCiOoNYdLFXfJsGDIM1QVsaj/opMGBTK+ayItsvApVf+YjrbfoyX4eHkyPO eFJYHgECqcGrQnzcDkwHfZ7t9hCFKoGm3o2MuGEsvRNR2PSDPHqX3jpQ37cBfTcBYWZ4BLnbar z6OUlDHWi4Pf80BZnnejGiuzwhB4XORZXDaVKm/Gl7oqY+mKe7yx8zKXNHpUnI4hQE8uYzEju/ JsigAWLfjEQcH491KxBTQpuR Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Apr 2022 23:08:41 -0700 IronPort-SDR: bxeNAOGKqPY19fWEBsCuuIVm4MAgfGNqRue+ksDBrhR7e4i45ktwiRvr9TYD8fqlNOETfJyQ0U 89gobvfjtX3gMnwwVrhwF5tieRmgvC9IkMULFX/IEOtgP8fTOR10yzv8NvXcd+peImcrWjYkEE XpqmReuvCIH9V/7sWKtJE+UvUfZclfsZJ0crJmE7OcLPZdJQFJJ5wSXlWTtV10CR859yK1XSUO j9Y4fTC+ZjT1pIP//ZMlsQ5oxkpvLmXmJp3uYxZk/ilIOelrzhoYDpnri7hVQSAMJdiMTQVhgJ Wy4= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Apr 2022 23:37:40 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KkSX30bRzz1Rwrw for ; Wed, 20 Apr 2022 23:37:39 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1650523058; x=1653115059; bh=YWQm8OJGwY9DyLYO16 rmNKLkbJlmv5Jq1hk2A+TppXg=; b=VA4h/Y1PlMly8bIDXZxIERKppLN6DTMr+s W0NteRJuk9meTKZvsQexxnjCVOBGQf6q6C8XZjZoZuC/AUSK4bmp8PTInG2Pxhy3 F5+Eutr/m1CJHktYQ8dci493x0rI0NRgMMhhnaB0AL0Uahw7EgAp1ZZs4EzKOvdt OlHf/YwG43hWEItwzjORdgz5+xOU3cp0fdV9YTVDQ85asVmz1pGUCtq1q1b7WVX9 jAuOxOH/82rcsxv9YajA0zAP+sMpBlXYRIYKdBsghJsYy/SqXdrkWw2RbBFR3Srb fCGj6V76A7nILRK3RRdh41mZEY6Gshax1TGvlvU2PUR9qBDb9uNA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LmKVzNjwPfRj for ; Wed, 20 Apr 2022 23:37:38 -0700 (PDT) Received: from toolbox.wdc.com (unknown [10.225.165.119]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KkSX061yCz1Rvlx; Wed, 20 Apr 2022 23:37:36 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Richard Henderson , Alistair Francis Subject: [PULL 17/31] target/riscv: Use cpu_loop_exit_restore directly from mmu faults Date: Thu, 21 Apr 2022 16:36:16 +1000 Message-Id: <20220421063630.1033608-18-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421063630.1033608-1-alistair.francis@opensource.wdc.com> References: <20220421063630.1033608-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=68.232.143.124; envelope-from=prvs=10363b772=alistair.francis@opensource.wdc.com; helo=esa2.hgst.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The riscv_raise_exception function stores its argument into exception_index and then exits to the main loop. When we have already set exception_index, we can just exit directly. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Message-Id: <20220401125948.79292-2-richard.henderson@linaro.org> Signed-off-by: Alistair Francis --- target/riscv/cpu_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 1c60fb2e80..126251d5da 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -1150,7 +1150,7 @@ void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, env->badaddr = addr; env->two_stage_lookup = riscv_cpu_virt_enabled(env) || riscv_cpu_two_stage_lookup(mmu_idx); - riscv_raise_exception(&cpu->env, cs->exception_index, retaddr); + cpu_loop_exit_restore(cs, retaddr); } void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr, @@ -1175,7 +1175,7 @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr, env->badaddr = addr; env->two_stage_lookup = riscv_cpu_virt_enabled(env) || riscv_cpu_two_stage_lookup(mmu_idx); - riscv_raise_exception(env, cs->exception_index, retaddr); + cpu_loop_exit_restore(cs, retaddr); } bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, @@ -1311,7 +1311,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, first_stage_error, riscv_cpu_virt_enabled(env) || riscv_cpu_two_stage_lookup(mmu_idx)); - riscv_raise_exception(env, cs->exception_index, retaddr); + cpu_loop_exit_restore(cs, retaddr); } return true;