summaryrefslogtreecommitdiff
path: root/drivers/pci/host/pci-hyperv.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2017-03-24 21:07:21 +0300
committerBjorn Helgaas <bhelgaas@google.com>2017-04-04 21:58:20 +0300
commit433fcf6b7b31f1f233dd50aeb9d066a0f6ed4b9d (patch)
treef155e9e73bcc0753a35cc2794878d46a17ce6062 /drivers/pci/host/pci-hyperv.c
parent414428c5da1c71986727c2fa5cdf1ed071e398d7 (diff)
downloadlinux-433fcf6b7b31f1f233dd50aeb9d066a0f6ed4b9d.tar.xz
PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
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> Cc: <stable@vger.kernel.org>
Diffstat (limited to 'drivers/pci/host/pci-hyperv.c')
-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 a1b3c1957d43..8c952f694c2f 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -72,6 +72,7 @@ enum {
PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1
};
+#define CPU_AFFINITY_ALL -1ULL
#define PCI_CONFIG_MMIO_LENGTH 0x2000
#define CFG_PAGE_OFFSET 0x1000
#define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - CFG_PAGE_OFFSET)
@@ -898,9 +899,13 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
* processors because Hyper-V only supports 64 in a guest.
*/
affinity = irq_data_get_affinity_mask(data);
- for_each_cpu_and(cpu, affinity, cpu_online_mask) {
- int_pkt->int_desc.cpu_mask |=
- (1ULL << vmbus_cpu_number_to_vp_number(cpu));
+ if (cpumask_weight(affinity) >= 32) {
+ int_pkt->int_desc.cpu_mask = CPU_AFFINITY_ALL;
+ } else {
+ for_each_cpu_and(cpu, affinity, cpu_online_mask) {
+ int_pkt->int_desc.cpu_mask |=
+ (1ULL << vmbus_cpu_number_to_vp_number(cpu));
+ }
}
ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt,