From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D50CC4332E for ; Wed, 18 Mar 2020 21:58:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDE492076C for ; Wed, 18 Mar 2020 21:58:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bCwcLd/d"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="iXspVkpn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDE492076C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fa6SC1F1gN8ykhsb+UJTttw4LOc6ZHBZR0vtfVHB6iE=; b=bCwcLd/d5qs1yy 3njRnZFCYpWhYjPPWVY6liKrJ8l/PvBznEcvHdqer6XZ+bAeQbTcu2AtuWlTGP2RuCLdnaIVD+vZK FKG4CNVCOeADy8bGFWACH42qAUBnc5TvKPHQA6VYZc9zWHdBS1RFtgsYu31J8MfnqiKUOw8ZSLD6h MlW9QdNXhw9082UNnIb1UGPBsx6ARcvYeVOz5E8ILGVU34qvMXO6L8zrHsX+KR6s/vyRtZcG0Of/V OdtVXN5gY9AwwxsyK5ptugiIJJjc53HR0J0kPXAO3vWKSGGNwvMa1hVkYYsqNq8wwrLzOK+UPN9MI fjg9IuZJKhetimGHQuJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEgiF-0001CD-O3; Wed, 18 Mar 2020 21:58:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEgiC-0001Bi-Kn for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2020 21:58:53 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EADC32076C; Wed, 18 Mar 2020 21:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584568732; bh=fwb6/1fl+qNWmdBmMiFQ8pSoakKvLGgyes9mRnF7u2c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iXspVkpnNVO09YFjhzaEWdYDvt1usZAPfrJ2RQL2f3zpxwByHpOjc+QPpyTTvVNJk fRhTMX4fIg5OHKVaB9/BPg0aRQySOWuEoOw7OAhLKWd5kSRxpBkRoywrWBYZu7OK+B PAINfI9FfrQ0FVsS9z4hGvsl96KHzUXa3BOIlzVk= Date: Wed, 18 Mar 2020 21:58:47 +0000 From: Will Deacon To: Andre Przywara Subject: Re: [PATCH kvmtool v3] Add emulation for CFI compatible flash memory Message-ID: <20200318215847.GC8477@willie-the-truck> References: <20200221165532.90618-1-andre.przywara@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200221165532.90618-1-andre.przywara@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200318_145852_705630_77B47E0E X-CRM114-Status: GOOD ( 16.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Raphael Gault , Julien Thierry , Sami Mujawar , Alexandru Elisei , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Feb 21, 2020 at 04:55:32PM +0000, Andre Przywara wrote: > From: Raphael Gault > > The EDK II UEFI firmware implementation requires some storage for the EFI > variables, which is typically some flash storage. > Since this is already supported on the EDK II side, we add a CFI flash > emulation to kvmtool. > This is backed by a file, specified via the --flash or -F command line > option. Any flash writes done by the guest will immediately be reflected > into this file (kvmtool mmap's the file). > The flash will be limited to the nearest power-of-2 size, so only the > first 2 MB of a 3 MB file will be used. > > This implements a CFI flash using the "Intel/Sharp extended command > set", as specified in: > - JEDEC JESD68.01 > - JEDEC JEP137B > - Intel Application Note 646 > Some gaps in those specs have been filled by looking at real devices and > other implementations (QEMU, Linux kernel driver). > > At the moment this relies on DT to advertise the base address of the > flash memory (mapped into the MMIO address space) and is only enabled > for ARM/ARM64. The emulation itself is architecture agnostic, though. > > This is one missing piece toward a working UEFI boot with kvmtool on > ARM guests, the other is to provide writable PCI BARs, which is WIP. > > Signed-off-by: Raphael Gault > [Andre: rewriting and fixing] > Signed-off-by: Andre Przywra > --- > Hi, > > an update fixing Alexandru's review comments (many thanks for those!) > The biggest change code-wise is the split of the MMIO handler into three > different functions. Another significant change is the rounding *down* of > the present flash file size to the nearest power-of-two, to match flash > hardware chips and Linux' expectations. Alexandru -- are you happy with this now? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel