Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mshv: Add the HVCALL_GET_PARTITION_PROPERTY_EX hypercall

This hypercall can be used to fetch extended properties of a
partition. Extended properties are properties with values larger than
a u64. Some of these also need additional input arguments.

Add helper function for using the hypercall in the mshv_root driver.

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam <anirudh@anirudhrb.com>
Reviewed-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Reviewed-by: Easwar Hariharan <easwar.hariharan@linux.microsoft.com>
Reviewed-by: Tianyu Lan <tiala@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Purna Pavan Chandra Aekkaladevi and committed by
Wei Liu
59aeea19 9ebc528c

+100
+2
drivers/hv/mshv_root.h
··· 303 303 int hv_call_modify_spa_host_access(u64 partition_id, struct page **pages, 304 304 u64 page_struct_count, u32 host_access, 305 305 u32 flags, u8 acquire); 306 + int hv_call_get_partition_property_ex(u64 partition_id, u64 property_code, u64 arg, 307 + void *property_value, size_t property_value_sz); 306 308 307 309 extern struct mshv_root mshv_root; 308 310 extern enum hv_scheduler_type hv_scheduler_type;
+31
drivers/hv/mshv_root_hv_call.c
··· 590 590 return hv_result_to_errno(status); 591 591 } 592 592 593 + int hv_call_get_partition_property_ex(u64 partition_id, u64 property_code, 594 + u64 arg, void *property_value, 595 + size_t property_value_sz) 596 + { 597 + u64 status; 598 + unsigned long flags; 599 + struct hv_input_get_partition_property_ex *input; 600 + struct hv_output_get_partition_property_ex *output; 601 + 602 + local_irq_save(flags); 603 + input = *this_cpu_ptr(hyperv_pcpu_input_arg); 604 + output = *this_cpu_ptr(hyperv_pcpu_output_arg); 605 + 606 + memset(input, 0, sizeof(*input)); 607 + input->partition_id = partition_id; 608 + input->property_code = property_code; 609 + input->arg = arg; 610 + status = hv_do_hypercall(HVCALL_GET_PARTITION_PROPERTY_EX, input, output); 611 + 612 + if (!hv_result_success(status)) { 613 + local_irq_restore(flags); 614 + hv_status_debug(status, "\n"); 615 + return hv_result_to_errno(status); 616 + } 617 + memcpy(property_value, &output->property_value, property_value_sz); 618 + 619 + local_irq_restore(flags); 620 + 621 + return 0; 622 + } 623 + 593 624 int 594 625 hv_call_clear_virtual_interrupt(u64 partition_id) 595 626 {
+1
include/hyperv/hvgdk_mini.h
··· 491 491 #define HVCALL_GET_VP_STATE 0x00e3 492 492 #define HVCALL_SET_VP_STATE 0x00e4 493 493 #define HVCALL_GET_VP_CPUID_VALUES 0x00f4 494 + #define HVCALL_GET_PARTITION_PROPERTY_EX 0x0101 494 495 #define HVCALL_MMIO_READ 0x0106 495 496 #define HVCALL_MMIO_WRITE 0x0107 496 497
+40
include/hyperv/hvhdk.h
··· 376 376 u64 property_value; 377 377 } __packed; 378 378 379 + union hv_partition_property_arg { 380 + u64 as_uint64; 381 + struct { 382 + union { 383 + u32 arg; 384 + u32 vp_index; 385 + }; 386 + u16 reserved0; 387 + u8 reserved1; 388 + u8 object_type; 389 + } __packed; 390 + }; 391 + 392 + struct hv_input_get_partition_property_ex { 393 + u64 partition_id; 394 + u32 property_code; /* enum hv_partition_property_code */ 395 + u32 padding; 396 + union { 397 + union hv_partition_property_arg arg_data; 398 + u64 arg; 399 + }; 400 + } __packed; 401 + 402 + /* 403 + * NOTE: Should use hv_input_set_partition_property_ex_header to compute this 404 + * size, but hv_input_get_partition_property_ex is identical so it suffices 405 + */ 406 + #define HV_PARTITION_PROPERTY_EX_MAX_VAR_SIZE \ 407 + (HV_HYP_PAGE_SIZE - sizeof(struct hv_input_get_partition_property_ex)) 408 + 409 + union hv_partition_property_ex { 410 + u8 buffer[HV_PARTITION_PROPERTY_EX_MAX_VAR_SIZE]; 411 + struct hv_partition_property_vmm_capabilities vmm_capabilities; 412 + /* More fields to be filled in when needed */ 413 + }; 414 + 415 + struct hv_output_get_partition_property_ex { 416 + union hv_partition_property_ex property_value; 417 + } __packed; 418 + 379 419 enum hv_vp_state_page_type { 380 420 HV_VP_STATE_PAGE_REGISTERS = 0, 381 421 HV_VP_STATE_PAGE_INTERCEPT_MESSAGE = 1,
+26
include/hyperv/hvhdk_mini.h
··· 96 96 HV_PARTITION_PROPERTY_XSAVE_STATES = 0x00060007, 97 97 HV_PARTITION_PROPERTY_MAX_XSAVE_DATA_SIZE = 0x00060008, 98 98 HV_PARTITION_PROPERTY_PROCESSOR_CLOCK_FREQUENCY = 0x00060009, 99 + 100 + /* Extended properties with larger property values */ 101 + HV_PARTITION_PROPERTY_VMM_CAPABILITIES = 0x00090007, 99 102 }; 103 + 104 + #define HV_PARTITION_VMM_CAPABILITIES_BANK_COUNT 1 105 + #define HV_PARTITION_VMM_CAPABILITIES_RESERVED_BITFIELD_COUNT 59 106 + 107 + struct hv_partition_property_vmm_capabilities { 108 + u16 bank_count; 109 + u16 reserved[3]; 110 + union { 111 + u64 as_uint64[HV_PARTITION_VMM_CAPABILITIES_BANK_COUNT]; 112 + struct { 113 + u64 map_gpa_preserve_adjustable: 1; 114 + u64 vmm_can_provide_overlay_gpfn: 1; 115 + u64 vp_affinity_property: 1; 116 + #if IS_ENABLED(CONFIG_ARM64) 117 + u64 vmm_can_provide_gic_overlay_locations: 1; 118 + #else 119 + u64 reservedbit3: 1; 120 + #endif 121 + u64 assignable_synthetic_proc_features: 1; 122 + u64 reserved0: HV_PARTITION_VMM_CAPABILITIES_RESERVED_BITFIELD_COUNT; 123 + } __packed; 124 + }; 125 + } __packed; 100 126 101 127 enum hv_snp_status { 102 128 HV_SNP_STATUS_NONE = 0,