Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3634692pxk; Tue, 29 Sep 2020 02:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5NadAye5uRmvgTA285ZC4+YYpPtyNNgJkFzYHbHzCj7rbjqY/iyTJ4x7iVIjt2sR1V8Xf X-Received: by 2002:a17:906:288d:: with SMTP id o13mr2899661ejd.195.1601370349422; Tue, 29 Sep 2020 02:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601370349; cv=none; d=google.com; s=arc-20160816; b=pWQ4L3qLkGszwSs7MN6npQHdNVEENA5tsh5dztYZYbFXAw0cfkKNqmk32Knb2+Su9n ySsWoq7XM8eJj5zwyPyc2fg40pBVGA1RJiF74RaQw1jwB3GzN0tr0C1pE1M/bneQP4Zh uK6ynbIFH8SWKMgodbdW1JgVD9LwswpTPuKfTk8n8giy4ooRwPPAW3q1s7jYGuGmy+Lh WgPVJfp1GDyPTMGHHc+Ord5G6ckPrVCTC++nWnagfU/22OpFtBTTR8X2SY+8arMOXnLF LetRD+NVoGlxdpJcDoWSooRPp2Q024jnU0+cvQc8/MS8c3ji7Ko6ZcgQ5Riz5MUoVC0N Sjdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=eKHzuxS7ZP6J1Z8JGqN7OagP3nQ3homsGE6UKoIGvKM=; b=QVOXhYLGgylmQg9s3+ok5eqO0jdnSKBNISlthq7EXLiChahciqycB1j6vxfIteFm9z 4KNZRdjLCEJMetS6Qpeu3MTYbsqiEY9OGGJd4bGoInYSynVBYMyaAOy3qo2wT6szYJs1 HwdUC7uVOt5WSck9vFJbzgWwL/q7UBiul4QTqMhiYgODhQd28ikCoAv7mNm9RQOMRBDY +7PBUhJitTkz6PkgJGzG5z/C3kT4M8g2/p4OxqYH01ZZUAM10Dcw2J3mMrH/6OAIRw2S Oa/945Q4WqltojoePgyilFwwNX2MH8UvMymVz4nzSawodt3PozELInHp+anKwCyLyLJA oMvw== 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 b23si2250659eje.20.2020.09.29.02.05.26; Tue, 29 Sep 2020 02:05:49 -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 S1728055AbgI2JEO (ORCPT + 99 others); Tue, 29 Sep 2020 05:04:14 -0400 Received: from inva021.nxp.com ([92.121.34.21]:41342 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbgI2JEB (ORCPT ); Tue, 29 Sep 2020 05:04:01 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3F89F201191; Tue, 29 Sep 2020 11:04:00 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3D18A2001CE; Tue, 29 Sep 2020 11:04:00 +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 DC1B02032C; Tue, 29 Sep 2020 11:03:59 +0200 (CEST) From: Diana Craciun To: alex.williamson@redhat.com, kvm@vger.kernel.org Cc: bharatb.linux@gmail.com, linux-kernel@vger.kernel.org, eric.auger@redhat.com, Diana Craciun Subject: [PATCH v5 10/10] vfio/fsl-mc: Add support for device reset Date: Tue, 29 Sep 2020 12:03:39 +0300 Message-Id: <20200929090339.17659-11-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929090339.17659-1-diana.craciun@oss.nxp.com> References: <20200929090339.17659-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP 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 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 0aff99cdf722..e1b2dea8a5fe 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c @@ -299,7 +299,19 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, } case VFIO_DEVICE_RESET: { - return -ENOTTY; + int ret; + 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