qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

update Linux headers to 4.6

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+140 -12
+3 -1
include/standard-headers/asm-x86/hyperv.h
··· 226 226 (~((1ull << HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT) - 1)) 227 227 228 228 /* Declare the various hypercall operations. */ 229 - #define HV_X64_HV_NOTIFY_LONG_SPIN_WAIT 0x0008 229 + #define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008 230 + #define HVCALL_POST_MESSAGE 0x005c 231 + #define HVCALL_SIGNAL_EVENT 0x005d 230 232 231 233 #define HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE 0x00000001 232 234 #define HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT 12
+1
include/standard-headers/linux/input.h
··· 243 243 #define BUS_GSC 0x1A 244 244 #define BUS_ATARI 0x1B 245 245 #define BUS_SPI 0x1C 246 + #define BUS_RMI 0x1D 246 247 247 248 /* 248 249 * MT_TOOL types
+3 -2
include/standard-headers/linux/types.h
··· 1 - #include <stdint.h> 2 - #include "qemu/compiler.h" 1 + /* For QEMU all types are already defined via osdep.h, so this 2 + * header does not need to do anything. 3 + */
+1 -1
include/standard-headers/linux/virtio_balloon.h
··· 51 51 #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ 52 52 #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ 53 53 #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ 54 - #define VIRTIO_BALLOON_S_AVAIL 6 /* Amount of available memory in guest */ 54 + #define VIRTIO_BALLOON_S_AVAIL 6 /* Available memory as in /proc */ 55 55 #define VIRTIO_BALLOON_S_NR 7 56 56 57 57 /*
+3 -3
include/standard-headers/linux/virtio_blk.h
··· 43 43 #ifndef VIRTIO_BLK_NO_LEGACY 44 44 #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ 45 45 #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ 46 - #define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ 46 + #define VIRTIO_BLK_F_FLUSH 9 /* Flush command supported */ 47 47 #define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ 48 - /* Old (deprecated) name for VIRTIO_BLK_F_WCE. */ 49 - #define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE 48 + /* Old (deprecated) name for VIRTIO_BLK_F_FLUSH. */ 49 + #define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH 50 50 #endif /* !VIRTIO_BLK_NO_LEGACY */ 51 51 52 52 #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
+6
linux-headers/asm-arm64/kvm.h
··· 94 94 #define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ 95 95 #define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */ 96 96 #define KVM_ARM_VCPU_PSCI_0_2 2 /* CPU uses PSCI v0.2 */ 97 + #define KVM_ARM_VCPU_PMU_V3 3 /* Support guest PMUv3 */ 97 98 98 99 struct kvm_vcpu_init { 99 100 __u32 target; ··· 203 204 #define KVM_DEV_ARM_VGIC_GRP_NR_IRQS 3 204 205 #define KVM_DEV_ARM_VGIC_GRP_CTRL 4 205 206 #define KVM_DEV_ARM_VGIC_CTRL_INIT 0 207 + 208 + /* Device Control API on vcpu fd */ 209 + #define KVM_ARM_VCPU_PMU_V3_CTRL 0 210 + #define KVM_ARM_VCPU_PMU_V3_IRQ 0 211 + #define KVM_ARM_VCPU_PMU_V3_INIT 1 206 212 207 213 /* KVM_IRQ_LINE irq field index values */ 208 214 #define KVM_ARM_IRQ_TYPE_SHIFT 24
+2 -2
linux-headers/asm-powerpc/epapr_hcalls.h
··· 78 78 #define EV_SUCCESS 0 79 79 #define EV_EPERM 1 /* Operation not permitted */ 80 80 #define EV_ENOENT 2 /* Entry Not Found */ 81 - #define EV_EIO 3 /* I/O error occured */ 81 + #define EV_EIO 3 /* I/O error occurred */ 82 82 #define EV_EAGAIN 4 /* The operation had insufficient 83 83 * resources to complete and should be 84 84 * retried ··· 89 89 #define EV_ENODEV 7 /* No such device */ 90 90 #define EV_EINVAL 8 /* An argument supplied to the hcall 91 91 was out of range or invalid */ 92 - #define EV_INTERNAL 9 /* An internal error occured */ 92 + #define EV_INTERNAL 9 /* An internal error occurred */ 93 93 #define EV_CONFIG 10 /* A configuration error was detected */ 94 94 #define EV_INVALID_STATE 11 /* The object is in an invalid state */ 95 95 #define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
+9
linux-headers/asm-powerpc/kvm.h
··· 333 333 __u32 window_size; 334 334 }; 335 335 336 + /* for KVM_CAP_SPAPR_TCE_64 */ 337 + struct kvm_create_spapr_tce_64 { 338 + __u64 liobn; 339 + __u32 page_shift; 340 + __u32 flags; 341 + __u64 offset; /* in pages */ 342 + __u64 size; /* in pages */ 343 + }; 344 + 336 345 /* for KVM_ALLOCATE_RMA */ 337 346 struct kvm_allocate_rma { 338 347 __u64 rma_size;
+2
linux-headers/asm-x86/unistd_32.h
··· 375 375 #define __NR_membarrier 375 376 376 #define __NR_mlock2 376 377 377 #define __NR_copy_file_range 377 378 + #define __NR_preadv2 378 379 + #define __NR_pwritev2 379 378 380 379 381 #endif /* _ASM_X86_UNISTD_32_H */
+2
linux-headers/asm-x86/unistd_64.h
··· 328 328 #define __NR_membarrier 324 329 329 #define __NR_mlock2 325 330 330 #define __NR_copy_file_range 326 331 + #define __NR_preadv2 327 332 + #define __NR_pwritev2 328 331 333 332 334 #endif /* _ASM_X86_UNISTD_64_H */
+11
linux-headers/linux/kvm.h
··· 157 157 158 158 struct kvm_hyperv_exit { 159 159 #define KVM_EXIT_HYPERV_SYNIC 1 160 + #define KVM_EXIT_HYPERV_HCALL 2 160 161 __u32 type; 161 162 union { 162 163 struct { ··· 165 166 __u64 evt_page; 166 167 __u64 msg_page; 167 168 } synic; 169 + struct { 170 + __u64 input; 171 + __u64 result; 172 + __u64 params[2]; 173 + } hcall; 168 174 } u; 169 175 }; 170 176 ··· 856 862 #define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 857 863 #define KVM_CAP_HYPERV_SYNIC 123 858 864 #define KVM_CAP_S390_RI 124 865 + #define KVM_CAP_SPAPR_TCE_64 125 866 + #define KVM_CAP_ARM_PMU_V3 126 867 + #define KVM_CAP_VCPU_ATTRIBUTES 127 859 868 860 869 #ifdef KVM_CAP_IRQ_ROUTING 861 870 ··· 1148 1157 /* Available with KVM_CAP_PPC_ALLOC_HTAB */ 1149 1158 #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) 1150 1159 #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) 1160 + #define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, \ 1161 + struct kvm_create_spapr_tce_64) 1151 1162 /* Available with KVM_CAP_RMA */ 1152 1163 #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 1153 1164 /* Available with KVM_CAP_PPC_HTAB_FD */
+1 -1
linux-headers/linux/userfaultfd.h
··· 78 78 __u64 reserved3; 79 79 } reserved; 80 80 } arg; 81 - } __packed; 81 + } __attribute__((packed)); 82 82 83 83 /* 84 84 * Start at 0x12 and not at 0 to be more strict against bugs.
+90 -2
linux-headers/linux/vfio.h
··· 59 59 #define VFIO_TYPE (';') 60 60 #define VFIO_BASE 100 61 61 62 + /* 63 + * For extension of INFO ioctls, VFIO makes use of a capability chain 64 + * designed after PCI/e capabilities. A flag bit indicates whether 65 + * this capability chain is supported and a field defined in the fixed 66 + * structure defines the offset of the first capability in the chain. 67 + * This field is only valid when the corresponding bit in the flags 68 + * bitmap is set. This offset field is relative to the start of the 69 + * INFO buffer, as is the next field within each capability header. 70 + * The id within the header is a shared address space per INFO ioctl, 71 + * while the version field is specific to the capability id. The 72 + * contents following the header are specific to the capability id. 73 + */ 74 + struct vfio_info_cap_header { 75 + __u16 id; /* Identifies capability */ 76 + __u16 version; /* Version specific to the capability ID */ 77 + __u32 next; /* Offset of next capability */ 78 + }; 79 + 80 + /* 81 + * Callers of INFO ioctls passing insufficiently sized buffers will see 82 + * the capability chain flag bit set, a zero value for the first capability 83 + * offset (if available within the provided argsz), and argsz will be 84 + * updated to report the necessary buffer size. For compatibility, the 85 + * INFO ioctl will not report error in this case, but the capability chain 86 + * will not be available. 87 + */ 88 + 62 89 /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */ 63 90 64 91 /** ··· 194 221 #define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */ 195 222 #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */ 196 223 #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */ 224 + #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */ 197 225 __u32 index; /* Region index */ 198 - __u32 resv; /* Reserved for alignment */ 226 + __u32 cap_offset; /* Offset within info struct of first cap */ 199 227 __u64 size; /* Region size (bytes) */ 200 228 __u64 offset; /* Region offset from start of device fd */ 201 229 }; 202 230 #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) 203 231 232 + /* 233 + * The sparse mmap capability allows finer granularity of specifying areas 234 + * within a region with mmap support. When specified, the user should only 235 + * mmap the offset ranges specified by the areas array. mmaps outside of the 236 + * areas specified may fail (such as the range covering a PCI MSI-X table) or 237 + * may result in improper device behavior. 238 + * 239 + * The structures below define version 1 of this capability. 240 + */ 241 + #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 242 + 243 + struct vfio_region_sparse_mmap_area { 244 + __u64 offset; /* Offset of mmap'able area within region */ 245 + __u64 size; /* Size of mmap'able area */ 246 + }; 247 + 248 + struct vfio_region_info_cap_sparse_mmap { 249 + struct vfio_info_cap_header header; 250 + __u32 nr_areas; 251 + __u32 reserved; 252 + struct vfio_region_sparse_mmap_area areas[]; 253 + }; 254 + 255 + /* 256 + * The device specific type capability allows regions unique to a specific 257 + * device or class of devices to be exposed. This helps solve the problem for 258 + * vfio bus drivers of defining which region indexes correspond to which region 259 + * on the device, without needing to resort to static indexes, as done by 260 + * vfio-pci. For instance, if we were to go back in time, we might remove 261 + * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes 262 + * greater than or equal to VFIO_PCI_NUM_REGIONS are device specific and we'd 263 + * make a "VGA" device specific type to describe the VGA access space. This 264 + * means that non-VGA devices wouldn't need to waste this index, and thus the 265 + * address space associated with it due to implementation of device file 266 + * descriptor offsets in vfio-pci. 267 + * 268 + * The current implementation is now part of the user ABI, so we can't use this 269 + * for VGA, but there are other upcoming use cases, such as opregions for Intel 270 + * IGD devices and framebuffers for vGPU devices. We missed VGA, but we'll 271 + * use this for future additions. 272 + * 273 + * The structure below defines version 1 of this capability. 274 + */ 275 + #define VFIO_REGION_INFO_CAP_TYPE 2 276 + 277 + struct vfio_region_info_cap_type { 278 + struct vfio_info_cap_header header; 279 + __u32 type; /* global per bus driver */ 280 + __u32 subtype; /* type specific */ 281 + }; 282 + 283 + #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31) 284 + #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) 285 + 286 + /* 8086 Vendor sub-types */ 287 + #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1) 288 + #define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2) 289 + #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) 290 + 204 291 /** 205 292 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9, 206 293 * struct vfio_irq_info) ··· 336 423 * between described ranges are unimplemented. 337 424 */ 338 425 VFIO_PCI_VGA_REGION_INDEX, 339 - VFIO_PCI_NUM_REGIONS 426 + VFIO_PCI_NUM_REGIONS = 9 /* Fixed user ABI, region indexes >=9 use */ 427 + /* device specific cap to define content. */ 340 428 }; 341 429 342 430 enum {
+6
linux-headers/linux/vhost.h
··· 126 126 #define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file) 127 127 /* Set eventfd to signal an error */ 128 128 #define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file) 129 + /* Set busy loop timeout (in us) */ 130 + #define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, \ 131 + struct vhost_vring_state) 132 + /* Get busy loop timeout (in us) */ 133 + #define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, \ 134 + struct vhost_vring_state) 129 135 130 136 /* VHOST_NET specific defines */ 131 137