From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.7123.1572553777225799861 for ; Thu, 31 Oct 2019 13:29:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VrDj5tjI; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: bhsharma@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572553776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vl7pyZ4JnvH0oSF/aLMI3Rd+pTHIaKnCOAmc2Fg1szk=; b=VrDj5tjIsYo6bhW+RpWqg/dCvj+ce54QAEKp2NYUdcDcc/yf76gNyn3DVL/ybwXasrnG60 sr91EQ0hl6tO1J+cg0ffMwZIXovRw80I6gOwtfFC+Pim9O/rW7Ys5sRYUmy22choBwWxb7 w8uanPLOQ3mXIlr8QXpNcIhcsca4XzQ= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-330-D1y8o2llPryVvQ8R773RUw-1; Thu, 31 Oct 2019 16:29:34 -0400 Received: by mail-lj1-f198.google.com with SMTP id x17so283550ljd.15 for ; Thu, 31 Oct 2019 13:29:33 -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=s6tr/Yci+jJOMrzKuMJ96cKo8tR9aWm6KkR1xcxhVtU=; b=cl9i3etLUQbS3cQBfAejf0BvxslvAdcT2k0pDLEfavE6Jsrt6BMvf6jTdqsWnTUEt1 zRyggqDL4TDpjWk/GPlVoG2E1bYZ4p5hz7mbR6jseN1pfFkV3mU3Yui/7orDWwD+tNta Lnee6bSk7mWLSAPH5GroilFhiKvuaA0JG4QyLOPzJTDsA6gdsSgjcSSfUOyLpLo3GNyH y/vcqv7IRXfH0Bx3/G6teBMDq+vRmlewrDFift9p6Hysio+igA+g1qtFrTkys/qT9dzJ udTanqroSv4MKJrG/lUrL7kgyKzayzHeLFgL41y5nwVtGq1qP8r3Sv4hfIb4ks64Vljm iNUA== X-Gm-Message-State: APjAAAU7zFN98xkrgdXkkw1QP/rvnx7c0X3ZHZY5BC+jBjkLFmxs1USH 3EWqAW0+MP0ZmbBmwk0V1Kff6WSUI9/VgG7E7hAXZwOx5btG+7jG8XTU86Ruq+8Io5Ke9ham0Uc H2ZX9dbBxITzx97l7x2wVJbTK0Yzobw== X-Received: by 2002:a05:651c:1024:: with SMTP id w4mr5282836ljm.206.1572553772560; Thu, 31 Oct 2019 13:29:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA2oA4Xx557U+pmseSdmHUZZ4XBGroo9Cr+vj2cOUnHzz5ihSVU7dA1gWH0b6MqvsfVGrYLgBpKXj7xhnxQVg= X-Received: by 2002:a05:651c:1024:: with SMTP id w4mr5282822ljm.206.1572553772227; Thu, 31 Oct 2019 13:29:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bhupesh Sharma Date: Fri, 1 Nov 2019 01:59:19 +0530 Message-ID: Subject: Re: [edk2-devel] How /sys/firmware/fdt getting created To: Prabhakar Kushwaha Cc: Ard Biesheuvel , Naresh Bhat , edk2-devel-groups-io , kexec mailing list X-MC-Unique: D1y8o2llPryVvQ8R773RUw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Prabhakar, On Wed, Oct 30, 2019 at 1:47 PM Prabhakar Kushwaha wrote: > > On Wed, Oct 30, 2019 at 1:14 PM Ard Biesheuvel > wrote: > > > > On Wed, 30 Oct 2019 at 08:36, Prabhakar Kushwaha > > wrote: > > > > > > On Wed, Oct 30, 2019 at 12:43 PM Ard Biesheuvel > > > wrote: > > > > > > > > On Tue, 29 Oct 2019 at 18:17, Prabhakar Kushwaha > > > > wrote: > > > > > > > > > > Hi All, > > > > > > > > > > I am working on Ubuntu-18.04 with UEFI on ARM64(64 bit) platform.= The > > > > > UEFI used is having ACPI tables. > > > > > > > > > > I am trying to understand where and how /sys/firmware/fdt is gett= ing > > > > > created. is it created by UEFI or grub and passed to Linux? > > > > > > > > > > > > > Neither. It is created by Linux itself. > > > > > > > > > > > > > > > > > > Thanks Ard, > > > > > > Can you please point me the code where it is getting created. > > > I want to add below in /sys/firmware/fdt. > > > > > > #size-cells =3D <0x02>; > > > #address-cells =3D <0x02>; > > > > > > > Actually, in your case it is GRUB not the kernel that creates the FDT. > > It does this to pass the initrd information. > > > > So if you want to add these properties, you should add them there. > > > > Can you explain why doing this is necessary? > > I am trying to test kexec -p (kdump feature) on CentOS-release > 7.7.1908 and Ubuntu-18.04 distributions. > > "kexec -p" command show error on Ubuntu. While no error on CentOS > > CentOS: > $ kexec -p /boot/vmlinuz-`uname -r` --initrd=3D/boot/initramfs-`uname > -r`.img --reuse-cmdline > $ =3D=3D> No error > > Ubuntu > $ kexec -p /boot/vmlinuz-`uname -r` --initrd=3D/boot/initrd.img-`uname > -r` --reuse-cmdline > $ kexec: elfcorehdr doesn't fit cells-size. > $ kexec: setup_2nd_dtb failed. > $ kexec: load failed. > $ Cannot load /boot/vmlinuz-5.4.0-rc4+ > > Note: Both CentOS and Ubuntu has Linux-5.4-rc4 tag. > > When i debugged further reason for Ubuntu error is due to > address-cells and size-cells as "1" > log from kexec tool :- > load_crashdump_segments: elfcorehdr 0x7f7cbfc000-0x7f7cbff7ff > read_1st_dtb: found name =3Ddtb_sys /sys/firmware/fdt > get_cells_size: #address-cells:1 #size-cells:1 > > On CentOS both values are "2". > log from kexec tool :- > load_crashdump_segments: elfcorehdr 0xbf98bf0000-0xbf98bf33ff > read_1st_dtb: found nmae=3Ddtb_sys /sys/firmware/fdt > get_cells_size: #address-cells:2 #size-cells:2 > > Note: Kexec tool read values from /sys/firmware/fdt. > > I am trying to figure out why 2 distributions showing different values. There are a couple of things I can suggest: 1. Try to see if it is a kexec-tools specific issue or is the kernel itself passed an incorrectly fixed DTB (by grub?) with incorrect #address-cells and #size-cells values (in the past I have seen kexec-tools sometimes reports incorrect #address-cells and #size-cells values, but they should be fixed in the newer kexec-tools versions): a). Can you check the kexec-tools version and share the same: $ kexec -v b). Using 'dtc' tool, you can confirm if it reports a correct #address-cells and #size-cells values: # dtc -I dtb -O dts /sys/firmware/fdt | grep cells | less For e.g on my fedora arm64 system, it reports: #address-cells =3D <0x2>; #size-cells =3D <0x2>; 2a). If its not a kexec-tools specific issue, it is most probably a bootloader (grub?) issue in your case: For e.g. I use the following grub2 on my Fedora arm64 board: and contains the changes to send the correct #address-cells and #size-cells values to Linux (and hence user-space tools like kexec-tools later). I believe the same grub2 is used (backported) for CentOS, so things should be fine there. 2b). I see that the latest devel branch of ubuntu grub2 () also contains this fix, but I am not sure which grub2 version you have on your ubuntu machine. But you can do some debugging on the same by stopping the boot process on the grub prompt and debugging grub further to check the version and fixes done in fdt there. See for details. Hope this helps. Thanks, Bhupesh