From patchwork Fri Aug 26 20:55:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600314 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp652108mae; Fri, 26 Aug 2022 13:58:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Cs7IN65y+jknt/0w3Rc2oHExltX4qme0L3vpdQiscx6kJMgaNrjqsGTjSeIh4HnGE2JQI X-Received: by 2002:ad4:5c6c:0:b0:496:c323:6f87 with SMTP id i12-20020ad45c6c000000b00496c3236f87mr1244334qvh.62.1661547507328; Fri, 26 Aug 2022 13:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661547507; cv=none; d=google.com; s=arc-20160816; b=r0wn4QBCHQxILMHGUuuASKWOmSPfMkkRmrcIzVGmcHhc4JfqofRyjWvLbP38OH4RJl bX6FV4okTZyRHfEcMOXY3Krii3gTPwPF9zC5Ov5gn0lN5aGqJPf3EUPaDuJd+yif7JEJ 2aEZj+5sur0xjnaBlKe3gxhfujWXftsu9CSGAnCj5HtU/n5PELlFHXif5NXJa8kwDFsg c9v6PxNaXBRaQCI/XTrcx8IWbR3pTq4Tc2z7LoFw6omsz7oiJVpjOYIXnf3oCNAflvnX hP8kT8LpzfgIRSOwn0fMSbpvh9J9ApyDrJ9ZvotypLgfs0sns1Z6vMKAT9IrKRjZSMQb Ghng== 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=5pSXFwSlSVJciy/fhHEgZkCC53rjmr2bP7A8Givhm80=; b=AKRm6ejcICeTXHYrBS1URo4jaVAxbOBmHjKuqIOKK1zv241g8FEO0Qu9nysnO5eoPw n418meg36MfyAq4CABBDJUpkh7nxniNP5R1cj4DR7A6YUM23YjU1ytYSJLPAS41uBw9S 8ZiJyrVN9/qjstMn89COC5bUv0+Wb5x9Oh1N6fEs63sBJNqkeH9ukflsYKn4mEKEYk0J cusbt87rt9vsZ04nT8+nrtgsfJP9Jq6FkONpp9qsaJYyLb8034uQS/YzWwSSWM46emOw Kxvj/EDTHHscvf/6HJV6mrsUW4j7ZfJWNTT58NHdfQoEHvv+3F2TIH0gNYLqpR4/kEiA B13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=abcU9OBQ; 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 c29-20020ac8009d000000b003447fb24bf7si387201qtg.574.2022.08.26.13.58.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Aug 2022 13:58: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=pass header.i=@linaro.org header.s=google header.b=abcU9OBQ; 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]:52164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRgPK-0005d3-VV for patch@linaro.org; Fri, 26 Aug 2022 16:58:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRgMO-0002ge-Th for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:24 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:46592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRgMN-00033I-5M for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:24 -0400 Received: by mail-pg1-x535.google.com with SMTP id 69so752103pgb.13 for ; Fri, 26 Aug 2022 13:55:22 -0700 (PDT) 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; bh=5pSXFwSlSVJciy/fhHEgZkCC53rjmr2bP7A8Givhm80=; b=abcU9OBQipr+3mrTRVAf9oJWEfDHhM3FtmsZRN75XUgrn3Kifdo8YhZrPKN9X1tJMu 6XGPA1nQ8lZpsK+aH0GpDslyVAAGu05YzLTuNDX9Y4zTSV4+/WjA0mAvXMpD3OKduSMj WFGzhLUbKLJXFWLpT+uj5Iu4ud9hPMXwh1vimC9H0pnVO0EVMurTr4HAuMK/YfJzFf+L Tl1Wort8lfpf8pis+Vjp+y5Qa34PrLMmWlvEMSYCHxjjumd0kkS8HgwucEBJZ1Cc4h4M s4SLZLFLD7tmCN/OpZvc3BIj70KiBVYm4lPBpXCLQMK/W9z5roz59TiGfw38SEeG8OIA UZyg== 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; bh=5pSXFwSlSVJciy/fhHEgZkCC53rjmr2bP7A8Givhm80=; b=I/MXu7MSh7Hf7cSQrhMP9Zc8hcboRuTR4Ly0qRK1UqvyHawBlOgHaPDHw2Tsk7jodH xzqKwDZRnjoCGaX1LaNM1//GSYg3rGVZWcLR1Ktc2xcMe4WR6F+UF2FHR19YVEx04Tg6 P0cX+2Oi3cv8lCqqpD4MBCptzTbvh4TwE1BbXCg0sjG+ZpRKUalzKh6dhUFJhgzYWX9U 4zXkTO4H1QLtTuhRg/XIWEpmSr0FcrJCyrQrWf/GEKLeIvDZBAh842l4mpkfziReS2xT 6iOJtmOJd3VdjoY4dnDqn7WmpK9I1rNZDV2/k42CBEF3LIZi6x/6Y5MNUSScH/RVllvQ lacw== X-Gm-Message-State: ACgBeo0n5qG2J4WbFz6SYL5PosSB/C6iC8utf0mEtfpmgKXClGBKg0Ba EGDXimzMy3w/kbqct0iwBs4aGG5EIcnlBw== X-Received: by 2002:a63:4916:0:b0:427:d463:55e with SMTP id w22-20020a634916000000b00427d463055emr4769271pga.374.1661547321911; Fri, 26 Aug 2022 13:55:21 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:68d8:30f3:fbd7:6f7f]) by smtp.gmail.com with ESMTPSA id b11-20020a170902650b00b00172a567d910sm2009900plk.289.2022.08.26.13.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 13:55:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mrolnik@gmail.com Subject: [PATCH 1/3] target/avr: Call avr_cpu_do_interrupt directly Date: Fri, 26 Aug 2022 13:55:16 -0700 Message-Id: <20220826205518.2339352-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220826205518.2339352-1-richard.henderson@linaro.org> References: <20220826205518.2339352-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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" There is no need to go through cc->tcg_ops when we know what value that must have. Signed-off-by: Richard Henderson Reviewed-by: Michael Rolnik --- target/avr/helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index 82284f8997..9614ccf3e4 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -29,14 +29,13 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { bool ret = false; - CPUClass *cc = CPU_GET_CLASS(cs); AVRCPU *cpu = AVR_CPU(cs); CPUAVRState *env = &cpu->env; if (interrupt_request & CPU_INTERRUPT_RESET) { if (cpu_interrupts_enabled(env)) { cs->exception_index = EXCP_RESET; - cc->tcg_ops->do_interrupt(cs); + avr_cpu_do_interrupt(cs); cs->interrupt_request &= ~CPU_INTERRUPT_RESET; @@ -47,7 +46,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (cpu_interrupts_enabled(env) && env->intsrc != 0) { int index = ctz32(env->intsrc); cs->exception_index = EXCP_INT(index); - cc->tcg_ops->do_interrupt(cs); + avr_cpu_do_interrupt(cs); env->intsrc &= env->intsrc - 1; /* clear the interrupt */ if (!env->intsrc) { From patchwork Fri Aug 26 20:55:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600315 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp652538mae; Fri, 26 Aug 2022 13:59:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7nSk4xU1xGp7pW6qdLJw9fMawh6QgvlaG484DyX9QvNq6TIU2tCbhLneOx2u5kp6BavlMN X-Received: by 2002:a05:6214:5005:b0:472:e6b0:1fb2 with SMTP id jo5-20020a056214500500b00472e6b01fb2mr1205121qvb.124.1661547590248; Fri, 26 Aug 2022 13:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661547590; cv=none; d=google.com; s=arc-20160816; b=ZOztIodNA7BdRYifVmbrmtH4u6zrHD1igZ8efI+QGBRus7LOi5f5hI8H2BXlz1RDzB JAO2wzSJopN9H+0Z8h06F1GME7NdGvnq7kel4IjUMc/F3pwLDNS9tkFijfqb8Trm3FOd IhI5QBJ2iZDah5OJqAda19UMLThQMv0F2F9lAC8UaVrFSCmBvWjTBLm4hnFTKewNSly9 KJBNKs0GYiLmkYJCr2c7rm0D3RzJXknkVvcGtEoow49wrmyRW1crjzebEXbKjjKoDrHN 6pGWorwnfnPEHEaBqFzsS+w0g/ILp9/xYQGwqAGTckyBhAQ089uWNfaYVtSjZeK3qcSG x7EQ== 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=+qYqXrLsLw0dcBJ3rsNbWS6QwV4sJttAiucTYyfmq0U=; b=bYdjefWREmJTCYZdp3XlyLt5vbmwr7k6UML34aJ4ZMg2lzZdC8LN0jax2iHjMeMjzd Co2c876O8obwuboDD92sJKt/Inc1zqYx5e9ztBK3YvvEreG1ZCmXKXN7PFzZDC1DkLi+ Khczq/N15AnPEtcjAJ6cFdomnwrl6Mj4DRqkpVbXA7ipFaWVCo0R3PggC7DlmLe4zuOq kzyH77JSey0dbYYJtfyEYQ7uzoOoTwCPhLoSSwdJ7dgrmknfJwmeAyXILD3CKyTmBGDg xPXcJ7cZpyqryELCQ0bjxplNdPKGF4+mvjYhc/RX09HdCgbG2Eq90Kp1N58QFA+hnPQi W0sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IdZAK73p; 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 ey24-20020a05622a4c1800b003445a942923si376833qtb.686.2022.08.26.13.59.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Aug 2022 13:59:50 -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=IdZAK73p; 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]:44306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRgQf-0007V7-Sk for patch@linaro.org; Fri, 26 Aug 2022 16:59:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRgMQ-0002hE-Dn for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:26 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:46798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRgMO-00033N-RL for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:26 -0400 Received: by mail-pl1-x633.google.com with SMTP id jm11so2552740plb.13 for ; Fri, 26 Aug 2022 13:55:24 -0700 (PDT) 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; bh=+qYqXrLsLw0dcBJ3rsNbWS6QwV4sJttAiucTYyfmq0U=; b=IdZAK73p9ijbs9jb3vE2M+5SK5cV4rkJRtyj85cwPrmOwHquOiFHb2YlkQRsuNCuB9 xNes7Pj7hkCf2liLO1n/eje7p+8ncG1RUVRRvY3IfvFdXCQx3u5Wksj3cfPNDy1aq2uU Mx/KyH++wcl2LqF7JoSy2kSvJXwI2u1+xaGVQmSlrUkOcdHh6Ms3g+Yiu4xy5vxx7AWS fI3bHsuh2ePCh/WVbZhIpZDW7UMyZ6wUbBr6d2WY5BBoFB1tAnHGxpUYiHoBq74AryhN 4JzzaUwBBAW6dqFavy0jv1Y2NJXu7JmmSBFzGQeLrlnHghL3uVijd7+Yrb34BPVsKRaF 73eg== 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; bh=+qYqXrLsLw0dcBJ3rsNbWS6QwV4sJttAiucTYyfmq0U=; b=0/wfc9Kjh0Yq3sai+/MjI7iwyGzORdzdJS1h2GLXrdwQb6ZhwjBdXUszIXYzNoTRst uq6F5KraS8PlRYA6ZrlSL7lf9Lhi3eL9vaRVhX/5PRdi3u3+pX87koNi0Mkj9PNOxCcK lC2/bCvccdrLpckOPZsqY6L4p1sc4akjrjFPIeqbsQenJ8qaWkL4MQ+Wmkd566zXc1Tt 945BAL/hhEBSivmqSF09oJFSDRABqL4OTRTpHBM+47oeTFahkfHBHVQF63zHR4IZNxY2 DB9FBd+1hWao5Ax8Ak2jbU0BxXosLBtmnwtDy51GZcg1YBVBH7dI0tEXUgSZi2LRc2va 2OyQ== X-Gm-Message-State: ACgBeo2jlpiCyEkx1SqMdhmVqsr1G7MqXPs6WmnWFWB+fE2Pb/ZOA9t2 Gw/NhZuIdN7C1fC3AWmi3SX5Hb4FsMnwrQ== X-Received: by 2002:a17:902:c9cc:b0:172:e18d:4703 with SMTP id q12-20020a170902c9cc00b00172e18d4703mr5399539pld.41.1661547323062; Fri, 26 Aug 2022 13:55:23 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:68d8:30f3:fbd7:6f7f]) by smtp.gmail.com with ESMTPSA id b11-20020a170902650b00b00172a567d910sm2009900plk.289.2022.08.26.13.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 13:55:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mrolnik@gmail.com Subject: [PATCH 2/3] target/avr: Only execute one interrupt at a time Date: Fri, 26 Aug 2022 13:55:17 -0700 Message-Id: <20220826205518.2339352-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220826205518.2339352-1-richard.henderson@linaro.org> References: <20220826205518.2339352-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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" We cannot deliver two interrupts simultaneously; the first interrupt handler must execute first. Signed-off-by: Richard Henderson Reviewed-by: Michael Rolnik --- target/avr/helper.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index 9614ccf3e4..34f1cbffb2 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -28,7 +28,6 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - bool ret = false; AVRCPU *cpu = AVR_CPU(cs); CPUAVRState *env = &cpu->env; @@ -38,8 +37,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) avr_cpu_do_interrupt(cs); cs->interrupt_request &= ~CPU_INTERRUPT_RESET; - - ret = true; + return true; } } if (interrupt_request & CPU_INTERRUPT_HARD) { @@ -52,11 +50,10 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (!env->intsrc) { cs->interrupt_request &= ~CPU_INTERRUPT_HARD; } - - ret = true; + return true; } } - return ret; + return false; } void avr_cpu_do_interrupt(CPUState *cs) From patchwork Fri Aug 26 20:55:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 600313 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp651447mae; Fri, 26 Aug 2022 13:56:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WWx+Dq9EW8G2ki1THj2zO3Wj66tYWOvPkpBooEXwA9T5I6PNQklm4XbD+Laa7oTi6/+qU X-Received: by 2002:a05:620a:1512:b0:6bb:2393:7520 with SMTP id i18-20020a05620a151200b006bb23937520mr1096341qkk.488.1661547379497; Fri, 26 Aug 2022 13:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661547379; cv=none; d=google.com; s=arc-20160816; b=w4vT3IKEN4at+dKNDfIlPjc7Xhs00gQEzT87CbOYbTMarY5CVWyUe1ZjxjAvexoRLD FwNK8ZKEssALLsBlUCOijd+tK+loCThS72I+iqZhZ0x0VHtfx2v7G15dU3y1HF/aZNTa 5B3TvJKVbTuyZoyPeuNyfV324HMtBtop4O6HVEZOkhW7MnsNc39SZFpICi/iDZEBRDyc 7AK46+L9DkwA+T/cdIUT9IB+o62mIIbdT8e3rNOnYA9YiDN3HQbLTvoq7BSZqgkpbjii tPQgBXvOp7VYy+r1aQHTAfO/CdK/Diu5AmrP34LoXQ5hBcnpmnEwB4K/LXwHeUvr9jOt JZzQ== 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=nBCtz7PB4cTchcvi0fFpq6V9ay+TdmIULp5h3yuZcPo=; b=wMWasOxuI2+dv/mzeTY9hROiq5qO74kO3LlFibH7/wiLJ4jGyz3ke0cvu/fgmZo2Hb XCKUzXVlWgKJIc79SkPLDUdhcugHPDK0NMwPqPKfiPNRIpDDHMmOamTq0FNenGu8ziZM XzksjUqN5h223mcmAzwBB/v01KlVSagH01/tgmM9khUNm4ytG15KbFchZztUq50YpDSE 7SVg0Extwi4M3kGgXYOjF8s9zlc00cZTlLqXeps6X4Ti4SkFh56lmIp3B5ZSUs2KHG5D CjN+JrsQng0vaGKmojiqraU+LWu7u5KFwCzsosCiTUYUFE7G7ox4MBwtRR+ScxRyA5dU 3YIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kl0DtsZs; 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 k15-20020ad45bef000000b0049724954c54si281238qvc.194.2022.08.26.13.56.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Aug 2022 13:56:19 -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=kl0DtsZs; 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]:38006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRgNH-0002kx-4L for patch@linaro.org; Fri, 26 Aug 2022 16:56:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRgMR-0002iz-PT for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:27 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:50773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRgMP-00033e-Ul for qemu-devel@nongnu.org; Fri, 26 Aug 2022 16:55:27 -0400 Received: by mail-pj1-x1033.google.com with SMTP id t5so2703875pjs.0 for ; Fri, 26 Aug 2022 13:55:25 -0700 (PDT) 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; bh=nBCtz7PB4cTchcvi0fFpq6V9ay+TdmIULp5h3yuZcPo=; b=kl0DtsZs0j2+VeYTmTxQ3D4tzjK5CY0xI9927FvYOSmJjnkuXhA8qaNQ6mMgmu8ttd bbhKyXuLUoMpKiWJCr0vKjbYOVucNnmX2ATvXMKG2mWBDeCvFEwmcgmfY1jcngHrVjex cpNl3lodfRshZsoiz/9mrno1tB6xAi5oBU6z3k58sqoH8nlKDzopOZviRq3Gro4gZTku j9avKrCnxjFd+6zWyUCjfldinCs5/lNokdLjxCUf9LekfUOqAzu9B+EGbuR0iTHqyH7+ Sk83q+zKEk521efmK1R/3gIYi5qPlHETJGykvEJP/rb+H0X1nXOPqr26+ThIoxM51wMW J7vQ== 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; bh=nBCtz7PB4cTchcvi0fFpq6V9ay+TdmIULp5h3yuZcPo=; b=cqH/PHSKJgZhs44H8u/gio2NCaP5IVncO5pEaCBLdVwTBHgNgvCcgZaSvzwA1HP/Go 1zg4rluFuc/PknOcveH0pjeVsmjqCWXLHVA2ylRlEYe+vseCWdlib+b0YZ0CK+OHLNGu wbDNzoEHxUSsK9m6n273sl9cKwrQqykgwADve5j7ZzDPZh7ejygIi74eGh/UQ0ocJDYT K8+wz5ssIxPIWukrIVvT6Zr76QltN9zDL4MUEP03l4OaIjKaL2UsFxYlTj3GehuEOLhM WN6YoF53t8ucaikJHfTTrNL2rmUTJniwjvEcXZRWA7yPYaNa6rHq1dEPQ54m0jdP9zrR bcsg== X-Gm-Message-State: ACgBeo17t62/DToWdTgihlGeZM1mWGu+igoASTo17iEe9Og7R5eEv5T8 HHwgfnkZm0nkpC7aImPQaE79ly8O6/ftXQ== X-Received: by 2002:a17:903:18b:b0:16e:f09c:919b with SMTP id z11-20020a170903018b00b0016ef09c919bmr5367708plg.135.1661547324211; Fri, 26 Aug 2022 13:55:24 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:68d8:30f3:fbd7:6f7f]) by smtp.gmail.com with ESMTPSA id b11-20020a170902650b00b00172a567d910sm2009900plk.289.2022.08.26.13.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 13:55:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mrolnik@gmail.com Subject: [PATCH 3/3] target/avr: Disable interrupts when env->skip set Date: Fri, 26 Aug 2022 13:55:18 -0700 Message-Id: <20220826205518.2339352-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220826205518.2339352-1-richard.henderson@linaro.org> References: <20220826205518.2339352-1-richard.henderson@linaro.org> 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" This bit is not saved across interrupts, so we must delay delivering the interrupt until the skip has been processed. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1118 Signed-off-by: Richard Henderson Reviewed-by: Michael Rolnik --- target/avr/helper.c | 9 +++++++++ target/avr/translate.c | 26 ++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index 34f1cbffb2..156dde4e92 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -31,6 +31,15 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) AVRCPU *cpu = AVR_CPU(cs); CPUAVRState *env = &cpu->env; + /* + * We cannot separate a skip from the next instruction, + * as the skip would not be preserved across the interrupt. + * Separating the two insn normally only happens at page boundaries. + */ + if (env->skip) { + return false; + } + if (interrupt_request & CPU_INTERRUPT_RESET) { if (cpu_interrupts_enabled(env)) { cs->exception_index = EXCP_RESET; diff --git a/target/avr/translate.c b/target/avr/translate.c index dc9c3d6bcc..026753c963 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -2971,8 +2971,18 @@ static void avr_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) if (skip_label) { canonicalize_skip(ctx); gen_set_label(skip_label); - if (ctx->base.is_jmp == DISAS_NORETURN) { + + switch (ctx->base.is_jmp) { + case DISAS_NORETURN: ctx->base.is_jmp = DISAS_CHAIN; + break; + case DISAS_NEXT: + if (ctx->base.tb->flags & TB_FLAGS_SKIP) { + ctx->base.is_jmp = DISAS_TOO_MANY; + } + break; + default: + break; } } @@ -2989,6 +2999,11 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) { DisasContext *ctx = container_of(dcbase, DisasContext, base); bool nonconst_skip = canonicalize_skip(ctx); + /* + * Because we disable interrupts while env->skip is set, + * we must return to the main loop to re-evaluate afterward. + */ + bool force_exit = ctx->base.tb->flags & TB_FLAGS_SKIP; switch (ctx->base.is_jmp) { case DISAS_NORETURN: @@ -2997,7 +3012,7 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) case DISAS_NEXT: case DISAS_TOO_MANY: case DISAS_CHAIN: - if (!nonconst_skip) { + if (!nonconst_skip && !force_exit) { /* Note gen_goto_tb checks singlestep. */ gen_goto_tb(ctx, 1, ctx->npc); break; @@ -3005,8 +3020,11 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) tcg_gen_movi_tl(cpu_pc, ctx->npc); /* fall through */ case DISAS_LOOKUP: - tcg_gen_lookup_and_goto_ptr(); - break; + if (!force_exit) { + tcg_gen_lookup_and_goto_ptr(); + break; + } + /* fall through */ case DISAS_EXIT: tcg_gen_exit_tb(NULL, 0); break;