From: Marek Vasut <marek.vasut@gmail.com> To: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> Cc: takuya.sakata.wz@bp.renesas.com, Magnus Damm <magnus.damm@gmail.com>, Linux-Renesas <linux-renesas-soc@vger.kernel.org>, u-boot@lists.denx.de, Geert Uytterhoeven <geert@linux-m68k.org> Subject: Re: [U-Boot] [RFC] ARM: rmobile: create DT memory nodes for R8A7795 3.0 and newer Date: Fri, 15 Jun 2018 13:43:11 +0200 [thread overview] Message-ID: <3a3b322d-c04d-063e-392b-7967a9b8959c@gmail.com> (raw) In-Reply-To: <CAO3366yB85UTK+T1Wq8_tV_J4AS0zwAWkKSDAfqUJWcLsDj=7g@mail.gmail.com> On 06/15/2018 12:37 PM, Ulrich Hecht wrote: > On Fri, Jun 15, 2018 at 12:09 PM, Marek Vasut <marek.vasut@gmail.com> wrote: >>> + arm_smccc_smc(ARM_SMCCC_RENESAS_MEMCONF, >>> + 0, 0, 0, 0, 0, 0, 0, &res); >> >> Will this call work on platforms without patched ATF ? >> (I think not, don't you need to handle return value?) > > I have not actually tested that, but if I understand the ATF code > correctly, unimplemented calls return > SMC_UNK (0xffffffff), which should be handled by the default case (NOP) below. Which means the board has a memory size of 0 and fails to boot ? >>> + switch (res.a0) { >>> + case 1: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x038000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x040000000ULL; >>> + base[2] = 0x600000000ULL; >>> + size[2] = 0x040000000ULL; >>> + base[3] = 0x700000000ULL; >>> + size[3] = 0x040000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 4); >>> + break; >>> + case 2: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x078000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x080000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 2); >>> + break; >>> + case 3: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x078000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x080000000ULL; >>> + base[2] = 0x600000000ULL; >>> + size[2] = 0x080000000ULL; >>> + base[3] = 0x700000000ULL; >>> + size[3] = 0x080000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 4); >>> + break; >> >> Obvious design question is -- since you're adding new SMC call anyway, >> can't the call just return the memory layout table itself, so that it >> won't be duplicated both in U-Boot and ATF ? > > My gut feeling was to go with the smallest interface possible. But this doesn't scale. The API here uses some ad-hoc constants to identify memory layout tables which have to be encoded both in ATF and U-Boot, both of which must be kept in sync. The ATF already has those memory layout tables, it's only a matter of passing them to U-Boot. If you do just that, the ad-hoc constants and encoding of tables into U-Boot goes away and in fact simplifies the design. Yet, I have to wonder if ATF doesn't already contain some sort of standard SMC call to get memory topology. It surprises me that it wouldn't. -- Best regards, Marek Vasut _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
WARNING: multiple messages have this Message-ID (diff)
From: Marek Vasut <marek.vasut@gmail.com> To: u-boot@lists.denx.de Subject: [U-Boot] [RFC] ARM: rmobile: create DT memory nodes for R8A7795 3.0 and newer Date: Fri, 15 Jun 2018 13:43:11 +0200 [thread overview] Message-ID: <3a3b322d-c04d-063e-392b-7967a9b8959c@gmail.com> (raw) In-Reply-To: <CAO3366yB85UTK+T1Wq8_tV_J4AS0zwAWkKSDAfqUJWcLsDj=7g@mail.gmail.com> On 06/15/2018 12:37 PM, Ulrich Hecht wrote: > On Fri, Jun 15, 2018 at 12:09 PM, Marek Vasut <marek.vasut@gmail.com> wrote: >>> + arm_smccc_smc(ARM_SMCCC_RENESAS_MEMCONF, >>> + 0, 0, 0, 0, 0, 0, 0, &res); >> >> Will this call work on platforms without patched ATF ? >> (I think not, don't you need to handle return value?) > > I have not actually tested that, but if I understand the ATF code > correctly, unimplemented calls return > SMC_UNK (0xffffffff), which should be handled by the default case (NOP) below. Which means the board has a memory size of 0 and fails to boot ? >>> + switch (res.a0) { >>> + case 1: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x038000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x040000000ULL; >>> + base[2] = 0x600000000ULL; >>> + size[2] = 0x040000000ULL; >>> + base[3] = 0x700000000ULL; >>> + size[3] = 0x040000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 4); >>> + break; >>> + case 2: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x078000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x080000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 2); >>> + break; >>> + case 3: >>> + base[0] = 0x048000000ULL; >>> + size[0] = 0x078000000ULL; >>> + base[1] = 0x500000000ULL; >>> + size[1] = 0x080000000ULL; >>> + base[2] = 0x600000000ULL; >>> + size[2] = 0x080000000ULL; >>> + base[3] = 0x700000000ULL; >>> + size[3] = 0x080000000ULL; >>> + fdt_fixup_memory_banks(blob, base, size, 4); >>> + break; >> >> Obvious design question is -- since you're adding new SMC call anyway, >> can't the call just return the memory layout table itself, so that it >> won't be duplicated both in U-Boot and ATF ? > > My gut feeling was to go with the smallest interface possible. But this doesn't scale. The API here uses some ad-hoc constants to identify memory layout tables which have to be encoded both in ATF and U-Boot, both of which must be kept in sync. The ATF already has those memory layout tables, it's only a matter of passing them to U-Boot. If you do just that, the ad-hoc constants and encoding of tables into U-Boot goes away and in fact simplifies the design. Yet, I have to wonder if ATF doesn't already contain some sort of standard SMC call to get memory topology. It surprises me that it wouldn't. -- Best regards, Marek Vasut
next prev parent reply other threads:[~2018-06-15 11:43 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-15 9:40 [RFC] ARM: rmobile: create DT memory nodes for R8A7795 3.0 and newer Ulrich Hecht 2018-06-15 9:40 ` [U-Boot] " Ulrich Hecht 2018-06-15 9:40 ` [RFC ATF] Add SMCCC_RENESAS_MEMCONF SMC call Ulrich Hecht 2018-06-15 9:40 ` [U-Boot] " Ulrich Hecht 2018-06-15 10:09 ` [U-Boot] [RFC] ARM: rmobile: create DT memory nodes for R8A7795 3.0 and newer Marek Vasut 2018-06-15 10:09 ` Marek Vasut 2018-06-15 10:37 ` Ulrich Hecht 2018-06-15 10:37 ` [U-Boot] " Ulrich Hecht 2018-06-15 11:43 ` Marek Vasut [this message] 2018-06-15 11:43 ` Marek Vasut 2018-06-15 12:00 ` Marek Vasut 2018-06-15 12:00 ` Marek Vasut 2018-06-15 23:21 ` Laurent Pinchart 2018-06-15 23:21 ` [U-Boot] " Laurent Pinchart 2018-06-15 23:42 ` Marek Vasut 2018-06-15 23:42 ` [U-Boot] " Marek Vasut 2018-06-16 15:44 ` Laurent Pinchart 2018-06-16 15:44 ` [U-Boot] " Laurent Pinchart 2018-06-17 0:08 ` Marek Vasut 2018-06-17 0:08 ` [U-Boot] " Marek Vasut 2018-06-19 2:15 ` Laurent Pinchart 2018-06-19 2:15 ` Laurent Pinchart 2018-06-19 5:43 ` Magnus Damm 2018-06-19 5:43 ` [U-Boot] " Magnus Damm 2018-06-19 5:56 ` Laurent Pinchart 2018-06-19 5:56 ` Laurent Pinchart 2018-06-19 6:44 ` Magnus Damm 2018-06-19 6:58 ` Geert Uytterhoeven 2018-06-19 6:58 ` [U-Boot] " Geert Uytterhoeven 2018-06-19 7:11 ` Laurent Pinchart 2018-06-19 7:11 ` Laurent Pinchart 2018-06-19 7:17 ` Geert Uytterhoeven 2018-06-19 7:17 ` [U-Boot] " Geert Uytterhoeven 2018-06-20 4:55 ` Marek Vasut 2018-06-20 4:55 ` [U-Boot] " Marek Vasut 2018-06-28 17:24 ` Eugeniu Rosca 2018-06-28 17:24 ` Eugeniu Rosca
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3a3b322d-c04d-063e-392b-7967a9b8959c@gmail.com \ --to=marek.vasut@gmail.com \ --cc=geert@linux-m68k.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=magnus.damm@gmail.com \ --cc=takuya.sakata.wz@bp.renesas.com \ --cc=u-boot@lists.denx.de \ --cc=ulrich.hecht+renesas@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.