Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3080995rdb; Tue, 13 Feb 2024 06:27:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkUb2q+TVeA7me5fdaHbCbw8y05iP2dIgaIVr+3MoXLSUWe4O33QydOsJsLVRF780EI6qjmidCAUkJqJIa/Zf780m0lSjUddq8G4LmMA== X-Google-Smtp-Source: AGHT+IEHsUvRLDAYmVmBfIXwfsg1at3XyHzKs2d9ztMwsfR3fw1Zj9TlTorwEWrYV6CTElICZg0E X-Received: by 2002:a05:6a20:c706:b0:19c:9013:8aff with SMTP id hi6-20020a056a20c70600b0019c90138affmr8735960pzb.34.1707834430338; Tue, 13 Feb 2024 06:27:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707834430; cv=pass; d=google.com; s=arc-20160816; b=e2f0CeMGo8tsShZHX3/IIpWPSviL3aQ6XojwT85z8HbQDl5LjqustOhf9a0vM4WuJr bjZq5FC+IofP5CQLKlI3/HI26VXTyHWFriYoGSu73LC648Ayrn3YynVYPob48to3uhKb pLQuYJ8WJo3konfsZPBCbqBqJu5sJnCofAG62+dKBiMaPUM0G4+PbNZuCP3/8ZVH5LUB Zd+Uy/UPcUCnPdU0XZecqYX4FQPG8unY7/aqnvOxAAHYof1QRrIf8+C776E1Sqk1FBr2 yQl0G7VUgIbz8yAUNc5tsHQlf/WomIp69sAHmd6zTS6p5zPWFrchqBC3AXI/+8M6QNVx 2S2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=xn+jQYpVDm0LrE2BS/+92v/4tL5PF4w1LwRpKfG4228=; fh=FyIpfX88P2JgU6Q4N0Sb35OaaRKuhxp0QH4moa7QA/w=; b=fsCM3vic5Mng52mnpSn8vGMsp5zo7IzwkHeoi+6uHWp4+APc2wnGKtjB/fSYmTzJqg D13Gdo/vnX6VpKWa7sgOE7eVbVx/6ENso+9Q4iwdw5GEfxJPn98/GZEIX0ckEBvnA4ow zxOOfhD8bXoyTiDvcfl5S3VpGgH8+YBjsEASxbTyKY53dPmxahEmp1JAYS45AaA8mN/v duwY0b+S4OOjYm7Ol3lCnKLV05EWPOrRhCyDuJh1BCg5oONp4nGGdf9S9ke+eCsX5Am1 Sh/wCC6NwZxa5oKtjga9Dfdly+lKdZcu0LjEzkTpTFg49rfHU7TmPoyEZkOR0T4R18hx iTDw==; 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=m4wwgZrR; 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-63672-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63672-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com X-Forwarded-Encrypted: i=2; AJvYcCWUWMhOatZak6LrLRHST1gc0D7wrfUMcA4sBRV+AVYhNqTNAefNCnY+En9lCJLae+KBjX+JVoODRLgV1LJRR5nS6eYZnkF4qnzLgPlaFg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cl7-20020a056a02098700b005cdc07fbef4si2169965pgb.736.2024.02.13.06.27.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:27:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63672-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=@oracle.com header.s=corp-2023-11-20 header.b=m4wwgZrR; 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-63672-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63672-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8E10128B015 for ; Tue, 13 Feb 2024 14:26:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEE1658122; Tue, 13 Feb 2024 14:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="m4wwgZrR" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.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 71DC958108 for ; Tue, 13 Feb 2024 14:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707834367; cv=none; b=IDtDrpIoTQDBPk5rZ0R/NRsoAtp1S1syPhN2KBGYJR0V/jtdd8oECEk4qavbc6tIBwApmj+ajZBw6kMvsEZKGRDcOqIw5QnXxl7tGrvL+29NQmc3V0rRiZPfLTAgrWGnKE7suby5Pipt10xV14vCb2CSJNlEE09zlgi3/2zwEuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707834367; c=relaxed/simple; bh=5Sxu7vk0RgDuyxfPAVYOqd8ty37LyCj1c00JhxqqCsw=; h=From:To:Cc:Subject:Date:Message-Id; b=bNMfNzuU3hA6rd//JN/h3m2a1mY1spXYf/awflTgUGIJ7znYg6KMDdgq82rX5bmWFK35+9yznFGNA8JDK/kQ1g5JUfIkqetKDkxDX8bqbeE4LBF0WWoD+7ibE0B5VOQxA964OxWuj+X7t2EblG6CKws0gcGY4eU1QZGxMUlNVJ8= 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=m4wwgZrR; arc=none smtp.client-ip=205.220.165.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 (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41DE1e2R003550; Tue, 13 Feb 2024 14:26:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2023-11-20; bh=xn+jQYpVDm0LrE2BS/+92v/4tL5PF4w1LwRpKfG4228=; b=m4wwgZrRO/vJsAVAP9JvnxBG8a2Ec8fIysDW7PdExgWKlRdM3HR7ZnbjxFEORv9VapYr 3rlzZlUnd6HexgXStnVjdCA8krlqZuSrqXEARafBTspAUCC7Bt+oo6wocNMkeHUJ6plr s1FLaeY3UmxCVsBy8XHzpEmCQUq3SHajzjXhdyz2PpOW66MyJLWrNiBPzMp+YzHC1c0Z YjVHuZJdM5A5Fv1oRgUepM0Tu88TOMuTQ2wFRVqkjAYRah5W5AQSYyTLUPtDXPLRlbcC hv3Gx+5hDyV31VTYfp8NrWDfF+c26rKNK/OAsHE7bcgjt7we5ReV8tIcBAWTVYsGnnzg cw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w89tm82jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Feb 2024 14:26:00 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41DDDpH0015119; Tue, 13 Feb 2024 14:26:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3w5yk7dj41-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Feb 2024 14:26:00 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41DEPxE2036697; Tue, 13 Feb 2024 14:25:59 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3w5yk7dj34-1; Tue, 13 Feb 2024 14:25:59 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Si-Wei Liu , Eugenio Perez Martin , Stefano Garzarella , Steve Sistare Subject: [PATCH V2] vdpa: skip suspend/resume ops if not DRIVER_OK Date: Tue, 13 Feb 2024 06:25:58 -0800 Message-Id: <1707834358-165470-1-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 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-13_08,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402130114 X-Proofpoint-ORIG-GUID: ZRIAUdXa9O3X2mLqtThzhFrXMtU4y15M X-Proofpoint-GUID: ZRIAUdXa9O3X2mLqtThzhFrXMtU4y15M Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: If a vdpa device is not in state DRIVER_OK, then there is no driver state to preserve, so no need to call the suspend and resume driver ops. Suggested-by: Eugenio Perez Martin " Signed-off-by: Steve Sistare --- drivers/vhost/vdpa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index bc4a51e4638b..aef92a7c57f3 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -595,6 +595,9 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v) const struct vdpa_config_ops *ops = vdpa->config; int ret; + if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) + return 0; + if (!ops->suspend) return -EOPNOTSUPP; @@ -615,6 +618,9 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v) const struct vdpa_config_ops *ops = vdpa->config; int ret; + if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) + return 0; + if (!ops->resume) return -EOPNOTSUPP; -- 2.39.3