Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248455

Re: [PATCHv3 08/11] arm64: Check for selected granule support

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCHv3 08/11] arm64: Check for selected granule support
Date 2015-10-16 10:20 +0200
Message-ID <qk8p5-t0-13@gated-at.bofh.it> (permalink)
References (2 earlier) <qjBCO-2bI-23@gated-at.bofh.it> <qjOgG-3WB-11@gated-at.bofh.it> <qjOTo-4XL-35@gated-at.bofh.it> <qjS0V-Yf-5@gated-at.bofh.it> <qjStY-1O0-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15 October 2015 at 17:11, Mark Rutland <mark.rutland@arm.com> wrote:
> On Thu, Oct 15, 2015 at 09:47:53AM -0500, Jeremy Linton wrote:
>> On 10/15/2015 06:25 AM, Suzuki K. Poulose wrote:
>> >+    /*
>> >+     * Check to see if the CPU supports the requested pagesize
>> >+     */
>> >+    asm volatile("mrs %0, ID_AA64MMFR0_EL1" : "=r" (aa64mmfr0_el1));
>> >+    aa64mmfr0_el1 >>= ID_AA64MMFR0_TGRAN_SHIFT;
>> >+    if ((aa64mmfr0_el1 & 0xf) != ID_AA64MMFR0_TGRAN_SUPPORTED) {
>> >+            pr_efi_err(sys_table_arg, PAGE_SIZE_STR" granule not supported by the CPU\n");
>> >+            return EFI_UNSUPPORTED;
>> >+    }
>>
>>
>> This is definitely an improvement over my original hack job.
>>
>> I would like to add, that I actually think this should be in a new
>> function "check_kernel_compatibility" (or whatever) that is called
>> before handle_kernel_image.
>
> To bikeshed, perhaps efi_arch_check_system?
>

Yes, that makes sense. But before we add such a function, we should
move all the stub C code to libstub where it will be subject to the
new check against R_AARCH64_ABSxx relocations (which we cannot support
in the stub).

>> That is because I don't really think it belongs in
>> handle_kernel_image which is focused on relocation. Plus, if you add
>> another function, you can avoid the "Failed to relocate kernel"
>> error that comes out following the granule not supported message.
>> Further, checks like this in the future will have a place to live.
>
> I agree.
>
> There are some other diagnostic utilities I'd like to add to the stub
> (e.g. dumping the memory map and ID registers) that would help with
> diagnosing boot issues. I started on those at Connect, but realised I
> needed to first implement half of printf for those to be useful.
>

Yes, printf() is sorely lacking in that context. But note that the
memory map can already be retrieved from the UEFI shell via the
'memmap' command.

>> Of course you will then need a matching stubbed out function for the
>> normal arm kernel as well.
>
> I'm sure there are similar things we'll want to check for 32-bit (e.g.
> LPAE support), but a stub should be fine for now.
>

ARM support is not merged yet, but it is good to keep it in mind.

-- 
Ard.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <suzuki.poulose@arm.com> - 2015-10-14 13:30 +0200
  Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-14 19:30 +0200
    Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-14 19:40 +0200
    Re: [PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-10-15 11:50 +0200
      Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-15 12:40 +0200
  Re: [PATCHv3 08/11] arm64: Check for selected granule support Jeremy Linton <jeremy.linton@arm.com> - 2015-10-14 23:20 +0200
    Re: [PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-10-15 11:50 +0200
    Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-15 12:50 +0200
      Re: [PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-10-15 13:30 +0200
        Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-15 14:40 +0200
          Re: [PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-10-15 15:00 +0200
            Re: [PATCHv3 08/11] arm64: Check for selected granule support Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2015-10-16 10:10 +0200
        Re: [PATCHv3 08/11] arm64: Check for selected granule support Jeremy Linton <jeremy.linton@arm.com> - 2015-10-15 16:50 +0200
          Re: [PATCHv3 08/11] arm64: Check for selected granule support "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2015-10-15 17:10 +0200
          Re: [PATCHv3 08/11] arm64: Check for selected granule support Mark Rutland <mark.rutland@arm.com> - 2015-10-15 17:20 +0200
            Re: [PATCHv3 08/11] arm64: Check for selected granule support Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2015-10-16 10:20 +0200

csiph-web