xenbus.c (8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17) xenbus.c (a67efff28832a597f46a0097916833937aa3983e)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * PCI Backend Xenbus Setup - handles setup with frontend and xend
4 *
5 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
10#include <linux/moduleparam.h>
11#include <linux/init.h>
12#include <linux/list.h>
13#include <linux/vmalloc.h>
14#include <linux/workqueue.h>
15#include <xen/xenbus.h>
16#include <xen/events.h>
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * PCI Backend Xenbus Setup - handles setup with frontend and xend
4 *
5 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
10#include <linux/moduleparam.h>
11#include <linux/init.h>
12#include <linux/list.h>
13#include <linux/vmalloc.h>
14#include <linux/workqueue.h>
15#include <xen/xenbus.h>
16#include <xen/events.h>
17#include <asm/xen/pci.h>
17#include <xen/pci.h>
18#include "pciback.h"
19
20#define INVALID_EVTCHN_IRQ (-1)
21
22static bool __read_mostly passthrough;
23module_param(passthrough, bool, S_IRUGO);
24MODULE_PARM_DESC(passthrough,
25 "Option to specify how to export PCI topology to guest:\n"\

--- 712 unchanged lines hidden (view full) ---

738 .remove = xen_pcibk_xenbus_remove,
739 .otherend_changed = xen_pcibk_frontend_changed,
740};
741
742const struct xen_pcibk_backend *__read_mostly xen_pcibk_backend;
743
744int __init xen_pcibk_xenbus_register(void)
745{
18#include "pciback.h"
19
20#define INVALID_EVTCHN_IRQ (-1)
21
22static bool __read_mostly passthrough;
23module_param(passthrough, bool, S_IRUGO);
24MODULE_PARM_DESC(passthrough,
25 "Option to specify how to export PCI topology to guest:\n"\

--- 712 unchanged lines hidden (view full) ---

738 .remove = xen_pcibk_xenbus_remove,
739 .otherend_changed = xen_pcibk_frontend_changed,
740};
741
742const struct xen_pcibk_backend *__read_mostly xen_pcibk_backend;
743
744int __init xen_pcibk_xenbus_register(void)
745{
746 if (!xen_pcibk_pv_support())
747 return 0;
748
746 xen_pcibk_backend = &xen_pcibk_vpci_backend;
747 if (passthrough)
748 xen_pcibk_backend = &xen_pcibk_passthrough_backend;
749 pr_info("backend is %s\n", xen_pcibk_backend->name);
750 return xenbus_register_backend(&xen_pcibk_driver);
751}
752
753void __exit xen_pcibk_xenbus_unregister(void)
754{
749 xen_pcibk_backend = &xen_pcibk_vpci_backend;
750 if (passthrough)
751 xen_pcibk_backend = &xen_pcibk_passthrough_backend;
752 pr_info("backend is %s\n", xen_pcibk_backend->name);
753 return xenbus_register_backend(&xen_pcibk_driver);
754}
755
756void __exit xen_pcibk_xenbus_unregister(void)
757{
755 xenbus_unregister_driver(&xen_pcibk_driver);
758 if (xen_pcibk_pv_support())
759 xenbus_unregister_driver(&xen_pcibk_driver);
756}
760}