ACRN: misc: Unify terminology for sos/uos rin macro

Rename SOS_VM_NUM to SERVICE_VM_NUM.
rename SOS_SOCKET_PORT to SERVICE_VM_SOCKET_PORT.
rename PROCESS_RUN_IN_SOS to PROCESS_RUN_IN_SERVICE_VM.
rename PCI_DEV_TYPE_SOSEMUL to PCI_DEV_TYPE_SERVICE_VM_EMUL.
rename SHUTDOWN_REQ_FROM_SOS to SHUTDOWN_REQ_FROM_SERVICE_VM.
rename PROCESS_RUN_IN_SOS to PROCESS_RUN_IN_SERVICE_VM.
rename SHUTDOWN_REQ_FROM_UOS to SHUTDOWN_REQ_FROM_USER_VM.
rename UOS_SOCKET_PORT to USER_VM_SOCKET_PORT.
rename SOS_CONSOLE to SERVICE_VM_OS_CONSOLE.
rename SOS_LCS_SOCK to SERVICE_VM_LCS_SOCK.
rename SOS_VM_BOOTARGS to SERVICE_VM_OS_BOOTARGS.
rename SOS_ROOTFS to SERVICE_VM_ROOTFS.
rename SOS_IDLE to SERVICE_VM_IDLE.
rename SEVERITY_SOS to SEVERITY_SERVICE_VM.
rename SOS_VM_UUID to SERVICE_VM_UUID.
rename SOS_REQ to SERVICE_VM_REQ.
rename RTCT_NATIVE_FILE_PATH_IN_SOS to RTCT_NATIVE_FILE_PATH_IN_SERVICE_VM.
rename CBC_REQ_T_UOS_ACTIVE to CBC_REQ_T_USER_VM_ACTIVE.
rename CBC_REQ_T_UOS_INACTIVE to CBC_REQ_T_USER_VM_INACTIV.
rename uos_active to user_vm_active.

Tracked-On: #6744
Signed-off-by: Liu Long <long.liu@linux.intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Liu Long
2021-10-29 15:06:51 +08:00
committed by wenlingz
parent e9c4ced460
commit 14c6e21efa
50 changed files with 231 additions and 226 deletions

View File

@@ -1102,8 +1102,8 @@ static struct {
*/
int create_and_inject_vrtct(struct vmctx *ctx)
{
#define RTCT_NATIVE_FILE_PATH_IN_SOS "/sys/firmware/acpi/tables/PTCT"
#define RTCT_V2_NATIVE_FILE_PATH_IN_SOS "/sys/firmware/acpi/tables/RTCT"
#define RTCT_NATIVE_FILE_PATH_IN_SERVICE_VM "/sys/firmware/acpi/tables/PTCT"
#define RTCT_V2_NATIVE_FILE_PATH_IN_SERVICE_VM "/sys/firmware/acpi/tables/RTCT"
#define RTCT_BUF_LEN 0x200 /* Otherwise, need to modify DSDT_OFFSET corresponding */
@@ -1122,9 +1122,9 @@ int create_and_inject_vrtct(struct vmctx *ctx)
};
/* Name of native RTCT table is "PTCT"(v1) or "RTCT"(v2) */
native_rtct_fd = open(RTCT_NATIVE_FILE_PATH_IN_SOS, O_RDONLY);
native_rtct_fd = open(RTCT_NATIVE_FILE_PATH_IN_SERVICE_VM, O_RDONLY);
if (native_rtct_fd < 0) {
native_rtct_fd = open(RTCT_V2_NATIVE_FILE_PATH_IN_SOS, O_RDONLY);
native_rtct_fd = open(RTCT_V2_NATIVE_FILE_PATH_IN_SERVICE_VM, O_RDONLY);
if (native_rtct_fd < 0) {
pr_err("RTCT file is NOT detected.\n");
return -1;

View File

@@ -98,8 +98,8 @@ static char virtual_uart_path[32 + MAX_VMNAME_LEN];
* Need to send open channel command to CBC signal char device before receive
* signal data.
* NOTE: Only send open channel command, no need to send close channel since
* close channel command would deactivate the signal channel for all UOS, so
* there will be a SOS service to deactivate signal channel in the future.
* close channel command would deactivate the signal channel for all User VM, so
* there will be a Service VM service to deactivate signal channel in the future.
*/
static uint8_t cbc_open_channel_command[] = {0xFD, 0x00, 0x00, 0x00};
@@ -119,23 +119,23 @@ static int dummy2_sfd = -1;
/*
* VM Manager interfaces description.
*
* +---------+ +---------+ +---------+
* |IOC | VM stop |VM | |SOS |
* |Mediator |<----------------+Manager | |Lifecycle|
* | | | | | |
* | | VM suspend | | | |
* | |<----------------+ | | |
* | | | | | |
* | | VM resume | | | |
* | |<----------------+ | | |
* | |get_wakeup_reason| |get wakeup reason| |
* | |for resume flow | |via unix socket | |
* | +---------------->| +---------------->| |
* +---------+ +---------+ +---------+
* +---------+ +---------+ +----------+
* |IOC | VM stop |VM | |Service VM|
* |Mediator |<----------------+Manager | |Lifecycle |
* | | | | | |
* | | VM suspend | | | |
* | |<----------------+ | | |
* | | | | | |
* | | VM resume | | | |
* | |<----------------+ | | |
* | |get_wakeup_reason| |get wakeup reason| |
* | |for resume flow | |via unix socket | |
* | +---------------->| +---------------->| |
* +---------+ +---------+ +----------+
*
* Only support stop/resume/suspend in IOC mediator currently.
* For resume request, IOC mediator will get the wakeup reason from SOS
* lifecycle service, then pass to UOS once received HB INIT from UOS.
* For resume request, IOC mediator will get the wakeup reason from Service VM
* lifecycle service, then pass to User VM once received HB INIT from User VM.
* For stop and suspend requests, they are implemented as wakeup reason of
* ignition button.
*/
@@ -166,11 +166,11 @@ static struct monitor_vm_ops vm_ops = {
* +-----------+ +-----------+
*
* INIT state: The state is IOC mediator initialized IOC state, all of CBC
* protocol packats are handler normally. In this state, UOS has
* protocol packats are handler normally. In this state, User VM has
* not yet sent active heartbeat.
*
* ACTIVE state: Enter this state if HB ACTIVE event is triggered that indicates
* UOS state has been active and need to set the bit 23(SoC active
* User VM state has been active and need to set the bit 23(SoC active
* bit) in the wakeup reason.
*
* SUSPENDING state: Enter this state if RAM REFRESH event or HB INACTIVE event
@@ -898,8 +898,8 @@ send_tx_request(struct ioc_dev *ioc, enum cbc_request_type type)
static int
process_hb_active_event(struct ioc_dev *ioc)
{
/* Enable wakeup reason bit 23 that indicating UOS is active */
return send_tx_request(ioc, CBC_REQ_T_UOS_ACTIVE);
/* Enable wakeup reason bit 23 that indicating User VM is active */
return send_tx_request(ioc, CBC_REQ_T_USER_VM_ACTIVE);
}
/*
@@ -917,7 +917,7 @@ process_ram_refresh_event(struct ioc_dev *ioc)
* Tx handler sents shutdown wakeup reason,
* Then enter suspended state.
*/
rc = send_tx_request(ioc, CBC_REQ_T_UOS_INACTIVE);
rc = send_tx_request(ioc, CBC_REQ_T_USER_VM_INACTIVE);
/*
* TODO: set suspend to PM DM
@@ -941,7 +941,7 @@ process_hb_inactive_event(struct ioc_dev *ioc)
* Tx sents shutdown wakeup reason,
* Then enter shutdown state.
*/
rc = send_tx_request(ioc, CBC_REQ_T_UOS_INACTIVE);
rc = send_tx_request(ioc, CBC_REQ_T_USER_VM_INACTIVE);
/*
* TODO: set shutdown to PM DM
@@ -1010,9 +1010,9 @@ process_resume_event(struct ioc_dev *ioc)
}
/*
* The signal channel is inactive after SOS resumed, need to send
* The signal channel is inactive after Service VM resumed, need to send
* open channel command again to activate the signal channel.
* And it would not impact to UOS itself enter/exit S3.
* And it would not impact to User VM itself enter/exit S3.
*/
if (ioc_ch_xmit(IOC_NATIVE_SIGNAL, cbc_open_channel_command,
sizeof(cbc_open_channel_command)) <= 0)

View File

@@ -590,7 +590,7 @@ cbc_update_heartbeat(struct cbc_pkt *pkt, uint8_t cmd, uint8_t sus_action)
}
/*
* Update wakeup reason value and notify UOS immediately.
* Update wakeup reason value and notify User VM immediately.
* Some events can change the wakeup reason include periodic wakeup reason
* from IOC firmware, IOC boot/resume reason, heartbeat state changing.
*/
@@ -621,7 +621,7 @@ cbc_update_wakeup_reason(struct cbc_pkt *pkt, uint32_t reason)
}
/*
* CBC wakeup reason processing is main entry for Tx(IOC->UOS) lifecycle
* CBC wakeup reason processing is main entry for Tx(IOC->User VM) lifecycle
* service.
*/
static void
@@ -640,20 +640,20 @@ cbc_process_wakeup_reason(struct cbc_pkt *pkt)
reason = payload[0] | (payload[1] << 8) | (payload[2] << 16);
/*
* Save the reason for UOS status switching from inactive to active,
* Save the reason for User VM status switching from inactive to active,
* since need to send a wakeup reason immediatly after the switching.
*/
pkt->reason = reason;
if (pkt->uos_active) {
if (pkt->user_vm_active) {
reason |= CBC_WK_RSN_SOC;
/* Unset RTC bit if UOS sends active heartbeat */
/* Unset RTC bit if User VM sends active heartbeat */
reason &= ~CBC_WK_RSN_RTC;
} else {
/*
* If UOS is inactive, indicate the acrnd boot reason
* as UOS periodic wakeup reason.
* If User VM is inactive, indicate the acrnd boot reason
* as User VM periodic wakeup reason.
*/
reason = pkt->ioc->boot_reason;
@@ -708,7 +708,7 @@ cbc_update_rtc_timer(uint16_t value, uint8_t unit)
}
/*
* CBC heartbeat processing is main entry for Rx(UOS->IOC) lifecycle service.
* CBC heartbeat processing is main entry for Rx(User_VM->IOC) lifecycle service.
*/
static void
cbc_process_heartbeat(struct cbc_pkt *pkt)
@@ -753,7 +753,7 @@ cbc_process_signal(struct cbc_pkt *pkt)
* link_len is 0 means the packet is transmitted to PTY(UART DM)
* if the signal channel is not active, do not transmit it to PTY
* to CBC cdevs, always forward the signals because signal channel
* status only for UOS
* status only for User VM
*/
if (pkt->req->link_len == 0 && is_active == false &&
(cmd == CBC_SD_SINGLE_SIGNAL ||
@@ -945,22 +945,22 @@ cbc_tx_handler(struct cbc_pkt *pkt)
CBC_WK_RSN_SOC);
cbc_send_pkt(pkt);
/* Heartbeat init also indicates UOS enter active state */
pkt->uos_active = true;
} else if (pkt->req->rtype == CBC_REQ_T_UOS_ACTIVE) {
/* Heartbeat init also indicates User VM enter active state */
pkt->user_vm_active = true;
} else if (pkt->req->rtype == CBC_REQ_T_USER_VM_ACTIVE) {
cbc_update_wakeup_reason(pkt, pkt->ioc->boot_reason |
CBC_WK_RSN_SOC);
cbc_send_pkt(pkt);
/* Enable UOS active flag */
pkt->uos_active = true;
} else if (pkt->req->rtype == CBC_REQ_T_UOS_INACTIVE) {
/* Enable User VM active flag */
pkt->user_vm_active = true;
} else if (pkt->req->rtype == CBC_REQ_T_USER_VM_INACTIVE) {
cbc_update_wakeup_reason(pkt, CBC_WK_RSN_SHUTDOWN);
cbc_send_pkt(pkt);
/* Disable UOS active flag */
pkt->uos_active = false;
/* Disable User VM active flag */
pkt->user_vm_active = false;
/*
* After sending shutdown wakeup reason, then trigger shutdown

View File

@@ -66,7 +66,7 @@ static uint16_t get_rpmb_blocks(void)
}
/* Common area of RPMB refers to the start area of RPMB
* shared among all UOS with RO access.
* shared among all User VM with RO access.
* It's predefined to 32KB in size which contains:
* AttKB(up to 16KB), RPMB info header (256B)
* and the remaining size for future uasge.
@@ -84,7 +84,7 @@ static uint16_t get_accessible_blocks(void)
}
/* Todo: To get the uos number, e.g. No.0 or No.1, which is
used for calculating UOS RPMB range address.
used for calculating User VM RPMB range address.
But this will be removed after config file is supported.
We plan to predefine such info and save to config file.
*/

View File

@@ -122,7 +122,7 @@ typedef struct {
/* This is the main data structure for tpm emulator,
* it will work with one SWTPM instance to
* provide TPM functionlity to UOS.
* provide TPM functionlity to User VM.
*
* ctrl_chan_fd: fd to communicate with SWTPM ctrl channel
* cmd_chan_fd: fd to communicate with SWTPM cmd channel