Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2527923lqp; Mon, 25 Mar 2024 01:13:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDd+yGec06BrNmP3LCcpgaOnF/KcFo0CEKtzpaXWnJJklyggPTX4LAIrDD16YxNmWShera0P2D+ENE9kwmX1yOrDb2GUir8SMIXszoDw== X-Google-Smtp-Source: AGHT+IFGfxXeG2UK1W85H17/dM7TwSW1mUZ+DwOGRiMbcbFpTlzZzk0RFy0qo4zB8g0NetVK9sJz X-Received: by 2002:a05:6a20:6b81:b0:1a3:63fa:d0e6 with SMTP id bu1-20020a056a206b8100b001a363fad0e6mr4538552pzb.57.1711354411353; Mon, 25 Mar 2024 01:13:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711354411; cv=pass; d=google.com; s=arc-20160816; b=mboMsMixH+6liFX0oUAf89Cz/DNnIb1jDlX53QGaJmyK8lbsxvS8/KfaHmvwSjMU+a 6sN0TptE+hNn98SowIvn3Gpo/GEtCR3Zg5emFEcXBcZK3WkQUbPdje45lLec0XgVZM4Z FqKae1+7itIqnrV+V7lRK7WNlBSFAE9+zOCFCii46WSpH7Kb4y7Oh7UyDvIcbwOociMq lfypTTyfrioQ4vSpvRxweBsw6IODMuan3L6ofJmqcoIMM3MRKf6JXabb94itzfSSmJOK Ee9XuF4O1FaBRisfJXHDmEL3B/prEQ1+sGppK30zyu9VKtokx8AfE+ifgyfxn1jl5EJY WHeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2FY/ibegmjxa3ybRsysB69FHgpMuG5nPZNoTzg7a0Xo=; fh=NLKCBiMkCEkusqoShKqXo1IBGNU8+2tPLOABJMbhfIA=; b=d+LHyfgX5LM+E0gGJIDqPDBq0yara11VD+2kAbHHDLLH10XbKZUpfpzm+ZjKldcv1X UE/k+HJfiVmJAMG28akBHLwnUn0+NnSx8fTiPK4SgT+bE+5rhO0YLDlBOoJ4U82REeTl g/QD0lRC2wRqYf9ENfj3Ow0aPdonfoMj+AQLDeTAUhSN8m3bI8rhM7ZLyZprisPjFvWS AXlFAUfIMnuN6drVVSYpJnTk7bg+YM/p5QGf92ckjD+O7cqsIUjKntkmBBj+sctYE8hX 8387JJoSY7JD7u+XeZSOaqXfyIvJ749Tti+0JEj0qcSbu4WdiX3LuJ/hEz6bqsh3JOVl XxMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxUsP55V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y4-20020a17090aa40400b0029b99e38da1si7038095pjp.44.2024.03.25.01.13.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 01:13:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxUsP55V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115995-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 09153296857 for ; Mon, 25 Mar 2024 08:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC18439A8D4; Mon, 25 Mar 2024 03:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NxUsP55V" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FC242398B5; Sun, 24 Mar 2024 23:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322337; cv=none; b=Fby+d1oNoxcDGHQV+14Uz3ps6XdoCkko2naRQbGgbmJHG+586mkoTevmjzac/xOK5UJ5r8VSZMmVtiQN1X423ULnmfJrvbunGPGauuz8iW4koLtJNghC0qn04U4tBZ9OA/z2P2IAHUpN35wpppMgh4qc76Vi7ZEIjaqsRcdgOec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322337; c=relaxed/simple; bh=CFci3iPnitWwKX7nQz0R6IUhFkGa3kYzyWMExaZ85mg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W+7iJIHRRAYn8qrGkoGA8ZeijhOf9vUVkQLSDfvkYX4mFrrA9Y2i8DLjXr5x8GW0a+3LTuljXcAwkDnRkx/P4HmxvFVmNR9yxA3VTGWrts6eC4NuGrEoNfiJqdSBsddV4UDHTraQfu//0/u3AXHXxmFER2YlE4qpKkqIJ0/A7JA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NxUsP55V; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50CD3C433C7; Sun, 24 Mar 2024 23:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322337; bh=CFci3iPnitWwKX7nQz0R6IUhFkGa3kYzyWMExaZ85mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxUsP55VU6L7uEAN8lQflJ1YehAIivjlWKuTbzVnFBaB+musgrxuU1upBzk5lAudV rZuD6lhjtuuSEQBA1Em3kziLden6iB1CxK+iNDntL7oa0kgK4HGcWcHhpaS6bd9Q8d 0c4LxrMKtxVUEEjV0JqCrbY1FsKtEM9gyEgreR3KQKiTnwObZVli18FLoQLp8AXq/M onwnaidDKXkgKp4uuvhOfWTMJxJLdfZ1d98rDtOCr/wut659L5R7hxVruM66YBgmk8 w6AkOc/S8Vcqld/WLVqAqMKc4YB5RHuG5gtDbdYVY0b6aEWtcjAw1asQ0IFFAzyxAE uRuzvdAOfLeJQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Steve Sistare , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Jason Wang , "Michael S . Tsirkin" , Sasha Levin Subject: [PATCH 6.1 419/451] vdpa_sim: reset must not run Date: Sun, 24 Mar 2024 19:11:35 -0400 Message-ID: <20240324231207.1351418-420-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Steve Sistare [ Upstream commit 9588e7fc511f9c55b9835f14916e90ab940061b7 ] vdpasim_do_reset sets running to true, which is wrong, as it allows vdpasim_kick_vq to post work requests before the device has been configured. To fix, do not set running until VIRTIO_CONFIG_S_DRIVER_OK is set. Fixes: 0c89e2a3a9d0 ("vdpa_sim: Implement suspend vdpa op") Signed-off-by: Steve Sistare Reviewed-by: Eugenio PĂ©rez Acked-by: Jason Wang Message-Id: <1707517807-137331-1-git-send-email-steven.sistare@oracle.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 61bde476cf9c8..e7fc25bfdd237 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -120,7 +120,7 @@ static void vdpasim_do_reset(struct vdpasim *vdpasim) for (i = 0; i < vdpasim->dev_attr.nas; i++) vhost_iotlb_reset(&vdpasim->iommu[i]); - vdpasim->running = true; + vdpasim->running = false; spin_unlock(&vdpasim->iommu_lock); vdpasim->features = 0; @@ -513,6 +513,7 @@ static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) spin_lock(&vdpasim->lock); vdpasim->status = status; + vdpasim->running = (status & VIRTIO_CONFIG_S_DRIVER_OK) != 0; spin_unlock(&vdpasim->lock); } -- 2.43.0