Received: by 10.192.165.148 with SMTP id m20csp4868133imm; Tue, 1 May 2018 05:24:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4/BfrYA0fBYMGwFnDtQUFP+SCezFsSHdb0AeZblvVrymD73I38WZBFkpbrlDYlliUuEB9 X-Received: by 2002:a17:902:1025:: with SMTP id b34-v6mr16084107pla.324.1525177478287; Tue, 01 May 2018 05:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525177478; cv=none; d=google.com; s=arc-20160816; b=tlQuIHKUXUUzKYmpe//8QffvqEdvudxQ/PS4IAZ23PHzExbWC5S578CQ9mx+SqV3jw ypgi87bey1ycXUJXK4xqcNxIAwx5N5mRxS21KFtz/z5Q00m7lr2vdUpWBHRtty/jT950 zwQcI90uybFagkpaQxR6S/yVtcrV2+trFV9NUN/vhs3WPLJziREX+wxuFNOr28AplXOu 321WsNjHCN/tXS0MOb6TUb4YvX5TIk8eqp/E8WtnFqFNbY2RVLZOGE8NKjMpS9/AvuRD AHfIpO6x5xeQWWrnUtsjZFyS2e7/sri/YPlOvEmt8rqPR7rllv9PEWiCZlkYEcBuJHrd kv4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=ZjTHZqKHckAMVr+a6BPYJQl3kcuQ2qmGGOdPULkCIzs=; b=Osj/A67Abmcw/jbngPm342Rba0yBIG3xnuMS1NGOVJnZiitgHiepnKZS+zwJ+XGeZP tsWxSnPKxAZA8wZsKyExCHi9g/B2bs40AKJ+wWTYtOnlKahociqvo0mYApOEaL5Gq/Sf WkPG+0Q11kw55HP5tqP+ZLt8s3g/AUJEBSjYGbbgDBcLm21r2YMCwXjxo5wLgvIhLK0x IDg1cqfK2m9O7g0RM/oTWPXoEAKaIh8cVwEpdoqIJkp+HzA+q12UKhmuhGj2LjyJoNxK PHaNUf0Z6tx7zJOpESyIGoFFBXeXG86CoDuesZnxUmR/SplPunVHLDBWM13WjbsmM8qv hRHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SMC+tGpQ; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f35-v6si9250737plh.193.2018.05.01.05.24.22; Tue, 01 May 2018 05:24:38 -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=@ti.com header.s=ti-com-17Q1 header.b=SMC+tGpQ; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755044AbeEAMYL (ORCPT + 99 others); Tue, 1 May 2018 08:24:11 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:55670 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754734AbeEAMYJ (ORCPT ); Tue, 1 May 2018 08:24:09 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w41CO3Bc007940; Tue, 1 May 2018 07:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1525177443; bh=a6fVIX6JlEtmsGEGTt8rivpNGm34lS5jgZX59JQTIxw=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=SMC+tGpQ/6EsDbtjyNhcCIms5Q/JGXIqt0drwwOrlJwdadL7pYO/X8fXLAHRcLvVh 87bx+JFFFZtChE8Y9C21K1QOymdlD/4omLOgggbibhmgomU4x6/aKtqh5w09z2xnHo rrl0pYWLLxTaDq0duKwZA+4xVKQwKp3geEpW1u08= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w41CO2Gl011815; Tue, 1 May 2018 07:24:03 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 1 May 2018 07:24:02 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 1 May 2018 07:24:02 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w41CNxdT017249; Tue, 1 May 2018 07:24:00 -0500 Subject: Re: [PATCH v7 3/9] PCI: endpoint: functions/pci-epf-test: Add second entry To: Lorenzo Pieralisi References: <20180426165605.GA6370@e107981-ln.cambridge.arm.com> <20180501115417.GD19391@e107981-ln.cambridge.arm.com> CC: Gustavo Pimentel , , , , , , , , From: Kishon Vijay Abraham I Message-ID: <5d625d04-38fe-7d5a-67fc-5ea92039474c@ti.com> Date: Tue, 1 May 2018 17:53:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180501115417.GD19391@e107981-ln.cambridge.arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lorenzo, On Tuesday 01 May 2018 05:24 PM, Lorenzo Pieralisi wrote: > On Tue, May 01, 2018 at 03:37:47PM +0530, Kishon Vijay Abraham I wrote: >> Hi Lorenzo, >> >> On Thursday 26 April 2018 10:26 PM, Lorenzo Pieralisi wrote: >>> On Tue, Apr 24, 2018 at 02:44:40PM +0100, Gustavo Pimentel wrote: >>>> Adds a seconds entry on the pci_epf_test_ids structure that disables the >>> >>> "Add a second entry to..." >>> >>>> linkup_notifier parameter on driver for the designware EP. >>>> >>>> This allows designware EPs that doesn't have linkup notification signal >>>> to work with pcitest. >>>> >>>> Updates the binding documentation accordingly. >>> >>> Valid for all the series: use imperative sentences. >>> >>> eg: >>> >>> "Update the binding documentation accordingly". >>> >>> not >>> >>> "Updates the binding documentation accordingly". >>> >>>> Signed-off-by: Gustavo Pimentel >>>> Acked-by: Kishon Vijay Abraham I >>>> --- >>>> Change v2->v3: >>>> - Added second entry in pci_epf_test_ids structure. >>>> - Remove test_reg_bar field assignment on second entry. >>>> Changes v3->v4: >>>> - Nothing changed, just to follow the patch set version. >>>> Changes v4->v5: >>>> - Changed pci_epf_test_cfg2 to pci_epf_test_designware. >>>> Changes v5->v6: >>>> - Changed name field from pci_epf_test_designware to pci_epf_test_dw. >>>> Changes v6->v7: >>>> - Changed variable name from data_cfg2 to data_linkup_notifier_disabled. >>>> >>>> Documentation/PCI/endpoint/function/binding/pci-test.txt | 2 ++ >>>> drivers/pci/endpoint/functions/pci-epf-test.c | 8 ++++++++ >>>> 2 files changed, 10 insertions(+) >>>> >>>> diff --git a/Documentation/PCI/endpoint/function/binding/pci-test.txt b/Documentation/PCI/endpoint/function/binding/pci-test.txt >>>> index 3b68b95..dc39f47 100644 >>>> --- a/Documentation/PCI/endpoint/function/binding/pci-test.txt >>>> +++ b/Documentation/PCI/endpoint/function/binding/pci-test.txt >>>> @@ -1,6 +1,8 @@ >>>> PCI TEST ENDPOINT FUNCTION >>>> >>>> name: Should be "pci_epf_test" to bind to the pci_epf_test driver. >>>> +name: Should be "pci_epf_test_dw" to bind to the pci_epf_test driver >>>> + with a custom configuration for the designware EP. >>> >>> The link between the "name" and the device created is quite obscure and >>> reading pci-test-howto.txt certainly does not clarify it. >>> >>> In pci-test-howto.txt an explanation should be added to the configs >>> device creation paragraph to clarify it. >>> >>>> Configurable Fields: >>>> vendorid : should be 0x104c >>>> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c >>>> index 7cef851..4ab463b 100644 >>>> --- a/drivers/pci/endpoint/functions/pci-epf-test.c >>>> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c >>>> @@ -459,10 +459,18 @@ static int pci_epf_test_bind(struct pci_epf *epf) >>>> return 0; >>>> } >>>> >>>> +static const struct pci_epf_test_data data_linkup_notifier_disabled = { >>>> + .linkup_notifier = false >>>> +}; >>>> + >>>> static const struct pci_epf_device_id pci_epf_test_ids[] = { >>>> { >>>> .name = "pci_epf_test", >>>> }, >>>> + { >>>> + .name = "pci_epf_test_dw", >>>> + .driver_data = (kernel_ulong_t)&data_linkup_notifier_disabled, >>>> + }, >>>> {}, >>> >>> Should not this be a property derived from the controller compatible >>> property instead of the test device name written in configfs ? >> >> pci_epf_test is an independent driver on its own that operates in a layer above >> the controller driver. So it does not get the controller compatible (which is >> used in controller drivers like pcie-designware-plat.c). pci_epf_test uses >> "pci_epf_device_id" which is _similar_ to "of_device_id" used by platform drivers. > > I understand that, the problem is that the independent driver depends on > features of the related controller driver as this patch shows. This > patch basically says that if you use a specific path in configfs (that > includes pci_epf_test_dw) your device has specific HW features (eg > linkup notifier above), that obviously depends on the platform HW not on > the string you use in configfs. > > What I am questioning is a) if I understand this right and b) whether > this is the right approach. Your understanding is right. Ideally pci-epf-test driver shouldn't have any HW specific configuration. But different HW have different configurations and pci-epf-test should be informed of the configuration the HW supports. configfs is just one way of creating epf_device and it was mainly added since pci-epf-test cannot have a dt entry because it doesn't represent anything in the HW. The other option was to have a callback to EPC driver to get the features it supports. But a particular feature that is required might be specific to a EPF driver. I find the driver_data approach in pci_epf_device_id to be more clean. Thanks Kishon