Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4085776pxb; Mon, 1 Feb 2021 12:02:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYiC8XXcmGtaipgww5Br2FOEIdyT2qfb3PQWRNFtIzyO9iikC5BmpCM7uOdbtDrEQsv78+ X-Received: by 2002:a17:906:b0c2:: with SMTP id bk2mr19637846ejb.223.1612209756382; Mon, 01 Feb 2021 12:02:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612209756; cv=none; d=google.com; s=arc-20160816; b=U8UDkQrRFbeoc1ZQ2dkdfz0Y6JIGF0k6EMVii2EXC/hfi50zS74gyCFwJ/m0U+Ixi/ w0Fz0Q7fX2v2XlnxaPHLYk15jmSZa5yAn6N1RNua7LPgREseIfD8bhnWKyloL9GqIJTV JIDJvXip26a7i4fggCM8KPJQR8T20HRTvRliNqPNbWFPAyWnrA1756QJKYUXmcpOlieY a/gpN2L7iPfPavWX6NXVZkJJcYNuRdLxsk14Cdr7D6yWQs3xE1EVh9x1Wp8+cidwwjHu ZrADBQUIOl+08mumKEZoTZXgbiTl1XaCa8goSIszs3Y1GdMKyyzosB0teZwuAUM6RKfn Iaug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6+pEZ2sU4Okxi+WU1gPDCbDCdtKwOEBqEUtnhiZE5hw=; b=Pnby1TEyjVWzaQYgHlNGqv4lpMBjePHDZ106qL3GCZ1IzUuRz2dAq02tKhUiKC26LA VQ5B08pHSwnotQ068BHsih9ha/0mfTqPgFIeLy31q28qzjcPc77DUGWHplx9EjUb/oUX 8Tl3BuzczVh62FRbLIIkWyXhZX9zgXKBPw04dnMiHi/QEPOjTDakYTi971q3D7ySGhC7 CtqzJgIUpFEJ25QvDX1bTsQB5yH7j2kDqCZnClMsOmRRBJicnobmqNXmCb9o3+lorPg6 mGIO8ztKJQJVQJOow6NbbY61NClohWsveM13k+wj/qUYRNICidGmj8gsgmAS5etMe08W 63fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=uLG9mLSR; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i8si11824821ejj.455.2021.02.01.12.02.10; Mon, 01 Feb 2021 12:02:36 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=uLG9mLSR; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232959AbhBAUBV (ORCPT + 99 others); Mon, 1 Feb 2021 15:01:21 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:41810 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232729AbhBAUAN (ORCPT ); Mon, 1 Feb 2021 15:00:13 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 111JxBAi023973; Mon, 1 Feb 2021 13:59:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1612209551; bh=6+pEZ2sU4Okxi+WU1gPDCbDCdtKwOEBqEUtnhiZE5hw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=uLG9mLSRsNEx6naVQmYRldVGKxbj0SFXO/iQnjjV/vFVL+glukoN0m1G4wTyPoex+ UZywJHnHxCs0h/P6zoOJGY6KJC8M9jXHRiDpYkbIsOiOMUsjce2sbC/BGNI3T6+JlF WXKi0rrv7g17XaYqoocxtQdX/I4z074llZx8vYi8= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 111JxBuR101774 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Feb 2021 13:59:11 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 1 Feb 2021 13:59:11 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 1 Feb 2021 13:59:11 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 111JwAQh085814; Mon, 1 Feb 2021 13:59:06 -0600 From: Kishon Vijay Abraham I To: Bjorn Helgaas , Jonathan Corbet , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann , Jon Mason , Dave Jiang , Allen Hubbe , Tom Joseph , Rob Herring CC: Greg Kroah-Hartman , , , , Subject: [PATCH v11 10/17] PCI: endpoint: Allow user to create sub-directory of 'EPF Device' directory Date: Tue, 2 Feb 2021 01:28:02 +0530 Message-ID: <20210201195809.7342-11-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210201195809.7342-1-kishon@ti.com> References: <20210201195809.7342-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Documentation/PCI/endpoint/pci-endpoint-cfs.rst explains how a user has to create a directory in-order to create a 'EPF Device' that can be configured/probed by 'EPF Driver'. Allow user to create a sub-directory of 'EPF Device' directory for any function specific attributes that has to be exposed to the user. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-ep-cfs.c | 23 +++++++++++++++++++++++ include/linux/pci-epf.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index 8f750961d6ab..f3a8b833b479 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -490,7 +490,29 @@ static struct configfs_item_operations pci_epf_ops = { .release = pci_epf_release, }; +static struct config_group *pci_epf_type_make(struct config_group *group, + const char *name) +{ + struct pci_epf_group *epf_group = to_pci_epf_group(&group->cg_item); + struct config_group *epf_type_group; + + epf_type_group = pci_epf_type_add_cfs(epf_group->epf, group); + return epf_type_group; +} + +static void pci_epf_type_drop(struct config_group *group, + struct config_item *item) +{ + config_item_put(item); +} + +static struct configfs_group_operations pci_epf_type_group_ops = { + .make_group = &pci_epf_type_make, + .drop_item = &pci_epf_type_drop, +}; + static const struct config_item_type pci_epf_type = { + .ct_group_ops = &pci_epf_type_group_ops, .ct_item_ops = &pci_epf_ops, .ct_attrs = pci_epf_attrs, .ct_owner = THIS_MODULE, @@ -553,6 +575,7 @@ static struct config_group *pci_epf_make(struct config_group *group, goto free_name; } + epf->group = &epf_group->group; epf_group->epf = epf; kfree(epf_name); diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index b241e7dd171f..6833e2160ef1 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -9,6 +9,7 @@ #ifndef __LINUX_PCI_EPF_H #define __LINUX_PCI_EPF_H +#include #include #include #include @@ -128,6 +129,7 @@ struct pci_epf_bar { * EPC device * @sec_epc_bar: represents the BAR of EPF device associated with secondary EPC * @sec_epc_func_no: unique (physical) function number within the secondary EPC + * @group: configfs group associated with the EPF device */ struct pci_epf { struct device dev; @@ -150,6 +152,7 @@ struct pci_epf { struct list_head sec_epc_list; struct pci_epf_bar sec_epc_bar[6]; u8 sec_epc_func_no; + struct config_group *group; }; /** -- 2.17.1