From nobody Mon Feb 9 18:48:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662011553; cv=none; d=zohomail.com; s=zohoarc; b=m2vA+a26Usay+wcikKh67tisSBHnfMPaxZ7JN/vY7nrMNETqg9j4CLkNGpCw5Yw93TRsPpT8LTy7ymyXxAuUiBPL5d5ozdQ9R7tQKTuzEvhsCqqkgNg5leeN1nMkQ4olf+WE6LoBRSVmdjSOLsGrtxRI7dDQFJGlt7kHcWjANvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662011553; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=U/h2PuXjGmHqeTevSKtXVEUhLbvpxvYx+D8DjCnF93A=; b=gM/ZES9SWPP+UmTny1D0Z9mg7I0/i6PU9o7AwwWWjEjgPFeXEHMgyK8Nl3gYpW5tFSfI+wsTd+qrSjD5EGbkdcC4JGZbcRfnnAs4GxiGSfRnrvS1PX4MaksCpoh04N3kQ79l4Tzi+DMAeTLkDBquM7KRoOTZkWztyRi/lSOUJFc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662011553690594.9442248222899; Wed, 31 Aug 2022 22:52:33 -0700 (PDT) Received: from localhost ([::1]:52108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTd7w-0000lp-7R for importer@patchew.org; Thu, 01 Sep 2022 01:52:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTd4P-00073r-Eu for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:54 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:39426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTd4K-0002Sn-RM for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:51 -0400 Received: by mail-wm1-x32b.google.com with SMTP id i188-20020a1c3bc5000000b003a7b6ae4eb2so706508wma.4 for ; Wed, 31 Aug 2022 22:48:48 -0700 (PDT) Received: from localhost.localdomain ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id q13-20020adff78d000000b0022533c4fa48sm13429938wrp.55.2022.08.31.22.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 22:48:46 -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=U/h2PuXjGmHqeTevSKtXVEUhLbvpxvYx+D8DjCnF93A=; b=aZ2eXVYnP0GT4VRMHKspmAvo2o7RKWyg0XCUPZHTag0jRpDd94OUohCVq7rx4ey/dp T/qabEpYT8fT1MpZufzRuCeKiaq9vHf5dgz6FStMbr3MTTMFcGmOlfG2mUTYz1MY7gRV DohQL5CIrLXc6Sa6ytJeEyKQ250B8e4gtGK2IPfxM7Y4oika2HM3PUH1zioBOedjp8sp ZZUkH/nd2lrzxATzgEFlQOCsXVHN2Zwe8xs7P77nKFBPlCMg9v3/DOZFzuimCDO4JHjv 7g/3BV4itrHhH9tyPP/np48k1GfpU1LBfyga0QXi7pAd/KdqO9jFHSaF/IgqN9Diw3sJ uC1g== 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=U/h2PuXjGmHqeTevSKtXVEUhLbvpxvYx+D8DjCnF93A=; b=s+kEie0bKspGJW6KXN0sdkEHcZm+tnsq8qG50T+ZSMYPunQlOMP8Xhd3a62FqIx7xr tKQz/qQeyiFiX1saPfPUwNkk077EYaAPZ36m/2W1vwVd8S/HdcVN2S9zAYIeux2Tb6JU stDYWlypDikMw9abipfbtHLZcv6qSMwSGIPxnV3loXi0GzGrprmam4AZeFF6jaBTCbL/ sv12M/yV7kLw+wjLDqtXJNmXLnyxv5kJdyDwaSwfkKstFsdhMtZyz9s30JlgB/nuSU3w ADPEWE4ieIRso+z3iP7uLaL64+qIl6OWHu8iNLCUC8JpFTW/SKaOniq7W5yTQB8FyTSR /ZAg== X-Gm-Message-State: ACgBeo3gRbm6crJsWXCgI2aFnzcsuo82zBOvGKnV9+vbGuUqNZcHCd69 hrWkVzS29Fhxyan3doGUYG6Gm1Zp1asNhr5KU98= X-Google-Smtp-Source: AA6agR6BmvZfOEg5Mca6YVRDLIdKk5+10k0HS45zDwRx/LwgHa6HA8TSV9fOg9Hs0pdTieU3ejEtfA== X-Received: by 2002:a05:600c:35d4:b0:3a6:18ba:1585 with SMTP id r20-20020a05600c35d400b003a618ba1585mr4026091wmq.48.1662011327263; Wed, 31 Aug 2022 22:48:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/4] target/avr: Support probe argument to tlb_fill Date: Thu, 1 Sep 2022 06:48:40 +0100 Message-Id: <20220901054843.31646-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901054843.31646-1-richard.henderson@linaro.org> References: <20220901054843.31646-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32b.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662011555635100004 While there are no target-specific nonfaulting probes, generic code may grow some uses at some point. Note that the attrs argument was incorrect -- it should have been MEMTXATTRS_UNSPECIFIED. Just use the simpler interface. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/avr/helper.c | 46 ++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/target/avr/helper.c b/target/avr/helper.c index db76452f9a..82284f8997 100644 --- a/target/avr/helper.c +++ b/target/avr/helper.c @@ -102,38 +102,50 @@ bool avr_cpu_tlb_fill(CPUState *cs, vaddr address, in= t size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr) { - int prot =3D 0; - MemTxAttrs attrs =3D {}; + int prot, page_size =3D TARGET_PAGE_SIZE; uint32_t paddr; =20 address &=3D TARGET_PAGE_MASK; =20 if (mmu_idx =3D=3D MMU_CODE_IDX) { - /* access to code in flash */ + /* Access to code in flash. */ paddr =3D OFFSET_CODE + address; prot =3D PAGE_READ | PAGE_EXEC; - if (paddr + TARGET_PAGE_SIZE > OFFSET_DATA) { + if (paddr >=3D OFFSET_DATA) { + /* + * This should not be possible via any architectural operation= s. + * There is certainly not an exception that we can deliver. + * Accept probing that might come from generic code. + */ + if (probe) { + return false; + } error_report("execution left flash memory"); abort(); } - } else if (address < NUMBER_OF_CPU_REGISTERS + NUMBER_OF_IO_REGISTERS)= { - /* - * access to CPU registers, exit and rebuilt this TB to use full a= ccess - * incase it touches specially handled registers like SREG or SP - */ - AVRCPU *cpu =3D AVR_CPU(cs); - CPUAVRState *env =3D &cpu->env; - env->fullacc =3D 1; - cpu_loop_exit_restore(cs, retaddr); } else { - /* access to memory. nothing special */ + /* Access to memory. */ paddr =3D OFFSET_DATA + address; prot =3D PAGE_READ | PAGE_WRITE; + if (address < NUMBER_OF_CPU_REGISTERS + NUMBER_OF_IO_REGISTERS) { + /* + * Access to CPU registers, exit and rebuilt this TB to use + * full access in case it touches specially handled registers + * like SREG or SP. For probing, set page_size =3D 1, in order + * to force tlb_fill to be called for the next access. + */ + if (probe) { + page_size =3D 1; + } else { + AVRCPU *cpu =3D AVR_CPU(cs); + CPUAVRState *env =3D &cpu->env; + env->fullacc =3D 1; + cpu_loop_exit_restore(cs, retaddr); + } + } } =20 - tlb_set_page_with_attrs(cs, address, paddr, attrs, prot, - mmu_idx, TARGET_PAGE_SIZE); - + tlb_set_page(cs, address, paddr, prot, mmu_idx, page_size); return true; } =20 --=20 2.34.1 From nobody Mon Feb 9 18:48:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662011554; cv=none; d=zohomail.com; s=zohoarc; b=ZkcKYsoREHPjVzTCh2kMx6MDB05QG+cexRRJ84GtIs6tZPZ75L+62cke6QIuC1i4sYw0NeEAKsqAO6Gqbr2wYa0514mTYiWmVyO5Dkm2Cg+3TGXQT1oGCz1we8i0JothzByStCKgRY4uk6ZJufNsT9EGqzaNv7QpOkenmdRduLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662011554; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pnrkcB7u5z1U6ZLIT5ewwpikaStb8NPbw7XF1+tgjNM=; b=guvIL3eJa1+9h72QN9tgX1F2Nn7rVHL/fA2BeX76UUgtWWYlMf9E6+V+TbIUDkVxVOLp1lkytfTTO5C8WYZIuRex1pXip8VrdDACOKPWCkD1zwwB62EMH7NqFcB5Rxft6DRDRc2XfBcKuNf5U9q8ZJx40nrsH8hD5zjJGwXjFf0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662011554033137.7765704275995; Wed, 31 Aug 2022 22:52:34 -0700 (PDT) Received: from localhost ([::1]:52106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTd7u-0000kq-V1 for importer@patchew.org; Thu, 01 Sep 2022 01:52:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTd4Q-00073x-Jb for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:54 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:53974) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTd4O-0002T0-UU for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:54 -0400 Received: by mail-wm1-x336.google.com with SMTP id h1so8419697wmd.3 for ; Wed, 31 Aug 2022 22:48:50 -0700 (PDT) Received: from localhost.localdomain ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id q13-20020adff78d000000b0022533c4fa48sm13429938wrp.55.2022.08.31.22.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 22:48:48 -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=pnrkcB7u5z1U6ZLIT5ewwpikaStb8NPbw7XF1+tgjNM=; b=n2yKUHL4xzO1KEXGfD69/ymDMQyfWukeU0brel/elTvsM492ZK7qvu+RnPGIY0/y72 B/VuuFZTFXBTms2LtlWVVeYLyUxQg98Sgw4Yt78Gyc32KRI6HhXK/CO03MLQuSAT0rVD x83h7i58rGEvLSuGbLf2ghyQ9nX2hYcBR20I8fBnc2E6QFs8CmcpUWxs1HssjAfDsQ0X kQj+ncFN76PgXafSwGLamXzsxIdaAmzoqS29yXZwTc0v1CM+taTrSyvyHLkOM4cQlL4L 65/buzc/APq1Mj6ZmND345Famtg2c0nlSNjUDHa805RZcJUembWFgur8d+JDi/PBGerf /FAg== 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=pnrkcB7u5z1U6ZLIT5ewwpikaStb8NPbw7XF1+tgjNM=; b=FLc6YAWOnHTxQxkJhX2+MhSnIsN4nQKzszcao8pksFHHe6p10X/BpiotPS5G6PZTV8 MIr1JsmVQYP6KgkCE7lcpamFJZOhNNbI6nGhVGiiF6LTZixONLNvZewTojYjua8TXzA+ ExHEyw3a74kgokOJWJryAwxt+bi6VH98T1VO9SY/5rdHhwgsegGS489cBXwBBTX0g++M PXS1XZGzJg3uOQn91f/ZVlH5aihxyElcUGdYEjzxChCp012q40VifoFj/ccf/+Z3gXss gt08tWEuEQHCXxhiC6hPtsyxrg4NXP3OQBQi/t1Ca7ehtGiXjWAKjPNDmF0jOwCAU6bi EoxQ== X-Gm-Message-State: ACgBeo1J2/boDob6GziQT3I7hGDnjEAPwnsiKfatm5Lw0rawWJJfprah 75F2YrfdspH2T5nCNjpz5Mn7+TIoHb/uM+nrR1Q= X-Google-Smtp-Source: AA6agR6uGRC9XqABAjTtN3w6olO2yzygqAEciFeRlVJribUeW0xwDWly126hDrvbJ+M+ez4FuN8Efg== X-Received: by 2002:a05:600c:1c1b:b0:3a5:e6ec:d12f with SMTP id j27-20020a05600c1c1b00b003a5e6ecd12fmr3947993wms.2.1662011328941; Wed, 31 Aug 2022 22:48:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Michael Rolnik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 2/4] target/avr: Call avr_cpu_do_interrupt directly Date: Thu, 1 Sep 2022 06:48:41 +0100 Message-Id: <20220901054843.31646-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901054843.31646-1-richard.henderson@linaro.org> References: <20220901054843.31646-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662011555598100003 There is no need to go through cc->tcg_ops when we know what value that must have. Reviewed-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- 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 =3D false; - CPUClass *cc =3D CPU_GET_CLASS(cs); AVRCPU *cpu =3D AVR_CPU(cs); CPUAVRState *env =3D &cpu->env; =20 if (interrupt_request & CPU_INTERRUPT_RESET) { if (cpu_interrupts_enabled(env)) { cs->exception_index =3D EXCP_RESET; - cc->tcg_ops->do_interrupt(cs); + avr_cpu_do_interrupt(cs); =20 cs->interrupt_request &=3D ~CPU_INTERRUPT_RESET; =20 @@ -47,7 +46,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_r= equest) if (cpu_interrupts_enabled(env) && env->intsrc !=3D 0) { int index =3D ctz32(env->intsrc); cs->exception_index =3D EXCP_INT(index); - cc->tcg_ops->do_interrupt(cs); + avr_cpu_do_interrupt(cs); =20 env->intsrc &=3D env->intsrc - 1; /* clear the interrupt */ if (!env->intsrc) { --=20 2.34.1 From nobody Mon Feb 9 18:48:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662011763; cv=none; d=zohomail.com; s=zohoarc; b=YPNioeBGsjuK++AoM1RsRdyTKcZq3lWdGTo2YQVj9yWsJ8ALYFKbXaI5tu2K2ecs3PIITspinIgLqkOP2MrZtfjz3WnFNPrv9D3SxcpACvRF5GgYgO8A+CocCDxkStpRD8v/3Kblxhr8JCZvLc7bl40EMaajplQweUw10+qxpww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662011763; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=onqIs+XT2WZfG8WtGyXgNUrHr/Df9zcYrXD6nOSwGCs=; b=KLr1qizcT/+NT8YuuAZBGXYfkam5xhkfGD8OT9BR1ClQVBVleIfAx6LDpsz5tMOQbDqIwxBmfhX+AiTz2nNuDZuiBAEj/RLdgScfbrgFE7lZS8HJjwvpbWwAj9ra64OUtreZtVGAriuZyGWcbdccYxS8yvWqb9Oyg51EqdAtsT0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662011763076844.8532445047166; Wed, 31 Aug 2022 22:56:03 -0700 (PDT) Received: from localhost ([::1]:45742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTdBK-0004OQ-0J for importer@patchew.org; Thu, 01 Sep 2022 01:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTd4Q-00073y-Lo for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:54 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:36726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTd4O-0002T6-Uc for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:54 -0400 Received: by mail-wr1-x436.google.com with SMTP id u17so1590833wrp.3 for ; Wed, 31 Aug 2022 22:48:51 -0700 (PDT) Received: from localhost.localdomain ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id q13-20020adff78d000000b0022533c4fa48sm13429938wrp.55.2022.08.31.22.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 22:48:49 -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=onqIs+XT2WZfG8WtGyXgNUrHr/Df9zcYrXD6nOSwGCs=; b=uQBW/8tnJAsg7rFDlHOWg8jdifLXntZjgajxOcGQzxgXtKIlJcCDNzwRMMOh5hVFEO /IwhD4Cs1yVahJXjiIm2G4rKb5M8xc2mNOLDPbX4gLV2GlDc2csrDAKApWw7qUltPpYr Jw0PWiHGhqfcXpM5d4TllpA8xGMDrKtB/zmDymTQwSTDAoNyaWObb1FztG0/1aAK/Cmz Q8xuWNhJt/ux9jgfrkyryunPABrvC941pzlo+shDPP/JsBF+saBcSkbWeDBC/lGz1kap l5av28iMP/kSWW1WMsmGN8ukET5dVPTU9UtYBCSJ+xn0DmMi0WY+UVtUT5lYBkL+pPAj QHdA== 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=onqIs+XT2WZfG8WtGyXgNUrHr/Df9zcYrXD6nOSwGCs=; b=jUqfocP8rApcfVVPQtOfOPDnjohAgUWhUmjzpsBuO2hs8LqyXG3nIy1B9SVOvPxUpI gG5zQm963tXBzXQbYZi5rlwhRBcfiG0cbOWKS7493JXJWJ3ACrs7bRSPlTq4zc96KhQB ZKvHdb1pvNsq/PCxYUNaxiTC+pj21r0BlkYX0Anl8oXnzsBI9FobhwdoOEfkeqga5LKk 7cT704/Y+YEzuY5UfRYIal2eosWl5emFwCMflgA8Us3+EyyF2x0FhH14vmcpf3asTKxr xUD3B95fss63UKYFdNXmaGeqEoL/BcGflx29V8xJzL3sMLLYgdamifRhBoElZKknXy+t 2ZuA== X-Gm-Message-State: ACgBeo0fvcmgCC9ENJjMU6UJD4S5FNzeJ9xLVuFSkTpmZgmBiYrBz6lQ n710/5FIDtTBr/w9bDYk+W6Zab7BqCYBc5ljGk4= X-Google-Smtp-Source: AA6agR6jj1H6feEsnHI1f0s5B3aHD2Ua0G3phEohnQbqXy0YiEAlZuVjdleFC+obN46N0yl8FlaHkA== X-Received: by 2002:a05:6000:1e18:b0:226:e095:a98c with SMTP id bj24-20020a0560001e1800b00226e095a98cmr7087054wrb.235.1662011330233; Wed, 31 Aug 2022 22:48:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Michael Rolnik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 3/4] target/avr: Only execute one interrupt at a time Date: Thu, 1 Sep 2022 06:48:42 +0100 Message-Id: <20220901054843.31646-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901054843.31646-1-richard.henderson@linaro.org> References: <20220901054843.31646-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x436.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662011764637100001 We cannot deliver two interrupts simultaneously; the first interrupt handler must execute first. Reviewed-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- 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 @@ =20 bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - bool ret =3D false; AVRCPU *cpu =3D AVR_CPU(cs); CPUAVRState *env =3D &cpu->env; =20 @@ -38,8 +37,7 @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_r= equest) avr_cpu_do_interrupt(cs); =20 cs->interrupt_request &=3D ~CPU_INTERRUPT_RESET; - - ret =3D 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 &=3D ~CPU_INTERRUPT_HARD; } - - ret =3D true; + return true; } } - return ret; + return false; } =20 void avr_cpu_do_interrupt(CPUState *cs) --=20 2.34.1 From nobody Mon Feb 9 18:48:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1662011770; cv=none; d=zohomail.com; s=zohoarc; b=cx79kRRImcslmYclVosbOnT7zM75zw+xSZqAgpmK8LQowPaNFuADRFmWe76j/F/5Z6gkM/tbWDLFEGc/jVmMEqE9fvs6iow7Kx+u7RGTaUllvHDg9QYIu4E9H0QSlkleHwab8pG6nrSMqJM/ozD3aQh7qdDyvfAMBcJqqRQhipU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662011770; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=osXM6kebf211jyJTnRVlg1LBiYlRKdmijrWPSS9x4Wo=; b=hKMib6qRDg3n0oGjBLtsi2jCEnnRpBhOvlJV9xk0Ub6WwEzZ/VwDOTfAdm/PpsRLEJw8Aiju7OHf1am7gTZpFjR/vG2Jmn83KeYq3D7VEgfpelgJyQkJDgFDmrbBrYReSIbnOIWALt0cTviVvHSfdLDdEAa71DFVWwZslI5/2Jw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1662011770089798.1458980178963; Wed, 31 Aug 2022 22:56:10 -0700 (PDT) Received: from localhost ([::1]:45744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTdBR-0004Vb-3O for importer@patchew.org; Thu, 01 Sep 2022 01:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTd4S-00074P-4v for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:57 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:46621) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTd4P-0002TD-6T for qemu-devel@nongnu.org; Thu, 01 Sep 2022 01:48:55 -0400 Received: by mail-wm1-x335.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so761539wms.5 for ; Wed, 31 Aug 2022 22:48:52 -0700 (PDT) Received: from localhost.localdomain ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id q13-20020adff78d000000b0022533c4fa48sm13429938wrp.55.2022.08.31.22.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 22:48:50 -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=osXM6kebf211jyJTnRVlg1LBiYlRKdmijrWPSS9x4Wo=; b=x2uGWdT/ZYePepG3NSmVyD9zoGF6zyfvPZ5OcAfQxyFzIYvrb+GXL/vNJP4ALg6cHY KWG8X4ZVfEQc1K6sbonJ3dNoi0yqwVrNs/aPmIeo84hSZms4mscZkORiIhFSw4sjszwg 6jmC16xkNPpXzmU784EbkZ3EZ9q3jP83XxUSzslb4rLODnTRtY8H2cO24BJMHdt3W2d3 GEHlDHWUq0sQb3+qRKizl4VzUOuVbw5DAitU9P6eeBNjG+r6h2X2tsel1+eXiGY98lsh B9/3wF1rrmlPmvvFyj87yMUssxaY+j+5TUJ8jibyhzuZEVERNKN/s/u/OI4Q8Q1kI0Q1 G/4Q== 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=osXM6kebf211jyJTnRVlg1LBiYlRKdmijrWPSS9x4Wo=; b=rCI+sYQt5pQM62LAcGSk7ky1i3yx61jJrJOl974yfhDY/wCwbNl65KO83pvTM6iaPE IuPOTeqvzVbosJGBsS2JVayVTlWI7icTje/gkUq+27z6iloppWzukDdQFwAx0qq7/vfw LX/soBykfUpxizvKHZKnBtzj3WR9CIGFcw6h7d0E0qVcyNzawD1qJdWU1hq5/OC+Q/Mn snTH1XAneEmr7m83Xz/wnWj4w3CDre8Lh20kjNf+cN69FgGXfpWOIvL8l9FPGM/CW5YY 8pk1UvAbPidNq+68GNs1FRErmJSKTJnIv8/u03Jn2b+SrX3FgpnWkPrpRp7A2TOB3z7Q xM/A== X-Gm-Message-State: ACgBeo3AWNeFpAOEuwqdjYouprXMhdbnmkFDEMs3m1I1OLMZJyyOkmaA 1uCHna5At9CBDNDOOr9M6cvTjKRGwgBgeXLPMhE= X-Google-Smtp-Source: AA6agR4DkKIm1RiyFgpRCOQPd0qwt9hnJ9iAnBr/ig6ci8QcU2N3z9zUpMPl5BC3/zttHqoqpKR3EA== X-Received: by 2002:a05:600c:1d14:b0:3a5:e8ba:f394 with SMTP id l20-20020a05600c1d1400b003a5e8baf394mr3894705wms.137.1662011331566; Wed, 31 Aug 2022 22:48:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Michael Rolnik , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 4/4] target/avr: Disable interrupts when env->skip set Date: Thu, 1 Sep 2022 06:48:43 +0100 Message-Id: <20220901054843.31646-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901054843.31646-1-richard.henderson@linaro.org> References: <20220901054843.31646-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x335.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1662011770631100001 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 Reviewed-by: Michael Rolnik Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- 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 =3D AVR_CPU(cs); CPUAVRState *env =3D &cpu->env; =20 + /* + * 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 =3D 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 =3D=3D DISAS_NORETURN) { + + switch (ctx->base.is_jmp) { + case DISAS_NORETURN: ctx->base.is_jmp =3D DISAS_CHAIN; + break; + case DISAS_NEXT: + if (ctx->base.tb->flags & TB_FLAGS_SKIP) { + ctx->base.is_jmp =3D DISAS_TOO_MANY; + } + break; + default: + break; } } =20 @@ -2989,6 +2999,11 @@ static void avr_tr_tb_stop(DisasContextBase *dcbase,= CPUState *cs) { DisasContext *ctx =3D container_of(dcbase, DisasContext, base); bool nonconst_skip =3D 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 =3D ctx->base.tb->flags & TB_FLAGS_SKIP; =20 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; --=20 2.34.1