Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp604674imb; Fri, 1 Mar 2019 09:01:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxlLg9dmPpkhPf0fDPNkG599IIQuKU54TklnKhycI2K7mLNYRzyTkvBZ61YB+jZ2Ldv3Syz X-Received: by 2002:a17:902:ba8c:: with SMTP id k12mr6488012pls.193.1551459677419; Fri, 01 Mar 2019 09:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551459677; cv=none; d=google.com; s=arc-20160816; b=ZdtCRxBg3kKBL8S1BbotOVBbO6q6nGqUEQXFwEl1uTxMh1RjnTkPwhL5VebEmzbF4N EfomlQGCITjlHRnKqx/UXFpaeYVPt5iwo4MbUkU3WrqsBQEJFJ6g00hdjQQtrA9xcAlw OYEH1jhiaS8mZ8v8653xaiF+JZ4wWatldPn9y9nqxgEF42MsRAPFGNYsZHONW8tr7hpP WJKfDEdUxq5IZ1BXReBB4Gsu4FIjv1+RxSdm6xrgmCdNZuL7VddQEkB/HWUXdZteGxMj JNK6DVV8sAPE82GkKdcBfbR/F5slaOFCISxmoqzTkK+b0WDKzGGkXGsA9vweIVXCfejq w18w== 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=AaLEDUDdhYlgZsYyWMbsTinbtGWxeyB7niro7fD5UiI=; b=MqP+tYrzuJpQ5Wa0Hlsi46iA3WJDPZf6jcdvXSeEwlh9Z1v0oLe6/KRYq1HrC4hu6G 7TZIVxJYSX5UX8AfRqmnwsUTUzLUPiSllHQz8dMvOYmzkkIFmZfy1BFdeSBa1FrwQX16 Y+WdfnrTXjgIWDlgFhU3rB8fRH9J+3abRjlRp7ryj/Gy/3uyjsYWRaFA0ANeGBrto4IP x3j1VGQxJErPM8K7aFmnSkffGUs/nYgZPQTyhrkVWTYgH+pPfgOJEjk1a8Iu04I9p6VK MQGp6ztXco1g9CnQVAEQT95wQheViI5Q/lTAUW/2RtBeJ+Q2SJllRlPVQu7BS4ruW+Mp cWjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EUyX9Zkf; 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 z186si19716019pgd.477.2019.03.01.09.01.01; Fri, 01 Mar 2019 09:01:17 -0800 (PST) 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=EUyX9Zkf; 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 S2389304AbfCARAG (ORCPT + 99 others); Fri, 1 Mar 2019 12:00:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:36474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389182AbfCARAG (ORCPT ); Fri, 1 Mar 2019 12:00:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 D3E2020857; Fri, 1 Mar 2019 17:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551459605; bh=L5vtetHrEy9oal9REsCsxQSvlO9Q456lbnteWlGnOIQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EUyX9ZkfolsvavE0N7lY29W2RxFT9Hr72sJ/v4ojB5iRXvjP3h1xbagIBJEyBlC6e IphJVjq3Fz80Y0q/RgeWLeHp7UGPGXDgQLHY+1qqLFuZG5G0xEu5rZh7b3bsd4j6md F3jKzp2hgo8NqFUe2KvxNCIjCtGK2bVDLe5h0Fco= Date: Fri, 1 Mar 2019 18:00:02 +0100 From: Greg KH To: Parav Pandit Cc: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "michal.lkml@markovi.net" , "davem@davemloft.net" , Jiri Pirko Subject: Re: [RFC net-next 1/8] subdev: Introducing subdev bus Message-ID: <20190301170002.GB24452@kroah.com> References: <1551418672-12822-1-git-send-email-parav@mellanox.com> <1551418672-12822-2-git-send-email-parav@mellanox.com> <20190301071727.GA8975@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 01, 2019 at 04:35:46PM +0000, Parav Pandit wrote: > Hi Greg, > > > -----Original Message----- > > From: Greg KH > > Sent: Friday, March 1, 2019 1:17 AM > > To: Parav Pandit > > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; > > michal.lkml@markovi.net; davem@davemloft.net; Jiri Pirko > > > > Subject: Re: [RFC net-next 1/8] subdev: Introducing subdev bus > > > > On Thu, Feb 28, 2019 at 11:37:45PM -0600, Parav Pandit wrote: > > > Introduce a new subdev bus which holds sub devices created from a > > > primary device. These devices are named as 'subdev'. > > > A subdev is identified similarly to pci device using 16-bit vendor id > > > and device id. > > > Unlike PCI devices, scope of subdev is limited to Linux kernel. > > > > But these are limited to only PCI devices, right? > > > For Mellanox use case yes, its limited to PCI devices. > > > This sounds a lot like that ARM proposal a week or so ago that asked for > > something like this, are you working with them to make sure your proposal > > works for them as well? (sorry, can't find where that was announced, it was > > online somewhere...) > > > We were not aware of it, mostly because we are either on net side of mailing lists (netdev, rdma, virt etc). > ARM proposal likely on linux-kernel, I guess. > I will lookup that proposal and surely see if both of us can use common infrastructure. > > > > A central entry that assigns unique subdev vendor and device id is: > > > include/linux/subdev_ids.h enums. Enum are chosen over define macro so > > > that two vendors do not end up with vendor id in kernel development > > > process. > > > > Why not just make it dynamic with on static ids? > > > Can you please elaborate? > Do you mean we should use something similar to pci_add_dynid() with enhancement to catch duplicate id addition? I have no idea what I wrote here, sorry :) I was trying to say something like "using an enumerated type going to rely on a central authority for your "dynamic" bus, why is that needed at all"? > > > subdev bus holds subdevices of multiple devices. A typical created > > > subdev for a PCI device in sysfs tree appears under their parent's > > > device as using core's default device naming scheme: > > > > > > subdev. > > > i.e. > > > subdev0 > > > subdev1 > > > > > > $ ls -l /sys/bus/pci/devices/0000:05:00.0 [..] > > > drwxr-xr-x 4 root root 0 Feb 13 15:57 subvdev0 > > > drwxr-xr-x 4 root root 0 Feb 13 15:57 subvdev1 > > > > > > Device model view: > > > ------------------ > > > +------+ +------+ +------+ > > > |subdev| |subdev| |subdev| > > > -----| 1 |----| 2 |-------| 3 |---------- > > > | +--|---+ +-|----+ +--|---+ | > > > --------|----------|---subdev bus--|-------------- > > > | | | > > > +--+----+-----+ +---+---+ > > > |pcidev | |pcidev | > > > -----| A |-----------------| B |---------- > > > | +-------+ +-------+ | > > > -------------------pci bus------------------------ > > > > To be clear, "subdev bus" is just a logical grouping, there is no physical > > backing "bus" here at all, right? > > > Yep. that's correct. > > > What is going to "bind" to subdev devices? PCI drivers? Or new types of > > drivers? > > > Devices are placed on subdev bus using devlink interface. And drivers which registers using subdev_register_driver(), their probe() method will be called. But it's just a virtual mapping, what "good" does this provide anyone? You are still sharing the same backing device here, what does this logical split buy you? > So yes, those are PCI vendor driver. > I tried to capture this in cover-letter. > At present users didn't ask to map this subdev to VM, but there is very high chance that once we have this without PCI SR-IOV, they would like to extend to VMs too. > So in that case devlink will have option to say, add 'passthrough' device, and in that case instead of vendor's pci driver, some high level vfio type driver will bind to it. > That is just the anticipation, but we haven't really worked out this fully. > But this model allows to do so. I think mfd is what you want to do here, instead of creating your own bus type. > > > +int subdev_add_dev(struct subdev *subdev, struct device *parent_dev, > > > + enum subdev_vendor_id vid, enum subdev_device_id did) { > > > + u32 id = 0; > > > + int ret; > > > + > > > + if (!parent_dev) > > > + return -EINVAL; > > > > No root devices? > > > I didn't get the comment. Intent of this check is subdev must have parent. Parent type doesn't matter. You do not allow a subdev to sit at the "root" of the device tree. That's fine, it was just a comment, it's your choice. thanks, greg k-h