Received: by 10.192.165.148 with SMTP id m20csp4159039imm; Mon, 30 Apr 2018 12:54:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr4JRzENgl1LBLHje4sjcpffe2CWlkHA/B4dog+cZh29NGba5ei2bOlkvhjyQW3bLXAG2jk X-Received: by 2002:a63:6406:: with SMTP id y6-v6mr10970603pgb.205.1525118068774; Mon, 30 Apr 2018 12:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525118068; cv=none; d=google.com; s=arc-20160816; b=JM4oOkTvvhr4Yrput9Uxa/JwOFs1Ug7GDEHTsD0sVis/3LZhnHq7jEOaCaudXzCKsO NZsXUVfTZptz5cvKYQ/dEJhSoCZIq1Df/Fc7ivbQGdoQWBNXwi3Iuqtux2145X98MMF9 AVpcJNEpp7tmlWYAvySDQKmnEWQmXZetmx/aVqgbCl0bsXuMrf2WuiDVoF0ZPsrQNliT EaYEoW+dSLCQWcCNzKX5PuizGYYzrzp5SJTMTsD0okRxHzp2NIIAsMWAlE5KHeDnGVrD 2Zf+t2gyIpu5/fx4V2vDu9WSuPdVJ1EeXiCWtp2lhLJ5Xp6kDciSssE7loaXPojnn1+a MiWw== 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=GYgGUbD3XG/E9LG7ckVJeKs9lFqA6zckexaanj3nW4M=; b=qn4JCBhney2RUokLJ3MhkN6bN7JzuMd0+wiwjKaqRUnKsGj0JIchWEF02zLVjQ3LkJ ZFaf8lvcGqBN8PUgFSGq7BgIhy9f8g87gsVhJJN7IVptgyK5S7uxO3o9yJ2mKCtlpgmt msDJe69Lc8WDFMj82dvN6/s6CFaEODB0oB415R2tOpzhjd1gsgtTNAmIuw0ZUnvAQ8ud zkV1ZEJsRB61nu5Jbyv98EaYuJHMhXZGTvgyLAC71iz7jqQBta0Q3ukWWLpC1I9jKPIi 87lE4mfiOuSG3mC21y/44WQF2RODxdY8AVeLVvKH/lYNoF/ztw0w8e5FlcTJ89XeVuKA 1NGA== 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 f5-v6si2535949plr.247.2018.04.30.12.54.14; Mon, 30 Apr 2018 12:54:28 -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 S932254AbeD3Twd (ORCPT + 99 others); Mon, 30 Apr 2018 15:52:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:35220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756134AbeD3T2D (ORCPT ); Mon, 30 Apr 2018 15:28:03 -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 BA28822DC1; Mon, 30 Apr 2018 19:28:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA28822DC1 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.16 025/113] virtio_console: dont tie bufs to a vq Date: Mon, 30 Apr 2018 12:23:56 -0700 Message-Id: <20180430184016.139579045@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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.16-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;