Message ID | 20220726072225.19884-15-xuanzhuo@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1F36C433EF for <kvm@archiver.kernel.org>; Tue, 26 Jul 2022 07:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238058AbiGZHX2 (ORCPT <rfc822;kvm@archiver.kernel.org>); Tue, 26 Jul 2022 03:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238110AbiGZHXF (ORCPT <rfc822;kvm@vger.kernel.org>); Tue, 26 Jul 2022 03:23:05 -0400 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C69F2AE2A; Tue, 26 Jul 2022 00:23:00 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=37;SR=0;TI=SMTPD_---0VKUNV2U_1658820172; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0VKUNV2U_1658820172) by smtp.aliyun-inc.com; Tue, 26 Jul 2022 15:22:53 +0800 From: Xuan Zhuo <xuanzhuo@linux.alibaba.com> To: virtualization@lists.linux-foundation.org Cc: Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Johannes Berg <johannes@sipsolutions.net>, "Michael S. Tsirkin" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, Vadim Pasternak <vadimp@nvidia.com>, Bjorn Andersson <bjorn.andersson@linaro.org>, Mathieu Poirier <mathieu.poirier@linaro.org>, Cornelia Huck <cohuck@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Sven Schnelle <svens@linux.ibm.com>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Jesper Dangaard Brouer <hawk@kernel.org>, John Fastabend <john.fastabend@gmail.com>, Xuan Zhuo <xuanzhuo@linux.alibaba.com>, Vincent Whitchurch <vincent.whitchurch@axis.com>, linux-um@lists.infradead.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, bpf@vger.kernel.org, kangjie.xu@linux.alibaba.com Subject: [PATCH v13 14/42] virtio_ring: split: introduce virtqueue_reinit_split() Date: Tue, 26 Jul 2022 15:21:57 +0800 Message-Id: <20220726072225.19884-15-xuanzhuo@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20220726072225.19884-1-xuanzhuo@linux.alibaba.com> References: <20220726072225.19884-1-xuanzhuo@linux.alibaba.com> MIME-Version: 1.0 X-Git-Hash: 19d2a6aae0b1 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org |
Series |
virtio pci support VIRTIO_F_RING_RESET
|
expand
|
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 2067818f7047..aa5dda96824e 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -967,6 +967,25 @@ static void virtqueue_vring_init_split(struct vring_virtqueue_split *vring_split } } +static void virtqueue_reinit_split(struct vring_virtqueue *vq) +{ + int size, i; + + memset(vq->split.vring.desc, 0, vq->split.queue_size_in_bytes); + + size = sizeof(struct vring_desc_state_split) * vq->split.vring.num; + memset(vq->split.desc_state, 0, size); + + size = sizeof(struct vring_desc_extra) * vq->split.vring.num; + memset(vq->split.desc_extra, 0, size); + + for (i = 0; i < vq->split.vring.num - 1; i++) + vq->split.desc_extra[i].next = i + 1; + + virtqueue_init(vq, vq->split.vring.num); + virtqueue_vring_init_split(&vq->split, vq); +} + static void virtqueue_vring_attach_split(struct vring_virtqueue *vq, struct vring_virtqueue_split *vring_split) {