File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -630,7 +630,7 @@ static bool mshv_handle_gpa_intercept(struct mshv_vp *vp)
630630{
631631 struct mshv_partition * p = vp -> vp_partition ;
632632 struct mshv_mem_region * region ;
633- bool ret ;
633+ bool ret = false ;
634634 u64 gfn ;
635635#if defined(CONFIG_X86_64 )
636636 struct hv_x64_memory_intercept_message * msg =
@@ -641,19 +641,28 @@ static bool mshv_handle_gpa_intercept(struct mshv_vp *vp)
641641 (struct hv_arm64_memory_intercept_message * )
642642 vp -> vp_intercept_msg_page -> u .payload ;
643643#endif
644+ enum hv_intercept_access_type access_type =
645+ msg -> header .intercept_access_type ;
644646
645647 gfn = HVPFN_DOWN (msg -> guest_physical_address );
646648
647649 region = mshv_partition_region_by_gfn_get (p , gfn );
648650 if (!region )
649651 return false;
650652
653+ if (access_type == HV_INTERCEPT_ACCESS_WRITE &&
654+ !(region -> hv_map_flags & HV_MAP_GPA_WRITABLE ))
655+ goto put_region ;
656+
657+ if (access_type == HV_INTERCEPT_ACCESS_EXECUTE &&
658+ !(region -> hv_map_flags & HV_MAP_GPA_EXECUTABLE ))
659+ goto put_region ;
660+
651661 /* Only movable memory ranges are supported for GPA intercepts */
652662 if (region -> mreg_type == MSHV_REGION_TYPE_MEM_MOVABLE )
653663 ret = mshv_region_handle_gfn_fault (region , gfn );
654- else
655- ret = false;
656664
665+ put_region :
657666 mshv_region_put (region );
658667
659668 return ret ;
Original file line number Diff line number Diff line change @@ -2485,6 +2485,14 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus)
24852485 if (!hv_dev )
24862486 continue ;
24872487
2488+ /*
2489+ * If the Hyper-V host doesn't provide a NUMA node for the
2490+ * device, default to node 0. With NUMA_NO_NODE the kernel
2491+ * may spread work across NUMA nodes, which degrades
2492+ * performance on Hyper-V.
2493+ */
2494+ set_dev_node (& dev -> dev , 0 );
2495+
24882496 if (hv_dev -> desc .flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY &&
24892497 hv_dev -> desc .virtual_numa_node < num_possible_nodes ())
24902498 /*
@@ -3778,7 +3786,7 @@ static int hv_pci_probe(struct hv_device *hdev,
37783786 hbus -> bridge -> domain_nr );
37793787 if (!hbus -> wq ) {
37803788 ret = - ENOMEM ;
3781- goto free_dom ;
3789+ goto free_bus ;
37823790 }
37833791
37843792 hdev -> channel -> next_request_id_callback = vmbus_next_request_id ;
@@ -3874,8 +3882,6 @@ static int hv_pci_probe(struct hv_device *hdev,
38743882 vmbus_close (hdev -> channel );
38753883destroy_wq :
38763884 destroy_workqueue (hbus -> wq );
3877- free_dom :
3878- pci_bus_release_emul_domain_nr (hbus -> bridge -> domain_nr );
38793885free_bus :
38803886 kfree (hbus );
38813887 return ret ;
Original file line number Diff line number Diff line change @@ -1533,4 +1533,10 @@ struct hv_mmio_write_input {
15331533 u8 data [HV_HYPERCALL_MMIO_MAX_DATA_LENGTH ];
15341534} __packed ;
15351535
1536+ enum hv_intercept_access_type {
1537+ HV_INTERCEPT_ACCESS_READ = 0 ,
1538+ HV_INTERCEPT_ACCESS_WRITE = 1 ,
1539+ HV_INTERCEPT_ACCESS_EXECUTE = 2
1540+ };
1541+
15361542#endif /* _HV_HVGDK_MINI_H */
Original file line number Diff line number Diff line change @@ -779,7 +779,7 @@ struct hv_x64_intercept_message_header {
779779 u32 vp_index ;
780780 u8 instruction_length :4 ;
781781 u8 cr8 :4 ; /* Only set for exo partitions */
782- u8 intercept_access_type ;
782+ u8 intercept_access_type ; /* enum hv_intercept_access_type */
783783 union hv_x64_vp_execution_state execution_state ;
784784 struct hv_x64_segment_register cs_segment ;
785785 u64 rip ;
@@ -825,7 +825,7 @@ union hv_arm64_vp_execution_state {
825825struct hv_arm64_intercept_message_header {
826826 u32 vp_index ;
827827 u8 instruction_length ;
828- u8 intercept_access_type ;
828+ u8 intercept_access_type ; /* enum hv_intercept_access_type */
829829 union hv_arm64_vp_execution_state execution_state ;
830830 u64 pc ;
831831 u64 cpsr ;
You can’t perform that action at this time.
0 commit comments