Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1513212ybz; Thu, 30 Apr 2020 00:16:23 -0700 (PDT) X-Google-Smtp-Source: APiQypLTwRMD0Y747AUGGH6jdOKV0uybrUOqTQ/VeL/sNw4Aw1G3CsudjYSTLYAYe7miVWdGX972 X-Received: by 2002:a05:6402:1b91:: with SMTP id cc17mr1370109edb.46.1588230982880; Thu, 30 Apr 2020 00:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588230982; cv=none; d=google.com; s=arc-20160816; b=WcpPdi1PzJzpg0Y6PDc6KTzpX5Ig0euQ0ZOiT2Uv2vdgFGWJvtSMRWssXj4AeZZwaq 3CO9Ew6D2r/Yipri022dai1inkNRP+pUDScX/i8LNd0f87i7q8XO82q45juz8IzjLvNd 8UXLeFXu7IVaOjhejVPl0mTH5o//0rnim+bL+SBOVOUraTQl0pTHEx3m4xJtZu1RK6O2 VZwsqexwVVMAk6kjLMBG2BZeNyJ7kZCu8i6BG5pRiWYCkfQ37hQTk6rDoxfPAznJeoo7 y6x3wnISm9aQbSWkA4qimWAxoZjWtzSPdge93WVZU2HFibBWQu4wIOG/zyFL7+TIDhMt 8TXQ== 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:ironport-sdr:ironport-sdr; bh=DsCc3hmTYDoxkG3Dosvkki88mTmsm0Jbjq0koe0aLSo=; b=ENDaYjuzIvTn0w/hMGmlNvfI2WHsgl60CAUnlIhvhzAFEwkV/JzUe8W9qbK6o9ofg3 IVzr+e6pB91Q4YVMES9U2RBbhlhRYq4DZ4+8Tq5i3wW/dhBknDfME4QZfEW6ZF9SeYiZ +qC1zzOkmQece/Z5eGvP14YjUAhUJ77rL5NGTv5rbmjoH6/EGA0pqMJ3z7ILwomWqxK7 AtGyqEFqX6C4c9LxNWhJ4MLnG0V+P67r15w8JH3LEVtO9f2wQ3vKazLf3vqGU/V4EJEi IV7shd9sodzBvbHhNUcmDruILoWxK7YuaBXRAZObkfCt2+pkZLKdv8ASSO5UIamr/B36 gPxQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si5141586ejm.358.2020.04.30.00.15.58; Thu, 30 Apr 2020 00:16:22 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbgD3HMA (ORCPT + 99 others); Thu, 30 Apr 2020 03:12:00 -0400 Received: from mga17.intel.com ([192.55.52.151]:62850 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbgD3HL7 (ORCPT ); Thu, 30 Apr 2020 03:11:59 -0400 IronPort-SDR: zIhMdhHpwuhMbIax0Hc/mkjk0Aa6hPeSl1PYaY2VJABA3Pxk1/4BM9ahyMzvAaAVdc8ZDzA3Yv DHlmC8YuCDSg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 00:11:58 -0700 IronPort-SDR: C0A6tRiBbpq82fp2h6tIIO/ByrLbb/xDotajYFIx7MY7VuRtVYhIhdzXbXsJEjuNjfvnXsKQQ3 cdhohQm9uDCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,334,1583222400"; d="scan'208";a="261681955" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.141]) by orsmga006.jf.intel.com with ESMTP; 30 Apr 2020 00:11:56 -0700 Date: Thu, 30 Apr 2020 15:09:03 +0800 From: Xu Yilun To: Moritz Fischer Cc: matthew.gerlach@linux.intel.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: How to update a piece of flash for FPGA firmware? Message-ID: <20200430070903.GA31302@yilunxu-OptiPlex-7050> References: <20200428050135.GA27416@yilunxu-OptiPlex-7050> <20200430031210.GA6168@epycbox.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430031210.GA6168@epycbox.lan> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Moritz & Matthew: Thanks a lot for the comments! It helps a lot so we could keep working on right direction. For "next boot" or "rescan" case, it cause rebuild the fpga-region. So maybe we don't have to model it in fpga class. Yilun On Wed, Apr 29, 2020 at 08:12:10PM -0700, Moritz Fischer wrote: > Hi Matthew, Yilun > > On Tue, Apr 28, 2020 at 03:06:07PM -0700, matthew.gerlach@linux.intel.com wrote: > > Hi Yilun, > > > > You raise some very interesting questions. Please see > > my comments below. > > > > Matthew > > > > On Tue, 28 Apr 2020, Xu Yilun wrote: > > > > > Hi, > > > > > > I wonder if an updating of FPGA Flash (but cannot reload) could be > > > implemented as fpga-mgr? > > > > > > I have the pcie based FPGA card. The bitstream for FPGA static region is > > > stored on flash chip. Board will load the bitstream to FPGA on system > > > power cycle. The flash chip could be accessed through "PCIE -> ... -> > > > Flash update engine -> Flash". So the update of the FPGA static region is > > > basicly updating the flash chip through PCIE and rebooting system. > > > > I think you mean power cycle when you say "rebooting system" above, but > > your point is worth highlighting. During this flash update the > > FPGA is actually fully configured and running its application. Typically, > > during a fpga-mgr update of the static region or partial reconfiguration > > region, the actual contents of the fpga region is "changing" during the > > update. > > Yeah, this sounds more like a flash driver with MTD or maybe NVMEM? > That's probably how I'd do it. Depending on your (Q)SPI controller you > might already have a driver for that, and you'd just have to instantiate > it as a sub-device. > > > > > > > > > Should I implement the flash update engine as a fpga-mgr device? On one > > > hand it is just a flash write, FPGA functionality is actually not > > > changed before reboot. Does fpga-mgr requires bitstream takes function > > > immediately after write_complete()? On the other hand, the flash write > > > do affects FPGA static region on next boot. Operating on the > > > corresponding fpga region makes kernel fully aware of what is being > > > done. > > > > When an fpga-mgr is used in a device tree overlay flow, one gains > > the benefit the enumeration of the nodes in the overlay after the > > update has completed. > > I'm not sure how to model 'on next reboot' part. > > > > > > > > Actually the FPGA card do has the capability to reload bitstream at > > > runtime. But it will cause the whole PCIE device lost, static region is > > > also destroyed. We need to rescan PCI to get it back. So I think > > > basically this is the same case as system reboot from FPGA's > > > perspective. > > > > Yes, on those cards that have the ability to power cycle themselves (i.e. > > fully reconfigure the FPGA from flash), the PCIe connection to the card > > is broken because of a surprise link down PCIe error. As you say a PCI > > rescan (i.e. re-enumeration of the entire card) is required. Since > > the card has to be re-scanned at the PCI level anyway, there may not be much > > benefit to using the fpga-mgr in this flow. > > Agreed. > > > > I wonder if these kinds of more disruptive updates are better suited to > > something firmware updates rather than fpga updates? > > Yeah. > > Cheers, > Moritz