From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Ue55X-0007bG-Od for mharc-grub-devel@gnu.org; Sun, 19 May 2013 10:59:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ue55T-0007b8-Ow for grub-devel@gnu.org; Sun, 19 May 2013 10:59:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ue55R-00020e-8f for grub-devel@gnu.org; Sun, 19 May 2013 10:59:51 -0400 Received: from mail-ee0-f45.google.com ([74.125.83.45]:53825) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ue55R-00020U-2J for grub-devel@gnu.org; Sun, 19 May 2013 10:59:49 -0400 Received: by mail-ee0-f45.google.com with SMTP id l10so3381826eei.18 for ; Sun, 19 May 2013 07:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=pEdo8wITC4GrcUMw3wq/P/SRc79GLf9DKpBLtQBnFac=; b=cM9NmIVMxZ5/JmOuOKk9tAUebKC2fHclFuwBuqACofGrh888HFXBhgil3OayNlkbC9 CouUMoEB0Ms2G2hzYH8+XrxTZKNBft+ffx6qUij2P7Pc/Wti4DJ0ApGAaOQAf/cHOnht X6B0w3qc/JqB/LxFPKkYe2Es/E5WDMnNsGwynh1ut8rquhCWf4PPOQDSKXb+NjNm9u6V DSJB63oAYmR4TUI8NlW2f4OGTiasIk2AOlidLhO+CVWWLjY9mkuGxeZOuqACp3irgWk4 vyFBuqaAehK8r3vO1q9alijOHa6tGAuzlaOm35mmucti6lScgFVTrwAQgoSccZ7/Q2qD svsQ== X-Received: by 10.15.109.131 with SMTP id cf3mr10458260eeb.1.1368975587565; Sun, 19 May 2013 07:59:47 -0700 (PDT) Received: from [192.168.56.2] (na-19-76-226.service.infuturo.it. [151.19.76.226]) by mx.google.com with ESMTPSA id a5sm14655059ees.6.2013.05.19.07.59.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 19 May 2013 07:59:46 -0700 (PDT) Message-ID: <5198E92E.7040700@gmail.com> Date: Sun, 19 May 2013 17:01:02 +0200 From: Francesco Lavra User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [RFT] Caches on ARMv7 References: <51956E58.5050806@gmail.com> In-Reply-To: <51956E58.5050806@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.83.45 Cc: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2013 14:59:54 -0000 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;