return 0;
}
-bool xen_has_pv_devices()
-{
- if (!xen_domain())
- return false;
-
- /* PV domains always have them. */
- if (xen_pv_domain())
- return true;
-
- /* And user has xen_platform_pci=0 set in guest config as
- * driver did not modify the value. */
- if (xen_platform_pci_unplug == 0)
- return false;
-
- if (xen_platform_pci_unplug & XEN_UNPLUG_NEVER)
- return false;
-
- if (xen_platform_pci_unplug & XEN_UNPLUG_ALL)
- return true;
-
- /* This is an odd one - we are going to run legacy
- * and PV drivers at the same time. */
- if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
- return true;
-
- /* And the caller has to follow with xen_pv_{disk,nic}_devices
- * to be certain which driver can load. */
- return false;
-}
-EXPORT_SYMBOL_GPL(xen_has_pv_devices);
-
-static bool __xen_has_pv_device(int state)
-{
- /* HVM domains might or might not */
- if (xen_hvm_domain() && (xen_platform_pci_unplug & state))
- return true;
-
- return xen_has_pv_devices();
-}
-
-bool xen_has_pv_nic_devices(void)
-{
- return __xen_has_pv_device(XEN_UNPLUG_ALL_NICS | XEN_UNPLUG_ALL);
-}
-EXPORT_SYMBOL_GPL(xen_has_pv_nic_devices);
-
-bool xen_has_pv_disk_devices(void)
-{
- return __xen_has_pv_device(XEN_UNPLUG_ALL_IDE_DISKS |
- XEN_UNPLUG_AUX_IDE_DISKS | XEN_UNPLUG_ALL);
-}
-EXPORT_SYMBOL_GPL(xen_has_pv_disk_devices);
-
-/*
- * This one is odd - it determines whether you want to run PV _and_
- * legacy (IDE) drivers together. This combination is only possible
- * under HVM.
- */
-bool xen_has_pv_and_legacy_disk_devices(void)
-{
- if (!xen_domain())
- return false;
-
- /* N.B. This is only ever used in HVM mode */
- if (xen_pv_domain())
- return false;
-
- if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
- return true;
-
- return false;
-}
-EXPORT_SYMBOL_GPL(xen_has_pv_and_legacy_disk_devices);
-
void xen_unplug_emulated_devices(void)
{
int r;
char *type;
int len;
/* no unplug has been done: do not hook devices != xen vbds */
- if (xen_has_pv_and_legacy_disk_devices()) {
+ if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY) {
int major;
if (!VDEV_IS_EXTENDED(vdevice))
if (!xen_domain())
return -ENODEV;
- if (!xen_has_pv_disk_devices())
+ if (xen_hvm_domain() && !xen_platform_pci_unplug)
return -ENODEV;
if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
#include <xen/xenbus.h>
#include <xen/page.h>
#include "tpm.h"
-#include <xen/platform_pci.h>
struct tpm_private {
struct tpm_chip *chip;
if (!xen_domain())
return -ENODEV;
- if (!xen_has_pv_devices())
- return -ENODEV;
-
return xenbus_register_frontend(&tpmfront_driver);
}
module_init(xen_tpmfront_init);
#include <xen/interface/io/fbif.h>
#include <xen/interface/io/kbdif.h>
#include <xen/xenbus.h>
-#include <xen/platform_pci.h>
struct xenkbd_info {
struct input_dev *kbd;
if (xen_initial_domain())
return -ENODEV;
- if (!xen_has_pv_devices())
- return -ENODEV;
-
return xenbus_register_frontend(&xenkbd_driver);
}
if (!xen_domain())
return -ENODEV;
- if (!xen_has_pv_nic_devices())
+ if (xen_hvm_domain() && !xen_platform_pci_unplug)
return -ENODEV;
pr_info("Initialising Xen virtual ethernet driver\n");
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <linux/time.h>
-#include <xen/platform_pci.h>
#include <asm/xen/swiotlb-xen.h>
#define INVALID_GRANT_REF (0)
if (!xen_pv_domain() || xen_initial_domain())
return -ENODEV;
- if (!xen_has_pv_devices())
- return -ENODEV;
-
pci_frontend_registrar(1 /* enable */);
return xenbus_register_frontend(&xenpci_driver);
#include <xen/interface/io/fbif.h>
#include <xen/interface/io/protocols.h>
#include <xen/xenbus.h>
-#include <xen/platform_pci.h>
struct xenfb_info {
unsigned char *fb;
if (xen_initial_domain())
return -ENODEV;
- if (!xen_has_pv_devices())
- return -ENODEV;
-
return xenbus_register_frontend(&xenfb_driver);
}
#ifndef MODULE
static int __init boot_wait_for_devices(void)
{
- if (!xen_has_pv_devices())
+ if (xen_hvm_domain() && !xen_platform_pci_unplug)
return -ENODEV;
ready_to_wait_for_devices = 1;
extern int xen_platform_pci_unplug;
-#if defined(CONFIG_XEN_PVHVM)
-extern bool xen_has_pv_devices(void);
-extern bool xen_has_pv_disk_devices(void);
-extern bool xen_has_pv_nic_devices(void);
-extern bool xen_has_pv_and_legacy_disk_devices(void);
-#else
-static inline bool xen_has_pv_devices(void)
-{
- return IS_ENABLED(CONFIG_XEN);
-}
-static inline bool xen_has_pv_disk_devices(void)
-{
- return IS_ENABLED(CONFIG_XEN);
-}
-static inline bool xen_has_pv_nic_devices(void)
-{
- return IS_ENABLED(CONFIG_XEN);
-}
-static inline bool xen_has_pv_and_legacy_disk_devices(void)
-{
- return false;
-}
-#endif
#endif /* _XEN_PLATFORM_PCI_H */