Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3518944pxa; Wed, 26 Aug 2020 02:36:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIjzmFWMkTEA1+9qXQwgOqPwmKCxpDSqxS9+5mHJDT5GsVqADA683tiUF9yuXu/aXvumcY X-Received: by 2002:a17:906:a89a:: with SMTP id ha26mr11455160ejb.391.1598434573408; Wed, 26 Aug 2020 02:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598434573; cv=none; d=google.com; s=arc-20160816; b=X1+x4DExW8Rsx76AJLSqDUoo/9vd10ICELEklPeEogEmrXLCBHnc6v8GZQuKC6vU2H qnxIMRtUGCZ7u+GJkpNtUajBvu3FA+n0rA3P+G+UxUYm51SRkOm1X3u6aeU2sCIVJ7o/ ngwiA8r+jKOHw3OZ9X3KuReWc2zBGkO4/ayXdQPfhqzJrUeoCSPYOazJz8w81zxAyddS CTpu8DaBVsprTgYNhtTUhjIGckk9dMCzHxJ2XzTYjWX9aVswlm2LVCt2XBrIMNGfy9bm 6hBjCEW+TRD2zz1+yzn4jnts6zlpud3wei+zjc52oFYHMEmiOfmTev9hWdURGcbiCk+E qTqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Q/Rf965wb+Sw5a04reqSF1XECMbRF1raQH2p//xWx4k=; b=MpGJTDZGkpO/zvOPjtxB/ERa11GjYb0tB+6L1WuXj7O77gJ0p+IW58Z5nrVx7Zm6tz 6igW3zutQgto9R6S90h5JB0zdt4+ucS1sl4ou4qaBmEdPG2Az8pJMngbgRT7gv5iLsr7 aBxe+lkbHK5t4hs8jPum/5YtGliLq9E5ZhacVsXO3oXiOwifiCeBNFR6aneThagKvm/X Zkhll4wwXVgfIieMIjFqALCrjE/SF+O2AJAEqOPOo2f9AbvbJutbM8ZZuKjfDipHzCPL QsnESYvifKb2UrXnBHLJTMJD7B9yGiy74eGhVnq73eKiCNls5/nSC2Ep+etRL+5XLL7c DZrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si1221681ejh.517.2020.08.26.02.35.50; Wed, 26 Aug 2020 02:36:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbgHZJe3 (ORCPT + 99 others); Wed, 26 Aug 2020 05:34:29 -0400 Received: from inva020.nxp.com ([92.121.34.13]:42228 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbgHZJd5 (ORCPT ); Wed, 26 Aug 2020 05:33:57 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 821741A1559; Wed, 26 Aug 2020 11:33:55 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 766CF1A08FA; Wed, 26 Aug 2020 11:33:55 +0200 (CEST) Received: from fsr-ub1864-111.ea.freescale.net (fsr-ub1864-111.ea.freescale.net [10.171.82.141]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 291A7202CA; Wed, 26 Aug 2020 11:33:55 +0200 (CEST) From: Diana Craciun To: alex.williamson@redhat.com, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bharatb.linux@gmail.com, laurentiu.tudor@nxp.com, Diana Craciun Subject: [PATCH v4 10/10] vfio/fsl-mc: Add support for device reset Date: Wed, 26 Aug 2020 12:33:15 +0300 Message-Id: <20200826093315.5279-11-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826093315.5279-1-diana.craciun@oss.nxp.com> References: <20200826093315.5279-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently only resetting the DPRC container is supported which will reset all the objects inside it. Resetting individual objects is possible from the userspace by issueing commands towards MC firmware. Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 27713aa86878..d17c5b3148ad 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c @@ -310,7 +310,20 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, } case VFIO_DEVICE_RESET: { - return -ENOTTY; + int ret = 0; + + struct fsl_mc_device *mc_dev = vdev->mc_dev; + + /* reset is supported only for the DPRC */ + if (!is_fsl_mc_bus_dprc(mc_dev)) + return -ENOTTY; + + ret = dprc_reset_container(mc_dev->mc_io, 0, + mc_dev->mc_handle, + mc_dev->obj_desc.id, + DPRC_RESET_OPTION_NON_RECURSIVE); + return ret; + } default: return -ENOTTY; -- 2.17.1