All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 15/16] arm64: pmuv3: handle !PMUv3 when probing
Date: Fri, 7 Apr 2017 15:29:09 +0100	[thread overview]
Message-ID: <20170407142908.GO19342@arm.com> (raw)
In-Reply-To: <1491503363-17731-16-git-send-email-mark.rutland@arm.com>

On Thu, Apr 06, 2017 at 07:29:22PM +0100, Mark Rutland wrote:
> When probing via ACPI, we won't know up-front whether a CPU has a PMUv3
> compatible PMU. Thus we need to consult ID registers during probe time.
> 
> This patch updates our PMUv3 probing code to test for the presence of
> PMUv3 functionality before touching an PMUv3-specific registers, and
> before updating the struct arm_pmu with PMUv3 data.
> 
> When a PMUv3-compatible PMU is not present, probing will return -ENODEV.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/kernel/perf_event.c | 85 ++++++++++++++++++++++++++++++++++--------
>  1 file changed, 69 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> index 57ae9d9..50790d7 100644
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -957,11 +957,24 @@ static int armv8_vulcan_map_event(struct perf_event *event)
>  				ARMV8_PMU_EVTYPE_EVENT);
>  }
>  
> +struct armv8pmu_probe_info {
> +	struct arm_pmu *pmu;
> +	bool present;
> +};
> +
>  static void __armv8pmu_probe_pmu(void *info)
>  {
> -	struct arm_pmu *cpu_pmu = info;
> +	struct armv8pmu_probe_info *probe = info;
> +	struct arm_pmu *cpu_pmu = probe->pmu;
> +	u64 dfr0;
>  	u32 pmceid[2];
>  
> +	dfr0 = read_sysreg(id_aa64dfr0_el1);
> +	if (((dfr0 >> ID_AA64DFR0_PMUVER_SHIFT) & 0xf) != 1)
> +		return;

Shouldn't we be using one of those fancy cpuid_feature_extract_*_field helpers?

It would also be worth spinning this up on qemu, if you get a chance, as
I don't think that implements the PMU.

Will

  reply	other threads:[~2017-04-07 14:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 18:29 [PATCHv2 00/16] arm_pmu: ACPI support Mark Rutland
2017-04-06 18:29 ` [PATCHv2 01/16] drivers/perf: arm_pmu: remove pointless PMU disabling Mark Rutland
2017-04-06 18:29 ` [PATCHv2 02/16] drivers/perf: arm_pmu: define armpmu_init_fn Mark Rutland
2017-04-06 18:29 ` [PATCHv2 03/16] drivers/perf: arm_pmu: fold init into alloc Mark Rutland
2017-04-06 18:29 ` [PATCHv2 04/16] drivers/perf: arm_pmu: factor out pmu registration Mark Rutland
2017-04-06 18:29 ` [PATCHv2 05/16] drivers/perf: arm_pmu: simplify cpu_pmu_request_irqs() Mark Rutland
2017-04-06 18:29 ` [PATCHv2 06/16] drivers/perf: arm_pmu: handle no platform_device Mark Rutland
2017-04-06 18:29 ` [PATCHv2 07/16] drivers/perf: arm_pmu: rename irq request/free functions Mark Rutland
2017-04-06 18:29 ` [PATCHv2 08/16] drivers/perf: arm_pmu: split cpu-local irq request/free Mark Rutland
2017-04-06 18:29 ` [PATCHv2 09/16] drivers/perf: arm_pmu: move irq request/free into probe Mark Rutland
2017-04-06 18:29 ` [PATCHv2 10/16] drivers/perf: arm_pmu: split out platform device probe logic Mark Rutland
2017-04-06 18:29 ` [PATCHv2 11/16] arm64: add function to get a cpu's MADT GICC table Mark Rutland
2017-04-06 18:29 ` [PATCHv2 12/16] arm64: parking: kill acpi_set_mailbox_entry() Mark Rutland
2017-04-06 18:29 ` [PATCHv2 13/16] arm64: parking: fix type endianness Mark Rutland
2017-04-06 18:29 ` [PATCHv2 14/16] drivers/perf: arm_pmu: add ACPI framework Mark Rutland
2017-04-07 14:27   ` Will Deacon
2017-04-07 14:49     ` Mark Rutland
2017-04-06 18:29 ` [PATCHv2 15/16] arm64: pmuv3: handle !PMUv3 when probing Mark Rutland
2017-04-07 14:29   ` Will Deacon [this message]
2017-04-07 16:30     ` Mark Rutland
2017-04-07 18:05     ` Mark Rutland
2017-04-07 19:09       ` Jeremy Linton
2017-04-06 18:29 ` [PATCHv2 16/16] arm64: pmuv3: use arm_pmu ACPI framework Mark Rutland
2017-04-07 14:30 ` [PATCHv2 00/16] arm_pmu: ACPI support Will Deacon
2017-04-07 16:13   ` Mark Rutland

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=20170407142908.GO19342@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 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.