Received: by 10.192.165.148 with SMTP id m20csp4177230imm; Mon, 30 Apr 2018 13:15:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqwnrdzg+hwU6E6FufzZS8nYw8pT4VbF7D6lWQy84xBYOC77GU6B4i2KFeiDLhh5Zyr9B7P X-Received: by 2002:a17:902:8a81:: with SMTP id p1-v6mr14144806plo.183.1525119314931; Mon, 30 Apr 2018 13:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525119314; cv=none; d=google.com; s=arc-20160816; b=HrirkOIQyoOC96z7xazquwSdCNcYNfpSysHxU9u57OJK/1SXiNA/nv+q+rd/z1vq7o ldjVuJhwjT5JN4jnRxcumgsVjaC45EowyCFXED0k7fvC3CA217IMeq55Syu1Nqm4SIyD GEPW63RlXiWsraYuYjudmHqcXwUHNfUoy6YQEwxngPK+X36g0ZS59+4/pLVw9bgjGneP 9MWB7dWH3NP9ufErwFKyUdz5/1wzgalQ0/vV4QjCpCvXwIOAIW/Nz3jrONq2aAXbmb8s PvLn8B+Xz9ZVIuueuwcFHyYmL6Ydb9v9jd0b+9SpM/nfoYzGQsw/8u3lZDX4od+/rmck 2VwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=+h0Va9S7975yoTsZqUb2VnHjB01h0dX+1uZRtkIM24o=; b=mxtVOw439VN2tVF2z3maZpRu9ZmxhsHwbvZG4Fm0plQT8lVFdUG6u+gA84dD5Bvn8B MuaEVmB2sPBowT2bspfzE1nQjLqk8TXzF3S0Z2xDoibEpJjHx/0ruAJnmnI0Mob9c8qr IiO577ohq6JYeXad+jIhNBxP56rKhfSNsqMD72HHgVsh5ybZOLaLX80Nh1tE/KSdaArW 427dIszjevCCaC4Wn6GgeF65aqzgGy04l1LA6Tw0Lyxr8qYjrzz5GOtrbSILyP7IheP4 UR/D2i4eWTzp9Luvi4hgxgT22/+qy1kFn4MA2Bx6eXN/6Jhl2GnbV3rEKYf9eJ7oULVS I8kg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13si4270358pfg.140.2018.04.30.13.15.00; Mon, 30 Apr 2018 13:15:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755903AbeD3UOu (ORCPT + 99 others); Mon, 30 Apr 2018 16:14:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:33176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932112AbeD3T1E (ORCPT ); Mon, 30 Apr 2018 15:27:04 -0400 Received: from localhost (unknown [104.132.1.102]) (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 DCDA722DC0; Mon, 30 Apr 2018 19:27:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDA722DC0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" Subject: [PATCH 4.14 23/91] virtio_console: dont tie bufs to a vq Date: Mon, 30 Apr 2018 12:24:05 -0700 Message-Id: <20180430184005.403756809@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael S. Tsirkin commit 2855b33514d290c51d52d94e25d3ef942cd4d578 upstream. 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: Greg Kroah-Hartman --- drivers/char/virtio_console.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- 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(str 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 fi 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(st 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 vi nr_added_bufs = 0; do { - buf = alloc_buf(vq, PAGE_SIZE, 0); + buf = alloc_buf(vq->vdev, PAGE_SIZE, 0); if (!buf) break;