Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2058015ima; Mon, 22 Oct 2018 03:35:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV613Vz1Nz911rTPTvFAD3fsCbXPtQxkbGI14pqksIIv32iGY/W97qNplhx/EadzaWbOHFBSo X-Received: by 2002:a63:f5a:: with SMTP id 26-v6mr42378548pgp.100.1540204528417; Mon, 22 Oct 2018 03:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540204528; cv=none; d=google.com; s=arc-20160816; b=G+cZU5wLUfA/O4t+zTAYJhLmK19j53DeqmXkj3eKaLel3PyVeZFcQPPX28PXyuc6Es a6u5bsgTe/4KPNyvVUqC4OLiqSvnGMA/nxnOmXTUILcXAz1H+njGe9jdXA1ltroK4XV7 QIaOOufoqe0JmvmO4PYJNNHOl9CRsGh0MHgBINhNoM2EjS3bQUpJf28uiLQ6SJxXp6gW 2ygdywRkns60zCRmIX2TsXsGQ50aX8QBN/Oo067F6df1C8HvM8BJSYnq4hDB7yptnJzT frDkwPquYi7FFFJed8xM89RxaH1bjpqBbleNdgEcwLlRLqaULuqSOW2la3UscanUDY/L Eixg== 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; bh=+vDzutpy4i3aGDuAO9GDJV8l9Toex6uwQ2H12nSR/AU=; b=XCp4sC+kn8GGwBy64wnZ+r3oEQgQGDl98I7eHEG0YmeiGakgDv/7NVEQv3BVGcaMaI i9mh1dEiIiFTAUi3+NwSi7Kj4nF3kJvMSJaG0gFutpN3SO9qtBOfY5d4+tJQnPS5dRaM CDQVAKsJTv50E5Ad1WYAMTJzwbxvCs1LYFxMZx8M3yxo9LbNRA+j494OxUt4PmZYakWU DyxCqqgf7lnIzImCEPtfVPt3Sg6P4BxTbHBszyaH3G7FngL2nAlRNSkYOb8ZL+LqaVEv lto3n5NGLVvC4qzDN2By7JNXjBPpneZyKIMrThdUvBdM4dcIDWUtUhrf1h2amNU7MdFI u/bQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si33741013pgo.144.2018.10.22.03.35.13; Mon, 22 Oct 2018 03:35:28 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728652AbeJVSv0 (ORCPT + 99 others); Mon, 22 Oct 2018 14:51:26 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46222 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728614AbeJVSv0 (ORCPT ); Mon, 22 Oct 2018 14:51:26 -0400 Received: by mail-wr1-f65.google.com with SMTP id i4-v6so5610400wrr.13 for ; Mon, 22 Oct 2018 03:33:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+vDzutpy4i3aGDuAO9GDJV8l9Toex6uwQ2H12nSR/AU=; b=J97eFLqqawvXBYpgOx1ck71z6wT6jxXWpgzNyDPt/GiasSkAoqDbKQU1W6yEgMxeMf zMmKlAjIrn9AT46Fy2mxBJ5yyNKdhdXOE871xalWT0qmpwKBcaXyNyy7Z6+KE4lvoi8a yUJcmy4XWbD6lFUSq+ekfMABLpTS3amBbX29M1dLUO6NUTvreS2IlpBeSWTb99zhqchY gtNFgk5buY7A5zclDQ/GyWX20Ui7cGxayfSntvIgNznZssC1de7FqIT9OD9/Zq23poIs Vu98R6k5YCXwZf6hfJ1TdFBeis8DLw6k+YBfqrZESG2CUC/BJEM885zVoas0qnqyXtgP 9A7w== X-Gm-Message-State: ABuFfojqby5nY+P73BO4J4TzZjhyTubBcFYCKmIiYafQbO5daxpslKPX FAAob6hpo28q5HyXFqyPjSzW/w== X-Received: by 2002:adf:a352:: with SMTP id d18-v6mr45322201wrb.31.1540204406038; Mon, 22 Oct 2018 03:33:26 -0700 (PDT) Received: from localhost ([185.7.230.215]) by smtp.gmail.com with ESMTPSA id a1-v6sm28297167wrt.79.2018.10.22.03.33.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Oct 2018 03:33:25 -0700 (PDT) Date: Mon, 22 Oct 2018 03:33:24 -0700 From: Moritz Fischer To: Andreas Puhm Cc: Alan Tull , Moritz Fischer , "linux-fpga@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [Bug] altera_cvp registers a PCI device (Altera/Intel FPGA) without verifying that it supports CVP Message-ID: <20181022103324.GA6888@archbook> References: <2c6313a3f7c04b70b8a06a50934fe27a@SRV177.busymouse24.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c6313a3f7c04b70b8a06a50934fe27a@SRV177.busymouse24.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andreas, On Fri, Oct 19, 2018 at 03:53:02PM +0000, Andreas Puhm wrote: > Hello, > > I hope the following information is descriptive enough. > If this is no the case, I will provide further details. > > -------------------------------------------------------------------- > 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. > At this point, the altera_cvp module cannot be used to program this device via CvP. > In addition no other module can use the device, as it is still registered by altera_cvp. > > Keywords: altera_cvp module, PCI, Configure-via-Protocol > > Kernel version: problem occured with v4.15, should occur from 4.14+ > > Instructions to reproduce: > Proper hardware is necessary to reproduce this, i.e., FPGA with instantiated Altera/Intel PCIe IP Core with disabled CvP feature. > > Workaround: > It is possible to circumvent this problem by manually unloading or blacklisting the altera_cvp module. > > Suggested Patch: > This patch was successfully build and tested for 4.15 and 4.18 > > Subject: [PATCH] register device only, if it supports CvP operation Could you make this: 'fpga: altera_cvp: Conditionalize registration' or something along those lines? > > This patch is based on: git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tag/?h=v4.18 Put some of the extensive description you made above in the git commit message, please, such that future us will know why the change was made :) Thanks for your patch, Moritz