From nobody Tue May 7 03:07:17 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1652697235; cv=none; d=zohomail.com; s=zohoarc; b=DjNTV5RplsH9x8VvGxEmGBiY2pZjyAvdJoRfFPHpp383I6VuyBZ9d4PFJxUKP0jxN+n4LNSjvtAYZ+NQeL+5fSQdsUFCWid8o3CkE70SUZm3gdXGRqClB8OGiJ7EvM0b5TTp1QDpN4Ba0EhufgFI9VRSGU7lGhkUBpieEq0NVPc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652697235; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=33wIKmukBZWBx0IiXiXd/lT2EfDXkdMd0jCk53T6Hhk=; b=C2ERr/We+z3R9KGm91gHtUY704Kvoe5N4TqCrVz67PIbTPhnMcjz1i3SUxIPI0pY9IrRVlbC7dAyeajx25ctR7NvYGTOuPS7Z1WarHCj38s0rQSe12CICRNER/rV8zs/Z+Nrj+xOUAQyt2Y+isJik33w3GI1fAZEz/dYFxmKQbk= 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+importer2=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 1652697235320733.9131258751082; Mon, 16 May 2022 03:33:55 -0700 (PDT) Received: from localhost ([::1]:35192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqY30-00045j-5A for importer2@patchew.org; Mon, 16 May 2022 06:33:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqY0J-0002Ms-UU for qemu-devel@nongnu.org; Mon, 16 May 2022 06:31:07 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:34426) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqY0F-0004Gj-6a for qemu-devel@nongnu.org; Mon, 16 May 2022 06:31:07 -0400 Received: by mail-wr1-x436.google.com with SMTP id j24so4622897wrb.1 for ; Mon, 16 May 2022 03:31:02 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d8-20020adf9c88000000b0020d106c0386sm665042wre.89.2022.05.16.03.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 03:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=33wIKmukBZWBx0IiXiXd/lT2EfDXkdMd0jCk53T6Hhk=; b=DMBcqctSP6P/IwT85pzewb0SPbtwQNz0Zo4Cp2WiTNW2vSTji+p1T0I8GF5+ETQrkF XtUAojFia4VrQegdEvD1Yc4gOV8SOsgnBtAuNArrwhA2IGFbP9OEAASy8x/Bhyaiu8Zv KLQnGHKQkYEprLz4VVbXd1vApP2D91G0NcxemkgmrSqzkVmjYyH6OiHJD3Qi4KCG1hiH O8nSoRRzdl+UaWRKaOYvBKk7zfJcTTx+7shgncqaU9pQVGbMyTyBbZLYnWK+UsM3aJB2 t3b3QK/+QJgKQnrRjDLkfXCUdG2Oj12wyZTCQBxml22BiRYKHEHG+/j3JHSLYHaWBOIS /zSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=33wIKmukBZWBx0IiXiXd/lT2EfDXkdMd0jCk53T6Hhk=; b=fiptqC4NzhE0cgscOXOd+SbeLied9AnsaNOH2yKL/HbHctMuqKjP7OEDi8QTMIGV0J X205QV4Di8ZyFr23aeDVODF9pCTfn55yhPjxEGL0V+Qw5EZ+K+A7RXzZVeGNJ7o0EiIH uNHyWiZaY+odqMcpJQ5reAuhWpUZus8qPQqPhzKpdOJiCYPloK4jU0WlC9T26RFmGrNg KameZRHM+/8axsaSi8Kcr7FN2WiGTr/IhLuVfCl3pP1Fvzwb8zXicA10082G42juBc78 JwK/sJFjVxbO1eu+Q7R1mvQaNbc68EFAOFnfYMXfpuO4z88KlqvArOxxnvmBIHkVWDJJ XocQ== X-Gm-Message-State: AOAM530r2fyjRFdKexFms5LtHMuRvKPxX06veFeWe6twXm7jj5280RKE iT4ci4Ywwvrfp2E8FgdWk3zj5A== X-Google-Smtp-Source: ABdhPJxO8NZzquC+mCmf93EhewmkP6n/XhusFG7xENbPeCVnyKYWHlEBVuAR7yuZv4BkD0ctqparJw== X-Received: by 2002:a5d:56d2:0:b0:20d:fbf:5b70 with SMTP id m18-20020a5d56d2000000b0020d0fbf5b70mr1124306wrw.34.1652697061143; Mon, 16 May 2022 03:31:01 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Alistair Francis , Francisco Iglesias Subject: [PATCH] ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY Date: Mon, 16 May 2022 11:30:58 +0100 Message-Id: <20220516103058.162280-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1652697237685100001 Content-Type: text/plain; charset="utf-8" The traditional ptimer behaviour includes a collection of weird edge case behaviours. In 2016 we improved the ptimer implementation to fix these and generally make the behaviour more flexible, with ptimers opting in to the new behaviour by passing an appropriate set of policy flags to ptimer_init(). For backwards-compatibility, we defined PTIMER_POLICY_DEFAULT (which sets no flags) to give the old weird behaviour. This turns out to be a poor choice of name, because people writing new devices which use ptimers are misled into thinking that the default is probably a sensible choice of flags, when in fact it is almost always not what you want. Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY and beef up the comment to more clearly say that new devices should not be using it. The code-change part of this commit was produced by sed -i -e 's/PTIMER_POLICY_DEFAULT/PTIMER_POLICY_LEGACY/g' $(git grep -l = PTIMER_POLICY_DEFAULT) Signed-off-by: Peter Maydell Reviewed-by: Francisco Iglesias Reviewed-by: Richard Henderson --- include/hw/ptimer.h | 16 ++++++++++++---- hw/arm/musicpal.c | 2 +- hw/dma/xilinx_axidma.c | 2 +- hw/dma/xlnx_csu_dma.c | 2 +- hw/m68k/mcf5206.c | 2 +- hw/m68k/mcf5208.c | 2 +- hw/net/can/xlnx-zynqmp-can.c | 2 +- hw/net/fsl_etsec/etsec.c | 2 +- hw/net/lan9118.c | 2 +- hw/rtc/exynos4210_rtc.c | 4 ++-- hw/timer/allwinner-a10-pit.c | 2 +- hw/timer/altera_timer.c | 2 +- hw/timer/arm_timer.c | 2 +- hw/timer/digic-timer.c | 2 +- hw/timer/etraxfs_timer.c | 6 +++--- hw/timer/exynos4210_mct.c | 6 +++--- hw/timer/exynos4210_pwm.c | 2 +- hw/timer/grlib_gptimer.c | 2 +- hw/timer/imx_epit.c | 4 ++-- hw/timer/imx_gpt.c | 2 +- hw/timer/mss-timer.c | 2 +- hw/timer/sh_timer.c | 2 +- hw/timer/slavio_timer.c | 2 +- hw/timer/xilinx_timer.c | 2 +- tests/unit/ptimer-test.c | 4 ++-- 25 files changed, 43 insertions(+), 35 deletions(-) diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index c443218475b..4dc02b0de47 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -33,9 +33,17 @@ * to stderr when the guest attempts to enable the timer. */ =20 -/* The default ptimer policy retains backward compatibility with the legacy - * timers. Custom policies are adjusting the default one. Consider providi= ng - * a correct policy for your timer. +/* + * The 'legacy' ptimer policy retains backward compatibility with the + * traditional ptimer behaviour from before policy flags were introduced. + * It has several weird behaviours which don't match typical hardware + * timer behaviour. For a new device using ptimers, you should not + * use PTIMER_POLICY_LEGACY, but instead check the actual behaviour + * that you need and specify the right set of policy flags to get that. + * + * If you are overhauling an existing device that uses PTIMER_POLICY_LEGACY + * and are in a position to check or test the real hardware behaviour, + * consider updating it to specify the right policy flags. * * The rough edges of the default policy: * - Starting to run with a period =3D 0 emits error message and stops the @@ -54,7 +62,7 @@ * since the last period, effectively restarting the timer with a * counter =3D counter value at the moment of change (.i.e. one less). */ -#define PTIMER_POLICY_DEFAULT 0 +#define PTIMER_POLICY_LEGACY 0 =20 /* Periodic timer counter stays with "0" for a one period before wrapping * around. */ diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 7c840fb4283..b65c020115a 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -464,7 +464,7 @@ static void mv88w8618_timer_init(SysBusDevice *dev, mv8= 8w8618_timer_state *s, sysbus_init_irq(dev, &s->irq); s->freq =3D freq; =20 - s->ptimer =3D ptimer_init(mv88w8618_timer_tick, s, PTIMER_POLICY_DEFAU= LT); + s->ptimer =3D ptimer_init(mv88w8618_timer_tick, s, PTIMER_POLICY_LEGAC= Y); } =20 static uint64_t mv88w8618_pit_read(void *opaque, hwaddr offset, diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index bc383f53cca..cbb8f0f1696 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -552,7 +552,7 @@ static void xilinx_axidma_realize(DeviceState *dev, Err= or **errp) =20 st->dma =3D s; st->nr =3D i; - st->ptimer =3D ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT); + st->ptimer =3D ptimer_init(timer_hit, st, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(st->ptimer); ptimer_set_freq(st->ptimer, s->freqhz); ptimer_transaction_commit(st->ptimer); diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c index 60ada3286b4..1ce52ea5a2b 100644 --- a/hw/dma/xlnx_csu_dma.c +++ b/hw/dma/xlnx_csu_dma.c @@ -666,7 +666,7 @@ static void xlnx_csu_dma_realize(DeviceState *dev, Erro= r **errp) sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); =20 s->src_timer =3D ptimer_init(xlnx_csu_dma_src_timeout_hit, - s, PTIMER_POLICY_DEFAULT); + s, PTIMER_POLICY_LEGACY); =20 s->attr =3D MEMTXATTRS_UNSPECIFIED; =20 diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index 6d93d761a5e..2ab1b4f0593 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -152,7 +152,7 @@ static m5206_timer_state *m5206_timer_init(qemu_irq irq) m5206_timer_state *s; =20 s =3D g_new0(m5206_timer_state, 1); - s->timer =3D ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_DEFAULT= ); + s->timer =3D ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_LEGACY); s->irq =3D irq; m5206_timer_reset(s); return s; diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 655207e393d..be1033f84f8 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -197,7 +197,7 @@ static void mcf5208_sys_init(MemoryRegion *address_spac= e, qemu_irq *pic) /* Timers. */ for (i =3D 0; i < 2; i++) { s =3D g_new0(m5208_timer_state, 1); - s->timer =3D ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_DEF= AULT); + s->timer =3D ptimer_init(m5208_timer_trigger, s, PTIMER_POLICY_LEG= ACY); memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s, "m5208-timer", 0x00004000); memory_region_add_subregion(address_space, 0xfc080000 + 0x4000 * i, diff --git a/hw/net/can/xlnx-zynqmp-can.c b/hw/net/can/xlnx-zynqmp-can.c index 22bb8910fa8..82ac48cee24 100644 --- a/hw/net/can/xlnx-zynqmp-can.c +++ b/hw/net/can/xlnx-zynqmp-can.c @@ -1079,7 +1079,7 @@ static void xlnx_zynqmp_can_realize(DeviceState *dev,= Error **errp) =20 /* Allocate a new timer. */ s->can_timer =3D ptimer_init(xlnx_zynqmp_can_ptimer_cb, s, - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); =20 ptimer_transaction_begin(s->can_timer); =20 diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c index 6d50c395439..4e6cc708dec 100644 --- a/hw/net/fsl_etsec/etsec.c +++ b/hw/net/fsl_etsec/etsec.c @@ -393,7 +393,7 @@ static void etsec_realize(DeviceState *dev, Error **err= p) object_get_typename(OBJECT(dev)), dev->id, e= tsec); qemu_format_nic_info_str(qemu_get_queue(etsec->nic), etsec->conf.macad= dr.a); =20 - etsec->ptimer =3D ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_DE= FAULT); + etsec->ptimer =3D ptimer_init(etsec_timer_hit, etsec, PTIMER_POLICY_LE= GACY); ptimer_transaction_begin(etsec->ptimer); ptimer_set_freq(etsec->ptimer, 100); ptimer_transaction_commit(etsec->ptimer); diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c index 6aff424cbe5..456ae38107b 100644 --- a/hw/net/lan9118.c +++ b/hw/net/lan9118.c @@ -1363,7 +1363,7 @@ static void lan9118_realize(DeviceState *dev, Error *= *errp) s->pmt_ctrl =3D 1; s->txp =3D &s->tx_packet; =20 - s->timer =3D ptimer_init(lan9118_tick, s, PTIMER_POLICY_DEFAULT); + s->timer =3D ptimer_init(lan9118_tick, s, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(s->timer); ptimer_set_freq(s->timer, 10000); ptimer_set_limit(s->timer, 0xffff, 1); diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c index ae67641de66..d1620c7a2ac 100644 --- a/hw/rtc/exynos4210_rtc.c +++ b/hw/rtc/exynos4210_rtc.c @@ -564,14 +564,14 @@ static void exynos4210_rtc_init(Object *obj) Exynos4210RTCState *s =3D EXYNOS4210_RTC(obj); SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); =20 - s->ptimer =3D ptimer_init(exynos4210_rtc_tick, s, PTIMER_POLICY_DEFAUL= T); + s->ptimer =3D ptimer_init(exynos4210_rtc_tick, s, PTIMER_POLICY_LEGACY= ); ptimer_transaction_begin(s->ptimer); ptimer_set_freq(s->ptimer, RTC_BASE_FREQ); exynos4210_rtc_update_freq(s, 0); ptimer_transaction_commit(s->ptimer); =20 s->ptimer_1Hz =3D ptimer_init(exynos4210_rtc_1Hz_tick, - s, PTIMER_POLICY_DEFAULT); + s, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(s->ptimer_1Hz); ptimer_set_freq(s->ptimer_1Hz, RTC_BASE_FREQ); ptimer_transaction_commit(s->ptimer_1Hz); diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c index c3fc2a4daaf..971f78462ab 100644 --- a/hw/timer/allwinner-a10-pit.c +++ b/hw/timer/allwinner-a10-pit.c @@ -275,7 +275,7 @@ static void a10_pit_init(Object *obj) =20 tc->container =3D s; tc->index =3D i; - s->timer[i] =3D ptimer_init(a10_pit_timer_cb, tc, PTIMER_POLICY_DE= FAULT); + s->timer[i] =3D ptimer_init(a10_pit_timer_cb, tc, PTIMER_POLICY_LE= GACY); } } =20 diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index c6e02d2b5a7..0f1f54206a3 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -185,7 +185,7 @@ static void altera_timer_realize(DeviceState *dev, Erro= r **errp) return; } =20 - t->ptimer =3D ptimer_init(timer_hit, t, PTIMER_POLICY_DEFAULT); + t->ptimer =3D ptimer_init(timer_hit, t, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(t->ptimer); ptimer_set_freq(t->ptimer, t->freq_hz); ptimer_transaction_commit(t->ptimer); diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 84cf2726bb3..69c88634722 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -180,7 +180,7 @@ static arm_timer_state *arm_timer_init(uint32_t freq) s->freq =3D freq; s->control =3D TIMER_CTRL_IE; =20 - s->timer =3D ptimer_init(arm_timer_tick, s, PTIMER_POLICY_DEFAULT); + s->timer =3D ptimer_init(arm_timer_tick, s, PTIMER_POLICY_LEGACY); vmstate_register(NULL, VMSTATE_INSTANCE_ID_ANY, &vmstate_arm_timer, s); return s; } diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c index e3aae4a45a4..d5186f44549 100644 --- a/hw/timer/digic-timer.c +++ b/hw/timer/digic-timer.c @@ -139,7 +139,7 @@ static void digic_timer_init(Object *obj) { DigicTimerState *s =3D DIGIC_TIMER(obj); =20 - s->ptimer =3D ptimer_init(digic_timer_tick, NULL, PTIMER_POLICY_DEFAUL= T); + s->ptimer =3D ptimer_init(digic_timer_tick, NULL, PTIMER_POLICY_LEGACY= ); =20 /* * FIXME: there is no documentation on Digic timer diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index 139e5b86a44..ecc2831bafb 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -370,9 +370,9 @@ static void etraxfs_timer_realize(DeviceState *dev, Err= or **errp) ETRAXTimerState *t =3D ETRAX_TIMER(dev); SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); =20 - t->ptimer_t0 =3D ptimer_init(timer0_hit, t, PTIMER_POLICY_DEFAULT); - t->ptimer_t1 =3D ptimer_init(timer1_hit, t, PTIMER_POLICY_DEFAULT); - t->ptimer_wd =3D ptimer_init(watchdog_hit, t, PTIMER_POLICY_DEFAULT); + t->ptimer_t0 =3D ptimer_init(timer0_hit, t, PTIMER_POLICY_LEGACY); + t->ptimer_t1 =3D ptimer_init(timer1_hit, t, PTIMER_POLICY_LEGACY); + t->ptimer_wd =3D ptimer_init(watchdog_hit, t, PTIMER_POLICY_LEGACY); =20 sysbus_init_irq(sbd, &t->irq); sysbus_init_irq(sbd, &t->nmi); diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index d0e53439968..e175a9f5b9b 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1503,17 +1503,17 @@ static void exynos4210_mct_init(Object *obj) =20 /* Global timer */ s->g_timer.ptimer_frc =3D ptimer_init(exynos4210_gfrc_event, s, - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); memset(&s->g_timer.reg, 0, sizeof(struct gregs)); =20 /* Local timers */ for (i =3D 0; i < 2; i++) { s->l_timer[i].tick_timer.ptimer_tick =3D ptimer_init(exynos4210_ltick_event, &s->l_timer[i], - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); s->l_timer[i].ptimer_frc =3D ptimer_init(exynos4210_lfrc_event, &s->l_timer[i], - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); s->l_timer[i].id =3D i; } =20 diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index 220088120ee..02924a9e5b3 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -400,7 +400,7 @@ static void exynos4210_pwm_init(Object *obj) sysbus_init_irq(dev, &s->timer[i].irq); s->timer[i].ptimer =3D ptimer_init(exynos4210_pwm_tick, &s->timer[i], - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); s->timer[i].id =3D i; s->timer[i].parent =3D s; } diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index d5118901097..5c4923c1e09 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -383,7 +383,7 @@ static void grlib_gptimer_realize(DeviceState *dev, Err= or **errp) =20 timer->unit =3D unit; timer->ptimer =3D ptimer_init(grlib_gptimer_hit, timer, - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); timer->id =3D i; =20 /* One IRQ line for each timer */ diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ebd58254d15..2bf8c754b21 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -347,9 +347,9 @@ static void imx_epit_realize(DeviceState *dev, Error **= errp) 0x00001000); sysbus_init_mmio(sbd, &s->iomem); =20 - s->timer_reload =3D ptimer_init(imx_epit_reload, s, PTIMER_POLICY_DEFA= ULT); + s->timer_reload =3D ptimer_init(imx_epit_reload, s, PTIMER_POLICY_LEGA= CY); =20 - s->timer_cmp =3D ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_DEFAULT); + s->timer_cmp =3D ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_LEGACY); } =20 static void imx_epit_class_init(ObjectClass *klass, void *data) diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c index 5c0d9a269ce..80b83026399 100644 --- a/hw/timer/imx_gpt.c +++ b/hw/timer/imx_gpt.c @@ -505,7 +505,7 @@ static void imx_gpt_realize(DeviceState *dev, Error **e= rrp) 0x00001000); sysbus_init_mmio(sbd, &s->iomem); =20 - s->timer =3D ptimer_init(imx_gpt_timeout, s, PTIMER_POLICY_DEFAULT); + s->timer =3D ptimer_init(imx_gpt_timeout, s, PTIMER_POLICY_LEGACY); } =20 static void imx_gpt_class_init(ObjectClass *klass, void *data) diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c index fe0ca905f3c..ee7438f1684 100644 --- a/hw/timer/mss-timer.c +++ b/hw/timer/mss-timer.c @@ -232,7 +232,7 @@ static void mss_timer_init(Object *obj) for (i =3D 0; i < NUM_TIMERS; i++) { struct Msf2Timer *st =3D &t->timers[i]; =20 - st->ptimer =3D ptimer_init(timer_hit, st, PTIMER_POLICY_DEFAULT); + st->ptimer =3D ptimer_init(timer_hit, st, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(st->ptimer); ptimer_set_freq(st->ptimer, t->freq_hz); ptimer_transaction_commit(st->ptimer); diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c index c72c327bfaf..77889397669 100644 --- a/hw/timer/sh_timer.c +++ b/hw/timer/sh_timer.c @@ -239,7 +239,7 @@ static void *sh_timer_init(uint32_t freq, int feat, qem= u_irq irq) s->enabled =3D 0; s->irq =3D irq; =20 - s->timer =3D ptimer_init(sh_timer_tick, s, PTIMER_POLICY_DEFAULT); + s->timer =3D ptimer_init(sh_timer_tick, s, PTIMER_POLICY_LEGACY); =20 sh_timer_write(s, OFFSET_TCOR >> 2, s->tcor); sh_timer_write(s, OFFSET_TCNT >> 2, s->tcnt); diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index 90fdce4c442..8c4f6eb06b6 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -405,7 +405,7 @@ static void slavio_timer_init(Object *obj) tc->timer_index =3D i; =20 s->cputimer[i].timer =3D ptimer_init(slavio_timer_irq, tc, - PTIMER_POLICY_DEFAULT); + PTIMER_POLICY_LEGACY); ptimer_transaction_begin(s->cputimer[i].timer); ptimer_set_period(s->cputimer[i].timer, TIMER_PERIOD); ptimer_transaction_commit(s->cputimer[i].timer); diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index 1eb927eb847..c7f17cd6460 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -223,7 +223,7 @@ static void xilinx_timer_realize(DeviceState *dev, Erro= r **errp) =20 xt->parent =3D t; xt->nr =3D i; - xt->ptimer =3D ptimer_init(timer_hit, xt, PTIMER_POLICY_DEFAULT); + xt->ptimer =3D ptimer_init(timer_hit, xt, PTIMER_POLICY_LEGACY); ptimer_transaction_begin(xt->ptimer); ptimer_set_freq(xt->ptimer, t->freq_hz); ptimer_transaction_commit(xt->ptimer); diff --git a/tests/unit/ptimer-test.c b/tests/unit/ptimer-test.c index 9176b96c1ce..22ef1ccb3a0 100644 --- a/tests/unit/ptimer-test.c +++ b/tests/unit/ptimer-test.c @@ -768,7 +768,7 @@ static void add_ptimer_tests(uint8_t policy) char policy_name[256] =3D ""; char *tmp; =20 - if (policy =3D=3D PTIMER_POLICY_DEFAULT) { + if (policy =3D=3D PTIMER_POLICY_LEGACY) { g_sprintf(policy_name, "default"); } =20 @@ -862,7 +862,7 @@ static void add_ptimer_tests(uint8_t policy) static void add_all_ptimer_policies_comb_tests(void) { int last_policy =3D PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT; - int policy =3D PTIMER_POLICY_DEFAULT; + int policy =3D PTIMER_POLICY_LEGACY; =20 for (; policy < (last_policy << 1); policy++) { if ((policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) && --=20 2.25.1