From patchwork Thu Nov 24 11:50:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 628321 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp300699pvb; Thu, 24 Nov 2022 03:57:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7IZGFJFhbtvYavmL7FN5M1Eo3R870ZdfrRYchc5PSAOXvGbllizvk8qKvzu2n4pPdMXfTb X-Received: by 2002:ac8:5c03:0:b0:3a5:3979:23f0 with SMTP id i3-20020ac85c03000000b003a5397923f0mr30236917qti.216.1669291076438; Thu, 24 Nov 2022 03:57:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669291076; cv=none; d=google.com; s=arc-20160816; b=B2e4yjiCmivfa6HzY1hXIOHsPmzvxKF7ELJ/xsW97uyki+c9KUvQ+AW8BsMrjbqtjH T8QvcLaksBnuTtdlO9xJh8w/9tVn4T3a3B/q8yn8YzxjvU5X2V+N9uWhTvhZpdjegFpW nP/PscYOgvbnjfq6kSujpJBxgQZM3uRgOWKpGwSyBhLCqwE4lnS7FpcdtxfyL5ch2vgW 05uNW+oPsu40VzeO94aZUFS5hj8fwS/im90i3YgKg7oYrZ9PQlhCfNPQ1VuSREq40I4b GxIYjLSG+ICdfwJ8fnIiaUPFZl9MnW/MGJrA7q/8Wpr8Upvi07U8VQvF+DUTIn0/fhvw 0h/Q== 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=CJxN8OwLvz4RIGrwju4T4c5A0ASCmNoxWaI71mOwfMg=; b=h9XxxI+hlEObbev997z+RiDcoPUNeKc2yU840M2JtoiTMHaGGSHIysTQYU0ZCVGAsZ +shZg5GzkjK1XYsAfbFOs/l5Hl9fqlMcHmt9itG4e+m+963AkxuCv4VYEf+OFOWiA1nL CILbs79sZv+EdNTaSh4qxQzVuC3qjYc+xSCwZDgNvSsJ3rADqpJSP3Fy5YStaOD4C/cT rTmxupAgvpB+fSRWYrzR/KjtdHwHwjXjKz9Cky9PXeMurNeCPBgrNhMASvM9g/tEU1Ii d0b7JFKACUh2z+V9rrGPVN56XX23TflI9f5bGSwankeLQPwhGcnEpb0/LdQKG1k7mVcd yw2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WYCZu0FB; 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 8-20020ad45b88000000b004bc1a36b5bfsi501666qvp.458.2022.11.24.03.57.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Nov 2022 03:57:56 -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=WYCZu0FB; 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 1oyAl8-0004LC-Jx; Thu, 24 Nov 2022 06:51:14 -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 1oyAku-0003xz-TU for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:51:00 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyAkp-000526-Ey for qemu-devel@nongnu.org; Thu, 24 Nov 2022 06:51:00 -0500 Received: by mail-wm1-x336.google.com with SMTP id v7so1151089wmn.0 for ; Thu, 24 Nov 2022 03:50:54 -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=CJxN8OwLvz4RIGrwju4T4c5A0ASCmNoxWaI71mOwfMg=; b=WYCZu0FBoPLym6lgz2W4phD1L4vtnHcb9H8Jd2tcm2xIojsGTcWN0xG3UI2tfP+jle l9oT48HYjdf/xL48l5BQFqOS+i6ZmpnnVk3t1sE0KokrFOWeRFx+N9UmfwW4bqfcoomj rQgVoL/lgb27BNAvGD6SBVvhgDQM+CrqXxZ9zwqopKmWwODz1ouLzbhCase9ybioYvGZ vWWVrbupwi091AAcoQxPNckEynMUUEZ2W+gl9a3M1loa2nR8ZQN5ISu/PdHYXorelk/y MCRN6wz4P7F20jHbjnj7SxGCk9BvLP3qs/zRg8O09nCJKN60ig4WFV/CdaTqGId4yWmP SZAA== 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=CJxN8OwLvz4RIGrwju4T4c5A0ASCmNoxWaI71mOwfMg=; b=7edc9bMy7ZMVmyoYEEtHPjQp4q3uknkahk1g+XE4bcPXw4yJA8b5MUTOgmiVyMXCQ5 Gu6hUXIkjl/1RldNk14z09lgmFsUY13bwzUgjHMSouc2swUBMDVbR/VjTtiy6vN8evz7 XnitQaFBnFNK9oalfq0IQaHE+LpfyvTBGfxrnCM1CFRhzMWcvms2CxK5eQgj6B4Fv+1e QYPuf5YHXlLsrNMyxu4fQr3EKgwZjSpf7EnQoJRzbldLyaClRiyN3jJaRoQtwlZ1mSCW IUtrrs9KVwDKN6akvXd3W3bYpwAp68S9vGLNAF6C9HTWpG+WEx4oi1PD2t9kMfGMBGwW kC6Q== X-Gm-Message-State: ANoB5pl68GiTa920x2FCMf9riIvvg0xHeZtvVCO/mgfOHUxZX7G8p+00 HnuVOUm/83ec2FGeLykztuzMiccfAZlGfw== X-Received: by 2002:a05:600c:18a1:b0:3cf:a9d5:36c7 with SMTP id x33-20020a05600c18a100b003cfa9d536c7mr9505500wmp.13.1669290654048; Thu, 24 Nov 2022 03:50:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f14-20020a05600c154e00b003c6f3e5ba42sm6212559wmg.46.2022.11.24.03.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 03:50:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Peter Maydell , Michael Rolnik , "Edgar E. Iglesias" , Taylor Simpson , Song Gao , Xiaojuan Yang , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Chris Wulff , Marek Vasut , Stafford Horne , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson , Greg Kurz , Palmer Dabbelt , Alistair Francis , Bin Meng , Yoshinori Sato , Mark Cave-Ayland , Artyom Tarasenko , Bastian Koppelmann , Max Filippov , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH for-8.0 19/19] target/xtensa: Convert to 3-phase reset Date: Thu, 24 Nov 2022 11:50:22 +0000 Message-Id: <20221124115023.2437291-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124115023.2437291-1-peter.maydell@linaro.org> References: <20221124115023.2437291-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@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 autolearn=unavailable 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 Convert the xtensa CPU class to use 3-phase reset, so it doesn't need to use device_class_set_parent_reset() any more. Signed-off-by: Peter Maydell --- target/xtensa/cpu-qom.h | 4 ++-- target/xtensa/cpu.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/target/xtensa/cpu-qom.h b/target/xtensa/cpu-qom.h index 4fc35ee49b8..419c7d8e4a3 100644 --- a/target/xtensa/cpu-qom.h +++ b/target/xtensa/cpu-qom.h @@ -41,7 +41,7 @@ typedef struct XtensaConfig XtensaConfig; /** * XtensaCPUClass: * @parent_realize: The parent class' realize handler. - * @parent_reset: The parent class' reset handler. + * @parent_phases: The parent class' reset phase handlers. * @config: The CPU core configuration. * * An Xtensa CPU model. @@ -52,7 +52,7 @@ struct XtensaCPUClass { /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; const XtensaConfig *config; }; diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 09923301c40..2dc8f2d232f 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -85,16 +85,18 @@ bool xtensa_abi_call0(void) } #endif -static void xtensa_cpu_reset(DeviceState *dev) +static void xtensa_cpu_reset_hold(Object *obj) { - CPUState *s = CPU(dev); + CPUState *s = CPU(obj); XtensaCPU *cpu = XTENSA_CPU(s); XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(cpu); CPUXtensaState *env = &cpu->env; bool dfpu = xtensa_option_enabled(env->config, XTENSA_OPTION_DFP_COPROCESSOR); - xcc->parent_reset(dev); + if (xcc->parent_phases.hold) { + xcc->parent_phases.hold(obj); + } env->pc = env->config->exception_vector[EXC_RESET0 + env->static_vectors]; env->sregs[LITBASE] &= ~1; @@ -240,11 +242,13 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); XtensaCPUClass *xcc = XTENSA_CPU_CLASS(cc); + ResettableClass *rc = RESETTABLE_CLASS(oc); device_class_set_parent_realize(dc, xtensa_cpu_realizefn, &xcc->parent_realize); - device_class_set_parent_reset(dc, xtensa_cpu_reset, &xcc->parent_reset); + resettable_class_set_parent_phases(rc, NULL, xtensa_cpu_reset_hold, NULL, + &xcc->parent_phases); cc->class_by_name = xtensa_cpu_class_by_name; cc->has_work = xtensa_cpu_has_work;