| .. | .. |
|---|
| 765 | 765 | if (completion_done(&vmbus_connection.unload_event)) |
|---|
| 766 | 766 | goto completed; |
|---|
| 767 | 767 | |
|---|
| 768 | | - for_each_online_cpu(cpu) { |
|---|
| 768 | + for_each_present_cpu(cpu) { |
|---|
| 769 | 769 | struct hv_per_cpu_context *hv_cpu |
|---|
| 770 | 770 | = per_cpu_ptr(hv_context.cpu_context, cpu); |
|---|
| 771 | 771 | |
|---|
| 772 | + /* |
|---|
| 773 | + * In a CoCo VM the synic_message_page is not allocated |
|---|
| 774 | + * in hv_synic_alloc(). Instead it is set/cleared in |
|---|
| 775 | + * hv_synic_enable_regs() and hv_synic_disable_regs() |
|---|
| 776 | + * such that it is set only when the CPU is online. If |
|---|
| 777 | + * not all present CPUs are online, the message page |
|---|
| 778 | + * might be NULL, so skip such CPUs. |
|---|
| 779 | + */ |
|---|
| 772 | 780 | page_addr = hv_cpu->synic_message_page; |
|---|
| 781 | + if (!page_addr) |
|---|
| 782 | + continue; |
|---|
| 783 | + |
|---|
| 773 | 784 | msg = (struct hv_message *)page_addr |
|---|
| 774 | 785 | + VMBUS_MESSAGE_SINT; |
|---|
| 775 | 786 | |
|---|
| .. | .. |
|---|
| 803 | 814 | * maybe-pending messages on all CPUs to be able to receive new |
|---|
| 804 | 815 | * messages after we reconnect. |
|---|
| 805 | 816 | */ |
|---|
| 806 | | - for_each_online_cpu(cpu) { |
|---|
| 817 | + for_each_present_cpu(cpu) { |
|---|
| 807 | 818 | struct hv_per_cpu_context *hv_cpu |
|---|
| 808 | 819 | = per_cpu_ptr(hv_context.cpu_context, cpu); |
|---|
| 809 | 820 | |
|---|
| 810 | 821 | page_addr = hv_cpu->synic_message_page; |
|---|
| 822 | + if (!page_addr) |
|---|
| 823 | + continue; |
|---|
| 824 | + |
|---|
| 811 | 825 | msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; |
|---|
| 812 | 826 | msg->header.message_type = HVMSG_NONE; |
|---|
| 813 | 827 | } |
|---|