| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * poll_state.c - Polling idle state |
|---|
| 3 | | - * |
|---|
| 4 | | - * This file is released under the GPLv2. |
|---|
| 5 | 4 | */ |
|---|
| 6 | 5 | |
|---|
| 7 | 6 | #include <linux/cpuidle.h> |
|---|
| .. | .. |
|---|
| 9 | 8 | #include <linux/sched/clock.h> |
|---|
| 10 | 9 | #include <linux/sched/idle.h> |
|---|
| 11 | 10 | |
|---|
| 12 | | -#define POLL_IDLE_TIME_LIMIT (TICK_NSEC / 16) |
|---|
| 13 | 11 | #define POLL_IDLE_RELAX_COUNT 200 |
|---|
| 14 | 12 | |
|---|
| 15 | 13 | static int __cpuidle poll_idle(struct cpuidle_device *dev, |
|---|
| .. | .. |
|---|
| 22 | 20 | local_irq_enable(); |
|---|
| 23 | 21 | if (!current_set_polling_and_test()) { |
|---|
| 24 | 22 | unsigned int loop_count = 0; |
|---|
| 23 | + u64 limit; |
|---|
| 24 | + |
|---|
| 25 | + limit = cpuidle_poll_time(drv, dev); |
|---|
| 25 | 26 | |
|---|
| 26 | 27 | while (!need_resched()) { |
|---|
| 27 | 28 | cpu_relax(); |
|---|
| .. | .. |
|---|
| 29 | 30 | continue; |
|---|
| 30 | 31 | |
|---|
| 31 | 32 | loop_count = 0; |
|---|
| 32 | | - if (local_clock() - time_start > POLL_IDLE_TIME_LIMIT) { |
|---|
| 33 | + if (local_clock() - time_start > limit) { |
|---|
| 33 | 34 | dev->poll_time_limit = true; |
|---|
| 34 | 35 | break; |
|---|
| 35 | 36 | } |
|---|
| .. | .. |
|---|
| 48 | 49 | snprintf(state->desc, CPUIDLE_DESC_LEN, "CPUIDLE CORE POLL IDLE"); |
|---|
| 49 | 50 | state->exit_latency = 0; |
|---|
| 50 | 51 | state->target_residency = 0; |
|---|
| 52 | + state->exit_latency_ns = 0; |
|---|
| 53 | + state->target_residency_ns = 0; |
|---|
| 51 | 54 | state->power_usage = -1; |
|---|
| 52 | 55 | state->enter = poll_idle; |
|---|
| 53 | | - state->disabled = false; |
|---|
| 54 | 56 | state->flags = CPUIDLE_FLAG_POLLING; |
|---|
| 55 | 57 | } |
|---|
| 56 | 58 | EXPORT_SYMBOL_GPL(cpuidle_poll_state_init); |
|---|