From owner-freebsd-arm@freebsd.org Mon Sep 14 09:15:17 2015 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13989A03383 for ; Mon, 14 Sep 2015 09:15:17 +0000 (UTC) (envelope-from ard.biesheuvel@linaro.org) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C985E11DB for ; Mon, 14 Sep 2015 09:15:16 +0000 (UTC) (envelope-from ard.biesheuvel@linaro.org) Received: by ioii196 with SMTP id i196so158916596ioi.3 for ; Mon, 14 Sep 2015 02:15:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=OPQm8N1k1w61M5EAvdGEZUinv9YP0jqZalrS5JKiaIA=; b=QyFOtavUL3FNDZztpVpG2f+Vz6WC65BqYx0BiSyNl26yHz9jasHchC3zQuY1nI1nqF fE05Ji2eHLdJ+7zwJSpR+QqmT9w24wxcYe4vMBLTrDCKiYPS1thHGFMIpWBIcRTMeVI5 HhZlInNUbdTSqaPAN2chUn8YoIaf3efftrrJuXX19W4qmXqsQIn3VYQTYL7GdWmSH8SM DsZz9qFm1nVYT6lkaLQNEOGwrKA0SM3Kk9QFf1cR9G2FQfZXz+OwzPPzT+dTfh0+gS3m 2vGc0IbbM/SUy3ra+7XJogGOcDB/mvy/H+C+ZYOVG/oZsx5VWWSmxxTgY3Cz7UqOFuGB H2eg== X-Gm-Message-State: ALoCoQkQdSLeGcswQIXxtgWzbfc4pGky9gcMH95338Djm7/xo/wKqORxW3SoeS0AVtCyTNtM0G7L MIME-Version: 1.0 X-Received: by 10.107.169.234 with SMTP id f103mr21866056ioj.130.1442221765706; Mon, 14 Sep 2015 02:09:25 -0700 (PDT) Received: by 10.36.138.69 with HTTP; Mon, 14 Sep 2015 02:09:25 -0700 (PDT) In-Reply-To: <55F6886D.1090900@huawei.com> References: <20150910112418.GC29293@leverpostej> <20150910121514.GE29293@leverpostej> <20150910144938.GI29293@leverpostej> <20150910162302.GN29293@leverpostej> <20150911124643.GB4530@olila.local.net-space.pl> <20150911154534.GD4530@olila.local.net-space.pl> <55F6886D.1090900@huawei.com> Date: Mon, 14 Sep 2015 11:09:25 +0200 Message-ID: Subject: Re: [PATCH] efi/libstub/fdt: Standardize the names of EFI stub parameters From: Ard Biesheuvel To: Shannon Zhao Cc: Daniel Kiper , Stefano Stabellini , Mark Rutland , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-efi@vger.kernel.org" , "Ian.Campbell@citrix.com" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "leif.lindholm@linaro.org" , "xen-devel@lists.xen.org" , "julien.grall@citrix.com" , "freebsd-arm@freebsd.org" , "matt.fleming@intel.com" , "christoffer.dall@linaro.org" , "jbeulich@suse.com" , "peter.huangpeng@huawei.com" , "shannon.zhao@linaro.org" , Konrad Rzeszutek Wilk Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Mon, 14 Sep 2015 11:21:33 +0000 X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 09:15:17 -0000 On 14 September 2015 at 10:42, Shannon Zhao wrote: [..] > > It only needs to apply following patch to fix a bug in Linux kernel when > mapping EFI_MEMORY_RUNTIME memory. > Could you explain why you think efi_virtmap_init() should fail if there are no EFI_MEMORY_RUNTIME regions? The absence of such regions is allowed by the spec, so efi_virtmap_init() is correct imo to return success. If you are trying to work around the issue where Xen does not expose any Runtime Services regions, there is simply no way to do that and be still UEFI compliant. I have suggested before that we should perhaps tolerate this anyway, by considering the case where the EFI System Table has a NULL runtime services pointer. But rigging efi_virtmap_init() like this is really not the way to achieve that. -- Ard. > Author: Shannon Zhao > Date: Thu Aug 20 14:54:58 2015 +0800 > > arm64/efi: Fix a bug when no EFI_MEMORY_RUNTIME memory found > > Currently if the attribute type of all the EFI Memory Descriptors are > not EFI_MEMORY_RUNTIME, efi_virtmap_init will return true. But at this > case, it expect false as there are no EFI memory for RUNTIME. Fix it by > introducing a status to show whether it finds EFI_MEMORY_RUNTIME. > > Signed-off-by: Shannon Zhao > > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c > index e8ca6ea..bad7f87 100644 > --- a/arch/arm64/kernel/efi.c > +++ b/arch/arm64/kernel/efi.c > @@ -233,6 +233,7 @@ void __init efi_init(void) > static bool __init efi_virtmap_init(void) > { > efi_memory_desc_t *md; > + bool status = false; > > for_each_efi_memory_desc(&memmap, md) { > u64 paddr, npages, size; > @@ -264,8 +265,11 @@ static bool __init efi_virtmap_init(void) > prot = PAGE_KERNEL; > > create_pgd_mapping(&efi_mm, paddr, md->virt_addr, size, > prot); > + status = true; > } > - return true; > + if (status) > + return true; > + return false; > } > > -- > Shannon >