From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C773C433E7 for ; Sat, 10 Oct 2020 23:15:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06ECF20760 for ; Sat, 10 Oct 2020 23:15:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y3HaPF7b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388138AbgJJWx1 (ORCPT ); Sat, 10 Oct 2020 18:53:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51471 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731295AbgJJTHa (ORCPT ); Sat, 10 Oct 2020 15:07:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602356849; 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=bpTY/19B0CDH9zVrgG82JXhZ+L19dEoW0NN8qYH+ph0=; b=Y3HaPF7b4HIFtRLgmxnTUC1YCTOH2Xr+JifWgUgzpJIpmlwblGcQm2KfGDeEGT869vGbrC 2XR8mWCHJ5lXeGmnSBMt7pxRaWVJ7TSapZMu3lZYc/1gT4JDjQB2x5LVqHsVN6PpUjO0YS QhlD+OMYOYuzD2gfscVv/gmyEBPFrsI= 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-302-Uu6AbL9YPpihCWJcaW9g0A-1; Sat, 10 Oct 2020 13:50:44 -0400 X-MC-Unique: Uu6AbL9YPpihCWJcaW9g0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 624FC107ACF6; Sat, 10 Oct 2020 17:50:43 +0000 (UTC) Received: from [10.36.113.210] (ovpn-113-210.ams2.redhat.com [10.36.113.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E82BF5C1D0; Sat, 10 Oct 2020 17:50:38 +0000 (UTC) Subject: Re: [PATCH v6 10/10] vfio/fsl-mc: Add support for device reset To: Diana Craciun , Alex Williamson , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bharatb.linux@gmail.com, laurentiu.tudor@nxp.com References: <20201005173654.31773-1-diana.craciun@oss.nxp.com> <20201005173654.31773-11-diana.craciun@oss.nxp.com> From: Auger Eric Message-ID: <829321cf-0d95-c72a-dbd6-8fc034d8bba8@redhat.com> Date: Sat, 10 Oct 2020 19:50:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20201005173654.31773-11-diana.craciun@oss.nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Diana, On 10/5/20 7:36 PM, 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 Reviewed-by: Eric Auger Eric > --- > drivers/vfio/fsl-mc/vfio_fsl_mc.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c > index d95568cd8021..d009f873578c 100644 > --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c > +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c > @@ -217,6 +217,10 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, > return -EINVAL; > > info.flags = VFIO_DEVICE_FLAGS_FSL_MC; > + > + if (is_fsl_mc_bus_dprc(mc_dev)) > + info.flags |= VFIO_DEVICE_FLAGS_RESET; > + > info.num_regions = mc_dev->obj_desc.region_count; > info.num_irqs = mc_dev->obj_desc.irq_count; > > @@ -299,7 +303,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; >