From patchwork Fri Dec 30 00:01:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 637861 Delivered-To: patch@linaro.org Received: by 2002:a17:906:1189:b0:7d5:1b03:224a with SMTP id n9csp4174809eja; Thu, 29 Dec 2022 16:24:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXtglIh3e0Y6+ajWrsZJWyqePQ9qf1sc/QSIVh3VGnMgf/l12+ujMMCZ/kmJocY+IAPlSCwp X-Received: by 2002:a0c:e6c2:0:b0:520:6ac2:14df with SMTP id l2-20020a0ce6c2000000b005206ac214dfmr35728599qvn.2.1672359360387; Thu, 29 Dec 2022 16:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672359360; cv=none; d=google.com; s=arc-20160816; b=pTzbA6moWS8XQPCs9LhDIWQOLk9TiKuwDZP3UqRpEZRW07P1OQqFSwFl/tzoqlvcqk SU/AtdzpbPf/juuG50Raw0WxuZveB9BIHB+8WoH2QfTKrxjrNKika2vDvzOtKPyDVaGS 5zDfn2wCKsvc6CKXRBwsBvtIMps22a9kMcLKDYjv9YUjW7eyQyqVrQ94umC4r1fpun1T z4niEBfzSgkg1ZXVKGRdeBdLV84k/E0WnjWVQTP93t577LdJxu7peU+tv6vAWhm25+jV bIzlC5Nc3UhN6M+3X/GjZzAd+J7b0gD7nAA5L6VBjKhn96ugriRUlcdZ2w5cQo1Ldr/H tChw== 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=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=zHklj0CoQFQoxtxqxIuA76MhVQuH9310+KPS0gTx03H42/eUko3XdrI5oec6TuN6OF GoBIhmu/niSFBExWnx72DbOmsz+6bc6YCBL4JhB1lcM6Y6j80FlJMA3RsLQIzSmg9WVs Fe/IGf+vRymu2rN4//1x1/TjdZjE/yN0G5hz5OKOCROFUzrxvaGh6pfaX168mC2ooR/n YUiQM/tmHo6BRvE3mB5DmoSGwFk/hObdkRFbfr5CdbIk3doRuljEkQGL7HWXZFSxXR91 7FVtWPj+H8gA6nXkdejottgu/bq28brUmVPWYeN/Kr9PcYu8l6ctQsGUeqFhQ5nAjDDX Dcsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HxksPY9G; 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 eo11-20020ad4594b000000b005214df9a7ecsi8650785qvb.576.2022.12.29.16.16.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 16:16:00 -0800 (PST) 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=HxksPY9G; 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 1pB2r7-000310-Tz; Thu, 29 Dec 2022 19:02:37 -0500 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 1pB2r4-0002yJ-Rh for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:02:34 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pB2r3-0002g0-6c for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:02:34 -0500 Received: by mail-pj1-x102f.google.com with SMTP id o8-20020a17090a9f8800b00223de0364beso24358672pjp.4 for ; Thu, 29 Dec 2022 16:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=HxksPY9G2ZbnBY77BTiepwj81VIl2hBLXqFuzerP3bHMeHX1U4C0JQ5MXelVhol/3L 755Re1XSpyUSQ3XqaAKkYoBz5zG5fCJAiqg2mBN7ZV7ODrTsYCG6evS0CcZbt6jCVzuX 07Ol1H+7VJuikty2a+oaIP7sZSTpuCgvyarjwVBQ7KZRCkqIWZaMmi9R8SBJ2zdawBsi wjs/UwINaS0+HFoBexxQvjiJRAeny3uZlUVIRDO1ST7xKMT5E+aejn5PfOHb1marNlSj BX4h0bwWRsojt/XBvYNfkm4LQOmjgiKXQ0/YLdH6REFQgNw9rU90xU68zmv4/ywTSTFK Kkmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=1y/tXWdTWI0vCwq66Bd7dAixKbHX6fB2Vsdpuh+SVC4=; b=nsIeD+pdXkP13us5TV25qJT9qsej7dVL7/Yg6k0zbT7dM++x94WGrYX7TLtaRRiFLg XC29mgV2/Dc5FT0i2XLR6tibTBnMsXJv7G4LM8kJ4TgP484UKVD3aOeSJdNCcbDREg8C SWsOyzXw6uchxcJP9GRjig8s6k7ka5GkLdL5h+pehsMJrBfHsnnvHwBAR8hGdnF0S1P4 8W+Oi8kicNBd3GIlHTuEaXXXTH+E8j/6AFDJwRLJIHtC7sFJjJ2D67y0wy5bXwvvYTzY 6yBZ8Gb5xAH4PuuXgGY6SBkVRTfLKB8WO3Twujyt0kJtHEnOXxg5sxCMxXdbaZpKZNDn Kqrg== X-Gm-Message-State: AFqh2krVkGiNTwW7DR5s2aoZT+cRs93FVdtuW39E1qIwhQRcR1xnuM9U AMlKA482UPKvodgPDBXASHAJAfKVqCoe4cUj X-Received: by 2002:a17:902:d2cd:b0:192:9c7a:e60c with SMTP id n13-20020a170902d2cd00b001929c7ae60cmr6953086plc.48.1672358551406; Thu, 29 Dec 2022 16:02:31 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id j14-20020a170903028e00b00192849e1d0asm7343953plr.116.2022.12.29.16.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 16:02:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis Subject: [PULL 09/47] target/riscv: Use QEMU_IOTHREAD_LOCK_GUARD in riscv_cpu_update_mip Date: Thu, 29 Dec 2022 16:01:43 -0800 Message-Id: <20221230000221.2764875-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230000221.2764875-1-richard.henderson@linaro.org> References: <20221230000221.2764875-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/cpu_helper.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 278d163803..241d06bab8 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -610,7 +610,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value) CPURISCVState *env = &cpu->env; CPUState *cs = CPU(cpu); uint64_t gein, vsgein = 0, vstip = 0, old = env->mip; - bool locked = false; if (riscv_cpu_virt_enabled(env)) { gein = get_field(env->hstatus, HSTATUS_VGEIN); @@ -621,10 +620,7 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value) mask = ((mask == MIP_VSTIP) && env->vstime_irq) ? 0 : mask; vstip = env->vstime_irq ? MIP_VSTIP : 0; - if (!qemu_mutex_iothread_locked()) { - locked = true; - qemu_mutex_lock_iothread(); - } + QEMU_IOTHREAD_LOCK_GUARD(); env->mip = (env->mip & ~mask) | (value & mask); @@ -634,10 +630,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value) cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); } - if (locked) { - qemu_mutex_unlock_iothread(); - } - return old; }