From patchwork Tue Mar 19 06:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 781075 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1778140wrs; Mon, 18 Mar 2024 23:31:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWvHLwRZCI5YC1g9akq1UEjChRR97fUJJWz1Do11e8/SAifFFUITW28XwlwKJZs9g4RI2oAYK7HabtQvnygySOX X-Google-Smtp-Source: AGHT+IEAopUbOR0ZlDWnNYP5rDMwmeQBfHASKbtyzTBYidUeRLwG9bMQuGCzgC9eQFRV5KnAyyyj X-Received: by 2002:a5b:c8b:0:b0:dd0:453b:485e with SMTP id i11-20020a5b0c8b000000b00dd0453b485emr10832375ybq.58.1710829882888; Mon, 18 Mar 2024 23:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710829882; cv=none; d=google.com; s=arc-20160816; b=1HTGo85jR17Im+2Lu9aU3fdg6/YyYbT0T45VMYKp0sY75P0kvpmKJyXAfrpcJq3THz MRnk0m2QzIm3gGerNw2IA9H7rFoLUaygkouJiLN1Nl2x5Qwpm8pWj+gmI7QFx4GJbvOo kvNUPes17z2f//dTB9MaAcRUfHtCOfmpIIfh09zkQhDMtfI3UweBn7H+cK2mhk9qsK1v ff8Q7BT6JGweq3i4dHiTUuQ532b/jNptQ6kBnOdlUKXY1yeIIbkIJAzIi32yAk25R2lM 3iACt7YLF0EskVhAb7hno7tSYWVNjNwAZrhhMPm0beZAHYnXJ9fnenzSBw5Fn0pxQ4gG 2Ssg== 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=n1MPot1rwOH2sHZ4KnXL6/xrTAyUEmTpRKdgwXMTPjQ=; fh=gePD3z8dMUYjJ8/ZZTN9tznSOiGIRTnAzPrBTUj0xb0=; b=ThvCB43c9G2lLrccM5kv0W9I/10Y+yCEEzWHxtunMPNyzzJQn/SqwyC7abioBhZOu7 PFFCuwslp3SBd6PsnzRq34uRdoqXrzsRy1cIIhfvJu14aUfF19Qir19QBVoqz7Xq00fG oLuq+X2tjbgki9jJkCBVTNyevLpODkcMy2gCWWnzmiPhbOU1NhkkDQbIIkVTWiqwqo77 cHESfufNOC30NcB0XXFS9HecuVKLdkyjDRylaAvlSd4OXBlsy40lwpXas2tBFxjISpjt Z0vWTeGr3AuBfd8zydYDF5Vs2pOW0ApIRzhSUv1l6JlzHR7pyQiecDDJT+j+B8CyjNj5 F9Bg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=owwEE06F; 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 s37-20020a05622a1aa500b0042f0f3b2fe3si11096443qtc.582.2024.03.18.23.31.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Mar 2024 23:31:22 -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=owwEE06F; 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 1rmSya-0005Dx-QN; Tue, 19 Mar 2024 02:29:35 -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 1rmSyY-00059B-HL for qemu-devel@nongnu.org; Tue, 19 Mar 2024 02:29:30 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmSyW-0005e9-U0 for qemu-devel@nongnu.org; Tue, 19 Mar 2024 02:29:30 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-414618e6820so5819905e9.0 for ; Mon, 18 Mar 2024 23:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710829766; x=1711434566; 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=n1MPot1rwOH2sHZ4KnXL6/xrTAyUEmTpRKdgwXMTPjQ=; b=owwEE06FNiM1zIBP72Rs2G0t0/gN4g4bRK+GvvWAg29woDcH9ua4qOphaS5MSdsSIR 7NVr8JuTTX3OcH9CGZ/1kSCC2ZLbYjQZHfX4gCAKF2kRP+2thVlIQac/KS1KFvdiTxHj T/6Lodr+CUvICEtcDaQ1zUiT6fZNVnQsTK8D++3fUAg1s23CoMklEGChN1wO02fXsj4/ XKyTS0x3h0gmFWoBm6xm/n04cz2HrU2F6MWtQgmgcZGzQnpcjbT0otRRLxKtTkI04soR ZNlOfIwQ5I6CHVKX8x2BQenvYfLA4Hz8k3oK6IGfdutunUeZpBYfoMSI8lXmixIaDUhW GI5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710829766; x=1711434566; 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=n1MPot1rwOH2sHZ4KnXL6/xrTAyUEmTpRKdgwXMTPjQ=; b=sO6HR+30Ln0h6q74QSYiPGE+GbnGzDFAhbZUhiMnoWd8tJ5KuFdJqIX6mHL8bW41J+ 5N/XhV1sYUFAtHrDGLp17lJt8en4vJFaoqh1t6jsL0mSmOGSFFaNkyjKl9Ka4SRcTzLe Q+XY0kbakOMUhuqyNvpsa+BFcpZGGpVEqI6zhXUpr5hKcEPZDsqpcZXWQfHny3AcmlXp qj2B0LHjkJ8+ZZZKGqBqUo4vQEQ1t/X4Ayn0hJc6IjaXpsz0c4uBRClm72qHh+RtIrN4 DpqLcJzK/bS/7BFZGmTar+AEmH1NIBCLtpiqvxKKrhRlJRO8asGN6W4xQUeMq4p2esjS QpyQ== X-Gm-Message-State: AOJu0Ywi07YiGDvodmwsPzY1q5WSqlDCshMHQr8MawEakEejmwDlnn9Q f5ADzF3ujxZLxOsoChiVdJIrAOseAtpKXhFYMdOxdW7KtRr/c0adZS7Jo3/JmSq/c1NrsJU9xZK e X-Received: by 2002:a05:600c:4fc8:b0:414:6172:8366 with SMTP id o8-20020a05600c4fc800b0041461728366mr1300185wmq.15.1710829766185; Mon, 18 Mar 2024 23:29:26 -0700 (PDT) Received: from m1x-phil.lan ([176.176.166.129]) by smtp.gmail.com with ESMTPSA id j17-20020a05600c191100b00414659ba8c2sm650763wmq.37.2024.03.18.23.29.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Mar 2024 23:29:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , "Edgar E. Iglesias" , Laurent Vivier , Anton Johansson , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH-for-9.1 5/8] target/microblaze: Restrict 64-bit 'res_addr' to system emulation Date: Tue, 19 Mar 2024 07:28:52 +0100 Message-ID: <20240319062855.8025-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240319062855.8025-1-philmd@linaro.org> References: <20240319062855.8025-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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-bounces+patch=linaro.org@nongnu.org 'res_addr' is only used in system emulation, where we have TARGET_LONG_BITS = 64, so we can directly use the native uint64_t type instead of target_ulong. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson --- target/microblaze/cpu.h | 10 +++++----- target/microblaze/cpu.c | 2 ++ target/microblaze/machine.c | 2 +- target/microblaze/translate.c | 9 +++++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index c0c7574dbd..c3e2aba0ec 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -260,11 +260,6 @@ struct CPUArchState { /* Stack protectors. Yes, it's a hw feature. */ uint32_t slr, shr; - /* lwx/swx reserved address */ -#define RES_ADDR_NONE 0xffffffff /* Use 0xffffffff to indicate no reservation */ - target_ulong res_addr; - uint32_t res_val; - /* Internal flags. */ #define IMM_FLAG (1 << 0) #define BIMM_FLAG (1 << 1) @@ -286,6 +281,11 @@ struct CPUArchState { uint32_t iflags; #if !defined(CONFIG_USER_ONLY) + /* lwx/swx reserved address */ +#define RES_ADDR_NONE 0xffffffff /* Use 0xffffffff to indicate no reservation */ + uint64_t res_addr; + uint32_t res_val; + /* Unified MMU. */ MicroBlazeMMU mmu; #endif diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 96c2b71f7f..9e393cf217 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -193,7 +193,9 @@ static void mb_cpu_reset_hold(Object *obj) } memset(env, 0, offsetof(CPUMBState, end_reset_fields)); +#ifndef CONFIG_USER_ONLY env->res_addr = RES_ADDR_NONE; +#endif /* Disable stack protector. */ env->shr = ~0; diff --git a/target/microblaze/machine.c b/target/microblaze/machine.c index 51705e4f5c..4daf8a2471 100644 --- a/target/microblaze/machine.c +++ b/target/microblaze/machine.c @@ -78,7 +78,7 @@ static const VMStateField vmstate_env_fields[] = { VMSTATE_UINT32(iflags, CPUMBState), VMSTATE_UINT32(res_val, CPUMBState), - VMSTATE_UINTTL(res_addr, CPUMBState), + VMSTATE_UINT64(res_addr, CPUMBState), VMSTATE_STRUCT(mmu, CPUMBState, 0, vmstate_mmu, MicroBlazeMMU), diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index d6a42381bb..493850c544 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -1872,7 +1872,9 @@ void mb_tcg_init(void) SP(iflags), SP(bvalue), SP(btarget), +#if !defined(CONFIG_USER_ONLY) SP(res_val), +#endif }; #undef R @@ -1883,6 +1885,9 @@ void mb_tcg_init(void) tcg_global_mem_new_i32(tcg_env, i32s[i].ofs, i32s[i].name); } - cpu_res_addr = - tcg_global_mem_new(tcg_env, offsetof(CPUMBState, res_addr), "res_addr"); +#if !defined(CONFIG_USER_ONLY) + cpu_res_addr = tcg_global_mem_new_i64(tcg_env, + offsetof(CPUMBState, res_addr), + "res_addr"); +#endif }