From nobody Mon Feb 9 23:17:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) client-ip=209.85.128.47; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f47.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1619973581; cv=none; d=zohomail.com; s=zohoarc; b=YlHvDuVozJDeSXYfUoulyOiTBSjQhe+MvzIMn2XWTDA3QGfJsV0RyRD8EdaeHvze0UYZa4B1+PKL/2fZaEa/LiphVayIceSsiSMjmwqMGAwYbzqxiFSKYu/6kstTvx0X+HjFET/Y21eaE4jhbKwmCSV9yg6dL13lGhmAztx6HwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619973581; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IdlZfh0jCcKdQ4dnlDtxjnnGZ8KwGepT18rEIuOb8mI=; b=DQFDnUf0Sya79x3q8EkNwNGx5pZjmwny8HvbrDuNoE0/OXyZ1WvXrq0woxB1lXqcsQNkMc0m4d4IgBzSlkZDhnQ583e3ufOncdPwgixVbK39gFbTqhtwfHI9m30+bgaHViHtZqyu3yT1y6JdVkpnW21VdFhZRbdADVf0z4ve00s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.zohomail.com with SMTPS id 1619973581326818.0706487824533; Sun, 2 May 2021 09:39:41 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id 82-20020a1c01550000b0290142562ff7c9so2136950wmb.3 for ; Sun, 02 May 2021 09:39:40 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (anancy-651-1-208-144.w109-217.abo.wanadoo.fr. [109.217.237.144]) by smtp.gmail.com with ESMTPSA id d2sm9374052wrs.10.2021.05.02.09.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 09:39:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IdlZfh0jCcKdQ4dnlDtxjnnGZ8KwGepT18rEIuOb8mI=; b=CPlmgpWLglnkbB3An2tamHh8z3VNiaXkQtQY8M/WTFze1A949NTgfou675vY/DdLtB pNhOaYnsZhthBlnShNgkaZ1LCYEzeL4ZBOxuEUHPgx9c2fHw1lxcTu9yJ6HflnveIbdG wRznmnl7RvLaLtoB0XGWKn7Y9yw9di221cG7FN73qKV/VmXXX41txM5a3RO2QExIp2wp SXLUf7XGTb8LW1H9oN0QOy9EX+turuSC2ihcl8KFaWeDXw24rr1vrURbp/4TqHyCXXjM 0ygpg/5TSpvr4nY77e9Nn/oJqWT9CCNcBfiZj5tFH7JjW5YNqfyy2QrIoMXa+o/MUUba RmFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IdlZfh0jCcKdQ4dnlDtxjnnGZ8KwGepT18rEIuOb8mI=; b=MXR0XR8xfcg2CUbciwa6w6uSaetPrYUgGE0wUedKKbKW5Hdwj7WjOilE0O3gLvc5fs yONiQPpmgAM+A2sfB4l56rOEXAKSeAAvWgxnTGRgNkscc2Dwp+czYFj310GQenxZD03c 6odmdmYwgACTPhtAjbwFTq8KZvZTzzkBlOJ4iKSiTw0ECJCOl/pUYz/2VfSZ0KNklJ0l ArMfU3xC/vxbt23bwUbZm/uiiAJEmgFKuY6Fi0Lpzf8NP3Dywli+R4otW+uToSgqYP0E p0CL6UEcQOHtOQXKGXTuLSUUy80BtQ/idtKSc3ErQcHIK8c6x34dVOheKk/5bD/fa7LY 5VGA== X-Gm-Message-State: AOAM532IwA3gNBsELJnIyxnnAZLr1QXM+UmdyN0UcoMSaic459TPM5bv jc4+KbMm5t9ILLxuVoay4RQ= X-Google-Smtp-Source: ABdhPJyty6Oav8OGx7G4wOdslp2C4RyfdeDyWoWap/MLaRR+KYm7w57qNa4//s6asW/M2Z753sueBw== X-Received: by 2002:a1c:a481:: with SMTP id n123mr27528996wme.162.1619973579623; Sun, 02 May 2021 09:39:39 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , "Edgar E. Iglesias" , "Michael S. Tsirkin" , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v3 1/2] hw/timer/etraxfs_timer: Convert to 3-phase reset (Resettable interface) Date: Sun, 2 May 2021 18:39:30 +0200 Message-Id: <20210502163931.552675-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210502163931.552675-1-f4bug@amsat.org> References: <20210502163931.552675-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) TYPE_ETRAX_FS_TIMER is a sysbus device, so its DeviceClass::reset() handler is called automatically when its qbus parent is reset (we don't need to register it manually). Convert the generic reset to a enter/hold resettable ones, and remove the qemu_register_reset() call. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias --- hw/timer/etraxfs_timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index 5379006086f..4ba662190de 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -309,9 +309,9 @@ static const MemoryRegionOps timer_ops =3D { } }; =20 -static void etraxfs_timer_reset(void *opaque) +static void etraxfs_timer_reset_enter(Object *obj, ResetType type) { - ETRAXTimerState *t =3D opaque; + ETRAXTimerState *t =3D ETRAX_TIMER(obj); =20 ptimer_transaction_begin(t->ptimer_t0); ptimer_stop(t->ptimer_t0); @@ -325,6 +325,12 @@ static void etraxfs_timer_reset(void *opaque) t->rw_wd_ctrl =3D 0; t->r_intr =3D 0; t->rw_intr_mask =3D 0; +} + +static void etraxfs_timer_reset_hold(Object *obj) +{ + ETRAXTimerState *t =3D ETRAX_TIMER(obj); + qemu_irq_lower(t->irq); } =20 @@ -343,14 +349,16 @@ static void etraxfs_timer_realize(DeviceState *dev, E= rror **errp) memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "etraxfs-timer", 0x5c); sysbus_init_mmio(sbd, &t->mmio); - qemu_register_reset(etraxfs_timer_reset, t); } =20 static void etraxfs_timer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 dc->realize =3D etraxfs_timer_realize; + rc->phases.enter =3D etraxfs_timer_reset_enter; + rc->phases.hold =3D etraxfs_timer_reset_hold; } =20 static const TypeInfo etraxfs_timer_info =3D { --=20 2.26.3