From: Mark Rutland <mark.rutland@arm.com>
To: Graeme Gregory <graeme@xora.org.uk>
Cc: "hanjun.guo@linaro.org" <hanjun.guo@linaro.org>,
Rob Herring <robh@kernel.org>, Al Stone <al.stone@linaro.org>,
Arnd Bergmann <arnd@arndb.de>, Mark Brown <broonie@linaro.org>,
Catalin Marinas <Catalin.Marinas@arm.com>,
Olof Johansson <olof@lixom.net>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Will Deacon <Will.Deacon@arm.com>,
"linaro-acpi@lists.linaro.org" <linaro-acpi@lists.linaro.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
Tomasz Nowicki <tomasz.nowicki@linaro.org>,
Sudeep Holla <Sudeep.Holla@arm.com>,
"grant.likely@linaro.org" <grant.likely@linaro.org>,
"graeme.gregory@linaro.org" <graeme.gregory@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Charles Garcia-Tobin <Charles.Garcia-Tobin@arm.com>
Subject: Re: [PATCH v3 part1 04/11] ARM64 / ACPI: Introduce arm-core.c and its related head file
Date: Fri, 25 Apr 2014 19:38:48 +0100 [thread overview]
Message-ID: <20140425183848.GE28819@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <20140425165320.GD1186@xora-haswell>
On Fri, Apr 25, 2014 at 05:53:20PM +0100, Graeme Gregory wrote:
> On Fri, Apr 25, 2014 at 04:51:47PM +0100, Mark Rutland wrote:
> > Hi Hanjun,
> >
> > On Fri, Apr 25, 2014 at 02:20:10PM +0100, Hanjun Guo wrote:
> > > ACPI core need lots extern variables and functions which should
> > > be provided by arch dependent code to make itself compilable. so
> > > introduce arm_core.c and its related header file here.
> > >
> > > acpi_boot_table_init() will be called in setup_arch() before
> > > paging_init(), so we should use eary_ioremap() mechanism here
> > > to get the RSDP and all the table pointers, with this patch,
> > > we can get ACPI boot-time tables from firmware on ARM64.
> > >
> > > Signed-off-by: Al Stone <al.stone@linaro.org>
> > > Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> > > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > > Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> > > ---
> > > arch/arm64/include/asm/acpi.h | 53 +++++++++++++++++++
> > > arch/arm64/kernel/setup.c | 4 ++
> > > drivers/acpi/Makefile | 2 +
> > > drivers/acpi/plat/Makefile | 1 +
> > > drivers/acpi/plat/arm-core.c | 113 +++++++++++++++++++++++++++++++++++++++++
> > > 5 files changed, 173 insertions(+)
> > > create mode 100644 drivers/acpi/plat/Makefile
> > > create mode 100644 drivers/acpi/plat/arm-core.c
> > >
> > > diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> > > index e3e990e..3ac9dfb 100644
> > > --- a/arch/arm64/include/asm/acpi.h
> > > +++ b/arch/arm64/include/asm/acpi.h
> > > @@ -19,6 +19,43 @@
> > > #ifndef _ASM_ACPI_H
> > > #define _ASM_ACPI_H
> > >
> > > +#include <asm/cacheflush.h>
> > > +
> > > +#include <linux/init.h>
> > > +
> > > +#define COMPILER_DEPENDENT_INT64 s64
> > > +#define COMPILER_DEPENDENT_UINT64 u64
> >
> > Is there any reason this can't be in a common ACPI header shared be ia64
> > and x86 too? Given we already have generic types for this it seems
> > pointless to define this in each architecture.
> >
> > It looks like include/acpi/actypes.h tries to do that already...
> >
> Yes I think we can replace that with uint64_t and int64_t types.
>
> > > +
> > > +/*
> > > + * Calling conventions:
> > > + *
> > > + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
> > > + * ACPI_EXTERNAL_XFACE - External ACPI interfaces
> > > + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
> > > + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
> > > + */
> > > +#define ACPI_SYSTEM_XFACE
> > > +#define ACPI_EXTERNAL_XFACE
> > > +#define ACPI_INTERNAL_XFACE
> > > +#define ACPI_INTERNAL_VAR_XFACE
> > > +
> > > +/* Asm macros */
> > > +#define ACPI_FLUSH_CPU_CACHE() flush_cache_all()
> >
> > This almost certainly does not do what you think it does.
> >
> > flush_cache_all walks the architected levels of cache visible to the
> > current CPU (i.e. those in CLIDR_EL1), and walks over each cache line at
> > that level, cleaning and evicting it. It also flushes the I-cache (which
> > I don't think you care about here).
> >
> > This is NOT safe if the cache is enabled. Lines can migrate between
> > levels in the middle of the sequence.
> >
> > In an SMP system this does NOT guarantee that data is evicted to memory,
> > even if the cache is disabled. Other CPUs with caches enabled can
> > acquire a cacheline (even if dirty) and it can sit in their cache.
> >
> > In a UP system or an SMP system where all other architected caches are
> > disabled (and flushed) this does NOT guarantee that data hits memory. In
> > the presence of a system-level cache this will simply flush the data out
> > to said system-level rather than memory.
> >
> > I believe the intent here is to have something analogous to WBINVD for
> > use in idle. Unfortunately there simply isn't anything analogous.
> > Luckily in the presence of PSCI, the PSCI implementation should do all
> > of the cache maintenance required to prevent any data loss and/or
> > corruption, and anything we need to have visible to noncacheable
> > accesses (i.e. flushed out to memory) we should be able to flush by VA.
> >
> > This maintenance is unsafe, and shouldn't be necessary on any sane
> > system. Please get rid of it. I would very much like to get rid of
> > flush_cache_all() before its misuse spreads further.
> >
> Thanks for explanation Mark, you are correct on x86 it is defined as
> wbinvd().
>
> I think looking at where it is actually used we can make this an empty
> macro on arm64 for now. Where it used are areas we don't currently
> execute and need arm64 replacements or refactorising to remove x86isms.
That sounds good. Is it worth putting a warn or similar there just in
case?
>
> > > +/* Basic configuration for ACPI */
> > > +#ifdef CONFIG_ACPI
> > > +extern int acpi_disabled;
> > > +extern int acpi_noirq;
> > > +extern int acpi_pci_disabled;
> > > +extern int acpi_strict;
> >
> > This looks very odd. Why are these prototypes not coming from a header?
> > If they're defined in the same place, why not move the disable_acpi
> > function there?
> >
>
> This is a header :-)
True; I must get my eyes tested. :)
Are these variables expected to be used by needed by other code, or are
they just for the benefit of the static inlines in this header?
> I think this is a peculiarity of how acpica is incorporated into linux
> but will check.
Ok.
>
> > > +static inline void disable_acpi(void)
> > > +{
> > > + acpi_disabled = 1;
> > > + acpi_pci_disabled = 1;
> > > + acpi_noirq = 1;
> > > +}
> >
> > [...]
> >
> > > +/*
> > > + * __acpi_map_table() will be called before page_init(), so early_ioremap()
> > > + * or early_memremap() should be called here.
> > > + */
> > > +char *__init __acpi_map_table(unsigned long phys, unsigned long size)
> > > +{
> > > + if (!phys || !size)
> > > + return NULL;
> >
> > Is there any reason that tables can't exist at physical address 0? It's
> > entirely valid to have memory there.
> >
> > [...]
> >
> On ARM64 there is not, we can fix this.
>
> > > +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
> > > +{
> > > + *irq = -1;
> > > +
> > > + return 0;
> > > +}
> > > +EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
> >
> > This appears to be missing a giant warning that it does nothing useful.
> >
> > I was under the impression that we were meant to use 0 to represent the
> > lack of an interrupt these days, too...
> >
> We can fix this.
Sounds good!
Cheers,
Mark.
next prev parent reply other threads:[~2014-04-25 18:39 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 13:20 [PATCH v3 part1 00/11] Enable ACPI on ARM64 in Kconfig Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 01/11] ACPI / processor: Rework _PDC related stuff to make it more arch-independent Hanjun Guo
2014-04-29 9:36 ` Grant Likely
2014-05-04 8:56 ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 02/11] ARM64 / ACPI: Introduce the skeleton of _PDC related for ARM64 Hanjun Guo
2014-04-29 9:39 ` Grant Likely
2014-05-04 8:58 ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 03/11] ARM64 : Add dummy asm/cpu.h Hanjun Guo
2014-04-29 9:40 ` Grant Likely
2014-04-29 10:43 ` Arnd Bergmann
2014-04-25 13:20 ` [PATCH v3 part1 04/11] ARM64 / ACPI: Introduce arm-core.c and its related head file Hanjun Guo
2014-04-25 15:51 ` Mark Rutland
2014-04-25 16:53 ` Graeme Gregory
2014-04-25 18:38 ` Mark Rutland [this message]
2014-04-26 12:09 ` Graeme Gregory
2014-04-28 14:58 ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-28 4:54 ` Zheng, Lv
2014-04-28 9:32 ` Hanjun Guo
2014-04-29 9:45 ` Grant Likely
2014-04-25 13:20 ` [PATCH v3 part1 05/11] ARM64 / ACPI: Introduce early_param for "acpi" Hanjun Guo
2014-04-29 9:51 ` Grant Likely
2014-04-25 13:20 ` [PATCH v3 part1 06/11] ARM64 / ACPI: Introduce lowlevel suspend function Hanjun Guo
2014-04-28 15:22 ` [Linaro-acpi] " Lorenzo Pieralisi
2014-04-29 8:46 ` Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 07/11] ARM64 / ACPI: Introduce arch_fix_phys_package_id() for cpu topology Hanjun Guo
2014-04-25 14:52 ` Mark Brown
2014-04-28 3:00 ` Hanjun Guo
2014-04-28 8:50 ` Mark Brown
2014-04-25 13:20 ` [PATCH v3 part1 08/11] ARM64 / ACPI: Introduce PCI functions for ACPI on ARM64 Hanjun Guo
2014-04-28 13:49 ` Arnd Bergmann
2014-04-29 8:44 ` Hanjun Guo
2014-04-29 10:01 ` [Linaro-acpi] " Arnd Bergmann
2014-05-05 8:35 ` Hanjun Guo
2014-05-05 13:09 ` Arnd Bergmann
2014-04-25 13:20 ` [PATCH v3 part1 09/11] ARM64 / ACPI: Enable ARM64 in Kconfig Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 10/11] ARM64 / ACPI: Select ACPI_REDUCED_HARDWARE_ONLY if ACPI is enabled on ARM64 Hanjun Guo
2014-04-25 13:20 ` [PATCH v3 part1 11/11] ACPI: Make EC depend on X86 || IA64 in Kconfig Hanjun Guo
2014-04-29 9:56 ` Grant Likely
2014-05-04 9:03 ` Hanjun Guo
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=20140425183848.GE28819@e106331-lin.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=Charles.Garcia-Tobin@arm.com \
--cc=Sudeep.Holla@arm.com \
--cc=Will.Deacon@arm.com \
--cc=al.stone@linaro.org \
--cc=arnd@arndb.de \
--cc=broonie@linaro.org \
--cc=graeme.gregory@linaro.org \
--cc=graeme@xora.org.uk \
--cc=grant.likely@linaro.org \
--cc=hanjun.guo@linaro.org \
--cc=linaro-acpi@lists.linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=olof@lixom.net \
--cc=rjw@rjwysocki.net \
--cc=robh@kernel.org \
--cc=tomasz.nowicki@linaro.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;
as well as URLs for NNTP newsgroup(s).