Stefano Stabellini | 416efba | 2017-10-30 15:40:51 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * (c) 2017 Stefano Stabellini <stefano@aporeto.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/module.h> |
| 16 | |
| 17 | #include <xen/events.h> |
| 18 | #include <xen/grant_table.h> |
| 19 | #include <xen/xen.h> |
| 20 | #include <xen/xenbus.h> |
| 21 | #include <xen/interface/io/pvcalls.h> |
| 22 | |
| 23 | static const struct xenbus_device_id pvcalls_front_ids[] = { |
| 24 | { "pvcalls" }, |
| 25 | { "" } |
| 26 | }; |
| 27 | |
| 28 | static int pvcalls_front_remove(struct xenbus_device *dev) |
| 29 | { |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | static int pvcalls_front_probe(struct xenbus_device *dev, |
| 34 | const struct xenbus_device_id *id) |
| 35 | { |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | static void pvcalls_front_changed(struct xenbus_device *dev, |
| 40 | enum xenbus_state backend_state) |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | static struct xenbus_driver pvcalls_front_driver = { |
| 45 | .ids = pvcalls_front_ids, |
| 46 | .probe = pvcalls_front_probe, |
| 47 | .remove = pvcalls_front_remove, |
| 48 | .otherend_changed = pvcalls_front_changed, |
| 49 | }; |
| 50 | |
| 51 | static int __init pvcalls_frontend_init(void) |
| 52 | { |
| 53 | if (!xen_domain()) |
| 54 | return -ENODEV; |
| 55 | |
| 56 | pr_info("Initialising Xen pvcalls frontend driver\n"); |
| 57 | |
| 58 | return xenbus_register_frontend(&pvcalls_front_driver); |
| 59 | } |
| 60 | |
| 61 | module_init(pvcalls_frontend_init); |