From: Sudeep Holla <sudeep.holla@arm.com> To: Jeremy Linton <jeremy.linton@arm.com> Cc: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, Sudeep Holla <sudeep.holla@arm.com> Subject: Re: [PATCH 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Date: Fri, 7 Jun 2019 11:03:09 +0100 [thread overview] Message-ID: <20190607100309.GE2429@e107155-lin> (raw) In-Reply-To: <20190523224015.56270-2-jeremy.linton@arm.com> On Thu, May 23, 2019 at 05:40:14PM -0500, Jeremy Linton wrote: > ACPI 6.3 adds a flag to the CPU node to indicate whether > the given PE is a thread. Add a function to return that > information for a given linux logical CPU. > > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> > --- > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++- > include/linux/acpi.h | 5 +++++ > 2 files changed, 57 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c > index b72e6afaa8fb..6f43a0c05f61 100644 > --- a/drivers/acpi/pptt.c > +++ b/drivers/acpi/pptt.c > @@ -517,6 +517,43 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) > return retval; > } > > +/** > + * check_acpi_cpu_flag() - Determine if CPU node has a flag set > + * @cpu: Kernel logical CPU number > + * @rev: The PPTT revision defining the flag > + * @flag: The flag itself > + * > + * Check the node representing a CPU for a given flag. > + * > + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or > + * the table revision isn't new enough. > + * Otherwise returns flag value > + */ > +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) Initially, I thought we already have similar function, but I was wrong. > +{ > + struct acpi_table_header *table; > + acpi_status status; > + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + struct acpi_pptt_processor *cpu_node = NULL; > + int ret = -ENONET; Unfortunately even ENONET is defined and will silently compile fine, but I assume you need ENOENT as mentioned in the comment/doc. > + > + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table); > + if (ACPI_FAILURE(status)) { > + acpi_pptt_warn_missing(); > + return ret; > + } > + > + if (table->revision >= rev) > + cpu_node = acpi_find_processor_node(table, acpi_cpu_id); > + > + if (cpu_node) > + ret = cpu_node->flags & flag; > + > + acpi_put_table(table); > + > + return ret; > +} > + > /** > * acpi_find_last_cache_level() - Determines the number of cache levels for a PE > * @cpu: Kernel logical CPU number > @@ -581,6 +618,21 @@ int cache_setup_acpi(unsigned int cpu) > return status; > } > > +/** > + * acpi_pptt_cpu_is_thread() - Determine if logical CPU is a thread > + * @cpu: Kernel logical CPU number > + * > + * > + * Return: 1, a thread > + * 0, not a thread > + * -ENOENT if the PPTT doesn't exist, the CPU cannot be found or > + * the table revision isn't new enough. > + */ > +int acpi_pptt_cpu_is_thread(unsigned int cpu) > +{ > + return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD); > +} > + > /** > * find_acpi_cpu_topology() - Determine a unique topology value for a given CPU > * @cpu: Kernel logical CPU number > @@ -641,7 +693,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level) > return ret; > } > > - Spurious ? > /** > * find_acpi_cpu_topology_package() - Determine a unique CPU package value > * @cpu: Kernel logical CPU number > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 98440df7fe42..513833233c65 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -1314,10 +1314,15 @@ static inline int lpit_read_residency_count_address(u64 *address) > #endif > > #ifdef CONFIG_ACPI_PPTT > +int acpi_pptt_cpu_is_thread(unsigned int cpu); > int find_acpi_cpu_topology(unsigned int cpu, int level); > int find_acpi_cpu_topology_package(unsigned int cpu); > int find_acpi_cpu_cache_topology(unsigned int cpu, int level); > #else > +static inline int acpi_pptt_cpu_is_thread(unsigned int cpu) > +{ > + return -EINVAL; > +} > static inline int find_acpi_cpu_topology(unsigned int cpu, int level) > { > return -EINVAL; > -- > 2.21.0 >
WARNING: multiple messages have this Message-ID (diff)
From: Sudeep Holla <sudeep.holla@arm.com> To: Jeremy Linton <jeremy.linton@arm.com> Cc: will.deacon@arm.com, Sudeep Holla <sudeep.holla@arm.com>, rjw@rjwysocki.net, linux-acpi@vger.kernel.org, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Subject: Re: [PATCH 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Date: Fri, 7 Jun 2019 11:03:09 +0100 [thread overview] Message-ID: <20190607100309.GE2429@e107155-lin> (raw) In-Reply-To: <20190523224015.56270-2-jeremy.linton@arm.com> On Thu, May 23, 2019 at 05:40:14PM -0500, Jeremy Linton wrote: > ACPI 6.3 adds a flag to the CPU node to indicate whether > the given PE is a thread. Add a function to return that > information for a given linux logical CPU. > > Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> > --- > drivers/acpi/pptt.c | 53 +++++++++++++++++++++++++++++++++++++++++++- > include/linux/acpi.h | 5 +++++ > 2 files changed, 57 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c > index b72e6afaa8fb..6f43a0c05f61 100644 > --- a/drivers/acpi/pptt.c > +++ b/drivers/acpi/pptt.c > @@ -517,6 +517,43 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag) > return retval; > } > > +/** > + * check_acpi_cpu_flag() - Determine if CPU node has a flag set > + * @cpu: Kernel logical CPU number > + * @rev: The PPTT revision defining the flag > + * @flag: The flag itself > + * > + * Check the node representing a CPU for a given flag. > + * > + * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or > + * the table revision isn't new enough. > + * Otherwise returns flag value > + */ > +static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag) Initially, I thought we already have similar function, but I was wrong. > +{ > + struct acpi_table_header *table; > + acpi_status status; > + u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu); > + struct acpi_pptt_processor *cpu_node = NULL; > + int ret = -ENONET; Unfortunately even ENONET is defined and will silently compile fine, but I assume you need ENOENT as mentioned in the comment/doc. > + > + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table); > + if (ACPI_FAILURE(status)) { > + acpi_pptt_warn_missing(); > + return ret; > + } > + > + if (table->revision >= rev) > + cpu_node = acpi_find_processor_node(table, acpi_cpu_id); > + > + if (cpu_node) > + ret = cpu_node->flags & flag; > + > + acpi_put_table(table); > + > + return ret; > +} > + > /** > * acpi_find_last_cache_level() - Determines the number of cache levels for a PE > * @cpu: Kernel logical CPU number > @@ -581,6 +618,21 @@ int cache_setup_acpi(unsigned int cpu) > return status; > } > > +/** > + * acpi_pptt_cpu_is_thread() - Determine if logical CPU is a thread > + * @cpu: Kernel logical CPU number > + * > + * > + * Return: 1, a thread > + * 0, not a thread > + * -ENOENT if the PPTT doesn't exist, the CPU cannot be found or > + * the table revision isn't new enough. > + */ > +int acpi_pptt_cpu_is_thread(unsigned int cpu) > +{ > + return check_acpi_cpu_flag(cpu, 2, ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD); > +} > + > /** > * find_acpi_cpu_topology() - Determine a unique topology value for a given CPU > * @cpu: Kernel logical CPU number > @@ -641,7 +693,6 @@ int find_acpi_cpu_cache_topology(unsigned int cpu, int level) > return ret; > } > > - Spurious ? > /** > * find_acpi_cpu_topology_package() - Determine a unique CPU package value > * @cpu: Kernel logical CPU number > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 98440df7fe42..513833233c65 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -1314,10 +1314,15 @@ static inline int lpit_read_residency_count_address(u64 *address) > #endif > > #ifdef CONFIG_ACPI_PPTT > +int acpi_pptt_cpu_is_thread(unsigned int cpu); > int find_acpi_cpu_topology(unsigned int cpu, int level); > int find_acpi_cpu_topology_package(unsigned int cpu); > int find_acpi_cpu_cache_topology(unsigned int cpu, int level); > #else > +static inline int acpi_pptt_cpu_is_thread(unsigned int cpu) > +{ > + return -EINVAL; > +} > static inline int find_acpi_cpu_topology(unsigned int cpu, int level) > { > return -EINVAL; > -- > 2.21.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-07 10:03 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-23 22:40 [PATCH 0/2] arm64/PPTT ACPI 6.3 thread flag support Jeremy Linton 2019-05-23 22:40 ` Jeremy Linton 2019-05-23 22:40 ` [PATCH 1/2] ACPI/PPTT: Add support for ACPI 6.3 thread flag Jeremy Linton 2019-05-23 22:40 ` Jeremy Linton 2019-06-07 10:03 ` Sudeep Holla [this message] 2019-06-07 10:03 ` Sudeep Holla 2019-05-23 22:40 ` [PATCH 2/2] arm64: topology: Use PPTT to determine if PE is a thread Jeremy Linton 2019-05-23 22:40 ` Jeremy Linton 2019-06-06 8:49 ` John Garry 2019-06-06 8:49 ` John Garry 2019-06-07 19:21 ` Jeremy Linton 2019-06-07 19:21 ` Jeremy Linton 2019-06-10 8:30 ` John Garry 2019-06-10 8:30 ` John Garry 2019-06-11 19:02 ` Jeremy Linton 2019-06-11 19:02 ` Jeremy Linton
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=20190607100309.GE2429@e107155-lin \ --to=sudeep.holla@arm.com \ --cc=catalin.marinas@arm.com \ --cc=jeremy.linton@arm.com \ --cc=lenb@kernel.org \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=rjw@rjwysocki.net \ --cc=will.deacon@arm.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.