LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, dvhart@infradead.org, boon.leong.ong@intel.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] x86: Add Isolated Memory Regions for Quark X1000
Date: Thu, 22 Jan 2015 10:59:36 +0200 [thread overview]
Message-ID: <CAHp75Vcd8axwSETRG8eq9Tu7Z0aPTDKfQr__gMsczt1PQ75sdg@mail.gmail.com> (raw)
In-Reply-To: <54C05207.6010306@nexus-software.ie>
On Thu, Jan 22, 2015 at 3:27 AM, Bryan O'Donoghue
<pure.logic@nexus-software.ie> wrote:
> On 21/01/15 20:57, Andy Shevchenko wrote:
[]
>>> + ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> + reg++, imr->rmask);
>>> + if (ret)
>>> + goto done;
>>> +
>>> + ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> + reg, imr->wmask);
>>
>>
>> Wouldn't be reg++ here as well? Below you substitute full offset which
>> I think points just to next register.
>
>
> I don't think we want to increment below..
>
>>
>>> + if (ret)
>>> + goto done;
>>> +
>>> + /* Lock bit must be set separately to addr_lo address bits */
>>> + if (lock) {
>>> + imr->addr_lo |= IMR_LOCK;
>>> + ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> + reg - IMR_LOCK_OFF,
>>> imr->addr_lo);
>>> + }
>
>
> ..because we calculate an offset anyway. An additional increment would just
> be unnecessary cycles.
Offset is a compile-time constant, right? And it should be 4.
Otherwise its meaning somehow looks confusing. I looked again and
would recommend to substitute it by NUM_REGS here and leave register
increment. I don't think it's a really big deal to waste CPU cycles
here since you use slower IOSF communication.
>>> + pr_info("protecting kernel .text - .rodata: %ldk (%p -
>>> %p)\n",
>>> + size / 1024, &_text, &__end_rodata);
>>
>>
>> size >> 10
>
>
> Andy.
>
> It was size >> 10 for V1 and you called it out as a magic number :)
>
> IMO, size / 1024 requires less thought to understand when reading the code.
Oh, my bad. Now a bit modified suggestion, to add KiB inside format
string and leave / 1024. Would it work for you?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2015-01-22 8:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 18:46 [PATCH v2 0/1] x86: Add IMR support to Quark/Galileo Bryan O'Donoghue
2015-01-21 18:46 ` [PATCH v2 1/1] x86: Add Isolated Memory Regions for Quark X1000 Bryan O'Donoghue
2015-01-21 20:57 ` Andy Shevchenko
2015-01-22 1:27 ` Bryan O'Donoghue
2015-01-22 8:59 ` Andy Shevchenko [this message]
2015-01-22 9:43 ` Bryan O'Donoghue
2015-01-22 11:24 ` Thomas Gleixner
2015-01-22 11:38 ` Bryan O'Donoghue
2015-01-22 15:02 ` Bryan O'Donoghue
2015-01-22 15:15 ` Bryan O'Donoghue
2015-01-22 16:28 ` Darren Hart
2015-01-22 19:50 ` Thomas Gleixner
2015-01-24 1:48 ` Ong, Boon Leong
2015-01-24 11:02 ` Andy Shevchenko
2015-01-24 21:56 ` Bryan O'Donoghue
2015-01-24 21:58 ` Bryan O'Donoghue
2015-01-24 19:52 ` Bryan O'Donoghue
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=CAHp75Vcd8axwSETRG8eq9Tu7Z0aPTDKfQr__gMsczt1PQ75sdg@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=boon.leong.ong@intel.com \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pure.logic@nexus-software.ie \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--subject='Re: [PATCH v2 1/1] x86: Add Isolated Memory Regions for Quark X1000' \
/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
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).