grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Francesco Lavra <francescolavra.fl@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
Subject: Re: [RFT] Caches on ARMv7
Date: Sun, 19 May 2013 17:01:02 +0200	[thread overview]
Message-ID: <5198E92E.7040700@gmail.com> (raw)
In-Reply-To: <51956E58.5050806@gmail.com>

Hi,

On 05/17/2013 01:40 AM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> Hello, all. I've changed in arm branch to detect cache type on runtime
> rather than compile time. Now a version compiled for armv6 should work
> on armv7 as well thus avoiding the need of two separate binaries. As an
> additional bonus it doesn't #error anymore when compiled with default
> gcc target (which is armv4t). Please test on armv7 when compiling for
> armv4t, armv6 and armv7.

A couple of minor issues in the cache probe function.

1) In the Main ID Register, for both ARMv6 and ARMv7, bits 15 to 4
contain the primary part number, whose value is implementation defined.
The special values 0x0 and 0x7 of the top 4 bits of the primary part
number are valid only for ARM implementations, i.e. when bits 31 to 24
contain the implementer code 0x41. I don't think we want to restrict
support to ARM implementations only, so I would drop the checks on bits
15 to 12.

2) The Cache Type Register in ARMv7 has always its 4 most significant
bits set to 1000.

So, please consider applying below patch.
Thanks,
Francesco

=== modified file 'grub-core/kern/arm/cache.c'
--- grub-core/kern/arm/cache.c	2013-05-17 11:05:28 +0000
+++ grub-core/kern/arm/cache.c	2013-05-19 14:43:23 +0000
@@ -29,8 +29,7 @@
   /* Read main ID Register */
   asm volatile ("mrc 	p15, 0, %0, c0, c0, 0": "=r"(main_id));

-  if (((main_id >> 12) & 0xf) == 0x0 || ((main_id >> 12) & 0xf) == 0x7
-      || (((main_id >> 16) & 0x7) != 0x7))
+  if (((main_id >> 16) & 0x7) != 0x7)
     grub_fatal ("Unsupported ARM ID 0x%x", main_id);

   /* Read Cache Type Register */
@@ -56,7 +55,7 @@
       grub_arch_cache_ilinesz = 8 << (cache_type & 3);
       type = ARCH_ARMV6;
       break;
-    case 0x80 ... 0x9f:
+    case 0x80 ... 0x8f:
       grub_arch_cache_dlinesz = 4 << ((cache_type >> 16) & 0xf);
       grub_arch_cache_ilinesz = 4 << (cache_type & 0xf);
       type = ARCH_ARMV7;


      reply	other threads:[~2013-05-19 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 23:40 [RFT] Caches on ARMv7 Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-19 15:01 ` Francesco Lavra [this message]

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=5198E92E.7040700@gmail.com \
    --to=francescolavra.fl@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=phcoder@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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).