Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3819011ima; Tue, 23 Oct 2018 11:47:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV60xCRrfg/qcfBlJuA97XNsaPiXhkS+DaFL0b8S0NOoIHCLozweTcxWnETFOkqJvQSZgcWAl X-Received: by 2002:a17:902:3204:: with SMTP id y4-v6mr44596608plb.135.1540320462556; Tue, 23 Oct 2018 11:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540320462; cv=none; d=google.com; s=arc-20160816; b=ispTf6QHQ8lFZLKExAnrssWT0Ay3kZCMkjUJwGYsGmVxlSO1aZQcFURvW4WeDQX/AF QifjmKWF0HkKzos6yKM37DBf2k2VzgtGljTo5gpy4nUOlC+G0jtgzm/gFnaKppcVnoHG 8qoYIAN8zuC/brcnGqqVypSFC3qIG1eYPZfD3SMlNq7b0epKlqOCZksQ2vV/bCcDek6C ejc/uTAjD6O50qpE+tfZuJ3WsKOTGxDtdB6dh+RQQLCaExInPLspV7lCE/jf3wEYBLUY DoTUMMyxx6KaOjkQib6Cl12ttKOBDav3Da/i4Q+fsOtDdwYYzVc70xLRknBMOGc/ELBK geLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=oMFOQFpTjWP2CnspiclX1Ai7HKrO66rnxWT6zfN2DOk=; b=BKbKXBqKdBNUPkr14afgQLEEOOVfY5Ym59tXdTO7ln7E4X1K3vX/ksrGcGlSPUOHsn sf5ftoWR49+0Wb9g6v3pfT7ldB4k1wy/7V6313wwdTzP3CRpnS5JJjg7yhk+cDKm6yQN 44w7qtGwKJ4dwZ3hIvV9djABtHVbKsw3bUMqEJVGdJXZZ2C4bf7ZD+xR9wvq1CWxMT/p tErBZp5CZuKgFI0EH7nZP7HNc8eWzoQA0QWBMCY+fnny+tXmQfSQyF1Ws/2Y9dVUgLry NJqj+uxGVAaD81pyzr+7FyKiLI5y+TFIJgGDH9nDxLjjefgAigj2c3M+pVU47bT6xdth C1vA== ARC-Authentication-Results: i=1; mx.google.com; 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 x2-v6si1969870plo.259.2018.10.23.11.47.26; Tue, 23 Oct 2018 11:47:42 -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; 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 S1728725AbeJXDL2 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 23 Oct 2018 23:11:28 -0400 Received: from mx01.busymouse24.de ([83.246.107.19]:49084 "EHLO mx01.busymouse24.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbeJXDL2 (ORCPT ); Tue, 23 Oct 2018 23:11:28 -0400 Received: from maskedhost [127.0.0.1] by mx01.busymouse24.de stage1 with esmtps (Exim MailCleaner) id 1gF1ha-000B8Z-4G from ; Tue, 23 Oct 2018 20:46:50 +0200 Received: from SRV177.busymouse24.de (192.168.100.177) by SRV177.busymouse24.de (192.168.100.177) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 23 Oct 2018 20:46:49 +0200 Received: from SRV177.busymouse24.de ([fe80::f87a:2c8c:90ef:d29a]) by SRV177.busymouse24.de ([fe80::f87a:2c8c:90ef:d29a%14]) with mapi id 15.00.1263.000; Tue, 23 Oct 2018 20:46:49 +0200 From: Andreas Puhm To: Anatolij Gustschin CC: Moritz Fischer , Alan Tull , "linux-fpga@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: AW: [PATCH] fpga: altera_cvp: restrict registration to CvP enabled devices Thread-Topic: [PATCH] fpga: altera_cvp: restrict registration to CvP enabled devices Thread-Index: AdRqCJx8+DqNmFX1QmK8kME9tbGkZQA09KeAAAcoCvA= Date: Tue, 23 Oct 2018 18:46:47 +0000 Message-ID: <3773264cdfcb4c258cc7eebd213302dd@SRV177.busymouse24.de> References: <78c44ad0b2344a4490ffd300cf0df746@SRV177.busymouse24.de> <20181023182649.047f1f93@crub> In-Reply-To: <20181023182649.047f1f93@crub> Accept-Language: de-AT, de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [83.246.107.135] x-exclaimer-md-config: 1802f3fe-bc94-4301-9dc2-d59a74e6de3a Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anatolij, > Von: Anatolij Gustschin [mailto:agust@denx.de] > Gesendet: Dienstag, 23. Oktober 2018 18:27 > An: Andreas Puhm > Cc: Moritz Fischer ; Alan Tull ; linux-fpga@vger.kernel.org; linux-kernel@vger.kernel.org > Betreff: Re: [PATCH] fpga: altera_cvp: restrict registration to CvP enabled devices > > Hi Andreas, > > On Mon, 22 Oct 2018 13:15:34 +0000 > Andreas Puhm puhm@oregano.at wrote: > ... > >Full description: > >The altera_cvp probe function only checks, > >if the Altera/Intel PCI device configuration space contains a vendor > >specific entry (VSEC Capability Header 0x000b) at offset 0x200. > > But the probe function does not verify, if the PCI device (and further > >the FPGA), for which it has been called, actually supports the Configure- > >via-Protocol feature. > > > >The PCI device (FPGA) can explicitly disable the Configur-via-Protocol > >(CvP) feature by setting the CVP_EN bit, index 20 of CVP_STATUS register, > >to '0'. > >As the altera_cvp probe function does not check this it registers the > >device in any way. > > The CvP docs says that on some FPGAs (e.g. Arria 10) the assertion of CVP > status can take up to 500ms. However it is not clear whether this delay > might be required after peripheral image configuration and after PCIe > link activation. The diagram describing configuration sequence suggests > that CVP_EN should be polled until it is asserted. I can imaging the > situation that this bit is still not asserted when the device is being > probed. Maybe we should better defer device probing if CVP_EN bit is > cleared? When deferred probing fails again and sufficient period for > CVP_EN bit assertion elapsed, then stop deferred probing and return > -ENODEV? > > Thanks, > > Anatolij Anatolij, thank you for your feedback. My rationale behind the patch is as follows: The CVP_EN is part of the Hard PCIe IP core configuration, and therefore, has a defined and static value right from "the start". Remark in [1, fig 12] " For high density devices such as Intel Cyclone 10 GX, it may be necessary to wait up to 500 ms for the CvP status register bit assertion." According to [2] the Cyclone 10 GX devices achieve proper operation within 100 ms (via the PCIe IP core and CvP). I think (and here the documentation is a bit lacking), that this remark is valid only for other bits of the status register, e.g., CVP_CONFIG_DONE or USERMODE. I also think, that the 500 ms delay is calculated from peripheral + core image programming and that the time for peripheral image programming is far lower than that (i.e., low enough to allow PCI enumeration). But if this actually means that it can take up to 500 ms to program the peripheral image, than such FPGAs would have different problems. I.e., missing the deadline for PCI enumeration. This would need a solution outside of the scope of the altera_cvp module (e.g., soft-reset to re-start enumeration with a stable system). Bottom line: The CVP_EN should be deemed stable when altera_cvp is called, if not, the programming of the Intel/Altera FPGA and PCIe IP core has not been completed in time for the enumeration of the PCI device. Hence it would be questionable or, more likely, would not have completed successfully in the first place, i.e., altera_cvp would not have been called. [1] "Intel(r) Cyclone(r) 10 GX CvP Initialization over PCI Express User Guide", 2018.01.02 [2] "Intel(r) Cyclone(r) 10 GX Device Overview", 2017.05.08 With best regards, Andreas