From nobody Wed Apr 2 14:18:38 2025 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=1742751487; cv=none; d=zohomail.com; s=zohoarc; b=fKRjLBAQ6fSO8uiE55jD2dh0JEqbEg0u52Mw6QeJz7rCn+/8UO8BhXALQmCeLlUuLnHv9n1kkEL4678X3LEiyPCRv2Pd35IPRw+8KcjLWe0Yk0kGeyO+eIZKwE8tiUF03XRYoZYkSJaa3iqRyXrBOEa6P1aTND4lvpmSlPQ/wik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742751487; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rA9BN8KH+TQHBF8y80g6NTHRuQA2RHpbRpcidozR5So=; b=KEjsxjEDk4D7wSEoBqnYPyFNavAMsIMW7JdtUCfOtFn/oJPQwzskEg6ojz1jq8lp2c1vO0uq/I15ruiQPE0bECM3z4yYGGZat2LEPjANma2O8dH0LeaolnkSnAaxIuwFRcSiTpNxBYaHMG4AyFDKEtdDJKoWrYJsYmxvpCiRQpY= 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 1742751487861269.78604524101024; Sun, 23 Mar 2025 10:38:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twPGY-0005r8-OC; Sun, 23 Mar 2025 13:37:42 -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 1twPGW-0005pL-EJ for qemu-devel@nongnu.org; Sun, 23 Mar 2025 13:37:40 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1twPGU-0002tt-MT for qemu-devel@nongnu.org; Sun, 23 Mar 2025 13:37:40 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-224100e9a5cso66342345ad.2 for ; Sun, 23 Mar 2025 10:37:38 -0700 (PDT) Received: from stoup.. (174-21-74-48.tukw.qwest.net. [174.21.74.48]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22781209ff3sm54075165ad.257.2025.03.23.10.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Mar 2025 10:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742751457; x=1743356257; darn=nongnu.org; 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=rA9BN8KH+TQHBF8y80g6NTHRuQA2RHpbRpcidozR5So=; b=mf1Z64jOULGRXw1/xLSETzXbYNLRj4w/bGhpiMPw/5kISuh4Bl4Ho3O8c7U/+d/QvR ykGZ/OuGgbto3AN5YJwBnWtrZzklHlAD0vaRDJ4XPKkvZTDuVUpZHN/ETfBPnJRB0LLm 6rQAe9QHniUFzZ8YmcpPgneklmLrRNw3brdUysHrq5OgS4RoD7TFZSR92aadqiMEmYQC qSAZbYNTNIfka/qrEVVF5o3XVF+VaSi5/+UJYJbikwVeH12UO3LlOpF0xhaaFCBymPi3 +tWG7uHCICObli1mtuaHn45pUOp4Y/LeT73lKVLTmisYG0/PP9rctsI95McS3NkggFdw NK+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742751457; x=1743356257; 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=rA9BN8KH+TQHBF8y80g6NTHRuQA2RHpbRpcidozR5So=; b=tuGy8u+48FZsYzoiUYizLHx/U6+pjn75IOhRvIXfaXTyHR9EgAxQF++5vt5f/lwuq1 AyU53csQQZGYODBWYIlozLtoXmsGkKi4FPwZz7CtpL4VQhsNjNUmWi6IvgXGmwcRvlQv 3I7GkG1iJANPQCtIR0n6Hvnx2XR6t3caiRqp1aAnPZRMaJ1rOGg6luWjYSzkHmcMg7gn 3FaVXMDYpPQ7U+Yf9RhpD2BqvCwG+BGOcaWXVKeXFllyzr/XZBBa5MzAxHFnHSYUi2Gl bNsvY/sByG2zJl/8ZA8hZO3EgaXBigyBJR7WrVvAzihv5LtnqyQU2cJxfKBYuxBrV2nJ Jm1A== X-Gm-Message-State: AOJu0YyRhRfJ8Nz4aA8KK1/FLv6XDf/btWxLMq4MVmiTLVRwndpTiAid hL76i84DyayTJKSX1uUoFfBT7k4Fr77zMTU69vPMAEE+E26jSALevMnpinobnA38bY5z5K03UlE U X-Gm-Gg: ASbGncv9UDxAHvmkpxXmAhgShdG5EiW+7gOF9oWCiTj+eX+qnAkSZY57HXVeIw5gkif H1dYM/tFaxPl4Ae6ef9Wq/66GJ+mezdtw57pBFdjER+QzY80YrAuqP/fEVKA9inb84DIELBtUP5 olJ5qQgu9P6z+KTw5rg+WUP2vM7RC8d8IK1Z47dRERbRtJ7q6VdXLNyTTsLYn1ivJ3CKZDqBuM3 y3JMe8NdkWYkdFSDgwk2unnNZdBjSL8MXbIFRHSZPRdBFquka334hRrt0HqrFSkyz2GqcuCGwIM Glv2J5NDoZwuLhafIRzQ3vSZl3fSfPGkRKbrKHAaoUDikJlk8MejpMyHaHT1w1aIQwAQ6dGmAHs bE5AY9qw9snY= X-Google-Smtp-Source: AGHT+IHkOjuzjmhJgV6JaV/SXtj5NUSPfXQWfBo5RzZy8Hq2cwFPpGSc09FzCDwtT/9LWFsMMcLYVw== X-Received: by 2002:a17:903:1aac:b0:220:df73:b639 with SMTP id d9443c01a7336-22780e0b2efmr153799675ad.36.1742751457346; Sun, 23 Mar 2025 10:37:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mrolnik@gmail.com, philmd@linaro.org, pierrick.bouvier@linaro.org Subject: [PATCH 08/17] target/avr: Add offset-io cpu property Date: Sun, 23 Mar 2025 10:37:20 -0700 Message-ID: <20250323173730.3213964-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250323173730.3213964-1-richard.henderson@linaro.org> References: <20250323173730.3213964-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1742751489665116600 Content-Type: text/plain; charset="utf-8" Communicate the offset of io within the first page between the board, the cpu, and the translator. So far this is always 0. This will be used to optimize memory layout. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/avr/cpu.h | 2 ++ hw/avr/atmega.c | 2 ++ target/avr/cpu.c | 1 + target/avr/translate.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/target/avr/cpu.h b/target/avr/cpu.h index be27b0152b..0f5e1a53bc 100644 --- a/target/avr/cpu.h +++ b/target/avr/cpu.h @@ -148,6 +148,8 @@ struct ArchCPU { =20 /* Initial value of stack pointer */ uint32_t init_sp; + /* Offset of the beginning of I/O within the first page. */ + uint32_t offset_io; }; =20 /** diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c index f6844bf118..273582b8af 100644 --- a/hw/avr/atmega.c +++ b/hw/avr/atmega.c @@ -236,6 +236,8 @@ static void atmega_realize(DeviceState *dev, Error **er= rp) =20 object_property_set_uint(OBJECT(&s->cpu), "init-sp", mc->io_size + mc->sram_size - 1, &error_abort= ); + object_property_set_uint(OBJECT(&s->cpu), "offset-io", + 0, &error_abort); =20 qdev_realize(DEVICE(&s->cpu), NULL, &error_abort); cpudev =3D DEVICE(&s->cpu); diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 0b14b36c17..080f6f30d3 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -169,6 +169,7 @@ static void avr_cpu_initfn(Object *obj) =20 static const Property avr_cpu_properties[] =3D { DEFINE_PROP_UINT32("init-sp", AVRCPU, init_sp, 0), + DEFINE_PROP_UINT32("offset-io", AVRCPU, offset_io, 0), }; =20 static ObjectClass *avr_cpu_class_by_name(const char *cpu_model) diff --git a/target/avr/translate.c b/target/avr/translate.c index 0490936cd5..e9fef1aaad 100644 --- a/target/avr/translate.c +++ b/target/avr/translate.c @@ -92,6 +92,7 @@ struct DisasContext { =20 /* Routine used to access memory */ int memidx; + uint32_t offset_io; =20 /* * some AVR instructions can make the following instruction to be skip= ped @@ -2664,6 +2665,7 @@ static void avr_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) ctx->cs =3D cs; ctx->env =3D cpu_env(cs); ctx->npc =3D ctx->base.pc_first / 2; + ctx->offset_io =3D env_archcpu(ctx->env)->offset_io; =20 ctx->skip_cond =3D TCG_COND_NEVER; if (tb_flags & TB_FLAGS_SKIP) { --=20 2.43.0