static int storvsc_change_queue_depth(struct scsi_device *sdev, int queue_depth);
 
 static int storvsc_vcpus_per_sub_channel = 4;
+static unsigned int storvsc_max_hw_queues;
 
 module_param(storvsc_ringbuffer_size, int, S_IRUGO);
 MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
 
+module_param(storvsc_max_hw_queues, uint, 0644);
+MODULE_PARM_DESC(storvsc_max_hw_queues, "Maximum number of hardware queues");
+
 module_param(storvsc_vcpus_per_sub_channel, int, S_IRUGO);
 MODULE_PARM_DESC(storvsc_vcpus_per_sub_channel, "Ratio of VCPUs to subchannels");
 
 {
        int ret;
        int num_cpus = num_online_cpus();
+       int num_present_cpus = num_present_cpus();
        struct Scsi_Host *host;
        struct hv_host_device *host_dev;
        bool dev_is_ide = ((dev_id->driver_data == IDE_GUID) ? true : false);
         * For non-IDE disks, the host supports multiple channels.
         * Set the number of HW queues we are supporting.
         */
-       if (!dev_is_ide)
-               host->nr_hw_queues = num_present_cpus();
+       if (!dev_is_ide) {
+               if (storvsc_max_hw_queues > num_present_cpus) {
+                       storvsc_max_hw_queues = 0;
+                       storvsc_log(device, STORVSC_LOGGING_WARN,
+                               "Resetting invalid storvsc_max_hw_queues value to default.\n");
+               }
+               if (storvsc_max_hw_queues)
+                       host->nr_hw_queues = storvsc_max_hw_queues;
+               else
+                       host->nr_hw_queues = num_present_cpus;
+       }
 
        /*
         * Set the error handler work queue.