From nobody Fri May 17 10:13:21 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1712569709; cv=none; d=zohomail.com; s=zohoarc; b=HYxupu9v2lrbfemTyYNBdd9ICWXxrtL6nSsux1NUx5rFuKv8iek2nYLeOGSpotvBofu7BBzJkWpilTV+h8MYkuC+3kM/EMnOsShsXvBffK0P8qVHDuju/Bi4V3aYlo6MMuwMM8ukfKpXxj282frRbpGgR78/evc3GyGsGMeu3wA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712569709; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=42sfYskPssuPjeznEW/BvX1nGe6MV+cM8zoJKwohHuc=; b=KLr/i1gqkLL1z6PnJQ/yMV+jusgddNg6jMmExn4L67psDLoJ5f5FcIraePwBA4odtH2Xm0NDRUfgGZb35ZGfWGfr0XEh9scUXVjgVWh9Ec/8vNxEwrMdsGpUaQ6LSucDjDFhwv+y/U0s7PYn21aZufE/d8mcBGvwQ5xyC3nHIQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171256970924312.825461697456944; Mon, 8 Apr 2024 02:48:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtlbI-0002TV-SZ; Mon, 08 Apr 2024 05:47:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtlbH-0002TK-93 for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:47:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtlbD-0005hv-F4 for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:47:39 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-AidBcL2RNqa1voQHlEerZA-1; Mon, 08 Apr 2024 05:47:32 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-343c86edeb7so2318812f8f.1 for ; Mon, 08 Apr 2024 02:47:32 -0700 (PDT) Received: from redhat.com ([2.52.152.188]) by smtp.gmail.com with ESMTPSA id dj15-20020a0560000b0f00b003436cb45f7esm8524803wrb.90.2024.04.08.02.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 02:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712569654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=42sfYskPssuPjeznEW/BvX1nGe6MV+cM8zoJKwohHuc=; b=BMlQwlo+myPvrJA+JP3LzlZ7UOIJsTgsryMMSd1sRYcC2pA2i4xjI2G01rLBJMHP1Edw/J BKfCiPcDFDeCK7EztuDqmclcj0FnOg2bKCUSqMY/wDIUeOZeJV8ZrnYP/BMm61q7O1lkiW Y5SC4ZXQUiYazLUF38HCvCSMQCSIeBE= X-MC-Unique: AidBcL2RNqa1voQHlEerZA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712569650; x=1713174450; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=42sfYskPssuPjeznEW/BvX1nGe6MV+cM8zoJKwohHuc=; b=A/f0LN72A1cWvS0ci400djvdzwWJA/Vz74/WhgD8jE2wGqLDIbWa7fh0ak31gE7RlA d/s2X/5JoHQ1hXJYZr2nuNmRSeAMRpR+kzRw0+jSgSpksDsZ5uNQgzaI5Kvcti8Uf+IF nMuZFv4c1zTXnwVxG4PXZm0g0A6KmCl9QJiP3zVeBFsZj8xnnwfMjdSjAlb5gLxx64SP sDyRG1B96AvoLYmWHrHeEb7DeqRjX8vJe8dDq0CkpMWdjAthY9XY7GjZEfQ1EWyS6dlf UYSHY6UYg7b5m0xRLOq72Y92ft6AWwwzbsdo5cgRai/TZr/aub3RubTffR78/mPI7YR6 6i/w== X-Gm-Message-State: AOJu0Yxq75Wpj2K5tnJlq5iQdShdwNVkeOiyNIApOF1gyYvFDS0+fBvd zTQSqJP3vIif8I5VymKj/bWBmO11KdeWyOBK2SzBZ2Xa33XbJB9ipyYKCz/MDsZM9mW/XoFIMGX xMCQL9QdnpoFgNPt1bGXTU0DuH+FYSr2Ae5RMMv3Ra2BrilfR+G8A5lz0Qraw/I1dT5k7mYSuU0 r83IXW46PNZ1mkkLsA+w9YwiR5VVxEKw== X-Received: by 2002:a5d:6d84:0:b0:345:c41a:23a2 with SMTP id l4-20020a5d6d84000000b00345c41a23a2mr1530334wrs.14.1712569650320; Mon, 08 Apr 2024 02:47:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEszKQyHDWuUALENixLR0AD4jLJOj1/icBA/9m+udILiYCrBbvuRzBftSv/ZCF4xNBKUqZyMQ== X-Received: by 2002:a5d:6d84:0:b0:345:c41a:23a2 with SMTP id l4-20020a5d6d84000000b00345c41a23a2mr1530299wrs.14.1712569649565; Mon, 08 Apr 2024 02:47:29 -0700 (PDT) Date: Mon, 8 Apr 2024 05:47:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Jason Wang , Cornelia Huck , Paolo Bonzini Subject: [PATCH] Revert "hw/virtio: Add support for VDPA network simulation devices" Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.355, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1712569710337100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit cd341fd1ffded978b2aa0b5309b00be7c42e347c. The patch adds non-upstream code in include/standard-headers/linux/virtio_pci.h which would make maintainance harder. Revert for now. Suggested-by: Jason Wang Signed-off-by: Michael S. Tsirkin Acked-by: Cornelia Huck Acked-by: Jason Wang --- include/hw/virtio/virtio-pci.h | 5 - include/hw/virtio/virtio.h | 19 -- include/standard-headers/linux/virtio_pci.h | 7 - hw/net/virtio-net.c | 16 -- hw/virtio/virtio-pci.c | 189 +------------------- hw/virtio/virtio.c | 39 ---- MAINTAINERS | 5 - docs/system/device-emulation.rst | 1 - docs/system/devices/vdpa-net.rst | 121 ------------- 9 files changed, 3 insertions(+), 399 deletions(-) delete mode 100644 docs/system/devices/vdpa-net.rst diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h index 4d57a9c751..59d88018c1 100644 --- a/include/hw/virtio/virtio-pci.h +++ b/include/hw/virtio/virtio-pci.h @@ -43,7 +43,6 @@ enum { VIRTIO_PCI_FLAG_INIT_FLR_BIT, VIRTIO_PCI_FLAG_AER_BIT, VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT, - VIRTIO_PCI_FLAG_VDPA_BIT, }; =20 /* Need to activate work-arounds for buggy guests at vmstate load. */ @@ -90,9 +89,6 @@ enum { #define VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED \ (1 << VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED_BIT) =20 -/* VDPA supported flags */ -#define VIRTIO_PCI_FLAG_VDPA (1 << VIRTIO_PCI_FLAG_VDPA_BIT) - typedef struct { MSIMessage msg; int virq; @@ -144,7 +140,6 @@ struct VirtIOPCIProxy { }; VirtIOPCIRegion regs[5]; }; - VirtIOPCIRegion lm; MemoryRegion modern_bar; MemoryRegion io_bar; uint32_t legacy_io_bar_idx; diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b3c74a1bca..c8f72850bc 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -35,9 +35,6 @@ (0x1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \ (0x1ULL << VIRTIO_F_ANY_LAYOUT)) =20 -#define LM_DISABLE 0x00 -#define LM_ENABLE 0x01 - struct VirtQueue; =20 static inline hwaddr vring_align(hwaddr addr, @@ -98,11 +95,6 @@ enum virtio_device_endian { VIRTIO_DEVICE_ENDIAN_BIG, }; =20 -typedef struct BitmapMemoryRegionCaches { - struct rcu_head rcu; - MemoryRegionCache bitmap; -} BitmapMemoryRegionCaches; - /** * struct VirtIODevice - common VirtIO structure * @name: name of the device @@ -136,14 +128,6 @@ struct VirtIODevice uint32_t generation; int nvectors; VirtQueue *vq; - uint8_t lm_logging_ctrl; - uint32_t lm_base_addr_low; - uint32_t lm_base_addr_high; - uint32_t lm_end_addr_low; - uint32_t lm_end_addr_high; - - BitmapMemoryRegionCaches *caches; - MemoryListener listener; uint16_t device_id; /* @vm_running: current VM running state via virtio_vmstate_change() */ @@ -395,11 +379,8 @@ hwaddr virtio_queue_get_desc_size(VirtIODevice *vdev, = int n); hwaddr virtio_queue_get_avail_size(VirtIODevice *vdev, int n); hwaddr virtio_queue_get_used_size(VirtIODevice *vdev, int n); unsigned int virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n); -unsigned int virtio_queue_get_vring_states(VirtIODevice *vdev, int n); void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, unsigned int idx); -void virtio_queue_set_vring_states(VirtIODevice *vdev, int n, - unsigned int idx); void virtio_queue_restore_last_avail_idx(VirtIODevice *vdev, int n); void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n); void virtio_queue_update_used_idx(VirtIODevice *vdev, int n); diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard= -headers/linux/virtio_pci.h index 86733278ba..3e2bc2c97e 100644 --- a/include/standard-headers/linux/virtio_pci.h +++ b/include/standard-headers/linux/virtio_pci.h @@ -221,13 +221,6 @@ struct virtio_pci_cfg_cap { #define VIRTIO_PCI_COMMON_ADM_Q_IDX 60 #define VIRTIO_PCI_COMMON_ADM_Q_NUM 62 =20 -#define LM_LOGGING_CTRL 0 -#define LM_BASE_ADDR_LOW 4 -#define LM_BASE_ADDR_HIGH 8 -#define LM_END_ADDR_LOW 12 -#define LM_END_ADDR_HIGH 16 -#define LM_VRING_STATE_OFFSET 0x20 - #endif /* VIRTIO_PCI_NO_MODERN */ =20 /* Admin command status. */ diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 58014a92ad..24e5e7d347 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2039,22 +2039,6 @@ static ssize_t virtio_net_receive_rcu(NetClientState= *nc, const uint8_t *buf, goto err; } =20 - /* Mark dirty page's bitmap of guest memory */ - if (vdev->lm_logging_ctrl =3D=3D LM_ENABLE) { - uint64_t chunk =3D elem->in_addr[i] / VHOST_LOG_CHUNK; - /* Get chunk index */ - BitmapMemoryRegionCaches *caches =3D qatomic_rcu_read(&vdev->c= aches); - uint64_t index =3D chunk / 8; - uint64_t shift =3D chunk % 8; - uint8_t val =3D 0; - address_space_read_cached(&caches->bitmap, index, &val, - sizeof(val)); - val |=3D 1 << shift; - address_space_write_cached(&caches->bitmap, index, &val, - sizeof(val)); - address_space_cache_invalidate(&caches->bitmap, index, sizeof(= val)); - } - elems[i] =3D elem; lens[i] =3D total; i++; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index eaaf86402c..cb6940fc0e 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1442,155 +1442,6 @@ int virtio_pci_add_shm_cap(VirtIOPCIProxy *proxy, return virtio_pci_add_mem_cap(proxy, &cap.cap); } =20 -/* Called within call_rcu(). */ -static void bitmap_free_region_cache(BitmapMemoryRegionCaches *caches) -{ - assert(caches !=3D NULL); - address_space_cache_destroy(&caches->bitmap); - g_free(caches); -} - -static void lm_disable(VirtIODevice *vdev) -{ - BitmapMemoryRegionCaches *caches; - caches =3D qatomic_read(&vdev->caches); - qatomic_rcu_set(&vdev->caches, NULL); - if (caches) { - call_rcu(caches, bitmap_free_region_cache, rcu); - } -} - -static void lm_enable(VirtIODevice *vdev) -{ - BitmapMemoryRegionCaches *old =3D vdev->caches; - BitmapMemoryRegionCaches *new =3D NULL; - hwaddr addr, end, size; - int64_t len; - - addr =3D vdev->lm_base_addr_low | ((hwaddr)(vdev->lm_base_addr_high) <= < 32); - end =3D vdev->lm_end_addr_low | ((hwaddr)(vdev->lm_end_addr_high) << 3= 2); - size =3D end - addr; - if (size <=3D 0) { - error_report("Invalid lm size."); - return; - } - - new =3D g_new0(BitmapMemoryRegionCaches, 1); - len =3D address_space_cache_init(&new->bitmap, vdev->dma_as, addr, siz= e, - true); - if (len < size) { - virtio_error(vdev, "Cannot map bitmap"); - goto err_bitmap; - } - qatomic_rcu_set(&vdev->caches, new); - - if (old) { - call_rcu(old, bitmap_free_region_cache, rcu); - } - - return; - -err_bitmap: - address_space_cache_destroy(&new->bitmap); - g_free(new); -} - -static uint64_t virtio_pci_lm_read(void *opaque, hwaddr addr, - unsigned size) -{ - VirtIOPCIProxy *proxy =3D opaque; - VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); - hwaddr offset_end =3D LM_VRING_STATE_OFFSET + - virtio_pci_queue_mem_mult(proxy) * VIRTIO_QUEUE_MA= X; - uint32_t val; - int qid; - - if (vdev =3D=3D NULL) { - return UINT64_MAX; - } - switch (addr) { - case LM_LOGGING_CTRL: - val =3D vdev->lm_logging_ctrl; - break; - case LM_BASE_ADDR_LOW: - val =3D vdev->lm_base_addr_low; - break; - case LM_BASE_ADDR_HIGH: - val =3D vdev->lm_base_addr_high; - break; - case LM_END_ADDR_LOW: - val =3D vdev->lm_end_addr_low; - break; - case LM_END_ADDR_HIGH: - val =3D vdev->lm_end_addr_high; - break; - default: - if (addr >=3D LM_VRING_STATE_OFFSET && addr <=3D offset_end) { - qid =3D (addr - LM_VRING_STATE_OFFSET) / - virtio_pci_queue_mem_mult(proxy); - val =3D virtio_queue_get_vring_states(vdev, qid); - } else - val =3D 0; - - break; - } - - return val; -} - -static void virtio_pci_lm_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) -{ - VirtIOPCIProxy *proxy =3D opaque; - VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); - hwaddr offset_end =3D LM_VRING_STATE_OFFSET + - virtio_pci_queue_mem_mult(proxy) * VIRTIO_QUEUE_MA= X; - int qid; - - if (vdev =3D=3D NULL) { - return; - } - - switch (addr) { - case LM_LOGGING_CTRL: - vdev->lm_logging_ctrl =3D val; - switch (val) { - case LM_DISABLE: - lm_disable(vdev); - break; - case LM_ENABLE: - lm_enable(vdev); - break; - default: - virtio_error(vdev, "Unsupport LM_LOGGING_CTRL value: %"PRIx64, - val); - break; - }; - - break; - case LM_BASE_ADDR_LOW: - vdev->lm_base_addr_low =3D val; - break; - case LM_BASE_ADDR_HIGH: - vdev->lm_base_addr_high =3D val; - break; - case LM_END_ADDR_LOW: - vdev->lm_end_addr_low =3D val; - break; - case LM_END_ADDR_HIGH: - vdev->lm_end_addr_high =3D val; - break; - default: - if (addr >=3D LM_VRING_STATE_OFFSET && addr <=3D offset_end) { - qid =3D (addr - LM_VRING_STATE_OFFSET) / - virtio_pci_queue_mem_mult(proxy); - virtio_queue_set_vring_states(vdev, qid, val); - } else - virtio_error(vdev, "Unsupport addr: %"PRIx64, addr); - break; - } -} - static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, unsigned size) { @@ -1972,15 +1823,6 @@ static void virtio_pci_modern_regions_init(VirtIOPCI= Proxy *proxy, }, .endianness =3D DEVICE_LITTLE_ENDIAN, }; - static const MemoryRegionOps lm_ops =3D { - .read =3D virtio_pci_lm_read, - .write =3D virtio_pci_lm_write, - .impl =3D { - .min_access_size =3D 1, - .max_access_size =3D 4, - }, - .endianness =3D DEVICE_LITTLE_ENDIAN, - }; g_autoptr(GString) name =3D g_string_new(NULL); =20 g_string_printf(name, "virtio-pci-common-%s", vdev_name); @@ -2017,14 +1859,6 @@ static void virtio_pci_modern_regions_init(VirtIOPCI= Proxy *proxy, proxy, name->str, proxy->notify_pio.size); - if (proxy->flags & VIRTIO_PCI_FLAG_VDPA) { - g_string_printf(name, "virtio-pci-lm-%s", vdev_name); - memory_region_init_io(&proxy->lm.mr, OBJECT(proxy), - &lm_ops, - proxy, - name->str, - proxy->lm.size); - } } =20 static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, @@ -2187,10 +2021,6 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->device, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->notify, ¬ify.ca= p); - if (proxy->flags & VIRTIO_PCI_FLAG_VDPA) { - memory_region_add_subregion(&proxy->modern_bar, - proxy->lm.offset, &proxy->lm.mr); - } =20 if (modern_pio) { memory_region_init(&proxy->io_bar, OBJECT(proxy), @@ -2260,9 +2090,6 @@ static void virtio_pci_device_unplugged(DeviceState *= d) virtio_pci_modern_mem_region_unmap(proxy, &proxy->isr); virtio_pci_modern_mem_region_unmap(proxy, &proxy->device); virtio_pci_modern_mem_region_unmap(proxy, &proxy->notify); - if (proxy->flags & VIRTIO_PCI_FLAG_VDPA) { - memory_region_del_subregion(&proxy->modern_bar, &proxy->lm.mr); - } if (modern_pio) { virtio_pci_modern_io_region_unmap(proxy, &proxy->notify_pio); } @@ -2317,17 +2144,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, E= rror **errp) proxy->notify_pio.type =3D VIRTIO_PCI_CAP_NOTIFY_CFG; =20 /* subclasses can enforce modern, so do this unconditionally */ - if (!(proxy->flags & VIRTIO_PCI_FLAG_VDPA)) { - memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", - /* PCI BAR regions must be powers of 2 */ - pow2ceil(proxy->notify.offset + proxy->notify.s= ize)); - } else { - proxy->lm.offset =3D proxy->notify.offset + proxy->notify.size; - proxy->lm.size =3D 0x20 + VIRTIO_QUEUE_MAX * 4; - memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", - /* PCI BAR regions must be powers of 2 */ - pow2ceil(proxy->lm.offset + proxy->lm.size)); - } + memory_region_init(&proxy->modern_bar, OBJECT(proxy), "virtio-pci", + /* PCI BAR regions must be powers of 2 */ + pow2ceil(proxy->notify.offset + proxy->notify.size)= ); =20 if (proxy->disable_legacy =3D=3D ON_OFF_AUTO_AUTO) { proxy->disable_legacy =3D pcie_port ? ON_OFF_AUTO_ON : ON_OFF_AUTO= _OFF; @@ -2482,8 +2301,6 @@ static Property virtio_pci_properties[] =3D { VIRTIO_PCI_FLAG_INIT_FLR_BIT, true), DEFINE_PROP_BIT("aer", VirtIOPCIProxy, flags, VIRTIO_PCI_FLAG_AER_BIT, false), - DEFINE_PROP_BIT("vdpa", VirtIOPCIProxy, flags, - VIRTIO_PCI_FLAG_VDPA_BIT, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index fb6b4ccd83..d229755eae 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3368,18 +3368,6 @@ static uint16_t virtio_queue_split_get_last_avail_id= x(VirtIODevice *vdev, return vdev->vq[n].last_avail_idx; } =20 -static uint32_t virtio_queue_split_get_vring_states(VirtIODevice *vdev, - int n) -{ - struct VirtQueue *vq =3D &vdev->vq[n]; - uint16_t avail, used; - - avail =3D vq->last_avail_idx; - used =3D vq->used_idx; - - return avail | (uint32_t)used << 16; -} - unsigned int virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n) { if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { @@ -3389,33 +3377,6 @@ unsigned int virtio_queue_get_last_avail_idx(VirtIOD= evice *vdev, int n) } } =20 -unsigned int virtio_queue_get_vring_states(VirtIODevice *vdev, int n) -{ - if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { - return -1; - } else { - return virtio_queue_split_get_vring_states(vdev, n); - } -} - -static void virtio_queue_split_set_vring_states(VirtIODevice *vdev, - int n, uint32_t idx) -{ - struct VirtQueue *vq =3D &vdev->vq[n]; - vq->last_avail_idx =3D (uint16_t)(idx & 0xffff); - vq->shadow_avail_idx =3D (uint16_t)(idx & 0xffff); - vq->used_idx =3D (uint16_t)(idx >> 16); -} - -void virtio_queue_set_vring_states(VirtIODevice *vdev, int n, uint32_t idx) -{ - if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { - return; - } else { - virtio_queue_split_set_vring_states(vdev, n, idx); - } -} - static void virtio_queue_packed_set_last_avail_idx(VirtIODevice *vdev, int n, unsigned int idx) { diff --git a/MAINTAINERS b/MAINTAINERS index e71183eef9..249b678fc6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2370,11 +2370,6 @@ F: hw/virtio/vhost-user-scmi* F: include/hw/virtio/vhost-user-scmi.h F: tests/qtest/libqos/virtio-scmi.* =20 -vdpa-net -M: Hao Chen -S: Maintained -F: docs/system/devices/vdpa-net.rst - virtio-crypto M: Gonglei S: Supported diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulatio= n.rst index e4a27f53c8..f19777411c 100644 --- a/docs/system/device-emulation.rst +++ b/docs/system/device-emulation.rst @@ -99,4 +99,3 @@ Emulated Devices devices/canokey.rst devices/usb-u2f.rst devices/igb.rst - devices/vdpa-net.rst diff --git a/docs/system/devices/vdpa-net.rst b/docs/system/devices/vdpa-ne= t.rst deleted file mode 100644 index 323d8c926a..0000000000 --- a/docs/system/devices/vdpa-net.rst +++ /dev/null @@ -1,121 +0,0 @@ -vdpa net -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -This document explains the setup and usage of the vdpa network device. -The vdpa network device is a paravirtualized vdpa emulate device. - -Description ------------ - -VDPA net devices support dirty page bitmap mark and vring state saving and= recovery. - -Users can use this VDPA device for live migration simulation testing in a = nested virtualization environment. - -Registers layout ----------------- - -The vdpa device add live migrate registers layout as follow:: - - Offset Register Name Bitwidth Associated vq - 0x0 LM_LOGGING_CTRL 4bits - 0x10 LM_BASE_ADDR_LOW 32bits - 0x14 LM_BASE_ADDR_HIGH 32bits - 0x18 LM_END_ADDR_LOW 32bits - 0x1c LM_END_ADDR_HIGH 32bits - 0x20 LM_RING_STATE_OFFSET 32bits vq0 - 0x24 LM_RING_STATE_OFFSET 32bits vq1 - 0x28 LM_RING_STATE_OFFSET 32bits vq2 - ...... - 0x20+1023*4 LM_RING_STATE_OFFSET 32bits vq1023 - -These registers are extended at the end of the notify bar space. - -Architecture diagram --------------------- -:: - - |-----------------------------------------------------------------------= -| - | guest-L1-user-space = | - | = | - | |---------------------------------------= -| - | | [virtio-net driver] = | - | | ^ guest-L2-src(iommu=3Do= n) | - | |--------------|------------------------= -| - | | | qemu-L2-src(viommu) = | - | [dpdk-vdpa]<->[vhost socket]<-+->[vhost-user backend(iommu=3Don)] = | - ------------------------------------------------------------------------= -- - ------------------------------------------------------------------------= -- - | ^ guest-L1-kernel-space = | - | | = | - | [VFIO] = | - | ^ = | - | | guest-L1-src(iommu=3Don) = | - --------|---------------------------------------------------------------= -- - --------|---------------------------------------------------------------= -- - | [vdpa net device(iommu=3Don)] [manager nic device] = | - | | | = | - | | | = | - | [tap device] qemu-L1-src(viommu) | = | - ------------------------------------------------+-----------------------= -- - | - | - --------------------- | - | kernel net bridge |<----- - | virbr0 |<----------------------------= ------ - --------------------- = | - = | - = | - ------------------------------------------------------------------------= -- | - | guest-L1-user-space = | | - | = | | - | |---------------------------------------= -| | - | | [virtio-net driver] = | | - | | ^ guest-L2-dst(iommu=3Do= n) | | - | |--------------|------------------------= -| | - | | | qemu-L2-dst(viommu) = | | - | [dpdk-vdpa]<->[vhost socket]<-+->[vhost-user backend(iommu=3Don)] = | | - ------------------------------------------------------------------------= -- | - ------------------------------------------------------------------------= -- | - | ^ guest-L1-kernel-space = | | - | | = | | - | [VFIO] = | | - | ^ = | | - | | guest-L1-dst(iommu=3Don) = | | - --------|---------------------------------------------------------------= -- | - --------|---------------------------------------------------------------= -- | - | [vdpa net device(iommu=3Don)] [manager nic device]-------------= ---+---- - | | = | - | | = | - | [tap device] qemu-L1-dst(viommu) = | - ------------------------------------------------------------------------= -- - - -Device properties ------------------ - -The Virtio vdpa device can be configured with the following properties: - - * ``vdpa=3Don`` open vdpa device emulated. - -Usages --------- -This patch add virtio sriov support and vdpa live migrate support. -You can open vdpa by set xml file as follow:: - - - - - - - - - - -Limitations ------------ -1. Dependent on tap device with param ``vhost=3Doff``. -2. Nested virtualization environment only supports ``q35`` machines. -3. Current only support split vring live migrate. - - - --=20 MST