Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1194779ybi; Wed, 3 Jul 2019 11:08:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0WkxooRwdATqE/hqc8N5YLNYOJM/HIL4nOE0SGTTZl3eTJ/loeO5LM88JKDRsjvsrqaB2 X-Received: by 2002:a65:4844:: with SMTP id i4mr21732243pgs.113.1562177320693; Wed, 03 Jul 2019 11:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562177320; cv=none; d=google.com; s=arc-20160816; b=cBdy6UWPEGd3ty/zRw0cBzlON/RbhFd9a0DlA0tepZjAs/dq/l/Yj1bGDkoHIdy7MG zw8Kx1pV0ija0p4+aWKNGn/4VxBtrRUxWCTmgFpIYkHp0OEeIxdqcpd83leRyjjhSANV MNugfHDP+NdGijq1KfSpr7LLfEhXRXXTseLkyKnSBN8OjJz8uYJ/kp4kfDhJ/UXiQtHB UZnO3DopRn54AwE+hupi308YbTNtAp4fhlunb9G5rvLpCMcR/5iMIWqU84L6a1pGUh82 RZWyF1xNwJ8GJySOsMedf5VZkXco4WnHouis/O7504Yt0z2IXu+xJceQEIGvUHnnz1xF igcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OVsB6OcyCWYuZrPK7+HOANLLikFPofST0N47s6fEDMM=; b=cE6IMHo9gOnvdkUzv4x6molHUiTFi2kXmxiIZfjV9bBbqH8uskC8CquXl8IQ6pmy96 MVDS5cqQhyPBQ9qxoyj6tkTakAUkeSy/ad5GdR6a7Xqbkm6pscVCq1smXommRTtAXNkD hzN1LMes0YzTCq0QkuXkxaiXWNhbEAF4Gktnan1GMo2PogPwJhNVOgczTXnLyM0vxQtX R5/cw6miffNVFoSmxSC8IpjodP9buKWBQ0RQlQOZ56RrgMTOZAMtGeJphbbeL2CXPpZM 5LJdDdfLv9S7spigbpX1CRHd0173h2nWsk09poXwz3TJbMUPA8pVzSyFamYAYuSW0Wns 4lgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fBBCK7og; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t70si2895690pgd.573.2019.07.03.11.08.25; Wed, 03 Jul 2019 11:08:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fBBCK7og; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727016AbfGCSH5 (ORCPT + 99 others); Wed, 3 Jul 2019 14:07:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:36274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfGCSH4 (ORCPT ); Wed, 3 Jul 2019 14:07:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E29B120659; Wed, 3 Jul 2019 18:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562177276; bh=ZxI9gMDVDvOvvdaFk/4FqawZmpkLnN9reXrQQEldQl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fBBCK7og15DSyF/hOj2RnfgNRUSXku173qRIunFe/CHFoGjzefwa0z5F7vH8glKEd HFGwlyQ4kUdP+spPljGC3ojj533UJgKIRefjIlVgDprO+HcMoJGxZqLWEb3l+tKlVf JDlhw9ig0jIKywgEkhCmI+Pl6STPdn3HaYgXeRBw= Date: Wed, 3 Jul 2019 20:07:53 +0200 From: Greg KH To: Moritz Fischer Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Wu Hao , Zhang Yi Z , Xu Yilun , Alan Tull Subject: Re: [PATCH 06/15] fpga: dfl: fme: add DFL_FPGA_FME_PORT_RELEASE/ASSIGN ioctl support. Message-ID: <20190703180753.GA24723@kroah.com> References: <20190628004951.6202-1-mdf@kernel.org> <20190628004951.6202-7-mdf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190628004951.6202-7-mdf@kernel.org> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 27, 2019 at 05:49:42PM -0700, Moritz Fischer wrote: > From: Wu Hao > > In order to support virtualization usage via PCIe SRIOV, this patch > adds two ioctls under FPGA Management Engine (FME) to release and > assign back the port device. In order to safely turn Port from PF > into VF and enable PCIe SRIOV, it requires user to invoke this > PORT_RELEASE ioctl to release port firstly to remove userspace > interfaces, and then configure the PF/VF access register in FME. > After disable SRIOV, it requires user to invoke this PORT_ASSIGN > ioctl to attach the port back to PF. > > Ioctl interfaces: > * DFL_FPGA_FME_PORT_RELEASE > Release platform device of given port, it deletes port platform > device to remove related userspace interfaces on PF, then > configures PF/VF access mode to VF. > > * DFL_FPGA_FME_PORT_ASSIGN > Assign platform device of given port back to PF, it configures > PF/VF access mode to PF, then adds port platform device back to > re-enable related userspace interfaces on PF. Why are you not using the "generic" bind/unbind facility that userspace already has for this with binding drivers to devices? Why a special ioctl? > --- a/include/uapi/linux/fpga-dfl.h > +++ b/include/uapi/linux/fpga-dfl.h > @@ -176,4 +176,36 @@ struct dfl_fpga_fme_port_pr { > > #define DFL_FPGA_FME_PORT_PR _IO(DFL_FPGA_MAGIC, DFL_FME_BASE + 0) > > +/** > + * DFL_FPGA_FME_PORT_RELEASE - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 1, > + * struct dfl_fpga_fme_port_release) > + * > + * Driver releases the port per Port ID provided by caller. > + * Return: 0 on success, -errno on failure. > + */ > +struct dfl_fpga_fme_port_release { > + /* Input */ > + __u32 argsz; /* Structure length */ > + __u32 flags; /* Zero for now */ > + __u32 port_id; > +}; meta-comment, why do all of your structures for ioctls have argsz? You "know" the size of the structure already, it's part of the ioctl definition. You shouldn't need to also set it again, right? Otherwise ALL Linux ioctls would need something crazy like this. thanks, greg k-h