mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
mshv: Handle insufficient contiguous memory hypervisor status
The HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY status indicates that the hypervisor lacks sufficient contiguous memory for its internal allocations. When this status is encountered, allocate and deposit HV_MAX_CONTIGUOUS_ALLOCATION_PAGES contiguous pages to the hypervisor. HV_MAX_CONTIGUOUS_ALLOCATION_PAGES is defined in the hypervisor headers, a deposit of this size will always satisfy the hypervisor's requirements. Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Reviewed-by: Mukesh R <mrathor@linux.microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
committed by
Wei Liu
parent
ede54383e6
commit
cf82dd5ea9
@@ -793,6 +793,7 @@ static const struct hv_status_info hv_status_infos[] = {
|
||||
_STATUS_INFO(HV_STATUS_UNKNOWN_PROPERTY, -EIO),
|
||||
_STATUS_INFO(HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE, -EIO),
|
||||
_STATUS_INFO(HV_STATUS_INSUFFICIENT_MEMORY, -ENOMEM),
|
||||
_STATUS_INFO(HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY, -ENOMEM),
|
||||
_STATUS_INFO(HV_STATUS_INVALID_PARTITION_ID, -EINVAL),
|
||||
_STATUS_INFO(HV_STATUS_INVALID_VP_INDEX, -EINVAL),
|
||||
_STATUS_INFO(HV_STATUS_NOT_FOUND, -EIO),
|
||||
|
||||
@@ -118,6 +118,9 @@ int hv_deposit_memory_node(int node, u64 partition_id,
|
||||
switch (hv_result(hv_status)) {
|
||||
case HV_STATUS_INSUFFICIENT_MEMORY:
|
||||
break;
|
||||
case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY:
|
||||
num_pages = HV_MAX_CONTIGUOUS_ALLOCATION_PAGES;
|
||||
break;
|
||||
default:
|
||||
hv_status_err(hv_status, "Unexpected!\n");
|
||||
return -ENOMEM;
|
||||
@@ -130,6 +133,7 @@ bool hv_result_needs_memory(u64 status)
|
||||
{
|
||||
switch (hv_result(status)) {
|
||||
case HV_STATUS_INSUFFICIENT_MEMORY:
|
||||
case HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -38,6 +38,7 @@ struct hv_u128 {
|
||||
#define HV_STATUS_INVALID_LP_INDEX 0x41
|
||||
#define HV_STATUS_INVALID_REGISTER_VALUE 0x50
|
||||
#define HV_STATUS_OPERATION_FAILED 0x71
|
||||
#define HV_STATUS_INSUFFICIENT_CONTIGUOUS_MEMORY 0x75
|
||||
#define HV_STATUS_TIME_OUT 0x78
|
||||
#define HV_STATUS_CALL_PENDING 0x79
|
||||
#define HV_STATUS_VTL_ALREADY_ENABLED 0x86
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "hvgdk_mini.h"
|
||||
|
||||
#define HV_MAX_CONTIGUOUS_ALLOCATION_PAGES 8
|
||||
|
||||
/*
|
||||
* Doorbell connection_info flags.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user