facility_enable Kernel Service

Purpose

Enables a specified facility to be used in the kernel environment. The specified facility would otherwise be restricted for use in the kernel environment.

Syntax

#include <sys/machine.h>
int facility_enable (facility)
uint64_t facility;

Parameter

facility
Specifies the facility that must be enabled.

Description

The facility_enable kernel service enables the use of facilities that typically result in a system failure if the facility is used in the kernel environment. Examples of such facilities include the Vector Multimedia Extension (VMX) facility or the Vector Scalar Extension (VSX) facility. Facilities that are supported by the facility_enable kernel service are defined in the /usr/include/sys/machine.h include file.

The facility_enable kernel service saves the state of a requested facility, then disables interrupts until the facility_disable kernel service is called.

When the facility_enable kernel service is active, the running program must follow the interrupt environment restrictions and the following additional restrictions:

  • The facility_enable kernel service cannot be used recursively or in a nested manner. That is, each call to the facility_enable kernel service must be followed by a call to the facility_disable kernel service before the facility_enable kernel service is called again.
  • The interrupt level cannot be modified when the facility_enable kernel service is active.
  • Only a single facility can be enabled when the facility_enable kernel service is called each time.
  • Sleep operations are not allowed while the facility_enable kernel service is active and will result in a system failure.
  • Block operations are not allowed while the facility_enable kernel service is active.
  • The facility_disable kernel service must be used along with the facility_enable kernel service to restore any state change since the call to the facility_enable kernel service.
Note: The facility_enable kernel service must not be called for instruction sequences that run for a long time. Disabling interrupts for a longer period of time can cause performance issues in the system.

Execution environment

The facility_enable kernel service can be called from either the process or interrupt environment.

Return values

0
Facility is enabled successfully and the specified facility is now active.
ENOSYS
Requested facility is not available or is not supported on this system.
EINVAL
The facility parameter is invalid.
EBUSY
The facility_enable kernel service is already called and is active.