lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 19 Aug 2014 11:50:27 +0800 From: Hanjun Guo <hanjun.guo@...aro.org> To: Catalin Marinas <catalin.marinas@....com> CC: "Rafael J. Wysocki" <rjw@...ysocki.net>, Mark Rutland <Mark.Rutland@....com>, "graeme.gregory@...aro.org" <graeme.gregory@...aro.org>, Arnd Bergmann <arnd@...db.de>, Olof Johansson <olof@...om.net>, "grant.likely@...aro.org" <grant.likely@...aro.org>, Sudeep Holla <Sudeep.Holla@....com>, Will Deacon <Will.Deacon@....com>, Jason Cooper <jason@...edaemon.net>, Marc Zyngier <Marc.Zyngier@....com>, Bjorn Helgaas <bhelgaas@...gle.com>, Daniel Lezcano <daniel.lezcano@...aro.org>, Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>, Robert Richter <rric@...nel.org>, Lv Zheng <lv.zheng@...el.com>, Robert Moore <robert.moore@...el.com>, Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>, Liviu Dudau <Liviu.Dudau@....com>, Randy Dunlap <rdunlap@...radead.org>, Charles Garcia-Tobin <Charles.Garcia-Tobin@....com>, "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "linaro-acpi@...ts.linaro.org" <linaro-acpi@...ts.linaro.org> Subject: Re: [PATCH v2 05/18] ARM64 / ACPI: Parse FADT table to get PSCI flags for PSCI init On 2014-8-18 22:27, Catalin Marinas wrote: > On Mon, Aug 04, 2014 at 04:28:12PM +0100, Hanjun Guo wrote: >> There are two flags: PSCI_COMPLIANT and PSCI_USE_HVC. When set, >> the former signals to the OS that the hardware is PSCI compliant. > > Actually it signals that the firmware is PSCI compliant. The hardware > doesn't care much. Right, I will update it. > >> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h >> index 6400312..6e04868 100644 >> --- a/arch/arm64/include/asm/acpi.h >> +++ b/arch/arm64/include/asm/acpi.h >> @@ -19,6 +19,18 @@ extern int acpi_disabled; >> extern int acpi_noirq; >> extern int acpi_pci_disabled; >> >> +/* 1 to indicate PSCI 0.2+ is implemented */ >> +static inline bool acpi_psci_present(void) >> +{ >> + return !!(acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_COMPLIANT); >> +} >> + >> +/* 1 to indicate HVC must be used instead of SMC as the PSCI conduit */ >> +static inline bool acpi_psci_use_hvc(void) >> +{ >> + return !!(acpi_gbl_FADT.arm_boot_flags & ACPI_FADT_PSCI_USE_HVC); >> +} > > Do we actually need !! here? Shouldn't the compiler figure out > conversion to bool automatically? I thought !! will explicitly show that it's a bool value and improve the readability of the code, but I'm ok to remove !! here. > >> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c >> index 9cf9127..69a315d 100644 >> --- a/arch/arm64/kernel/acpi.c >> +++ b/arch/arm64/kernel/acpi.c >> @@ -11,6 +11,8 @@ >> * published by the Free Software Foundation. >> */ >> >> +#define pr_fmt(fmt) "ACPI: " fmt >> + >> #include <linux/init.h> >> #include <linux/acpi.h> >> #include <linux/cpumask.h> >> @@ -47,6 +49,26 @@ void __init __acpi_unmap_table(char *map, unsigned long size) >> early_memunmap(map, size); >> } >> >> +static int __init acpi_parse_fadt(struct acpi_table_header *table) >> +{ >> + struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table; >> + >> + /* >> + * Revision in table header is the FADT Major version, >> + * and there is a minor version of FADT which was introduced >> + * by ACPI 5.1, we only deal with ACPI 5.1 or higher version >> + * to get arm boot flags, or we will disable ACPI. >> + */ >> + if (table->revision < 5 || fadt->minor_revision < 1) { > > If we ever get revision 6.0, this would trigger. Yes, good catch, actually I already fixed that in my local git repo, + if (table->revision > 5 || + (table->revision == 5 && fadt->minor_revision >= 1)) { + return 0; + } else { + pr_info("FADT revision is %d.%d, no PSCI support, should be 5.1 or higher\n", + table->revision, fadt->minor_revision); + disable_acpi(); + return -EINVAL; + } > >> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c >> index 85c6326..dfc4e4f3 100644 >> --- a/arch/arm64/kernel/setup.c >> +++ b/arch/arm64/kernel/setup.c >> @@ -395,6 +395,8 @@ void __init setup_arch(char **cmdline_p) >> efi_idmap_init(); >> >> cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; >> + acpi_boot_init(); >> + >> unflatten_device_tree(); > > Unless that's changed in a subsequent patch, do we still need to call > unflatten_device_tree() if ACPI was successful? No, we don't. in [PATCH v2 16/18], we will not call unflatten_device_tree() if ACPI is successful. Since the CONFIG_ACPI is not enabled for ARM64 (will enable it in the last patch), so acpi_boot_init() is a stub empty function here. > >> psci_init(); > > I would also rename this to something like psci_dt_init() and move the > acpi_disabled check here rather than in the callee. thanks for the suggestion, I will update my patch :) Thanks Hanjun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists