From: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
To: "Ong, Boon Leong" <boon.leong.ong@intel.com>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
"dvhart@infradead.org" <dvhart@infradead.org>,
"andy.shevchenko@gmail.com" <andy.shevchenko@gmail.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: Sat, 24 Jan 2015 19:52:07 +0000 [thread overview]
Message-ID: <54C3F7E7.6090306@nexus-software.ie> (raw)
In-Reply-To: <AF233D1473C1364ABD51D28909A1B1B73270D4C5@PGSMSX105.gar.corp.intel.com>
On 24/01/15 01:48, Ong, Boon Leong wrote:
Skipping stuff I agree with.
> From V1 comment:
> Suggest to add a statement on 3 different types of IMR: General IMR, Host Memory
> I/O Boundary IMR & System Management Mode IMR. Then, call out that this patch
> is meant to support general IMR type only.
Hmm - There's no mention of grouping like that in the documentation, nor
in released silicon - to my knowledge.
Also why do you want a statement added saying that it supports CPU only
mode ?
This patch will support adding IMRs for SMM mode - if calling code wants
do do that - it's just imr_add_range(base, size, SMM, SMM);
Same thing with virtual-channels, RMU, etc.
>> + ret = imr_check_range(base, size);
>> + if (ret)
>> + return ret;
>> +
>> + if (size < IMR_ALIGN)
>> + return -EINVAL;
> I believe this is redundant because imr_check_range() has test for (size & IMR_MASK)
> which means if the size is indeed smaller than 0x400, the test will caught it anyway.
Nope.
(0 & 0x3FF) == 0
We need to bounds check for a zero size.
I'll change it to
if (size == 0)
return -EINVAL;
to avoid confusion.
>> +
>> + /* Tweak the size value */
>> + size = imr_fixup_size(size);
>> + pr_debug("IMR %d phys 0x%08lx-0x%08lx rmask 0x%08x wmask
>> 0x%08x\n",
>> + reg, base, end, rmask, wmask);
> Do we want to account for the 'size fixup' above on 'end'
>> +
>> + /* Allocate IMR */
>> + imr.addr_lo = phys_to_imr(base);
>> + imr.addr_hi = phys_to_imr(end);
>
> The fix-up size above is never factored here ...
> 'end-size' should be the correct one
hmmm.
The correct fix is
size = imr_fixup_size(size);
end = base + size;
>> + } else {
>> + /* Search for match based on address range */
>> + for (i = 0; i < imr_dev.max_imr; i++) {
>> + ret = imr_read(reg, &imr);
> A serious bug here.... 'reg' should be 'i' . We enter this branch if reg=-1
> Is there a miss in your test case?
Hmm you're right.
Turns out there's only the one test case for imr_del_range();
Good catch.
--
BOD
prev parent reply other threads:[~2015-01-24 19:52 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
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 [this message]
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=54C3F7E7.6090306@nexus-software.ie \
--to=pure.logic@nexus-software.ie \
--cc=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=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome