mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
Some should cause changes in tooling, like the one adding LAST_EXCP, but the way it is structured end up not making that happen. The new SVM_EXIT_INVPCID should get used by arch/x86/util/kvm-stat.c, in the svm_exit_reasons table. The tools/perf/trace/beauty part has scripts to catch changes and automagically create tables, like tools/perf/trace/beauty/kvm_ioctl.sh, but changes are needed to make tools/perf/arch/x86/util/kvm-stat.c catch those automatically. These were handled by the existing scripts: $ tools/perf/trace/beauty/kvm_ioctl.sh > before $ cp include/uapi/linux/kvm.h tools/include/uapi/linux/kvm.h $ tools/perf/trace/beauty/kvm_ioctl.sh > after $ diff -u before after --- before 2020-11-03 08:43:52.910728608 -0300 +++ after 2020-11-03 08:44:04.273959984 -0300 @@ -89,6 +89,7 @@ [0xbf] = "SET_NESTED_STATE", [0xc0] = "CLEAR_DIRTY_LOG", [0xc1] = "GET_SUPPORTED_HV_CPUID", + [0xc6] = "X86_SET_MSR_FILTER", [0xe0] = "CREATE_DEVICE", [0xe1] = "SET_DEVICE_ATTR", [0xe2] = "GET_DEVICE_ATTR", $ $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h $ $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after $ diff -u before after --- before 2020-11-03 08:45:55.522225198 -0300 +++ after 2020-11-03 08:46:12.881578666 -0300 @@ -37,4 +37,5 @@ [0x71] = "VDPA_GET_STATUS", [0x73] = "VDPA_GET_CONFIG", [0x76] = "VDPA_GET_VRING_NUM", + [0x78] = "VDPA_GET_IOVA_RANGE", }; $ This addresses these perf build warnings: Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h' diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/sie.h' differs from latest version at 'arch/s390/include/uapi/asm/sie.h' diff -u tools/arch/s390/include/uapi/asm/sie.h arch/s390/include/uapi/asm/sie.h Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/kvm.h' differs from latest version at 'arch/x86/include/uapi/asm/kvm.h' diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/svm.h' differs from latest version at 'arch/x86/include/uapi/asm/svm.h' diff -u tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h' diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h' diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com> Cc: Borislav Petkov <bp@suse.de> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Joerg Roedel <jroedel@suse.de> Cc: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
153 lines
6.3 KiB
C
153 lines
6.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
#ifndef _LINUX_VHOST_H
|
|
#define _LINUX_VHOST_H
|
|
/* Userspace interface for in-kernel virtio accelerators. */
|
|
|
|
/* vhost is used to reduce the number of system calls involved in virtio.
|
|
*
|
|
* Existing virtio net code is used in the guest without modification.
|
|
*
|
|
* This header includes interface used by userspace hypervisor for
|
|
* device configuration.
|
|
*/
|
|
|
|
#include <linux/vhost_types.h>
|
|
#include <linux/types.h>
|
|
#include <linux/ioctl.h>
|
|
|
|
#define VHOST_FILE_UNBIND -1
|
|
|
|
/* ioctls */
|
|
|
|
#define VHOST_VIRTIO 0xAF
|
|
|
|
/* Features bitmask for forward compatibility. Transport bits are used for
|
|
* vhost specific features. */
|
|
#define VHOST_GET_FEATURES _IOR(VHOST_VIRTIO, 0x00, __u64)
|
|
#define VHOST_SET_FEATURES _IOW(VHOST_VIRTIO, 0x00, __u64)
|
|
|
|
/* Set current process as the (exclusive) owner of this file descriptor. This
|
|
* must be called before any other vhost command. Further calls to
|
|
* VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */
|
|
#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
|
|
/* Give up ownership, and reset the device to default values.
|
|
* Allows subsequent call to VHOST_OWNER_SET to succeed. */
|
|
#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
|
|
|
|
/* Set up/modify memory layout */
|
|
#define VHOST_SET_MEM_TABLE _IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
|
|
|
|
/* Write logging setup. */
|
|
/* Memory writes can optionally be logged by setting bit at an offset
|
|
* (calculated from the physical address) from specified log base.
|
|
* The bit is set using an atomic 32 bit operation. */
|
|
/* Set base address for logging. */
|
|
#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
|
|
/* Specify an eventfd file descriptor to signal on log write. */
|
|
#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
|
|
|
|
/* Ring setup. */
|
|
/* Set number of descriptors in ring. This parameter can not
|
|
* be modified while ring is running (bound to a device). */
|
|
#define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state)
|
|
/* Set addresses for the ring. */
|
|
#define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr)
|
|
/* Base value where queue looks for available descriptors */
|
|
#define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
|
|
/* Get accessor: reads index, writes value in num */
|
|
#define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
|
|
|
|
/* Set the vring byte order in num. Valid values are VHOST_VRING_LITTLE_ENDIAN
|
|
* or VHOST_VRING_BIG_ENDIAN (other values return -EINVAL).
|
|
* The byte order cannot be changed while the device is active: trying to do so
|
|
* returns -EBUSY.
|
|
* This is a legacy only API that is simply ignored when VIRTIO_F_VERSION_1 is
|
|
* set.
|
|
* Not all kernel configurations support this ioctl, but all configurations that
|
|
* support SET also support GET.
|
|
*/
|
|
#define VHOST_VRING_LITTLE_ENDIAN 0
|
|
#define VHOST_VRING_BIG_ENDIAN 1
|
|
#define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)
|
|
#define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)
|
|
|
|
/* The following ioctls use eventfd file descriptors to signal and poll
|
|
* for events. */
|
|
|
|
/* Set eventfd to poll for added buffers */
|
|
#define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file)
|
|
/* Set eventfd to signal when buffers have beed used */
|
|
#define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file)
|
|
/* Set eventfd to signal an error */
|
|
#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
|
|
/* Set busy loop timeout (in us) */
|
|
#define VHOST_SET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x23, \
|
|
struct vhost_vring_state)
|
|
/* Get busy loop timeout (in us) */
|
|
#define VHOST_GET_VRING_BUSYLOOP_TIMEOUT _IOW(VHOST_VIRTIO, 0x24, \
|
|
struct vhost_vring_state)
|
|
|
|
/* Set or get vhost backend capability */
|
|
|
|
/* Use message type V2 */
|
|
#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
|
|
/* IOTLB can accept batching hints */
|
|
#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
|
|
|
|
#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
|
|
#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
|
|
|
|
/* VHOST_NET specific defines */
|
|
|
|
/* Attach virtio net ring to a raw socket, or tap device.
|
|
* The socket must be already bound to an ethernet device, this device will be
|
|
* used for transmit. Pass fd -1 to unbind from the socket and the transmit
|
|
* device. This can be used to stop the ring (e.g. for migration). */
|
|
#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
|
|
|
|
/* VHOST_SCSI specific defines */
|
|
|
|
#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
|
|
#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
|
|
/* Changing this breaks userspace. */
|
|
#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
|
|
/* Set and get the events missed flag */
|
|
#define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32)
|
|
#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
|
|
|
|
/* VHOST_VSOCK specific defines */
|
|
|
|
#define VHOST_VSOCK_SET_GUEST_CID _IOW(VHOST_VIRTIO, 0x60, __u64)
|
|
#define VHOST_VSOCK_SET_RUNNING _IOW(VHOST_VIRTIO, 0x61, int)
|
|
|
|
/* VHOST_VDPA specific defines */
|
|
|
|
/* Get the device id. The device ids follow the same definition of
|
|
* the device id defined in virtio-spec.
|
|
*/
|
|
#define VHOST_VDPA_GET_DEVICE_ID _IOR(VHOST_VIRTIO, 0x70, __u32)
|
|
/* Get and set the status. The status bits follow the same definition
|
|
* of the device status defined in virtio-spec.
|
|
*/
|
|
#define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8)
|
|
#define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8)
|
|
/* Get and set the device config. The device config follows the same
|
|
* definition of the device config defined in virtio-spec.
|
|
*/
|
|
#define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, \
|
|
struct vhost_vdpa_config)
|
|
#define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, \
|
|
struct vhost_vdpa_config)
|
|
/* Enable/disable the ring. */
|
|
#define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, \
|
|
struct vhost_vring_state)
|
|
/* Get the max ring size. */
|
|
#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
|
|
|
|
/* Set event fd for config interrupt*/
|
|
#define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int)
|
|
|
|
/* Get the valid iova range */
|
|
#define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \
|
|
struct vhost_vdpa_iova_range)
|
|
#endif
|