Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2755159iof; Wed, 8 Jun 2022 11:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdsBlU96a/iv2RJYH3l3816nPBpp8zKMKm+2zogxmhpDkAnSdUlo3J6tecrGPF9Nl7BsvK X-Received: by 2002:a05:6402:125a:b0:431:34c8:4805 with SMTP id l26-20020a056402125a00b0043134c84805mr26426462edw.314.1654712320447; Wed, 08 Jun 2022 11:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654712320; cv=none; d=google.com; s=arc-20160816; b=Y75/Lpun33QrYofuOEr4k9nKeM+KjxiDQBVicX0pxhJrEPbgeKKvUHH+allw5Yk+rG XRD90jwfmlFe/7uPzkQsm14sQoKfem755jIc8vGEgrKSNnHMwRUO9+rWvf2VPC82Y8Ms g/ikmKXhP4ecGoogtnItdNSY6NrUMdAqj5fr30lhCJcR+xWqErSUt5kdzwJ3/1tUbEmb A7S9HQLmri/leTIZmPQ8aIjEsz2VLHIptjBiEVpNwOp6OzYkVbm7dN/YBbr7vRqR2+zj pki4YmZl+Df6eXQjTtNFdUojaSq/NCY2ApfT4ylmH+w0/1+sA+zmq6+ALOdvM/tb0MQ8 nS9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=egiLLKGdpV2llxCKr0nnUtNRcHSTkDD/C9StjqhJwTA=; b=J7TnkPqkLB0LX/3ImSM8quNauwB0Ybn34Dhe3ifei+0fihxxhaSO8esprpOnZvsz9J 4QjAuUAbEGxzYs+gg0gj9ZyGSomofyNMjSLQFfDC7aRzxRAAksPMk1qkoOFRkTnD8LuS mA4oq3KTBn5ws7FsquFtlMHV/YDtVJ6/hR7nNCi1n4ql3Vvvkc6s3RwfOLhF/TWRROsu ceoTNP5TCTnO7HIKdEg/BisDkaYtMVPZH491cDqJZA6zqloqQPta0wVoInbhi3NfRBKY Uk1Yv8KrmJM2W8M3z8EyJwmJFs+i4C/7Z36+xiYvB0+j3Bq2Ps2jo0ikdrZQ77asg2jB hgCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=k1sfvISH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh43-20020a1709076eab00b007108d0c6eaesi4559820ejc.1008.2022.06.08.11.18.00; Wed, 08 Jun 2022 11:18:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=k1sfvISH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231167AbiFHRW7 (ORCPT + 99 others); Wed, 8 Jun 2022 13:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbiFHRWm (ORCPT ); Wed, 8 Jun 2022 13:22:42 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 805A524A685 for ; Wed, 8 Jun 2022 10:14:22 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so24451381pjo.0 for ; Wed, 08 Jun 2022 10:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=egiLLKGdpV2llxCKr0nnUtNRcHSTkDD/C9StjqhJwTA=; b=k1sfvISH2Sdwc1FIPhi3BB/QRohqYKpauU1UWP0WMUSa2pVAd2t/OWq8UizdfKJ1Gs 0cEF2PM+PZEo4VgS7QP1/IfcIgk37/IS6d/g2aBxi6nz6zcDHOmE4AbzYBxv6TO7+6Gs dVdZDMAuSjNREJGGvzoIeG30ETbSwWUMdn/yr0lE88yCP7ur3M0Y1jO9eqA3rxjE8blQ wuX5g+Z0l3X+Ee3pkCLb1twGLH9iBL4LQSA2zQTimczmbnNVXNkjYorwyapf78W/3yUc 72c154e3w8K1kNFavpAJlAVOw4EyDrma+OX0pYxYDpYhVqPsb/zTYi5BdfdRDHxSTb3N 834A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=egiLLKGdpV2llxCKr0nnUtNRcHSTkDD/C9StjqhJwTA=; b=OvGNdMy6ailMOD5t/yhnWC8QObZLhvZW9R7wGFa4n5y3dgrpmcTZi2UrkztCjIE7os s1s6Rcx16vvkVMvaDCX7ns9nGUltbeEhXa/ChmtMmz5jLREl4MxOJOlGXtcAMhN+UI3n J7/5SU8xM1ugoV/YLl44LBAu7UAKV4ghZR1657OKxAj/g0juH8/IKST1755qWOlJYjLR /PJfh9xqQ+INxvZbnw5QDeSjwoSOJBRefKPaMIQFUzMD7Grmh/e+AErf4J4GvhNmVLF3 I7HwaKPeNQ+r9MDfB6wDSjy/s6H2jDUfwJOhpUzyFiZJXXFsYcmtqtxZ9jlQJywGZEMt oVHg== X-Gm-Message-State: AOAM531RTDhx4AlH4r/OG2NbwT8ZM1HYBW4ddgV6bqMLhUq/AcRm+qey wYBya/cYiUcU81DnR/zPA4obGA== X-Received: by 2002:a17:902:ec84:b0:167:6f74:ba76 with SMTP id x4-20020a170902ec8400b001676f74ba76mr20402231plg.17.1654708461912; Wed, 08 Jun 2022 10:14:21 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([122.162.103.97]) by smtp.gmail.com with ESMTPSA id t7-20020a17090a4e4700b001df4b919937sm16803986pjl.16.2022.06.08.10.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 10:14:21 -0700 (PDT) From: Anup Patel To: Bjorn Andersson , Mathieu Poirier Cc: Atish Patra , Alistair Francis , Anup Patel , linux-remoteproc@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH] rpmsg: virtio: Fix broken rpmsg_probe() Date: Wed, 8 Jun 2022 22:43:34 +0530 Message-Id: <20220608171334.730739-1-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The rpmsg_probe() is broken at the moment because virtqueue_add_inbuf() fails due to both virtqueues (Rx and Tx) marked as broken by the __vring_new_virtqueue() function. To solve this, virtio_device_ready() (which unbreaks queues) should be called before virtqueue_add_inbuf(). Fixes: 8b4ec69d7e09 ("virtio: harden vring IRQ") Signed-off-by: Anup Patel --- drivers/rpmsg/virtio_rpmsg_bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 905ac7910c98..71a64d2c7644 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -929,6 +929,9 @@ static int rpmsg_probe(struct virtio_device *vdev) /* and half is dedicated for TX */ vrp->sbufs = bufs_va + total_buf_space / 2; + /* From this point on, we can notify and get callbacks. */ + virtio_device_ready(vdev); + /* set up the receive buffers */ for (i = 0; i < vrp->num_bufs / 2; i++) { struct scatterlist sg; @@ -983,9 +986,6 @@ static int rpmsg_probe(struct virtio_device *vdev) */ notify = virtqueue_kick_prepare(vrp->rvq); - /* From this point on, we can notify and get callbacks. */ - virtio_device_ready(vdev); - /* tell the remote processor it can start sending messages */ /* * this might be concurrent with callbacks, but we are only -- 2.34.1