From patchwork Fri Feb 9 22:30:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 199146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1168008dyd; Fri, 9 Feb 2024 14:32:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFt5AOq/Lv5WjiR/XctqRRJ4TID6A4scbpHFL6Eiy+b72h0/k/O079ufQcyr4g37vrq7nW9 X-Received: by 2002:a17:906:6885:b0:a3b:d8b3:bb6c with SMTP id n5-20020a170906688500b00a3bd8b3bb6cmr301623ejr.12.1707517962394; Fri, 09 Feb 2024 14:32:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517962; cv=pass; d=google.com; s=arc-20160816; b=fzPPfwKVEqsgBBtRi4Ljo2/HnQpUHEffk6mQLH2eKVQcvEkFnhQH2fKngoCGqFWswA j/nnlykr+xKUaLgh9b9zDK6T+vYthpaXygF4pKfoBE+xtesX5zMz8a4xrJtiuSopuV/A 5FNM9ZPds1gyuPZQM/w8/b3lzsTnF8pB/XoWA2glIVyPxEjnJ1e2laYoU2+8BWHck5Lx jdBILEfJZQ5UOYk6LWfZuMndNu9yrd9R7bIkawEgVWDAtbGcrolSyvYx1a+RNlSBEOLv 4yG5uNOmpZ28alGggmwpMFslhL2tiRqq0Ffp7KZddTQ38GpJ+H/7hXjcF1Jeiwrd8k3B 1zig== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=moCCEpVANRkasMFH/GJCYekintrcdpGWHgEyFAi8gvs=; fh=BOy+p9eTNKA9kjMcJx//ZjqWhGkjiGRx7j7nd44Ei/k=; b=yL7p+G6qp9XoN+q3F0fGlDeScg+WgpkDsK7oSlQdx/RhhHJoRw3pD6bb2beeIjjzWW uS8xWjfH/j0nN2w54E2IsDV6CBGlHJwRypv2yz37HqSrBpkMFRyJC6KCd2o9vzR93aXZ yIMRYBbQpqO8SWC7v2tr58DA7mXkLfzxNR+H0PAwGFPBvZGQGFER+VW1w5Emq4LIVsTE 1AAe4SP1DuMAjrJRK3tHxI/mdvxuK8t+fHp0BvujDREf81VEzZ7o7Ny9isCZ0DZSe0D7 MKor0nKAs8Y9CVK6FWpOrhCCcgiFLIDXjl4jz3VbIIxm9T/b4NWmTpSf6ZdVxq4y6N0k gt1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=Qym7PzMa; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-60111-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60111-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com X-Forwarded-Encrypted: i=2; AJvYcCWT++yj4ci0P75gy2WCAaiAwcZYm8Wumeo1LK9pPugK3evw8ChtHeC2zxOfs0ocFlDHjq0zG/NqfN4Bk4VkYsb188M+xg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y10-20020a17090668ca00b00a3c0baad21esi535100ejr.249.2024.02.09.14.32.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:32:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60111-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=Qym7PzMa; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-60111-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60111-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 075FD1F22025 for ; Fri, 9 Feb 2024 22:32:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8E4A3B18A; Fri, 9 Feb 2024 22:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Qym7PzMa" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (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 269E63FDF for ; Fri, 9 Feb 2024 22:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517815; cv=none; b=CyBwDQJOkQClMU9UmrU0H+rj1fenqV7myD6aFVFHekm94VxnDaBDawDozZM36xm+niwLoXSDmx63a+2Hzeyq2E4a4str/4VX9ZtcT1HWmRp8DAsVydUX4UHn0TzvoDIG24ewmbJzblr7eVkUyfALj92VCSO9oMcXo4nlV0Ae34w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517815; c=relaxed/simple; bh=L73hoB9xUTAeRKc4fnAAeVp0lZYHqGJZyHoGKniDhmA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=pHoNKpyP7+F+XfvIhHISdab1YGEKqbe6wzPYVzc08l8SIDdfMIgkM9MWtbOIv2w9oy63XUaE5teR+q5mSzYOhRdsemmJXA2wYLqfjSRvGqCfaWjrKG9UBKYWvovLUHSW3nabadcbOqkvjvy068ke1EMMhVGhCxxlps0VbhtDBeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Qym7PzMa; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 419LnGM0016710; Fri, 9 Feb 2024 22:30:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2023-11-20; bh=moCCEpVANRkasMFH/GJCYekintrcdpGWHgEyFAi8gvs=; b=Qym7PzMa1tGuMCW/Yoafv234yADh7GieVk3eHZ9VPjYEDcONmXZmvu8B/hvW5o0txYrO qo9y/IthY45OFI276HpHzlYH6boSQLkFK602+sIKu4FpbYlutbm9M19RM8kbZmfQB7eV t76dR+G8uYmjvkHMiB1w9WGRPw88wUvKlUAA/CJUKFbsuQyEe8u/VEiRR/XeKQXm1ZkG lJ+tNACnKTYfJAxwE7tsfVtKKLK78eihkMyqC6qyEq3IN6W3K579osKYpssOExt4puGT AP9wsAygaVyC/zP/+tnvNteGBYTSLqLpoCTMbrOYSh12j7lG/zOObPhV65Tt1rBPEusu dA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w5uuxg3vu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Feb 2024 22:30:10 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 419LhasU039427; Fri, 9 Feb 2024 22:30:08 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w1bxcgj2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Feb 2024 22:30:08 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 419MU83E031940; Fri, 9 Feb 2024 22:30:08 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3w1bxcgj29-1; Fri, 09 Feb 2024 22:30:08 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Eugenio Perez Martin , Si-Wei Liu , Stefano Garzarella , Steve Sistare Subject: [PATCH V2] vdpa_sim: reset must not run Date: Fri, 9 Feb 2024 14:30:07 -0800 Message-Id: <1707517807-137331-1-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-09_18,2024-02-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402090165 X-Proofpoint-GUID: BwBz77vBQK_ta7s46YbOE02rI5hx-ukT X-Proofpoint-ORIG-GUID: BwBz77vBQK_ta7s46YbOE02rI5hx-ukT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790462355101535008 X-GMAIL-MSGID: 1790462355101535008 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 --- 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 be2925d0d283..18584ce70bf0 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -160,7 +160,7 @@ static void vdpasim_do_reset(struct vdpasim *vdpasim, u32 flags) } } - vdpasim->running = true; + vdpasim->running = false; spin_unlock(&vdpasim->iommu_lock); vdpasim->features = 0; @@ -483,6 +483,7 @@ static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status) mutex_lock(&vdpasim->mutex); vdpasim->status = status; + vdpasim->running = (status & VIRTIO_CONFIG_S_DRIVER_OK) != 0; mutex_unlock(&vdpasim->mutex); }