From: Feng Tang <feng.tang@intel.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Len Brown <lenb@kernel.org>,
"sfi-devel@simplefirmware.org" <sfi-devel@simplefirmware.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/8] SFI: core support
Date: Wed, 24 Jun 2009 15:40:52 +0800 [thread overview]
Message-ID: <20090624154052.1301144f@feng-desktop> (raw)
In-Reply-To: <20090624071220.GJ6760@one.firstfloor.org>
On Wed, 24 Jun 2009 15:12:20 +0800
Andi Kleen <andi@firstfloor.org> wrote:
> On Wed, Jun 24, 2009 at 11:34:40AM +0800, Feng Tang wrote:
> >
> > > > +static void __iomem *sfi_map_memory(u32 phys, u32 size)
> > > > +{
> > > > + if (!phys || !size)
> > > > + return NULL;
> > > > +
> > > > + if (sfi_tbl_permanant_mapped)
> > > > + return ioremap((unsigned long)phys, size);
> > > > + else
> > > > + return arch_early_ioremap((unsigned long)phys,
> > > > size); +}
> > >
> > > imho it would be cleaner if the callers just called these
> > > functions directly. Are the !phys !size checks really needed?
> >
> > Andi,
> >
> > Thanks for many good comments, will address them.
> >
> > For this question, this sfi_map_memory() may get called before and
> > after the ioremap() is ready, so we add a permanent flag to judge
> > the
>
> Yes, but the callers should know this and they can call the right
> function. I suspect only very few callers will need the early
> variant.
>
There is one sfi_table_parse() API, which is a SFI core function, it is exported
out and used in both boot phase (parsing cpu/ioapic) and later driver phase
(parsing idle/freq ...), when it get called, it doesn't know in which phase it get
called, and need such a flag to judge.
> > environment and chose the right API automatically. e.g. after
> > system is booted, cpu freq driver will implicitly call this API to
> > get freq info
>
> cpufreq driver shouldn't be initialized before ioremap
Right, it called the sfi_table_parse() after ioremap is ready.
>
> > >
> > > Since the mappings are always 4K you would only need to remap
> > > if the size is > PAGE_SIZE
> >
> > yes, some of the table may be in one page, but some may not start
> > at page boundary and cross pages, we do it this way as this
> > map/unmap/remap/unmap routine only happen few times in boot phase.
>
> The TLB flushes tend to be a few thousand cycles at least.
>
> It's not much, but with all the recent focus on faster boot times it's
> still better to not write unnecessarily inefficient initialization
> code.
good point, will take care of it
>
> >
> > >
> > > > +
> > > > + if (sfi_tb_verify_checksum(table, length))
> > > > + goto unmap_and_exit;
> > > > +
> > > > + /* Initialize sfi_tblist entry */
> > > > + sfi_tblist.tables[sfi_tblist.count].flags = flags;
> > > > + sfi_tblist.tables[sfi_tblist.count].address = addr;
> > > > + sfi_tblist.tables[sfi_tblist.count].pointer = NULL;
> > > > + memcpy(&sfi_tblist.tables[sfi_tblist.count].header,
> > > > + table, sizeof(struct sfi_table_header));
> > >
> > > To be honest I'm not sure why this list exists at all.
> > > Is it that difficult to just rewalk the firmware supplied
> > > table as needed?
> >
> > Currently, there are about 10 SFI tables (more are expected), and
> > most of them will be parsed in driver initialization phase, like
> > timer/cpu idle/ cpu frequency/rtc/system wake driver. Using a
> > global list may save some system overhead
>
> Walking the tables as they are laid out in memory should be quite
> equivalent to walking a list, shouldn't it?
>
> It would be only a relatively small simplification agreed, but if
> you're claiming to do a "Simple Firmware Interface" imho you should
> try to make it as simple possible, and that includes not setting up
> redundant data structures.
understand your concern, but to walk a list we still need have some global
parameter like SYST address, and do the map/unmap and checksum work.
another reason for the global sfi_table_desc[] is, we only do some time ioremap
for each table and save the mapped address for future use. this idea is
borrowed from ACPI table handling.
Thanks,
Feng
>
> -Andi
next prev parent reply other threads:[~2009-06-24 7:43 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 7:13 [RFC/PATCH 2.6.32] Simple Firmware Interface (SFI): initial support Len Brown
2009-06-23 7:13 ` [PATCH 1/8] SFI: Simple Firmware Interface - new Linux sub-system Len Brown
2009-06-23 7:14 ` [PATCH 2/8] SFI: include/linux/sfi.h Len Brown
2009-06-23 7:28 ` Ingo Molnar
2009-06-23 7:47 ` Feng Tang
2009-06-23 8:00 ` Ingo Molnar
2009-06-23 8:02 ` Feng Tang
2009-06-23 8:09 ` Ingo Molnar
2009-06-23 15:14 ` H. Peter Anvin
2009-06-30 21:57 ` Andrew Morton
2009-06-30 21:59 ` Ingo Molnar
2009-06-23 9:06 ` Sam Ravnborg
2009-06-23 15:52 ` Feng Tang
2009-06-23 19:26 ` Sam Ravnborg
2009-06-23 7:14 ` [PATCH 3/8] SFI: core support Len Brown
2009-06-23 7:56 ` Ingo Molnar
2009-06-23 8:32 ` Feng Tang
2009-06-23 9:03 ` Ingo Molnar
2009-06-23 9:15 ` Feng Tang
2009-06-23 17:20 ` Len Brown
2009-06-23 19:20 ` Ingo Molnar
2009-06-23 12:32 ` Andi Kleen
2009-06-23 16:57 ` Len Brown
2009-06-24 3:34 ` Feng Tang
2009-06-24 7:12 ` Andi Kleen
2009-06-24 7:40 ` Feng Tang [this message]
2009-06-24 7:55 ` Andi Kleen
2009-06-23 7:14 ` [PATCH 4/8] SFI: Hook boot-time initialization Len Brown
2009-06-23 7:14 ` [PATCH 5/8] SFI: Hook e820 memory map initialization Len Brown
2009-06-23 7:14 ` [PATCH 6/8] SFI: add ACPI extensions Len Brown
2009-06-23 12:18 ` Andi Kleen
2009-06-23 16:51 ` Len Brown
2009-06-23 7:14 ` [PATCH 7/8] SFI, PCI: Hook MMCONFIG Len Brown
2009-06-23 7:14 ` [PATCH 8/8] SFI: expose IO-APIC routines to SFI, not just ACPI Len Brown
2009-06-23 7:58 ` Ingo Molnar
2009-06-23 7:23 ` [PATCH 1/8] SFI: Simple Firmware Interface - new Linux sub-system Ingo Molnar
2009-06-23 18:31 ` [RFC/PATCH 2.6.32] Simple Firmware Interface (SFI): initial support Matthew Garrett
2009-06-23 18:41 ` Len Brown
2009-06-22 19:43 ` Pavel Machek
2009-06-24 21:13 ` Len Brown
2009-07-11 22:02 ` Pavel Machek
2009-07-13 3:25 ` [SFI-devel] " Peter Stuge
2009-06-23 18:51 ` Matthew Garrett
2009-06-23 20:00 ` Len Brown
2009-06-23 20:23 ` Matthew Garrett
2009-06-23 20:45 ` Matthew Garrett
2009-06-23 21:23 ` Alan Cox
2009-06-23 22:34 ` Len Brown
2009-06-23 22:20 ` Len Brown
2009-06-23 22:56 ` Matthew Garrett
2009-06-23 23:00 ` [SFI-devel] " Justen, Jordan L
2009-06-24 0:35 ` Len Brown
2009-06-23 21:33 ` Len Brown
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=20090624154052.1301144f@feng-desktop \
--to=feng.tang@intel.com \
--cc=andi@firstfloor.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sfi-devel@simplefirmware.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