From nobody Sat Nov 15 22:33:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1747753929; cv=none; d=zohomail.com; s=zohoarc; b=JZadAa7IVL4gL7e5XczMnXKrwpIGQCRGqoKUWB1MV8K0wuvt+OUZfpSNPO3/lgndgK0g9Jp8N5x/em9i6ilwu/PsDwpz2ZBnnrViulfaC11sVVVYr1Y93DYwoReahaVkMOgSkPRbZ7g+yaIJe24ODsqNinkPofpsyqSgIRbQh7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747753929; 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=KccohGerXlQI+AQkOCXQNhlheDs3vEsj3lqC/3gWZ1I=; b=Gl+pZHJXv+717IYkrntjHu0Kbit94nhsU6KONn6uTuESp16xSprSm4MqhDwU0RpqoSV7/YFerHNFvloleEPm5w6Xhhqkv3lI7WToqLJe2y7YnMdxvbG3sRBtpZUJT2fVgmsi4gkSRevxpGcz9BkKtCWc49yO7KVAYh48zpXkSH4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1747753929816530.2273073580182; Tue, 20 May 2025 08:12:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uHOYX-0007ww-Je; Tue, 20 May 2025 11:07:02 -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 1uHOYO-0007c4-AA; Tue, 20 May 2025 11:06:53 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uHOYM-0002y8-GK; Tue, 20 May 2025 11:06:52 -0400 Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2025 08:06:48 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.39]) by orviesa003.jf.intel.com with ESMTP; 20 May 2025 08:06:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747753611; x=1779289611; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mt5jKbsCQSp5uvoXWGR63XStLO+hUKDByG/gsMDB3KI=; b=PjQKLURn2zEkVi/gbDa1KS4oERA4BGni5cXHslh6B0JGf/PuvyZijriJ cjDjII1hKk50avlAAGhDV7kEBpfB+ekoVuUjMtz7XrmI1D3U7GFamVf+7 4kfTE6wDNH2+N5MuBUiatWd9iFvHNUBp9of2GTcjzE87Cdbs7Fk/LeJ0/ 33I04njzrLS2kzg/TCZsToIvbjrFw5udqoysAX2RftzX1NVxz5NvEo28x t+sztxZX9hqlc9jbfaB1WIGwrTxdmFvuDvZMioc334QRa31WuZqNVQ1PS V7x5lpivh+OIOpVjEp7f2rLrJ/G0j9/IrRMesCV9n9I6BChCYSGg4Deef Q==; X-CSE-ConnectionGUID: iV/cZjaWTEahtef3ZwSAiw== X-CSE-MsgGUID: 8PZCsXP/SlmUD6M6e48qsw== X-IronPort-AV: E=McAfee;i="6700,10204,11439"; a="59922475" X-IronPort-AV: E=Sophos;i="6.15,302,1739865600"; d="scan'208";a="59922475" X-CSE-ConnectionGUID: 4Ei2nWrPRN68Q280ZuH9+g== X-CSE-MsgGUID: SW3bvSy7QHCtpYttXQAOPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,302,1739865600"; d="scan'208";a="144461860" From: Zhao Liu To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org, Dapeng Mi , Zhao Liu Subject: [PATCH 2/5] hw/timer/hpet: Adjust num_timers in hpet_init() Date: Tue, 20 May 2025 23:27:47 +0800 Message-Id: <20250520152750.2542612-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250520152750.2542612-1-zhao1.liu@intel.com> References: <20250520152750.2542612-1-zhao1.liu@intel.com> 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=198.175.65.11; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -48 X-Spam_score: -4.9 X-Spam_bar: ---- X-Spam_report: (-4.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.487, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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 @intel.com) X-ZM-MESSAGEID: 1747753931030116600 Content-Type: text/plain; charset="utf-8" Currently, HPET adjusts num_timers in hpet_realize(), and doesn't change it in any other place. And this field is initialized as a property. Therefore, it's possible to move such adjustments to hept_init(), so that Rust side can synchronize this change. Adjust num_timers in hpet_init(). Signed-off-by: Zhao Liu --- hw/timer/hpet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 0fd1337a1564..48b1a9289f83 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -682,6 +682,12 @@ static void hpet_init(Object *obj) /* HPET Area */ memory_region_init_io(&s->iomem, obj, &hpet_ram_ops, s, "hpet", HPET_L= EN); sysbus_init_mmio(sbd, &s->iomem); + + if (s->num_timers < HPET_MIN_TIMERS) { + s->num_timers =3D HPET_MIN_TIMERS; + } else if (s->num_timers > HPET_MAX_TIMERS) { + s->num_timers =3D HPET_MAX_TIMERS; + } } =20 static void hpet_realize(DeviceState *dev, Error **errp) @@ -710,11 +716,6 @@ static void hpet_realize(DeviceState *dev, Error **err= p) sysbus_init_irq(sbd, &s->irqs[i]); } =20 - if (s->num_timers < HPET_MIN_TIMERS) { - s->num_timers =3D HPET_MIN_TIMERS; - } else if (s->num_timers > HPET_MAX_TIMERS) { - s->num_timers =3D HPET_MAX_TIMERS; - } for (i =3D 0; i < HPET_MAX_TIMERS; i++) { timer =3D &s->timer[i]; timer->qemu_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, hpet_timer,= timer); --=20 2.34.1