From owner-freebsd-arm@freebsd.org Thu Feb 13 13:50:05 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B3B025750A for ; Thu, 13 Feb 2020 13:50:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48JHvK3PkZz3y8t; Thu, 13 Feb 2020 13:50:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 61808214A; Thu, 13 Feb 2020 13:50:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f43.google.com with SMTP id z3so2627431qvn.0; Thu, 13 Feb 2020 05:50:05 -0800 (PST) X-Gm-Message-State: APjAAAXQDj5AU3FCcyo8poZCspFqcytesjaOajT83Uf+3xqRa2EwH0H5 jpwRm/2ieDp3h8ECeSYITPSQJRilrM1fgGWeWco= X-Google-Smtp-Source: APXvYqxu4QpPET/W1GaWlDQU2T8cc5R5tKYXh2ExuF0sXruCuBWduDxxfXqU2MYKf/4VqVElaw9N2E5cGA8kyeoECzA= X-Received: by 2002:a05:6214:a91:: with SMTP id ev17mr11386926qvb.112.1581601804875; Thu, 13 Feb 2020 05:50:04 -0800 (PST) MIME-Version: 1.0 References: <7E7605DC-021D-448A-8459-8EC26BA9836D.ref@yahoo.com> <7E7605DC-021D-448A-8459-8EC26BA9836D@yahoo.com> In-Reply-To: From: Kyle Evans Date: Thu, 13 Feb 2020 07:49:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A investigative hack that makes (for example) head -r356529 boot and operate normally an RPi4B (finally!): protect all armstub8-gic.bin's loaded content from replacement by the kernel To: Ralf Wenk Cc: Mark Millard , freebsd-arm , Oleksandr Tymoshenko , Andrew Turner , Emmanuel Vadot Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Feb 2020 13:50:05 -0000 On Thu, Feb 13, 2020 at 7:43 AM Ralf Wenk wrote: > > On 2020-02-12 at 18:00 -0800 Mark Millard wrote via freebsd-arm: > > [...] > > > > # svnlite diff /usr/src/sys/dev/fdt/fdt_common.c > > Index: /usr/src/sys/dev/fdt/fdt_common.c > > =================================================================== > > --- /usr/src/sys/dev/fdt/fdt_common.c (revision 357529) > > +++ /usr/src/sys/dev/fdt/fdt_common.c (working copy) > > @@ -485,7 +485,18 @@ > > > > tuples = res_len / tuple_size; > > reservep = (pcell_t *)&reserve; > > +#ifdef __aarch64__ > > + //HACK!!! > > + // Reserve the first few pages, for example to > > + // preserve armstub8-gic.bin or armstub.bin > > + // content. > > + mr[0].mr_start= 0; > > + mr[0].mr_size= 2*4096; > > + tuples++; > > + for (i = 1; i < tuples; i++) { > > +#else > > for (i = 0; i < tuples; i++) { > > +#endif > > > > rv = fdt_data_to_res(reservep, addr_cells, size_cells, > > (u_long *)&mr[i].mr_start, (u_long *)&mr[i].mr_size); > > @@ -512,6 +523,11 @@ > > > > root = OF_finddevice("/reserved-memory"); > > if (root == -1) { > > + // Fail over to checking for and handling memreserve, > > + // such as for a RPi4B. > > + if (0 == fdt_get_reserved_regions(reserved,mreserved)) > > + return (0); > > + > > return (ENXIO); > > } > > > > I can confirm that with your patch(es) my RPi3 does not freeze any more > when loading mac_ntpd.ko. The patches are applied against r357853M. > Have you tested the RPi3 with just this second hunk of patch to fallover to memreserve, or is the first hunk definitely required as well? Thanks, Kyle Evans