Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3530692pxb; Tue, 7 Sep 2021 01:27:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCKmcHo/vVErJiNqjUNWPN3pmxL26ApM9wJcU/1dcIiWlu6Z6ZZkcMvTsxwhKAvbedI1Yh X-Received: by 2002:a05:6402:1d2d:: with SMTP id dh13mr17535496edb.281.1631003228448; Tue, 07 Sep 2021 01:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631003228; cv=none; d=google.com; s=arc-20160816; b=tZoy7+kaeUgwPgh847RB5ir3OJeyvuTt1jN29BUWFhPUcgv9Tcn94lSXZfOZ6/KZnv f/cR16p861mIniRJIr+9tVtR7jcwsrHUrZHpHsNoP4uUHzGh/cN/9x/Y9Y/iUK4rxAYd JL/DtJuO3W9NAGhMWyn6nv/JqO6Jts+wvx7utnHGNDF1iX8tCCntE4cEuF2CcAL5CUtY Oog9YV5niXbeUBvJst7GuH7bZjk/0tQZ8Zudx/iIiRl051f32i5ZvPnNEgeV7Ke+SchR NbzFjki2qvWkh91x+w3OWhHVLAkN4zA1RdLyzbgSC5IdN+3fixs2Dlap6/NzRThdMqQh EIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=nlFSfoQ7SXqrtlS/FSZSEtUCAir1A7uzxwYSF0gDcQI=; b=vXY9S4KgkrYjbPDmVG/WXfaHB9CbJsFJG3uNgNNgXecpuxGrFktdjoAaQIdgFcU+Dd 4oa/TbHetlDGIJ1/9//ch+Vqr3p3rbMm1tD9jkHVsxMkXeJbdnBx7CNxY9yw9wz6JBtD EJ7R9wYcC1AQv31aOU6rCiz0N0T7Ih/NAjyxWHnd1b0q1ZGaKR0CP2CKcasquV438x9z 9PhHtnXDuBp2VuAX2BjpW9d2/cLC0DhADZnE+9vaOtiSzgxUkXOM/eUermM5GM33JqyA CeF0LnBdDmEr7R9JStkE9nbI0rSEOjxwNe00wqwqnaQ8sMLiZXewE0HvuAyBtN8KGvSM jCOg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si10474545ejd.52.2021.09.07.01.26.45; Tue, 07 Sep 2021 01:27:08 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241980AbhIGIRu (ORCPT + 99 others); Tue, 7 Sep 2021 04:17:50 -0400 Received: from mail-vs1-f42.google.com ([209.85.217.42]:38579 "EHLO mail-vs1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239550AbhIGIRq (ORCPT ); Tue, 7 Sep 2021 04:17:46 -0400 Received: by mail-vs1-f42.google.com with SMTP id a25so7578108vso.5 for ; Tue, 07 Sep 2021 01:16:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nlFSfoQ7SXqrtlS/FSZSEtUCAir1A7uzxwYSF0gDcQI=; b=byyyE82snrzXEY9ODgeemw+/uVqLX0WMLIRT5ch564aa224SdhTMzAciViXbflseKu 3yzF7uIVouhjLzLAGgP2UI9EryawbNymDBWcQbLCcxQ0FzttDRrAkPAPW5s0JqhVhjS4 aJe8Yjn931kw3N1d64Ie+5i9+/01u5fcuZZWd9C8+cnLzMzuea/i1Hugvc6YQSDGbXVc aAKtB2Rwn/imNLPE86a4n0uIu3aTdV93vdu5yynh2fGfPXV9I8w7UP/SCZqltaMrbKkp FZF4jfDHsDCT4a6Zj+kjJlOJ7ukme5dvlXNwvJSSJnSoEJMMx1p6xzCMdMHDIcO/lZKb 5mJg== X-Gm-Message-State: AOAM533LsUiUoiMNO3fgCL9LRVO1EUg1h4BRCvtkYlq6uCmR2433D56c Rfi7LXbOXik42dkrZxe2mG4UNb0awyXRICrEIWs= X-Received: by 2002:a67:3289:: with SMTP id y131mr8357469vsy.37.1631002600397; Tue, 07 Sep 2021 01:16:40 -0700 (PDT) MIME-Version: 1.0 References: <20210906095930.4184449-1-bert@biot.com> In-Reply-To: <20210906095930.4184449-1-bert@biot.com> From: Geert Uytterhoeven Date: Tue, 7 Sep 2021 10:16:28 +0200 Message-ID: Subject: Re: [PATCH] ARM: decompress: Use /memreserve/ DTS nodes when validating memory To: Bert Vermeulen Cc: Russell King , Ard Biesheuvel , Nicolas Pitre , Linux ARM , Linux Kernel Mailing List , John Crispin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hoi Bert, On Mon, Sep 6, 2021 at 12:00 PM Bert Vermeulen wrote: > If the bootloader needs the start of memory to be preserved, for example > because it dropped the Trusted Firmware blob there, this chunk of memory > shouldn't be used by the kernel. > > To avoid adding yet another SoC-specific text offset to arch/arm/Makefile, > this patch allows for a /memreserve/ entry in the DTS to mark off the > memory chunk instead. > > Signed-off-by: Bert Vermeulen Thanks for your patch! > --- a/arch/arm/boot/compressed/fdt_check_mem_start.c > +++ b/arch/arm/boot/compressed/fdt_check_mem_start.c > @@ -64,7 +64,7 @@ uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt) > uint32_t addr_cells, size_cells, base; > uint32_t fdt_mem_start = 0xffffffff; > const fdt32_t *reg, *endp; > - uint64_t size, end; > + uint64_t rsvaddr, size, end; > const char *type; > int offset, len; > > @@ -74,6 +74,19 @@ uint32_t fdt_check_mem_start(uint32_t mem_start, const void *fdt) > if (fdt_magic(fdt) != FDT_MAGIC) > return mem_start; > > + for (offset = fdt_off_mem_rsvmap(fdt); ; offset += 16) { > + rsvaddr = get_val(fdt + offset, 8); > + size = get_val(fdt + offset + 8, 8); The last parameter of get_val() is the number of cells, not the number of bytes. Hence it should be 2 for the 64-bit values in the memory reservation block. The rest looks good to me. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds