mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pci, pc, virtio: fixes, cleanups, features vhost user blk discard/write zeroes features misc cleanups and fixes all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 05 Feb 2019 16:00:20 GMT # gpg: using RSA key 281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: contrib/libvhost-user: cleanup casts r2d: fix build on mingw mmap-alloc: fix hugetlbfs misaligned length in ppc64 mmap-alloc: unfold qemu_ram_mmap() i386, acpi: cleanup build_facs by removing second unused argument fw_cfg: fix the life cycle and the name of "qemu_extra_params_fw" acpi: Make TPM 2.0 with TIS available as MSFT0101 hw/virtio: Use CONFIG_VIRTIO_PCI switch instead of CONFIG_PCI vhost-user-blk: add discard/write zeroes features support contrib/vhost-user-blk: fix the compilation issue pci/msi: export msi_is_masked() intel_iommu: reset intr_enabled when system reset intel_iommu: fix operator in vtd_switch_address_space hw: virtio-pci: drop DO_UPCAST include: update Linux headers to 4.21-rc1/5.0-rc1 scripts/update-linux-headers.sh: adjust for Linux 4.21-rc1 (or 5.0-rc1) contrib/libvhost-user: switch to uint64_t virtio: add checks for the size of the indirect table Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -790,10 +790,10 @@ vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)
|
||||
DPRINT("vhost_vring_addr:\n");
|
||||
DPRINT(" index: %d\n", vra->index);
|
||||
DPRINT(" flags: %d\n", vra->flags);
|
||||
DPRINT(" desc_user_addr: 0x%016llx\n", vra->desc_user_addr);
|
||||
DPRINT(" used_user_addr: 0x%016llx\n", vra->used_user_addr);
|
||||
DPRINT(" avail_user_addr: 0x%016llx\n", vra->avail_user_addr);
|
||||
DPRINT(" log_guest_addr: 0x%016llx\n", vra->log_guest_addr);
|
||||
DPRINT(" desc_user_addr: 0x%016" PRIx64 "\n", vra->desc_user_addr);
|
||||
DPRINT(" used_user_addr: 0x%016" PRIx64 "\n", vra->used_user_addr);
|
||||
DPRINT(" avail_user_addr: 0x%016" PRIx64 "\n", vra->avail_user_addr);
|
||||
DPRINT(" log_guest_addr: 0x%016" PRIx64 "\n", vra->log_guest_addr);
|
||||
|
||||
vq->vring.flags = vra->flags;
|
||||
vq->vring.desc = qva_to_va(dev, vra->desc_user_addr);
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "contrib/libvhost-user/libvhost-user-glib.h"
|
||||
#include "contrib/libvhost-user/libvhost-user.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/fs.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
struct virtio_blk_inhdr {
|
||||
unsigned char status;
|
||||
@@ -59,6 +63,20 @@ static size_t vub_iov_size(const struct iovec *iov,
|
||||
return len;
|
||||
}
|
||||
|
||||
static size_t vub_iov_to_buf(const struct iovec *iov,
|
||||
const unsigned int iov_cnt, void *buf)
|
||||
{
|
||||
size_t len;
|
||||
unsigned int i;
|
||||
|
||||
len = 0;
|
||||
for (i = 0; i < iov_cnt; i++) {
|
||||
memcpy(buf + len, iov[i].iov_base, iov[i].iov_len);
|
||||
len += iov[i].iov_len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static void vub_panic_cb(VuDev *vu_dev, const char *buf)
|
||||
{
|
||||
VugDev *gdev;
|
||||
@@ -157,6 +175,44 @@ vub_writev(VubReq *req, struct iovec *iov, uint32_t iovcnt)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
vub_discard_write_zeroes(VubReq *req, struct iovec *iov, uint32_t iovcnt,
|
||||
uint32_t type)
|
||||
{
|
||||
struct virtio_blk_discard_write_zeroes *desc;
|
||||
ssize_t size;
|
||||
void *buf;
|
||||
|
||||
size = vub_iov_size(iov, iovcnt);
|
||||
if (size != sizeof(*desc)) {
|
||||
fprintf(stderr, "Invalid size %ld, expect %ld\n", size, sizeof(*desc));
|
||||
return -1;
|
||||
}
|
||||
buf = g_new0(char, size);
|
||||
vub_iov_to_buf(iov, iovcnt, buf);
|
||||
|
||||
#if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
|
||||
VubDev *vdev_blk = req->vdev_blk;
|
||||
desc = (struct virtio_blk_discard_write_zeroes *)buf;
|
||||
uint64_t range[2] = { le64toh(desc->sector) << 9,
|
||||
le32toh(desc->num_sectors) << 9 };
|
||||
if (type == VIRTIO_BLK_T_DISCARD) {
|
||||
if (ioctl(vdev_blk->blk_fd, BLKDISCARD, range) == 0) {
|
||||
g_free(buf);
|
||||
return 0;
|
||||
}
|
||||
} else if (type == VIRTIO_BLK_T_WRITE_ZEROES) {
|
||||
if (ioctl(vdev_blk->blk_fd, BLKZEROOUT, range) == 0) {
|
||||
g_free(buf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
g_free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
vub_flush(VubReq *req)
|
||||
{
|
||||
@@ -212,44 +268,55 @@ static int vub_virtio_process_req(VubDev *vdev_blk,
|
||||
in_num--;
|
||||
|
||||
type = le32toh(req->out->type);
|
||||
switch (type & ~(VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_BARRIER)) {
|
||||
case VIRTIO_BLK_T_IN: {
|
||||
ssize_t ret = 0;
|
||||
bool is_write = type & VIRTIO_BLK_T_OUT;
|
||||
req->sector_num = le64toh(req->out->sector);
|
||||
if (is_write) {
|
||||
ret = vub_writev(req, &elem->out_sg[1], out_num);
|
||||
} else {
|
||||
ret = vub_readv(req, &elem->in_sg[0], in_num);
|
||||
}
|
||||
if (ret >= 0) {
|
||||
req->in->status = VIRTIO_BLK_S_OK;
|
||||
} else {
|
||||
req->in->status = VIRTIO_BLK_S_IOERR;
|
||||
}
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
switch (type & ~VIRTIO_BLK_T_BARRIER) {
|
||||
case VIRTIO_BLK_T_IN:
|
||||
case VIRTIO_BLK_T_OUT: {
|
||||
ssize_t ret = 0;
|
||||
bool is_write = type & VIRTIO_BLK_T_OUT;
|
||||
req->sector_num = le64toh(req->out->sector);
|
||||
if (is_write) {
|
||||
ret = vub_writev(req, &elem->out_sg[1], out_num);
|
||||
} else {
|
||||
ret = vub_readv(req, &elem->in_sg[0], in_num);
|
||||
}
|
||||
case VIRTIO_BLK_T_FLUSH: {
|
||||
vub_flush(req);
|
||||
if (ret >= 0) {
|
||||
req->in->status = VIRTIO_BLK_S_OK;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
} else {
|
||||
req->in->status = VIRTIO_BLK_S_IOERR;
|
||||
}
|
||||
case VIRTIO_BLK_T_GET_ID: {
|
||||
size_t size = MIN(vub_iov_size(&elem->in_sg[0], in_num),
|
||||
VIRTIO_BLK_ID_BYTES);
|
||||
snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
}
|
||||
case VIRTIO_BLK_T_FLUSH:
|
||||
vub_flush(req);
|
||||
req->in->status = VIRTIO_BLK_S_OK;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
case VIRTIO_BLK_T_GET_ID: {
|
||||
size_t size = MIN(vub_iov_size(&elem->in_sg[0], in_num),
|
||||
VIRTIO_BLK_ID_BYTES);
|
||||
snprintf(elem->in_sg[0].iov_base, size, "%s", "vhost_user_blk");
|
||||
req->in->status = VIRTIO_BLK_S_OK;
|
||||
req->size = elem->in_sg[0].iov_len;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
}
|
||||
case VIRTIO_BLK_T_DISCARD:
|
||||
case VIRTIO_BLK_T_WRITE_ZEROES: {
|
||||
int rc;
|
||||
rc = vub_discard_write_zeroes(req, &elem->out_sg[1], out_num, type);
|
||||
if (rc == 0) {
|
||||
req->in->status = VIRTIO_BLK_S_OK;
|
||||
req->size = elem->in_sg[0].iov_len;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
req->in->status = VIRTIO_BLK_S_UNSUPP;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
} else {
|
||||
req->in->status = VIRTIO_BLK_S_IOERR;
|
||||
}
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
req->in->status = VIRTIO_BLK_S_UNSUPP;
|
||||
vub_req_complete(req);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -313,6 +380,10 @@ vub_get_features(VuDev *dev)
|
||||
1ull << VIRTIO_BLK_F_TOPOLOGY |
|
||||
1ull << VIRTIO_BLK_F_BLK_SIZE |
|
||||
1ull << VIRTIO_BLK_F_FLUSH |
|
||||
#if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
|
||||
1ull << VIRTIO_BLK_F_DISCARD |
|
||||
1ull << VIRTIO_BLK_F_WRITE_ZEROES |
|
||||
#endif
|
||||
1ull << VIRTIO_BLK_F_CONFIG_WCE |
|
||||
1ull << VIRTIO_F_VERSION_1 |
|
||||
1ull << VHOST_USER_F_PROTOCOL_FEATURES;
|
||||
@@ -454,7 +525,7 @@ vub_get_blocksize(int fd)
|
||||
|
||||
#if defined(__linux__) && defined(BLKSSZGET)
|
||||
if (ioctl(fd, BLKSSZGET, &blocksize) == 0) {
|
||||
return blocklen;
|
||||
return blocksize;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -474,6 +545,13 @@ vub_initialize_config(int fd, struct virtio_blk_config *config)
|
||||
config->min_io_size = 1;
|
||||
config->opt_io_size = 1;
|
||||
config->num_queues = 1;
|
||||
#if defined(__linux__) && defined(BLKDISCARD) && defined(BLKZEROOUT)
|
||||
config->max_discard_sectors = 32768;
|
||||
config->max_discard_seg = 1;
|
||||
config->discard_sector_alignment = config->blk_size >> 9;
|
||||
config->max_write_zeroes_sectors = 32768;
|
||||
config->max_write_zeroes_seg = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VubDev *
|
||||
|
||||
@@ -38,6 +38,8 @@ static const int user_feature_bits[] = {
|
||||
VIRTIO_BLK_F_RO,
|
||||
VIRTIO_BLK_F_FLUSH,
|
||||
VIRTIO_BLK_F_CONFIG_WCE,
|
||||
VIRTIO_BLK_F_DISCARD,
|
||||
VIRTIO_BLK_F_WRITE_ZEROES,
|
||||
VIRTIO_F_VERSION_1,
|
||||
VIRTIO_RING_F_INDIRECT_DESC,
|
||||
VIRTIO_RING_F_EVENT_IDX,
|
||||
@@ -204,6 +206,8 @@ static uint64_t vhost_user_blk_get_features(VirtIODevice *vdev,
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_FLUSH);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_RO);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_DISCARD);
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_WRITE_ZEROES);
|
||||
|
||||
if (s->config_wce) {
|
||||
virtio_add_feature(&features, VIRTIO_BLK_F_CONFIG_WCE);
|
||||
|
||||
+12
-4
@@ -298,7 +298,7 @@ static void acpi_align_size(GArray *blob, unsigned align)
|
||||
|
||||
/* FACS */
|
||||
static void
|
||||
build_facs(GArray *table_data, BIOSLinker *linker)
|
||||
build_facs(GArray *table_data)
|
||||
{
|
||||
AcpiFacsDescriptorRev1 *facs = acpi_data_push(table_data, sizeof *facs);
|
||||
memcpy(&facs->signature, "FACS", 4);
|
||||
@@ -2141,8 +2141,16 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
||||
build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
|
||||
|
||||
if (TPM_IS_TIS(tpm)) {
|
||||
dev = aml_device("ISA.TPM");
|
||||
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
|
||||
if (misc->tpm_version == TPM_VERSION_2_0) {
|
||||
dev = aml_device("TPM");
|
||||
aml_append(dev, aml_name_decl("_HID",
|
||||
aml_string("MSFT0101")));
|
||||
} else {
|
||||
dev = aml_device("ISA.TPM");
|
||||
aml_append(dev, aml_name_decl("_HID",
|
||||
aml_eisaid("PNP0C31")));
|
||||
}
|
||||
|
||||
aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
|
||||
crs = aml_resource_template();
|
||||
aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
|
||||
@@ -2629,7 +2637,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
||||
* requirements.
|
||||
*/
|
||||
facs = tables_blob->len;
|
||||
build_facs(tables_blob, tables->linker);
|
||||
build_facs(tables_blob);
|
||||
|
||||
/* DSDT is pointed to by FADT */
|
||||
dsdt = tables_blob->len;
|
||||
|
||||
@@ -1153,7 +1153,7 @@ static bool vtd_switch_address_space(VTDAddressSpace *as)
|
||||
|
||||
assert(as);
|
||||
|
||||
use_iommu = as->iommu_state->dmar_enabled & !vtd_dev_pt_enabled(as);
|
||||
use_iommu = as->iommu_state->dmar_enabled && !vtd_dev_pt_enabled(as);
|
||||
|
||||
trace_vtd_switch_address_space(pci_bus_num(as->bus),
|
||||
VTD_PCI_SLOT(as->devfn),
|
||||
@@ -3138,6 +3138,7 @@ static void vtd_init(IntelIOMMUState *s)
|
||||
s->root = 0;
|
||||
s->root_extended = false;
|
||||
s->dmar_enabled = false;
|
||||
s->intr_enabled = false;
|
||||
s->iq_head = 0;
|
||||
s->iq_tail = 0;
|
||||
s->iq = 0;
|
||||
|
||||
+5
-4
@@ -118,7 +118,6 @@ static void fw_cfg_bootsplash(FWCfgState *s)
|
||||
{
|
||||
const char *boot_splash_filename = NULL;
|
||||
const char *boot_splash_time = NULL;
|
||||
uint8_t qemu_extra_params_fw[2];
|
||||
char *filename, *file_data;
|
||||
gsize file_size;
|
||||
int file_type;
|
||||
@@ -132,6 +131,8 @@ static void fw_cfg_bootsplash(FWCfgState *s)
|
||||
/* insert splash time if user configurated */
|
||||
if (boot_splash_time) {
|
||||
int64_t bst_val = qemu_opt_get_number(opts, "splash-time", -1);
|
||||
uint16_t bst_le16;
|
||||
|
||||
/* validate the input */
|
||||
if (bst_val < 0 || bst_val > 0xffff) {
|
||||
error_report("splash-time is invalid,"
|
||||
@@ -139,9 +140,9 @@ static void fw_cfg_bootsplash(FWCfgState *s)
|
||||
exit(1);
|
||||
}
|
||||
/* use little endian format */
|
||||
qemu_extra_params_fw[0] = (uint8_t)(bst_val & 0xff);
|
||||
qemu_extra_params_fw[1] = (uint8_t)((bst_val >> 8) & 0xff);
|
||||
fw_cfg_add_file(s, "etc/boot-menu-wait", qemu_extra_params_fw, 2);
|
||||
bst_le16 = cpu_to_le16(bst_val);
|
||||
fw_cfg_add_file(s, "etc/boot-menu-wait",
|
||||
g_memdup(&bst_le16, sizeof bst_le16), sizeof bst_le16);
|
||||
}
|
||||
|
||||
/* insert splash file if user configurated */
|
||||
|
||||
+1
-1
@@ -286,7 +286,7 @@ void msi_reset(PCIDevice *dev)
|
||||
MSI_DEV_PRINTF(dev, "reset\n");
|
||||
}
|
||||
|
||||
static bool msi_is_masked(const PCIDevice *dev, unsigned int vector)
|
||||
bool msi_is_masked(const PCIDevice *dev, unsigned int vector)
|
||||
{
|
||||
uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));
|
||||
uint32_t mask, data;
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@ static struct QEMU_PACKED
|
||||
|
||||
char pad[232];
|
||||
|
||||
char kernel_cmdline[256];
|
||||
char kernel_cmdline[256] QEMU_NONSTRING;
|
||||
} boot_params;
|
||||
|
||||
static void r2d_init(MachineState *machine)
|
||||
|
||||
@@ -11,7 +11,7 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-p
|
||||
|
||||
obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
|
||||
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
|
||||
ifeq ($(CONFIG_PCI),y)
|
||||
ifeq ($(CONFIG_VIRTIO_PCI),y)
|
||||
obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o
|
||||
obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o
|
||||
obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o
|
||||
|
||||
@@ -591,7 +591,7 @@ virtio_address_space_read(VirtIOPCIProxy *proxy, hwaddr addr,
|
||||
static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
|
||||
uint32_t val, int len)
|
||||
{
|
||||
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
|
||||
VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
|
||||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
struct virtio_pci_cfg_cap *cfg;
|
||||
|
||||
@@ -624,7 +624,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
|
||||
static uint32_t virtio_read_config(PCIDevice *pci_dev,
|
||||
uint32_t address, int len)
|
||||
{
|
||||
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
|
||||
VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
|
||||
struct virtio_pci_cfg_cap *cfg;
|
||||
|
||||
if (proxy->config_cap &&
|
||||
|
||||
+2
-2
@@ -646,7 +646,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,
|
||||
vring_desc_read(vdev, &desc, desc_cache, i);
|
||||
|
||||
if (desc.flags & VRING_DESC_F_INDIRECT) {
|
||||
if (desc.len % sizeof(VRingDesc)) {
|
||||
if (!desc.len || (desc.len % sizeof(VRingDesc))) {
|
||||
virtio_error(vdev, "Invalid size for indirect buffer table");
|
||||
goto err;
|
||||
}
|
||||
@@ -902,7 +902,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz)
|
||||
desc_cache = &caches->desc;
|
||||
vring_desc_read(vdev, &desc, desc_cache, i);
|
||||
if (desc.flags & VRING_DESC_F_INDIRECT) {
|
||||
if (desc.len % sizeof(VRingDesc)) {
|
||||
if (!desc.len || (desc.len % sizeof(VRingDesc))) {
|
||||
virtio_error(vdev, "Invalid size for indirect buffer table");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ int msi_init(struct PCIDevice *dev, uint8_t offset,
|
||||
bool msi_per_vector_mask, Error **errp);
|
||||
void msi_uninit(struct PCIDevice *dev);
|
||||
void msi_reset(PCIDevice *dev);
|
||||
bool msi_is_masked(const PCIDevice *dev, unsigned int vector);
|
||||
void msi_notify(PCIDevice *dev, unsigned int vector);
|
||||
void msi_send_message(PCIDevice *dev, MSIMessage msg);
|
||||
void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);
|
||||
|
||||
@@ -29,11 +29,50 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* DOC: overview
|
||||
*
|
||||
* In the DRM subsystem, framebuffer pixel formats are described using the
|
||||
* fourcc codes defined in `include/uapi/drm/drm_fourcc.h`. In addition to the
|
||||
* fourcc code, a Format Modifier may optionally be provided, in order to
|
||||
* further describe the buffer's format - for example tiling or compression.
|
||||
*
|
||||
* Format Modifiers
|
||||
* ----------------
|
||||
*
|
||||
* Format modifiers are used in conjunction with a fourcc code, forming a
|
||||
* unique fourcc:modifier pair. This format:modifier pair must fully define the
|
||||
* format and data layout of the buffer, and should be the only way to describe
|
||||
* that particular buffer.
|
||||
*
|
||||
* Having multiple fourcc:modifier pairs which describe the same layout should
|
||||
* be avoided, as such aliases run the risk of different drivers exposing
|
||||
* different names for the same data format, forcing userspace to understand
|
||||
* that they are aliases.
|
||||
*
|
||||
* Format modifiers may change any property of the buffer, including the number
|
||||
* of planes and/or the required allocation size. Format modifiers are
|
||||
* vendor-namespaced, and as such the relationship between a fourcc code and a
|
||||
* modifier is specific to the modifer being used. For example, some modifiers
|
||||
* may preserve meaning - such as number of planes - from the fourcc code,
|
||||
* whereas others may not.
|
||||
*
|
||||
* Vendors should document their modifier usage in as much detail as
|
||||
* possible, to ensure maximum compatibility across devices, drivers and
|
||||
* applications.
|
||||
*
|
||||
* The authoritative list of format modifier codes is found in
|
||||
* `include/uapi/drm/drm_fourcc.h`
|
||||
*/
|
||||
|
||||
#define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
|
||||
((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
|
||||
|
||||
#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
|
||||
|
||||
/* Reserve 0 for the invalid format specifier */
|
||||
#define DRM_FORMAT_INVALID 0
|
||||
|
||||
/* color index */
|
||||
#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
|
||||
|
||||
@@ -111,6 +150,21 @@ extern "C" {
|
||||
#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
|
||||
|
||||
#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
|
||||
#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V') /* [31:0] X:Y:Cb:Cr 8:8:8:8 little endian */
|
||||
|
||||
/*
|
||||
* packed YCbCr420 2x2 tiled formats
|
||||
* first 64 bits will contain Y,Cb,Cr components for a 2x2 tile
|
||||
*/
|
||||
/* [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
|
||||
#define DRM_FORMAT_Y0L0 fourcc_code('Y', '0', 'L', '0')
|
||||
/* [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian */
|
||||
#define DRM_FORMAT_X0L0 fourcc_code('X', '0', 'L', '0')
|
||||
|
||||
/* [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */
|
||||
#define DRM_FORMAT_Y0L2 fourcc_code('Y', '0', 'L', '2')
|
||||
/* [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian */
|
||||
#define DRM_FORMAT_X0L2 fourcc_code('X', '0', 'L', '2')
|
||||
|
||||
/*
|
||||
* 2 plane RGB + A
|
||||
@@ -298,6 +352,15 @@ extern "C" {
|
||||
*/
|
||||
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
|
||||
|
||||
/*
|
||||
* Tiled, 16 (pixels) x 16 (lines) - sized macroblocks
|
||||
*
|
||||
* This is a simple tiled layout using tiles of 16x16 pixels in a row-major
|
||||
* layout. For YCbCr formats Cb/Cr components are taken in such a way that
|
||||
* they correspond to their 16x16 luma block.
|
||||
*/
|
||||
#define DRM_FORMAT_MOD_SAMSUNG_16_16_TILE fourcc_mod_code(SAMSUNG, 2)
|
||||
|
||||
/*
|
||||
* Qualcomm Compressed Format
|
||||
*
|
||||
|
||||
@@ -91,10 +91,6 @@
|
||||
* %ETHTOOL_GSET to get the current values before making specific
|
||||
* changes and then applying them with %ETHTOOL_SSET.
|
||||
*
|
||||
* Drivers that implement set_settings() should validate all fields
|
||||
* other than @cmd that are not described as read-only or deprecated,
|
||||
* and must ignore all fields described as read-only.
|
||||
*
|
||||
* Deprecated fields should be ignored by both users and drivers.
|
||||
*/
|
||||
struct ethtool_cmd {
|
||||
@@ -886,7 +882,7 @@ struct ethtool_rx_flow_spec {
|
||||
uint32_t location;
|
||||
};
|
||||
|
||||
/* How rings are layed out when accessing virtual functions or
|
||||
/* How rings are laid out when accessing virtual functions or
|
||||
* offloaded queues is device specific. To allow users to do flow
|
||||
* steering and specify these queues the ring cookie is partitioned
|
||||
* into a 32bit queue index with an 8 bit virtual function id.
|
||||
@@ -895,7 +891,7 @@ struct ethtool_rx_flow_spec {
|
||||
* devices start supporting PCIe w/ARI. However at the moment I
|
||||
* do not know of any devices that support this so I do not reserve
|
||||
* space for this at this time. If a future patch consumes the next
|
||||
* byte it should be aware of this possiblity.
|
||||
* byte it should be aware of this possibility.
|
||||
*/
|
||||
#define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL
|
||||
#define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL
|
||||
@@ -1800,14 +1796,9 @@ enum ethtool_reset_flags {
|
||||
* rejected.
|
||||
*
|
||||
* Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
|
||||
* are not available in %ethtool_link_settings. Until all drivers are
|
||||
* converted to ignore them or to the new %ethtool_link_settings API,
|
||||
* for both queries and changes, users should always try
|
||||
* %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
|
||||
* only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
|
||||
* succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
|
||||
* %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
|
||||
* either %ethtool_cmd or %ethtool_link_settings).
|
||||
* are not available in %ethtool_link_settings. These fields will be
|
||||
* always set to zero in %ETHTOOL_GSET reply and %ETHTOOL_SSET will
|
||||
* fail if any of them is set to non-zero value.
|
||||
*
|
||||
* Users should assume that all fields not marked read-only are
|
||||
* writable and subject to validation by the driver. They should use
|
||||
|
||||
@@ -708,6 +708,14 @@
|
||||
#define REL_DIAL 0x07
|
||||
#define REL_WHEEL 0x08
|
||||
#define REL_MISC 0x09
|
||||
/*
|
||||
* 0x0a is reserved and should not be used in input drivers.
|
||||
* It was used by HID as REL_MISC+1 and userspace needs to detect if
|
||||
* the next REL_* event is correct or is just REL_MISC + n.
|
||||
* We define here REL_RESERVED so userspace can rely on it and detect
|
||||
* the situation described above.
|
||||
*/
|
||||
#define REL_RESERVED 0x0a
|
||||
#define REL_MAX 0x0f
|
||||
#define REL_CNT (REL_MAX+1)
|
||||
|
||||
@@ -744,6 +752,15 @@
|
||||
|
||||
#define ABS_MISC 0x28
|
||||
|
||||
/*
|
||||
* 0x2e is reserved and should not be used in input drivers.
|
||||
* It was used by HID as ABS_MISC+6 and userspace needs to detect if
|
||||
* the next ABS_* event is correct or is just ABS_MISC + n.
|
||||
* We define here ABS_RESERVED so userspace can rely on it and detect
|
||||
* the situation described above.
|
||||
*/
|
||||
#define ABS_RESERVED 0x2e
|
||||
|
||||
#define ABS_MT_SLOT 0x2f /* MT slot being modified */
|
||||
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
|
||||
#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
|
||||
|
||||
#define PCI_STATUS 0x06 /* 16 bits */
|
||||
#define PCI_STATUS_IMM_READY 0x01 /* Immediate Readiness */
|
||||
#define PCI_STATUS_INTERRUPT 0x08 /* Interrupt status */
|
||||
#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
|
||||
#define PCI_STATUS_66MHZ 0x20 /* Support 66 MHz PCI 2.1 bus */
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _LINUX_VHOST_TYPES_H
|
||||
#define _LINUX_VHOST_TYPES_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 "standard-headers/linux/types.h"
|
||||
|
||||
#include "standard-headers/linux/virtio_config.h"
|
||||
#include "standard-headers/linux/virtio_ring.h"
|
||||
|
||||
struct vhost_vring_state {
|
||||
unsigned int index;
|
||||
unsigned int num;
|
||||
};
|
||||
|
||||
struct vhost_vring_file {
|
||||
unsigned int index;
|
||||
int fd; /* Pass -1 to unbind from file. */
|
||||
|
||||
};
|
||||
|
||||
struct vhost_vring_addr {
|
||||
unsigned int index;
|
||||
/* Option flags. */
|
||||
unsigned int flags;
|
||||
/* Flag values: */
|
||||
/* Whether log address is valid. If set enables logging. */
|
||||
#define VHOST_VRING_F_LOG 0
|
||||
|
||||
/* Start of array of descriptors (virtually contiguous) */
|
||||
uint64_t desc_user_addr;
|
||||
/* Used structure address. Must be 32 bit aligned */
|
||||
uint64_t used_user_addr;
|
||||
/* Available structure address. Must be 16 bit aligned */
|
||||
uint64_t avail_user_addr;
|
||||
/* Logging support. */
|
||||
/* Log writes to used structure, at offset calculated from specified
|
||||
* address. Address must be 32 bit aligned. */
|
||||
uint64_t log_guest_addr;
|
||||
};
|
||||
|
||||
/* no alignment requirement */
|
||||
struct vhost_iotlb_msg {
|
||||
uint64_t iova;
|
||||
uint64_t size;
|
||||
uint64_t uaddr;
|
||||
#define VHOST_ACCESS_RO 0x1
|
||||
#define VHOST_ACCESS_WO 0x2
|
||||
#define VHOST_ACCESS_RW 0x3
|
||||
uint8_t perm;
|
||||
#define VHOST_IOTLB_MISS 1
|
||||
#define VHOST_IOTLB_UPDATE 2
|
||||
#define VHOST_IOTLB_INVALIDATE 3
|
||||
#define VHOST_IOTLB_ACCESS_FAIL 4
|
||||
uint8_t type;
|
||||
};
|
||||
|
||||
#define VHOST_IOTLB_MSG 0x1
|
||||
#define VHOST_IOTLB_MSG_V2 0x2
|
||||
|
||||
struct vhost_msg {
|
||||
int type;
|
||||
union {
|
||||
struct vhost_iotlb_msg iotlb;
|
||||
uint8_t padding[64];
|
||||
};
|
||||
};
|
||||
|
||||
struct vhost_msg_v2 {
|
||||
uint32_t type;
|
||||
uint32_t reserved;
|
||||
union {
|
||||
struct vhost_iotlb_msg iotlb;
|
||||
uint8_t padding[64];
|
||||
};
|
||||
};
|
||||
|
||||
struct vhost_memory_region {
|
||||
uint64_t guest_phys_addr;
|
||||
uint64_t memory_size; /* bytes */
|
||||
uint64_t userspace_addr;
|
||||
uint64_t flags_padding; /* No flags are currently specified. */
|
||||
};
|
||||
|
||||
/* All region addresses and sizes must be 4K aligned. */
|
||||
#define VHOST_PAGE_SIZE 0x1000
|
||||
|
||||
struct vhost_memory {
|
||||
uint32_t nregions;
|
||||
uint32_t padding;
|
||||
struct vhost_memory_region regions[0];
|
||||
};
|
||||
|
||||
/* VHOST_SCSI specific definitions */
|
||||
|
||||
/*
|
||||
* Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
|
||||
*
|
||||
* ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
|
||||
* RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
|
||||
* ABI Rev 1: January 2013. Ignore vhost_tpgt field in struct vhost_scsi_target.
|
||||
* All the targets under vhost_wwpn can be seen and used by guset.
|
||||
*/
|
||||
|
||||
#define VHOST_SCSI_ABI_VERSION 1
|
||||
|
||||
struct vhost_scsi_target {
|
||||
int abi_version;
|
||||
char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */
|
||||
unsigned short vhost_tpgt;
|
||||
unsigned short reserved;
|
||||
};
|
||||
|
||||
/* Feature bits */
|
||||
/* Log all write descriptors. Can be changed while device is active. */
|
||||
#define VHOST_F_LOG_ALL 26
|
||||
/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
|
||||
#define VHOST_NET_F_VIRTIO_NET_HDR 27
|
||||
|
||||
#endif
|
||||
@@ -34,15 +34,23 @@
|
||||
#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
|
||||
#define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory Stats virtqueue */
|
||||
#define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2 /* Deflate balloon on OOM */
|
||||
#define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3 /* VQ to report free pages */
|
||||
#define VIRTIO_BALLOON_F_PAGE_POISON 4 /* Guest is using page poisoning */
|
||||
|
||||
/* Size of a PFN in the balloon interface. */
|
||||
#define VIRTIO_BALLOON_PFN_SHIFT 12
|
||||
|
||||
#define VIRTIO_BALLOON_CMD_ID_STOP 0
|
||||
#define VIRTIO_BALLOON_CMD_ID_DONE 1
|
||||
struct virtio_balloon_config {
|
||||
/* Number of pages host wants Guest to give up. */
|
||||
uint32_t num_pages;
|
||||
/* Number of pages we've actually got in balloon. */
|
||||
uint32_t actual;
|
||||
/* Free page report command id, readonly by guest */
|
||||
uint32_t free_page_report_cmd_id;
|
||||
/* Stores PAGE_POISON if page poisoning is in use */
|
||||
uint32_t poison_val;
|
||||
};
|
||||
|
||||
#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
|
||||
#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
|
||||
#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
|
||||
#define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */
|
||||
#define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
|
||||
|
||||
/* Legacy feature bits */
|
||||
#ifndef VIRTIO_BLK_NO_LEGACY
|
||||
@@ -84,6 +86,39 @@ struct virtio_blk_config {
|
||||
|
||||
/* number of vqs, only available when VIRTIO_BLK_F_MQ is set */
|
||||
uint16_t num_queues;
|
||||
|
||||
/* the next 3 entries are guarded by VIRTIO_BLK_F_DISCARD */
|
||||
/*
|
||||
* The maximum discard sectors (in 512-byte sectors) for
|
||||
* one segment.
|
||||
*/
|
||||
uint32_t max_discard_sectors;
|
||||
/*
|
||||
* The maximum number of discard segments in a
|
||||
* discard command.
|
||||
*/
|
||||
uint32_t max_discard_seg;
|
||||
/* Discard commands must be aligned to this number of sectors. */
|
||||
uint32_t discard_sector_alignment;
|
||||
|
||||
/* the next 3 entries are guarded by VIRTIO_BLK_F_WRITE_ZEROES */
|
||||
/*
|
||||
* The maximum number of write zeroes sectors (in 512-byte sectors) in
|
||||
* one segment.
|
||||
*/
|
||||
uint32_t max_write_zeroes_sectors;
|
||||
/*
|
||||
* The maximum number of segments in a write zeroes
|
||||
* command.
|
||||
*/
|
||||
uint32_t max_write_zeroes_seg;
|
||||
/*
|
||||
* Set if a VIRTIO_BLK_T_WRITE_ZEROES request may result in the
|
||||
* deallocation of one or more of the sectors.
|
||||
*/
|
||||
uint8_t write_zeroes_may_unmap;
|
||||
|
||||
uint8_t unused1[3];
|
||||
} QEMU_PACKED;
|
||||
|
||||
/*
|
||||
@@ -112,6 +147,12 @@ struct virtio_blk_config {
|
||||
/* Get device ID command */
|
||||
#define VIRTIO_BLK_T_GET_ID 8
|
||||
|
||||
/* Discard command */
|
||||
#define VIRTIO_BLK_T_DISCARD 11
|
||||
|
||||
/* Write zeroes command */
|
||||
#define VIRTIO_BLK_T_WRITE_ZEROES 13
|
||||
|
||||
#ifndef VIRTIO_BLK_NO_LEGACY
|
||||
/* Barrier before this op. */
|
||||
#define VIRTIO_BLK_T_BARRIER 0x80000000
|
||||
@@ -131,6 +172,19 @@ struct virtio_blk_outhdr {
|
||||
__virtio64 sector;
|
||||
};
|
||||
|
||||
/* Unmap this range (only valid for write zeroes command) */
|
||||
#define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001
|
||||
|
||||
/* Discard/write zeroes range for each request. */
|
||||
struct virtio_blk_discard_write_zeroes {
|
||||
/* discard/write zeroes start sector */
|
||||
uint64_t sector;
|
||||
/* number of discard/write zeroes sectors */
|
||||
uint32_t num_sectors;
|
||||
/* flags for this range */
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
#ifndef VIRTIO_BLK_NO_LEGACY
|
||||
struct virtio_scsi_inhdr {
|
||||
__virtio32 errors;
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
*/
|
||||
#define VIRTIO_F_IOMMU_PLATFORM 33
|
||||
|
||||
/* This feature indicates support for the packed virtqueue layout. */
|
||||
#define VIRTIO_F_RING_PACKED 34
|
||||
|
||||
/*
|
||||
* Does the device support Single Root I/O Virtualization?
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user