| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * X86 specific ACPICA environments and implementation |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014, Intel Corporation |
|---|
| 5 | 6 | * Author: Lv Zheng <lv.zheng@intel.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #ifndef _ASM_X86_ACENV_H |
|---|
| .. | .. |
|---|
| 16 | 13 | |
|---|
| 17 | 14 | /* Asm macros */ |
|---|
| 18 | 15 | |
|---|
| 19 | | -#define ACPI_FLUSH_CPU_CACHE() wbinvd() |
|---|
| 16 | +/* |
|---|
| 17 | + * ACPI_FLUSH_CPU_CACHE() flushes caches on entering sleep states. |
|---|
| 18 | + * It is required to prevent data loss. |
|---|
| 19 | + * |
|---|
| 20 | + * While running inside virtual machine, the kernel can bypass cache flushing. |
|---|
| 21 | + * Changing sleep state in a virtual machine doesn't affect the host system |
|---|
| 22 | + * sleep state and cannot lead to data loss. |
|---|
| 23 | + */ |
|---|
| 24 | +#define ACPI_FLUSH_CPU_CACHE() \ |
|---|
| 25 | +do { \ |
|---|
| 26 | + if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) \ |
|---|
| 27 | + wbinvd(); \ |
|---|
| 28 | +} while (0) |
|---|
| 20 | 29 | |
|---|
| 21 | 30 | int __acpi_acquire_global_lock(unsigned int *lock); |
|---|
| 22 | 31 | int __acpi_release_global_lock(unsigned int *lock); |
|---|