Received: by 10.192.165.148 with SMTP id m20csp568530imm; Fri, 20 Apr 2018 11:21:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx49JHugYUFZgaMFe6RZhuF1DyMSN+xc8ugE+NZPkWzNdMxBziG21xj1Mg3PWST6EpyX5MIlS X-Received: by 10.99.119.2 with SMTP id s2mr9216380pgc.399.1524248476063; Fri, 20 Apr 2018 11:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524248476; cv=none; d=google.com; s=arc-20160816; b=HOeihZYbSsXD/EfT3g60BgN23NT5ZCVpNbFh7sRKToJy4ttEImbv28LUKVN23IWOVx +nwXrFmu91rMluF/udCwbOrmeN6eJyJM2WY6Bo0J7MDKU5Trh6GcpJM/NwEvb/uC+yDC ZjY5RYXKSKfsu/AS8383eIwZVGpab/B/O+HDM76CJetrDeuqY4wVDj/cGmtg76k5nw8h RhimTFflL9Aizxb8YwZRUw/zPjXcjsT3LL5Ja7xhesa1mv7id4Jn4sfpkLftV2IsHrjl v1QgsAAHru1CDKR3cle4+rHyx5As4Yt05uegVq7nFSWlGqzXBn6o7zxGD0m/4Bg1Vy8j wIJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=FoEph5KNVER9u5CXLuddQeBhLdpUNqSLUzYl6fkvem8=; b=WX4oM/Lsy4nWMNnWd5QMglWeuq5nyHoKLW5y6A/09Jj8jCSMFsvllwNxD7US80gelD Aqb2EYZkE2MYMXSXwBwQc0MEX/+6auilv6FtghUcZObb03fESS+EipGJ8TGOrl1DeYyd +JURUD1gW25kUH02yhUN1xKiWgrwgfXzFS+aDQXdwZRPg37EPPxrM7fPPfHn4O/KGLLL QRXXhvHTi5F1NpYYwmgeNe9kZzVzR4o09BHuVYPB9sDyXn7DQwOvnLy9cmpl/jDmh6Q2 ps7K5wQgCFsrMow1q7i2ohdz/kVV1l/pOrhNTG7GO/bB0XzNE55s72HPSO9YgvN7Vdz5 gycA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si5969778pfh.281.2018.04.20.11.21.01; Fri, 20 Apr 2018 11:21:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753895AbeDTSTY (ORCPT + 99 others); Fri, 20 Apr 2018 14:19:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60640 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753574AbeDTSSC (ORCPT ); Fri, 20 Apr 2018 14:18:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0ED27402314E; Fri, 20 Apr 2018 18:18:02 +0000 (UTC) Received: from redhat.com (ovpn-126-37.rdu2.redhat.com [10.10.126.37]) by smtp.corp.redhat.com (Postfix) with SMTP id 908FE11701C7; Fri, 20 Apr 2018 18:18:01 +0000 (UTC) Date: Fri, 20 Apr 2018 21:18:01 +0300 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Amit Shah , Arnd Bergmann , Greg Kroah-Hartman , virtualization@lists.linux-foundation.org, stable@vger.kernel.org, Tiwei Bie , Jason Wang Subject: [PATCH 1/6] virtio_console: don't tie bufs to a vq Message-ID: <1524248223-393618-2-git-send-email-mst@redhat.com> References: <1524248223-393618-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1524248223-393618-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 20 Apr 2018 18:18:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 20 Apr 2018 18:18:02 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org an allocated buffer doesn't need to be tied to a vq - only vq->vdev is ever used. Pass the function the just what it needs - the vdev. Signed-off-by: Michael S. Tsirkin --- drivers/char/virtio_console.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 468f061..3e56f32 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -422,7 +422,7 @@ static void reclaim_dma_bufs(void) } } -static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, +static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size, int pages) { struct port_buffer *buf; @@ -445,16 +445,16 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, return buf; } - if (is_rproc_serial(vq->vdev)) { + if (is_rproc_serial(vdev)) { /* * Allocate DMA memory from ancestor. When a virtio * device is created by remoteproc, the DMA memory is * associated with the grandparent device: * vdev => rproc => platform-dev. */ - if (!vq->vdev->dev.parent || !vq->vdev->dev.parent->parent) + if (!vdev->dev.parent || !vdev->dev.parent->parent) goto free_buf; - buf->dev = vq->vdev->dev.parent->parent; + buf->dev = vdev->dev.parent->parent; /* Increase device refcnt to avoid freeing it */ get_device(buf->dev); @@ -838,7 +838,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, count = min((size_t)(32 * 1024), count); - buf = alloc_buf(port->out_vq, count, 0); + buf = alloc_buf(port->portdev->vdev, count, 0); if (!buf) return -ENOMEM; @@ -957,7 +957,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, if (ret < 0) goto error_out; - buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); + buf = alloc_buf(port->portdev->vdev, 0, pipe->nrbufs); if (!buf) { ret = -ENOMEM; goto error_out; @@ -1374,7 +1374,7 @@ static unsigned int fill_queue(struct virtqueue *vq, spinlock_t *lock) nr_added_bufs = 0; do { - buf = alloc_buf(vq, PAGE_SIZE, 0); + buf = alloc_buf(vq->vdev, PAGE_SIZE, 0); if (!buf) break; -- MST