From: "Brüns, Stefan" <Stefan.Bruens@rwth-aachen.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] efi_loader: make pool allocations cacheline aligned
Date: Wed, 2 Aug 2017 15:24:42 +0000 [thread overview]
Message-ID: <4572767.ryYN3EvPXv@sbruens-linux> (raw)
In-Reply-To: <CAF6AEGtJ3ev6UZtgUETCPYzPJJm_TKJ5ewhEXsGS=+RZ=iP8nQ@mail.gmail.com>
On Mittwoch, 2. August 2017 11:28:37 CEST Rob Clark wrote:
> On Tue, Aug 1, 2017 at 9:10 PM, Heinrich Schuchardt
[...]
> >>
> >> @@ -356,7 +356,8 @@ efi_status_t efi_allocate_pool(int pool_type,
> >> unsigned long size,>>
> >> {
> >>
> >> efi_status_t r;
> >> efi_physical_addr_t t;
> >>
> >> - u64 num_pages = (size + sizeof(u64) + EFI_PAGE_MASK) >>
> >> EFI_PAGE_SHIFT; + u64 num_pages = DIV_ROUND_UP(size + sizeof(struct
> >> efi_pool_allocation), + EFI_PAGE_SIZE);
> >>
> >> if (size == 0) {
> >>
> >> *buffer = NULL;
> >
> > NAK
> >
> > With DIV_ROUND_UP you introduce a 64bit division. Depending on the
> > architecture this is only available via stdlib which is not available in
> > U-Boot.
>
> The divisor is a constant power of two so compiler should turn this into a
> shift
> > Please, use
> > + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT;
> > as in the original line.
>
> This was actually incorrect (missing a "- 1"), which is why I decided
> to stop open-coding DIV_ROUND_UP().
EFI_PAGE_MASK == EFI_PAGE_SIZE - 1
Kind regards,
Stefan
next prev parent reply other threads:[~2017-08-02 15:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 20:00 [U-Boot] [PATCH] efi_loader: make pool allocations cacheline aligned Rob Clark
2017-08-02 1:21 ` Heinrich Schuchardt
[not found] ` <f0b2b064-d919-b437-3c8d-a76902665424@gmx.de>
2017-08-02 9:28 ` Rob Clark
2017-08-02 15:24 ` Brüns, Stefan [this message]
2017-08-02 16:24 ` Rob Clark
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=4572767.ryYN3EvPXv@sbruens-linux \
--to=stefan.bruens@rwth-aachen.de \
--cc=u-boot@lists.denx.de \
/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.