// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2010 - 2015 UNISYS CORPORATION
* All rights reserved.
*/
#include <linux/acpi.h>
#include <linux/crash_dump.h>
#include <linux/visorbus.h>
#include "visorbus_private.h"
/* {72120008-4AAB-11DC-8530-444553544200} */
#define VISOR_SIOVM_GUID GUID_INIT(0x72120008, 0x4AAB, 0x11DC, 0x85, 0x30, \
0x44, 0x45, 0x53, 0x54, 0x42, 0x00)
static const guid_t visor_vhba_channel_guid = VISOR_VHBA_CHANNEL_GUID;
static const guid_t visor_siovm_guid = VISOR_SIOVM_GUID;
static const guid_t visor_controlvm_channel_guid = VISOR_CONTROLVM_CHANNEL_GUID;
#define POLLJIFFIES_CONTROLVM_FAST 1
#define POLLJIFFIES_CONTROLVM_SLOW 100
#define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128)
#define UNISYS_VISOR_LEAF_ID 0x40000000
/* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
#define UNISYS_VISOR_ID_EBX 0x73696e55
#define UNISYS_VISOR_ID_ECX 0x70537379
#define UNISYS_VISOR_ID_EDX 0x34367261
/*
* When the controlvm channel is idle for at least MIN_IDLE_SECONDS, we switch
* to slow polling mode. As soon as we get a controlvm message, we switch back
* to fast polling mode.
*/
#define MIN_IDLE_SECONDS 10
struct parser_context {
unsigned long allocbytes;
unsigned long param_bytes;
u8 *curr;
unsigned long bytes_remaining;
bool byte_stream;
struct visor_controlvm_parameters_header data;
};
/* VMCALL_CONTROLVM_ADDR: Used by all guests, not just IO. */
#define VMCALL_CONTROLVM_ADDR 0x0501
enum vmcall_result {
VMCALL_RESULT_SUCCESS = 0,
VMCALL_RESULT_INVALID_PARAM =
|