summaryrefslogtreecommitdiffstats
path: root/hw/core
diff options
context:
space:
mode:
authorPeter Maydell2018-07-09 15:57:13 +0200
committerPeter Maydell2018-07-09 15:57:13 +0200
commit6d1d4276aea9773af97fed651cb205aab4f1b163 (patch)
tree5fa7bf1c3d687cb75a751030a05705482630d65f /hw/core
parentMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.0-20180709' into... (diff)
parenthw/net/dp8393x: don't make prom region 'nomigrate' (diff)
downloadqemu-6d1d4276aea9773af97fed651cb205aab4f1b163.tar.gz
qemu-6d1d4276aea9773af97fed651cb205aab4f1b163.tar.xz
qemu-6d1d4276aea9773af97fed651cb205aab4f1b163.zip
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180709' into staging
target-arm queue: * hw/net/dp8393x: don't make prom region 'nomigrate' * boards.h: Remove doc comment reference to nonexistent function * hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset' * target/arm: Fix do_predset for large VL * tcg: Restrict check_size_impl to multiples of the line size * target/arm: Suppress Coverity warning for PRF * hw/timer/cmsdk-apb-timer: fix minor corner-case bugs and suppress spurious warnings when running Linux's timer driver * hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr # gpg: Signature made Mon 09 Jul 2018 14:53:38 BST # gpg: using RSA key 3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20180709: hw/net/dp8393x: don't make prom region 'nomigrate' boards.h: Remove doc comment reference to nonexistent function hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset' target/arm: Fix do_predset for large VL tcg: Restrict check_size_impl to multiples of the line size target/arm: Suppress Coverity warning for PRF hw/timer/cmsdk-apb-timer: run or stop timer on writes to RELOAD and VALUE hw/timer/cmsdk-apb-timer: Correctly identify and set one-shot mode hw/timer/cmsdk-apb-timer: Correct ptimer policy settings ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/ptimer.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index 7221c68a98..170fd34d8b 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -45,8 +45,20 @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
uint32_t period_frac = s->period_frac;
uint64_t period = s->period;
uint64_t delta = s->delta;
+ bool suppress_trigger = false;
- if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) {
+ /*
+ * Note that if delta_adjust is 0 then we must be here because of
+ * a count register write or timer start, not because of timer expiry.
+ * In that case the policy might require us to suppress the timer trigger
+ * that we would otherwise generate for a zero delta.
+ */
+ if (delta_adjust == 0 &&
+ (s->policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT)) {
+ suppress_trigger = true;
+ }
+ if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)
+ && !suppress_trigger) {
ptimer_trigger(s);
}
@@ -353,6 +365,14 @@ ptimer_state *ptimer_init(QEMUBH *bh, uint8_t policy_mask)
s->bh = bh;
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ptimer_tick, s);
s->policy_mask = policy_mask;
+
+ /*
+ * These two policies are incompatible -- trigger-on-decrement implies
+ * a timer trigger when the count becomes 0, but no-immediate-trigger
+ * implies a trigger when the count stops being 0.
+ */
+ assert(!((policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) &&
+ (policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)));
return s;
}