diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/acpi/ich9.h | 2 | ||||
-rw-r--r-- | include/hw/i386/ich9.h | 2 | ||||
-rw-r--r-- | include/hw/input/hid.h | 1 | ||||
-rw-r--r-- | include/hw/virtio/virtio-bus.h | 9 | ||||
-rw-r--r-- | include/hw/virtio/virtio-rng.h | 20 | ||||
-rw-r--r-- | include/hw/virtio/virtio.h | 61 | ||||
-rw-r--r-- | include/ui/console.h | 27 |
7 files changed, 32 insertions, 90 deletions
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 85b82ee50c..b1fe71faf5 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -45,7 +45,7 @@ typedef struct ICH9LPCPMRegs { } ICH9LPCPMRegs; void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, - qemu_irq sci_irq, qemu_irq cmos_s3_resume); + qemu_irq sci_irq); void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base); extern const VMStateDescription vmstate_ich9_pm; diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h index 51d59819ab..c5f637bffd 100644 --- a/include/hw/i386/ich9.h +++ b/include/hw/i386/ich9.h @@ -18,7 +18,7 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level); int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx); PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin); -void ich9_lpc_pm_init(PCIDevice *pci_lpc, qemu_irq cmos_s3); +void ich9_lpc_pm_init(PCIDevice *pci_lpc); PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus); i2c_bus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base); diff --git a/include/hw/input/hid.h b/include/hw/input/hid.h index 56c71ed5ae..2567879399 100644 --- a/include/hw/input/hid.h +++ b/include/hw/input/hid.h @@ -31,6 +31,7 @@ typedef struct HIDKeyboardState { uint8_t leds; uint8_t key[16]; int32_t keys; + QEMUPutKbdEntry *eh_entry; } HIDKeyboardState; struct HIDState { diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h index 311e8c78bd..9ed60f9c9d 100644 --- a/include/hw/virtio/virtio-bus.h +++ b/include/hw/virtio/virtio-bus.h @@ -70,10 +70,6 @@ struct VirtioBusState { * Only one VirtIODevice can be plugged on the bus. */ VirtIODevice *vdev; - /* - * This will be removed at the end of the series. - */ - VirtIOBindings bindings; }; int virtio_bus_plug_device(VirtIODevice *vdev); @@ -86,9 +82,14 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus); /* Get the features of the plugged device. */ uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus, uint32_t requested_features); +/* Set the features of the plugged device. */ +void virtio_bus_set_vdev_features(VirtioBusState *bus, + uint32_t requested_features); /* Get bad features of the plugged device. */ uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus); /* Get config of the plugged device. */ void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config); +/* Set config of the plugged device. */ +void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config); #endif /* VIRTIO_BUS_H */ diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index c9cadc24b6..debaa15d5a 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -15,6 +15,10 @@ #include "sysemu/rng.h" #include "sysemu/rng-random.h" +#define TYPE_VIRTIO_RNG "virtio-rng-device" +#define VIRTIO_RNG(obj) \ + OBJECT_CHECK(VirtIORNG, (obj), TYPE_VIRTIO_RNG) + /* The Virtio ID for the virtio rng device */ #define VIRTIO_ID_RNG 4 @@ -26,14 +30,12 @@ struct VirtIORNGConf { }; typedef struct VirtIORNG { - VirtIODevice vdev; - - DeviceState *qdev; + VirtIODevice parent_obj; /* Only one vq - guest puts buffer(s) on it when it needs entropy */ VirtQueue *vq; - VirtIORNGConf *conf; + VirtIORNGConf conf; RngBackend *rng; @@ -44,4 +46,14 @@ typedef struct VirtIORNG { int64_t quota_remaining; } VirtIORNG; +/* Set a default rate limit of 2^47 bytes per minute or roughly 2TB/s. If + you have an entropy source capable of generating more entropy than this + and you can pass it through via virtio-rng, then hats off to you. Until + then, this is unlimited for all practical purposes. +*/ +#define DEFINE_VIRTIO_RNG_PROPERTIES(_state, _conf_field) \ + DEFINE_PROP_UINT64("max-bytes", _state, _conf_field.max_bytes, \ + INT64_MAX), \ + DEFINE_PROP_UINT32("period", _state, _conf_field.period_ms, 1 << 16) + #endif diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d3f14366dc..ae7a4c43d3 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -90,20 +90,6 @@ typedef struct VirtQueueElement struct iovec out_sg[VIRTQUEUE_MAX_SIZE]; } VirtQueueElement; -typedef struct { - void (*notify)(DeviceState *d, uint16_t vector); - void (*save_config)(DeviceState *d, QEMUFile *f); - void (*save_queue)(DeviceState *d, int n, QEMUFile *f); - int (*load_config)(DeviceState *d, QEMUFile *f); - int (*load_queue)(DeviceState *d, int n, QEMUFile *f); - int (*load_done)(DeviceState *d, QEMUFile *f); - unsigned (*get_features)(DeviceState *d); - bool (*query_guest_notifiers)(DeviceState *d); - int (*set_guest_notifiers)(DeviceState *d, int nvqs, bool assigned); - int (*set_host_notifier)(DeviceState *d, int n, bool assigned); - void (*vmstate_change)(DeviceState *d, bool running); -} VirtIOBindings; - #define VIRTIO_PCI_QUEUE_MAX 64 #define VIRTIO_NO_VECTOR 0xffff @@ -128,33 +114,7 @@ struct VirtIODevice void *config; uint16_t config_vector; int nvectors; - /* - * Function pointers will be removed at the end of the series as they are in - * VirtioDeviceClass. - */ - uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features); - uint32_t (*bad_features)(VirtIODevice *vdev); - void (*set_features)(VirtIODevice *vdev, uint32_t val); - void (*get_config)(VirtIODevice *vdev, uint8_t *config); - void (*set_config)(VirtIODevice *vdev, const uint8_t *config); - void (*reset)(VirtIODevice *vdev); - void (*set_status)(VirtIODevice *vdev, uint8_t val); - /* Test and clear event pending status. - * Should be called after unmask to avoid losing events. - * If backend does not support masking, - * must check in frontend instead. - */ - bool (*guest_notifier_pending)(VirtIODevice *vdev, int n); - /* Mask/unmask events from this vq. Any events reported - * while masked will become pending. - * If backend does not support masking, - * must mask in frontend instead. - */ - void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask); - VirtQueue *vq; - const VirtIOBindings *binding; - DeviceState *binding_opaque; uint16_t device_id; bool vm_running; VMChangeStateEntry *vmstate; @@ -187,7 +147,7 @@ typedef struct VirtioDeviceClass { void virtio_init(VirtIODevice *vdev, const char *name, uint16_t device_id, size_t config_size); -void virtio_common_cleanup(VirtIODevice *vdev); +void virtio_cleanup(VirtIODevice *vdev); VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size, void (*handle_output)(VirtIODevice *, @@ -216,8 +176,6 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f); int virtio_load(VirtIODevice *vdev, QEMUFile *f); -void virtio_cleanup(VirtIODevice *vdev); - void virtio_notify_config(VirtIODevice *vdev); void virtio_queue_set_notification(VirtQueue *vq, int enable); @@ -228,8 +186,6 @@ int virtio_queue_empty(VirtQueue *vq); /* Host binding interface. */ -VirtIODevice *virtio_common_init(const char *name, uint16_t device_id, - size_t config_size, size_t struct_size); uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr); uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr); uint32_t virtio_config_readl(VirtIODevice *vdev, uint32_t addr); @@ -247,9 +203,6 @@ void virtio_reset(void *opaque); void virtio_update_irq(VirtIODevice *vdev); int virtio_set_features(VirtIODevice *vdev, uint32_t val); -void virtio_bind_device(VirtIODevice *vdev, const VirtIOBindings *binding, - DeviceState *opaque); - /* Base devices. */ typedef struct VirtIOBlkConf VirtIOBlkConf; struct virtio_net_conf; @@ -257,20 +210,8 @@ VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, struct virtio_net_conf *net, uint32_t host_features); typedef struct virtio_serial_conf virtio_serial_conf; -VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *serial); typedef struct VirtIOSCSIConf VirtIOSCSIConf; -VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *conf); typedef struct VirtIORNGConf VirtIORNGConf; -VirtIODevice *virtio_rng_init(DeviceState *dev, VirtIORNGConf *conf); -#ifdef CONFIG_VIRTFS -VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf); -#endif - - -void virtio_net_exit(VirtIODevice *vdev); -void virtio_serial_exit(VirtIODevice *vdev); -void virtio_scsi_exit(VirtIODevice *vdev); -void virtio_rng_exit(VirtIODevice *vdev); #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \ DEFINE_PROP_BIT("indirect_desc", _state, _field, \ diff --git a/include/ui/console.h b/include/ui/console.h index e591d742d4..1c82f51331 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -28,26 +28,13 @@ typedef void QEMUPutKBDEvent(void *opaque, int keycode); typedef void QEMUPutLEDEvent(void *opaque, int ledstate); typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state); -typedef struct QEMUPutMouseEntry { - QEMUPutMouseEvent *qemu_put_mouse_event; - void *qemu_put_mouse_event_opaque; - int qemu_put_mouse_event_absolute; - char *qemu_put_mouse_event_name; - - int index; - - /* used internally by qemu for handling mice */ - QTAILQ_ENTRY(QEMUPutMouseEntry) node; -} QEMUPutMouseEntry; - -typedef struct QEMUPutLEDEntry { - QEMUPutLEDEvent *put_led; - void *opaque; - QTAILQ_ENTRY(QEMUPutLEDEntry) next; -} QEMUPutLEDEntry; - -void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque); -void qemu_remove_kbd_event_handler(void); +typedef struct QEMUPutMouseEntry QEMUPutMouseEntry; +typedef struct QEMUPutKbdEntry QEMUPutKbdEntry; +typedef struct QEMUPutLEDEntry QEMUPutLEDEntry; + +QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, + void *opaque); +void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry); QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute, const char *name); |