aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2017-03-24 14:07:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-25 09:44:47 -0400
commit87e7dc97c8a0544553aacf8705c6772db55f6691 (patch)
tree18cee943389a43c0a41187fc4ecbbd2d5f06cc55
parentd1d63f97dd76f7d90f801bcc9a6334d5df96367a (diff)
PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
commit 433fcf6b7b31f1f233dd50aeb9d066a0f6ed4b9d upstream. When we have 32 or more CPUs in the affinity mask, we should use a special constant to specify that to the host. Fix this issue. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/pci/host/pci-hyperv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index ddabf7b23bb5..dafb4cdb2b7f 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -72,6 +72,7 @@ enum {
72 PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 72 PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1
73}; 73};
74 74
75#define CPU_AFFINITY_ALL -1ULL
75#define PCI_CONFIG_MMIO_LENGTH 0x2000 76#define PCI_CONFIG_MMIO_LENGTH 0x2000
76#define CFG_PAGE_OFFSET 0x1000 77#define CFG_PAGE_OFFSET 0x1000
77#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET) 78#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET)
@@ -889,9 +890,13 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
889 * processors because Hyper-V only supports 64 in a guest. 890 * processors because Hyper-V only supports 64 in a guest.
890 */ 891 */
891 affinity = irq_data_get_affinity_mask(data); 892 affinity = irq_data_get_affinity_mask(data);
892 for_each_cpu_and(cpu, affinity, cpu_online_mask) { 893 if (cpumask_weight(affinity) >= 32) {
893 int_pkt->int_desc.cpu_mask |= 894 int_pkt->int_desc.cpu_mask = CPU_AFFINITY_ALL;
894 (1ULL << vmbus_cpu_number_to_vp_number(cpu)); 895 } else {
896 for_each_cpu_and(cpu, affinity, cpu_online_mask) {
897 int_pkt->int_desc.cpu_mask |=
898 (1ULL << vmbus_cpu_number_to_vp_number(cpu));
899 }
895 } 900 }
896 901
897 ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, 902 ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt,