// SPDX-License-Identifier: GPL-2.0-only /* * psci_test - Tests relating to KVM's PSCI implementation. * * Copyright (c) 2021 Google LLC. * * This test includes: * - A regression test for a race between KVM servicing the PSCI CPU_ON call * and userspace reading the targeted vCPU's registers. * - A test for KVM's handling of PSCI SYSTEM_SUSPEND and the associated * KVM_SYSTEM_EVENT_SUSPEND UAPI.
*/
/* assert that SYSTEM_SUSPEND is discoverable */
GUEST_ASSERT(!psci_features(PSCI_1_0_FN_SYSTEM_SUSPEND));
GUEST_ASSERT(!psci_features(PSCI_1_0_FN64_SYSTEM_SUSPEND));
ret = psci_system_suspend(CPU_ON_ENTRY_ADDR, CPU_ON_CONTEXT_ID);
GUEST_SYNC(ret);
}
/* assert that SYSTEM_OFF2 is discoverable */
GUEST_ASSERT(psci_features(PSCI_1_3_FN_SYSTEM_OFF2) &
PSCI_1_3_OFF_TYPE_HIBERNATE_OFF);
GUEST_ASSERT(psci_features(PSCI_1_3_FN64_SYSTEM_OFF2) &
PSCI_1_3_OFF_TYPE_HIBERNATE_OFF);
/* With non-zero 'cookie' field, it should fail */
ret = psci_system_off2(PSCI_1_3_OFF_TYPE_HIBERNATE_OFF, 1);
GUEST_ASSERT(ret == PSCI_RET_INVALID_PARAMS);
/* * This would normally never return, so KVM sets the return value * to PSCI_RET_INTERNAL_FAILURE. The test case *does* return, so * that it can test both values for HIBERNATE_OFF.
*/
ret = psci_system_off2(PSCI_1_3_OFF_TYPE_HIBERNATE_OFF, 0);
GUEST_ASSERT(ret == PSCI_RET_INTERNAL_FAILURE);
/* * Revision F.b of the PSCI v1.3 specification documents zero as an * alias for HIBERNATE_OFF, since that's the value used in earlier * revisions of the spec and some implementations in the field.
*/
ret = psci_system_off2(0, 1);
GUEST_ASSERT(ret == PSCI_RET_INVALID_PARAMS);
ret = psci_system_off2(0, 0);
GUEST_ASSERT(ret == PSCI_RET_INTERNAL_FAILURE);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.