Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1597503pxk; Fri, 2 Oct 2020 13:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww9g1M9WYpB8kXErb7hrutQ9KLMtuGiQhUS6lcGT00IzqWZywEn3yal/CgRqriQgUyrMNL X-Received: by 2002:aa7:dd16:: with SMTP id i22mr4633803edv.335.1601671920458; Fri, 02 Oct 2020 13:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601671920; cv=none; d=google.com; s=arc-20160816; b=Z9hwE8qsdE+7rH6gMJZrY0bOL2pKJd8mq8lBeny46i7km4FXAVtmqB/WoE+RQPt08c ix67p+unj1/xqexanJilZv30BE0+YB+6BnYnXlAVEb7t7ESt+1njTfVMmVGkeXw35td2 O/q1+XqsS76ERP6ax066rTUyVlp1VozTyzfHd+m0D8s7gHaHHwQb9cM2ZLyA3Dlj7gsm zk+ZpgByntvfIAFGoprD2n75ZD8ZwleLsIfgBW+/GVzhE/kieT7CkH0TuZYkKj22U6xu 8IyFht+uRcrC2+kIswGWphetlmg1q97T1VINrmQjQlbMggMsENYLJEZhGOpUAkf0E2cx 8Sfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=ppiftakzyBBrl92VlbgA0nk1YkhmL3NI1QLA+tO7wYc=; b=kh9sZrmXNOMZPjPZWl+GeIqscq9M9k2bCTqIeDgjLJ6ZeWxKtHcfvE6A0z3VXmEO2n XKEH6FLZmyzfs6t6kQBQkEH3IDBZBih7H1KZNduQmKKG+vH4wNdXMS/ejuy5FgdPV5c5 BA0MLBuS5HbZs6sc1b/GB6pThCnkXyWv5Kiag0KPMIbgyuP9iJSVI+dqbhtrjQR3eUsM Eg9RW2GQnBRllYbC3AlX+YAVwn+ycw4uWkim22QO3SxrKG3DY6rQLMoscTsKRnKtXho4 gaL+zHjFqtir00BEMO7kSV4BKOKUXqPRf2nVDUg5uIkCseRPxfY6/pqPCFwjMjWbxJbz RYQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OHgU8Nuq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si233448ejc.459.2020.10.02.13.51.38; Fri, 02 Oct 2020 13:52:00 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OHgU8Nuq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725648AbgJBUuf (ORCPT + 99 others); Fri, 2 Oct 2020 16:50:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27058 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbgJBUuf (ORCPT ); Fri, 2 Oct 2020 16:50:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601671834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppiftakzyBBrl92VlbgA0nk1YkhmL3NI1QLA+tO7wYc=; b=OHgU8Nuq0byGN2XSRlt06MpX2Ad6+0WKT3RFjdNTUOLmNBo7Jjtx5mOh1JC+rSW5tEJUwK Z9I4tmdZsmoG5cqEyQFMT31RtkKPa3+BO5XBRhjJ8DIyQnFpGzr64J6Yeagss7/P4bAtog NxSvALdbapNprbh+dnO1pmxsITDed8U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-dYdmsqkhOJav0D66QukkzQ-1; Fri, 02 Oct 2020 16:50:32 -0400 X-MC-Unique: dYdmsqkhOJav0D66QukkzQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B1B9802B7F; Fri, 2 Oct 2020 20:50:31 +0000 (UTC) Received: from x1.home (ovpn-112-71.phx2.redhat.com [10.3.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3686E5D9D3; Fri, 2 Oct 2020 20:50:28 +0000 (UTC) Date: Fri, 2 Oct 2020 14:50:27 -0600 From: Alex Williamson To: Diana Craciun Cc: kvm@vger.kernel.org, bharatb.linux@gmail.com, linux-kernel@vger.kernel.org, eric.auger@redhat.com Subject: Re: [PATCH v5 10/10] vfio/fsl-mc: Add support for device reset Message-ID: <20201002145027.35519087@x1.home> In-Reply-To: <20200929090339.17659-11-diana.craciun@oss.nxp.com> References: <20200929090339.17659-1-diana.craciun@oss.nxp.com> <20200929090339.17659-11-diana.craciun@oss.nxp.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Sep 2020 12:03:39 +0300 Diana Craciun wrote: > 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; This should also result in setting the VFIO_DEVICE_FLAGS_RESET bit in vfio_device_info.flags for the appropriate devices. Thanks, Alex