aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2012-05-04 17:15:11 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-05-07 15:32:58 -0400
commitcd006086fa5d91414d8ff9ff2b78fbb593878e3c (patch)
tree3ea1ebd524b0a6be237026b300b95cfc7a6e2496 /drivers/ata
parentdb63a4c8115a0bb904496e1cdd3e7488e68b0d06 (diff)
ata_piix: defer disks to the Hyper-V drivers by default
When we are hosted on a Microsoft Hyper-V hypervisor the guest disks are exposed both via the Hyper-V paravirtualised drivers and via an emulated SATA disk drive. In this case we want to use the paravirtualised drivers if we can as they are much more efficient. Note that the Hyper-V paravirtualised drivers only expose the virtual hard disk devices, the CDROM/DVD devices must still be enumerated. Mark the host controller ATA_HOST_IGNORE_ATA to prevent enumeration of disk devices. BugLink: http://bugs.launchpad.net/bugs/929545 BugLink: http://bugs.launchpad.net/bugs/942316 Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ata_piix.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 7857e8fd0a3e..3c809bfbccf5 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1554,6 +1554,39 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
1554 return false; 1554 return false;
1555} 1555}
1556 1556
1557static int prefer_ms_hyperv = 1;
1558module_param(prefer_ms_hyperv, int, 0);
1559
1560static void piix_ignore_devices_quirk(struct ata_host *host)
1561{
1562#if IS_ENABLED(CONFIG_HYPERV_STORAGE)
1563 static const struct dmi_system_id ignore_hyperv[] = {
1564 {
1565 /* On Hyper-V hypervisors the disks are exposed on
1566 * both the emulated SATA controller and on the
1567 * paravirtualised drivers. The CD/DVD devices
1568 * are only exposed on the emulated controller.
1569 * Request we ignore ATA devices on this host.
1570 */
1571 .ident = "Hyper-V Virtual Machine",
1572 .matches = {
1573 DMI_MATCH(DMI_SYS_VENDOR,
1574 "Microsoft Corporation"),
1575 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
1576 },
1577 },
1578 { } /* terminate list */
1579 };
1580 const struct dmi_system_id *dmi = dmi_first_match(ignore_hyperv);
1581
1582 if (dmi && prefer_ms_hyperv) {
1583 host->flags |= ATA_HOST_IGNORE_ATA;
1584 dev_info(host->dev, "%s detected, ATA device ignore set\n",
1585 dmi->ident);
1586 }
1587#endif
1588}
1589
1557/** 1590/**
1558 * piix_init_one - Register PIIX ATA PCI device with kernel services 1591 * piix_init_one - Register PIIX ATA PCI device with kernel services
1559 * @pdev: PCI device to register 1592 * @pdev: PCI device to register
@@ -1669,6 +1702,9 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1669 } 1702 }
1670 host->flags |= ATA_HOST_PARALLEL_SCAN; 1703 host->flags |= ATA_HOST_PARALLEL_SCAN;
1671 1704
1705 /* Allow hosts to specify device types to ignore when scanning. */
1706 piix_ignore_devices_quirk(host);
1707
1672 pci_set_master(pdev); 1708 pci_set_master(pdev);
1673 return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); 1709 return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
1674} 1710}