mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-04 20:51:28 +00:00
For the MMIO and PCI buses, drivers typically allocate an IRQ line for their device before registering the device with the device tree for the relevant bus. This patch moves the IRQ allocation into the bus code, which is then called directly by the device tree when a new device is registered. IOPORT devices, however, tend to use hardcoded IRQs for legacy reasons, so they are still required to deal with their interrupts (which also require remapping for non-x86 architectures). Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
#ifndef KVM__VIRTIO_MMIO_H
|
|
#define KVM__VIRTIO_MMIO_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/virtio_mmio.h>
|
|
|
|
#define VIRTIO_MMIO_MAX_VQ 32
|
|
#define VIRTIO_MMIO_MAX_CONFIG 1
|
|
#define VIRTIO_MMIO_IO_SIZE 0x200
|
|
|
|
struct kvm;
|
|
|
|
struct virtio_mmio_ioevent_param {
|
|
struct virtio_device *vdev;
|
|
u32 vq;
|
|
};
|
|
|
|
struct virtio_mmio_hdr {
|
|
char magic[4];
|
|
u32 version;
|
|
u32 device_id;
|
|
u32 vendor_id;
|
|
u32 host_features;
|
|
u32 host_features_sel;
|
|
u32 reserved_1[2];
|
|
u32 guest_features;
|
|
u32 guest_features_sel;
|
|
u32 guest_page_size;
|
|
u32 reserved_2;
|
|
u32 queue_sel;
|
|
u32 queue_num_max;
|
|
u32 queue_num;
|
|
u32 queue_align;
|
|
u32 queue_pfn;
|
|
u32 reserved_3[3];
|
|
u32 queue_notify;
|
|
u32 reserved_4[3];
|
|
u32 interrupt_state;
|
|
u32 interrupt_ack;
|
|
u32 reserved_5[2];
|
|
u32 status;
|
|
} __attribute__((packed));
|
|
|
|
struct virtio_mmio {
|
|
u32 addr;
|
|
void *dev;
|
|
struct kvm *kvm;
|
|
u8 irq;
|
|
struct virtio_mmio_hdr hdr;
|
|
struct device_header dev_hdr;
|
|
struct virtio_mmio_ioevent_param ioeventfds[VIRTIO_MMIO_MAX_VQ];
|
|
};
|
|
|
|
int virtio_mmio_signal_vq(struct kvm *kvm, struct virtio_device *vdev, u32 vq);
|
|
int virtio_mmio_signal_config(struct kvm *kvm, struct virtio_device *vdev);
|
|
int virtio_mmio_exit(struct kvm *kvm, struct virtio_device *vdev);
|
|
int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
|
|
int device_id, int subsys_id, int class);
|
|
void virtio_mmio_assign_irq(struct device_header *dev_hdr);
|
|
#endif
|