Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5979145ybc; Wed, 27 Nov 2019 12:47:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxBfS+XBPUei34wjmXeu3HkEyG9w6LeGNy2rb7yhBfGqyoZ/pu5A9mXb2RWOW061c8S3rga X-Received: by 2002:a05:6402:546:: with SMTP id i6mr1155edx.242.1574887670649; Wed, 27 Nov 2019 12:47:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887670; cv=none; d=google.com; s=arc-20160816; b=QVKBNon8O2YqtMsGt3wl8vEg6vglqeBW1yfOMZvoVPZxeXZM4+w0aKQ9Q6RpS7buZc en+goPnf1nPqRpNrU+h/P2b82RG+IVa12rqIN6MUfKYNuVttbNkKbHhLpOw1c7GtnX/B AqYzrrcWnRp4RkYrHk5cLxF7IM2OzBpVSvw7kQUKEThNWLoIdsuB4iM1pBDu9n/7s6zA MiQA9xd/RVM01swLHiO5TCGAvz9jW3uWdSOjZfdScGhNNEQHGR4MlOQo7fA9rOqGy8MU O3fOR+6GXHfL1gJH1R8tCI9ofnFSCa2H1qdsJtbFtRrJr7Z7/IYEdSVc+F901enN9XAn WY6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yGHuUbgnhrP7OBn8i9HaBNp3pjtKOyjOG1b7yIjKc4Q=; b=lbyljcmLVNjuWf9d9yu/UlekMO9sPqGbbU77b6/gwoD3SorBX7X2qjy6yx/GkrvBmy 5hl1wf9rSSZIL3cBKuXAC+2sHmMHdR5MZTTx64baZ7eB1VEiFTfhCig95dWcCqjVau9h 0QbN9lO4BMLM4bSNwXRGUzyeaK/Mty2HZx8cmb2IUtnEBSUJQ1cCkFXPjVrvNWhjt1Zb RvAzczlFBCY4NQURWppOUUkqTlTV/2veLJFXN8ongAoQAH+TQ5Z3e0XjupdekM7Lci5E EuHO6JtDXEBPunsavbOiyfyKJZXi+hdYjPumiZ8PB43G+Nt/FPh9AMed2z+ApvuG36M8 pK2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hr2i4D/a"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z40si11411610edz.114.2019.11.27.12.47.26; Wed, 27 Nov 2019 12:47:50 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="hr2i4D/a"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728103AbfK0UpB (ORCPT + 99 others); Wed, 27 Nov 2019 15:45:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:54912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729668AbfK0Uoy (ORCPT ); Wed, 27 Nov 2019 15:44:54 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBB3421780; Wed, 27 Nov 2019 20:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887494; bh=2RQazaZHdMRFzzw+CHytliBKPTuap16KOhaHKyHHtMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hr2i4D/aAHvmS0OtjzDeDibmDkXa524s5nbh9v0i/U72y2ag7+9OJ5eNRGzR4/2YB umvWbfZ5cfXI3/JAewLvB81BQbuuODyFQpZ/PEAZPJCx79b5pHDFlYdsBu6pOXya+6 APKi9iHPtRHXHvYcpFE2rB0KFDdCs/voOiEBpjes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 4.9 133/151] virtio_console: dont tie bufs to a vq Date: Wed, 27 Nov 2019 21:31:56 +0100 Message-Id: <20191127203046.581934430@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203000.773542911@linuxfoundation.org> References: <20191127203000.773542911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael S. Tsirkin [ Upstream commit 2855b33514d290c51d52d94e25d3ef942cd4d578 ] 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. Cc: stable@vger.kernel.org Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- 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 43724bd8a0c0a..b09fc4553dc81 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,7 +445,7 @@ 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 @@ -455,9 +455,9 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, * DMA_MEMORY_INCLUDES_CHILDREN had been supported * in dma-coherent.c */ - 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); @@ -841,7 +841,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; @@ -960,7 +960,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; @@ -1377,7 +1377,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; -- 2.20.1