All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Eric Snowberg <eric.snowberg@oracle.com>, daniel.kiper@oracle.com
Subject: Re: [PATCH] sparc64: OBP available region contains grub. Start at grub_phys_end
Date: Sat, 13 Feb 2016 17:49:28 +0300	[thread overview]
Message-ID: <56BF4278.1010503@gmail.com> (raw)
In-Reply-To: <CAEaD8JOj9nMqjCemzQngnw8BpPxGkG+yfEN_1yRjrhu4Q8kO0A@mail.gmail.com>

13.02.2016 16:56, Vladimir 'phcoder' Serbinenko пишет:
> Le sam. 13 févr. 2016 06:30, Andrei Borzenkov <arvidjaar@gmail.com> a
> écrit :
> 
>> 13.02.2016 00:35, Eric Snowberg пишет:
>>> OBP available region contains grub. Start at grub_phys_end.
>>>
>>> This prevents a problem where grub was being overwritten since
>>> grub_phys_start does not start at a zero offset within the memory
>>> map.
>>>
>>> Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
>>> ---
>>>  grub-core/loader/sparc64/ieee1275/linux.c |   16 ++++++++--------
>>>  1 files changed, 8 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/grub-core/loader/sparc64/ieee1275/linux.c
>> b/grub-core/loader/sparc64/ieee1275/linux.c
>>> index d44d7a1..67ef048 100644
>>> --- a/grub-core/loader/sparc64/ieee1275/linux.c
>>> +++ b/grub-core/loader/sparc64/ieee1275/linux.c
>>> @@ -203,20 +203,20 @@ alloc_phys_choose (grub_uint64_t addr,
>> grub_uint64_t len,
>>>    if (addr + ctx->size >= end)
>>>      return 0;
>>>
>>> -  if (addr >= grub_phys_start && addr < grub_phys_end)
>>> -    {
>>> -      addr = ALIGN_UP (grub_phys_end, FOUR_MB);
>>> -      if (addr + ctx->size >= end)
>>> -     return 0;
>>> -    }
>>> -  if ((addr + ctx->size) >= grub_phys_start
>>> -      && (addr + ctx->size) < grub_phys_end)
>>> +  /* OBP available region contains grub. Start at grub_phys_end. */
>>> +  /* grub_phys_start does not start at the beginning of the memory
>> region */
>>> +  if ((grub_phys_start >= addr && grub_phys_end < end) ||
>>> +      (addr > grub_phys_start && addr < grub_phys_end))
>>
>> What about
>>
>> a) overlapping regions?
>>
>> addr < grub_phys_start < end < grub_phys_end
>>
>> Good catch. Condition should have been
> grub_phys_start >= addr && grub_phys_start < end) || (addr >
> grub_phys_start && addr < grub_phys_end))
> My pattern matching algorithm failed and I thought it was standard check
> for segment intersection but it wasn't. I'll fix this
> 
> 
>>
>> b) is is possible for requested region to fit before grub?
>>
> There is only 16KiB of memory before GRUB but thinking about it again, it's
> 16 KiB of virtual memory, not physical. What about attached patch?
> 

As far as I understand what it does looks OK.



  reply	other threads:[~2016-02-13 14:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 21:35 [PATCH] sparc64: OBP available region contains grub. Start at grub_phys_end Eric Snowberg
2016-02-12 22:16 ` Vladimir 'φ-coder/phcoder' Serbinenko
2016-02-13  5:30 ` Andrei Borzenkov
2016-02-13 13:56   ` Vladimir 'phcoder' Serbinenko
2016-02-13 14:49     ` Andrei Borzenkov [this message]
2016-02-13 16:03   ` Eric Snowberg
2016-02-13 16:06     ` Vladimir 'phcoder' Serbinenko
2016-02-13 23:26       ` Eric Snowberg

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=56BF4278.1010503@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=daniel.kiper@oracle.com \
    --cc=eric.snowberg@oracle.com \
    --cc=grub-devel@gnu.org \
    /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 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.