Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3263600pxu; Sun, 11 Oct 2020 03:27:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVSL84Jbz+2zyJWjLsk21WXiFsMhyQaMozSdxQJHOzCWOiQCu1DhkFd/dl2BI1yTUI1TtG X-Received: by 2002:a50:8e43:: with SMTP id 3mr8701739edx.178.1602412055113; Sun, 11 Oct 2020 03:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602412055; cv=none; d=google.com; s=arc-20160816; b=UyAK05URddSlkt0sd7lMb8EXyWtMd1WYHE/Ignkpnlx3ckqHcXQsmKDwckp9xVrNu8 w9kGq6UdmUBei64zdcNp6yyGkrwg4nAWowaAy1mk9WXw1LyMNi7RH7HTfy+5AthA8C9u sOTStlw+3Dj1NIFoZiBXmAavISpyteX+X3YabRJhCNidgbO326PM0vTXz1bHs3ZT5deG nipVa3qUqbtRRC7RerTx/BWG3lKm03WfqVoHOk24Ewf1VA5vmz+TxEYtIYezvNuqOP5y NcmaVGyxN9bTShqrLBTOe84Tb3SYIp3ejlD9AvDU5eSi08WhrfosbVu49WwuJqFdwnK4 G+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=bpTY/19B0CDH9zVrgG82JXhZ+L19dEoW0NN8qYH+ph0=; b=AabdLrjCN81P2qz2rh49t4GpNTEYJR6QPBtZGXARcGIFemvH+3QiJPVtRdnYd2whbm vA54zXaPI/JbKqcdtQsDnsXXZYcYQYSYWftaAl9RVXTF9S0wBiNrb6Zu2P0UvfI54rel 5A5CS11FxDRjW5bvlzDYfcEjIy1gWI/+lhKZRcVp+a81rmtdvHYpCryrV8D5ZPWvGN2t V/y0s3ARw1g4PT91zOYb5KbmC0YEnCNPr2zHC+3F+4k0TWUXe20cpNr3pQXrkGoEHRKT shz6SRaaeg088pe4LEGwXWf8gSPFIpuhDOXF0EmNJo3Z0RB7vJW8R+IMnZn8ItNGlkyZ IlIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y3HaPF7b; 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 mj7si10169981ejb.531.2020.10.11.03.27.12; Sun, 11 Oct 2020 03:27:35 -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=Y3HaPF7b; 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 S2388130AbgJJWx0 (ORCPT + 99 others); Sat, 10 Oct 2020 18:53:26 -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; >