Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1223650rdb; Fri, 9 Feb 2024 14:32:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUlLHM5qHlrRcHLw5a5wE0ADkEiWwsCPhGpkxP/sqZ4XPTWXjxxbO5MMD4voa/ooHY0EMQCtEsEWyBSQrfsK6pdatjuTu/YvCTPpTVbNQ== X-Google-Smtp-Source: AGHT+IHmvk1OikA27ZEAsh10Hl3sRHjyhmx2hBXLsamhs1fdljXoNvs3BI/bSOgeyOqoA7PmbdLx X-Received: by 2002:a05:620a:2911:b0:785:b094:9071 with SMTP id m17-20020a05620a291100b00785b0949071mr442788qkp.16.1707517929771; Fri, 09 Feb 2024 14:32:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517929; cv=pass; d=google.com; s=arc-20160816; b=B/n2Voud2+Lknh9GnFmLVs45NNgOSkKIIfHfaqPzbmej1cejV/q1zY6gpSxBCuCBSy 9euV/zfN/ZTOg87MtbcYO1OOa6ffn7rR9euPn83jA0YFTviGzzlZLx3gRyztC85zmi+H GWJNd7ya5IwSkRbC4Yya2zSGuRqhk2nUySFy3ipxQzrSJeR21bcQcX0Gj+jzBYa+sEM9 2w/2x/37cZXzt5Pd1R6twodLOO5w6XZ0bncDAcklIO7RDTyFoZzaMUgaoTyp49Y9srBW +Kl5Dx/kLc03Z/O7n2zBUToQu8pImkQLvqoRMPhNAzDvhXWiS6j6knD8nNrdnc7EZMhH to0g== 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=s0m3RONhBuuYD1488q0tsj2Vaijgp+sUXmdY6l8Ots8=; fh=kTNPPdKqEDZA81sVFN9sOYat9tUxjIDjxORD+brKPY0=; b=EySaRUV5eF/THDtd75RGMm51QaJg5bBFLqS6XC5hgAkBz2q11NQDNjH40JxYIDBelB 1Y8i0rONLfJinvqUZyLsDqrPwgQVCMZ2AHPH8LKFwrvlveFiX5RmqrTau5/Ilew5dEh7 HQp0ZdxwoZ0hKut35nkv41k9twxYYA/s6SoS+BYGcdTIF3cwbDbNXyTyBUxonT6ZbO17 IXlFf+U43cu72+GSbQVrPTdeQvO1FLzkHYU50WAn50Gjdm4G7qZQJA+cvNP6u9vpLSCY slz7nd+K5FbrDt7i54T7+0fg63y9+V4WDd0bgW4Onvht5DFSURdKsgonBWbxA6cH/JNB ukKg==; 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=OE55qmYS; 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-60110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60110-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; AJvYcCWnYQabV/2HoN8Zsq67mqY4BgefsHPWH4ESsC3tn5n/yqvWQD2+26SOzha4MGkvV9sXUY5BYRd6AYle0SrwACviGbdx7xsGCZ8Ocik32Q== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y2-20020a05620a0e0200b00785991e7040si447364qkm.511.2024.02.09.14.32.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:32:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=OE55qmYS; 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-60110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60110-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 81C4B1C22CCA for ; Fri, 9 Feb 2024 22:32:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B0F838DDD; Fri, 9 Feb 2024 22:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="OE55qmYS" 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 D51AA374C6 for ; Fri, 9 Feb 2024 22:30:06 +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=1707517809; cv=none; b=uaszx7p08UzNOx8FxwqO15sXVA/L9y/MXzPdDBmoHQrPD2a6d7QsKLVeLmyOg6czFqTZn3zOHWX57iOksmj9muio5mc5hwtFv1X3XAB+BTbsjkhqMSSEG/bio7TA6tQKXeh5Mazo9pHoN70QDEs44mfUUitLIIoyqdH93u2HPsE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517809; c=relaxed/simple; bh=ooUz90FvJ7Ve9JtszMBy/Igkiq4pVXCMiFPkjlO56gY=; h=From:To:Cc:Subject:Date:Message-Id; b=AZ13i4JFo+1uEaAkX7KmU82YvqY1sEgbFKaifqLnybR6hI+ATXclryntjNUrchoAJKE4auab2QND+ipvxovMo6V4ScD2s6MGNrNg/7SEWPaJwAE4GAsz8gjBZXcpkesN8PtS86bl16wwdoyzy0TMmMAk4JfYpy9euKC0uPjoOJE= 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=OE55qmYS; 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 (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 419MTKZd010579; Fri, 9 Feb 2024 22:30:02 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=s0m3RONhBuuYD1488q0tsj2Vaijgp+sUXmdY6l8Ots8=; b=OE55qmYSiGTrZaoWFoc7rlvMso6YEb3gF8ktcFDFCVqVrGluR0srYN5rSMoP+Koan5AD CQsWAC2SzQQhiROSFTpEHS++rNx5gVPX5f5WGfiw7xMusud3gUj33StwxFeAOCBFBMQb BPaO0kBS4TjmpPQhPN/djU/qDneBHhATVh14T8UO4AW0TUa0jYqg3MiYjLL7nQ+tUT0a uTRxyXm73/u/JvBSIW9Kj3cEbTHUluMJhtw/RZATp+lfFLIW7SvpmSoF5I8qz/xgFsAM lKzJ8ZCSPYr7o/mzuHqeJ6MpF31mUxeymsb+g6OXM/CdgDiBtxAjCfxrXveax8sGwXQb qQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w5vvtr01p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Feb 2024 22:30:02 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 419L4QXO019970; Fri, 9 Feb 2024 22:30:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w1bxk3485-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 09 Feb 2024 22:30:01 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 419MU0us010656; Fri, 9 Feb 2024 22:30:00 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3w1bxk347k-1; Fri, 09 Feb 2024 22:30:00 +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 V1] vdpa: suspend and resume require DRIVER_OK Date: Fri, 9 Feb 2024 14:29:59 -0800 Message-Id: <1707517799-137286-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-09_18,2024-02-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402090165 X-Proofpoint-GUID: UF_PWOtqDGzOFjyBCkXV-8xHPbfQRzOT X-Proofpoint-ORIG-GUID: UF_PWOtqDGzOFjyBCkXV-8xHPbfQRzOT Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Calling suspend or resume requires VIRTIO_CONFIG_S_DRIVER_OK, for all vdpa devices. 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..ce1882acfc3b 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -598,6 +598,9 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v) if (!ops->suspend) return -EOPNOTSUPP; + if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) + return -EINVAL; + ret = ops->suspend(vdpa); if (!ret) v->suspended = true; @@ -618,6 +621,9 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v) if (!ops->resume) return -EOPNOTSUPP; + if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK)) + return -EINVAL; + ret = ops->resume(vdpa); if (!ret) v->suspended = false; -- 2.39.3