Commit Graph

8 Commits

Author SHA1 Message Date
Mark Salter 465121a99f perf: imx_perf: add support for i.MX95 platform
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit d0d7c66c537d36fbb87c515edb695c1e8ea3cdcb
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Wed, 29 May 2024 16:03:56 +0800

    i.MX95 has a DDR PMU which is almostly same as i.MX93, it now supports
    read beat and write beat filter capabilities. This will add support for
    i.MX95 and enhance the driver to support specific filter handling for it.

    Usage:

    For read beat:
    ~# perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt2,axi_mask=ID_MASK,axi_id=ID/
    ~# perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt1,axi_mask=ID_MASK,axi_id=ID/
    ~# perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt0,axi_mask=ID_MASK,axi_id=ID/
    eg: For edma2: perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt0,axi_mask=0x00f,axi_id=0x00c/

    For write beat:
    ~# perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_wr_beat_filt,axi_mask=ID_MASK,axi_id=ID/
    eg: For edma2: perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_wr_beat_filt,axi_mask=0x00f,axi_id=0x00c/

    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240529080358.703784-6-xu.yang_2@nxp.com
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:45 -05:00
Mark Salter 36b22baf59 perf: imx_perf: refactor driver for imx93
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit fab5e5a866e86054a78bedd1bd1d6707421149a5
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Wed, 29 May 2024 16:03:54 +0800

    This driver is initinally used to support imx93 Soc and now it's time to
    add support for imx95 Soc. However, some macro definitions and events are
    different on these two Socs. For preparing imx95 supports, this will
    refactor driver for imx93.

    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240529080358.703784-4-xu.yang_2@nxp.com
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:45 -05:00
Mark Salter e468c588bb perf: imx_perf: let the driver manage the counter usage rather the user
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit 27e4a6523edd2aaf78abd72556d30629a38490b2
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Wed, 29 May 2024 16:03:53 +0800

    In current design, the user of perf app needs to input counter ID to count
    events. However, this is not user-friendly since the user needs to lookup
    the map table to find the counter. Instead of letting the user to input
    the counter, let this driver to manage the counters in this patch.

    This will be implemented by:
     1. allocate counter 0 for cycle event.
     2. find unused counter from 1-10 for reference events.
     3. allocate specific counter for counter-specific events.

    In this patch, counter attr will be kept for back-compatible but all the
    value passed down by counter=<n> will be ignored. To mark counter-specific
    events, counter ID will be encoded into perf_pmu_events_attr.id.

    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240529080358.703784-3-xu.yang_2@nxp.com
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:45 -05:00
Mark Salter 1bbd26e96a perf: imx_perf: add macro definitions for parsing config attr
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit 4773dd10fda0e12a08a231d2fb773646817da343
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Wed, 29 May 2024 16:03:52 +0800

    The user can set event and counter in cmdline and the driver need to parse
    it using 'config' attr value. This will add macro definitions to avoid
    hard-code in driver.

    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240529080358.703784-2-xu.yang_2@nxp.com
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:45 -05:00
Mark Salter f24104676f perf: fsl_imx9_ddr: Convert to platform remove callback returning void
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit 78da2a93b55b647e0770c6394cc938f6918db124
Author: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
Date: Fri, 15 Dec 2023 14:59:12 +0100

    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is ignored (apart
    from emitting a warning) and this typically results in resource leaks.

    To improve here there is a quest to make the remove callback return
    void. In the first step of this quest all drivers are converted to
    .remove_new(), which already returns void. Eventually after all drivers
    are converted, .remove_new() will be renamed to .remove().

    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Link: https://lore.kernel.org/r/bd12035ca467d7f4cd5edcfd6febda56600caacd.1702648125.git.u.kleine-koenig@pengutronix.de
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:40 -05:00
Mark Salter 7a7c8f3e1e perf: imx_perf: fix counter start and config sequence
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit ac9aa295f7a89d38656739628796f086f0b160e2
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Wed, 29 May 2024 16:03:55 +0800

    In current driver, the counter will start firstly and then be configured.
    This sequence is not correct for AXI filter events since the correct
    AXI_MASK and AXI_ID are not set yet. Then the results may be inaccurate.

    Reviewed-by: Frank Li <Frank.Li@nxp.com>
    Fixes: 55691f99d417 ("drivers/perf: imx_ddr: Add support for NXP i.MX9 SoC DDRC PMU driver")
    cc: stable@vger.kernel.org
    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Link: https://lore.kernel.org/r/20240529080358.703784-5-xu.yang_2@nxp.com
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:40 -05:00
Mark Salter 6f00f155c8 drivers/perf: Remove usage of the deprecated ida_simple_xx() API
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit 79c03ed4b896513d226abdd83214b8436efdc22c
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sun, 10 Dec 2023 18:48:18 +0100

    ida_alloc() and ida_free() should be preferred to the deprecated
    ida_simple_get() and ida_simple_remove().

    This is less verbose.

    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Link: https://lore.kernel.org/r/85b0b73a1b2f743dd5db15d4765c7685100de27f.1702230488.git.christophe.jaillet@wanadoo.fr
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:38 -05:00
Mark Salter d505dbccf6 drivers/perf: imx_ddr: Add support for NXP i.MX9 SoC DDRC PMU driver
JIRA: https://issues.redhat.com/browse/RHEL-5704

commit 55691f99d417084305e575c477f06556f93dfb0b
Author: Xu Yang <xu.yang_2@nxp.com>
Date: Tue, 18 Apr 2023 18:29:08 +0800

    Add ddr performance monitor support for i.MX93.

    There are 11 counters for ddr performance events.
    - Counter 0 is a 64-bit counter that counts only clock cycles.
    - Counter 1-10 are 32-bit counters that can monitor counter-specific
      events in addition to counting reference events.

    For example:
      perf stat -a -e imx9_ddr0/ddrc_pm_1,counter=1/,imx9_ddr0/ddrc_pm_2,counter=2/ ls

    Besides, this ddr pmu support AXI filter capability. It's implemented as
    counter-specific events. It now supports read transaction, write transaction
    and read beat events which corresponding respecitively to counter 2, 3 and 4.
    axi_mask and axi_id need to be as event parameters.

    For example:
      perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_trans_filt,counter=2,axi_mask=ID_MASK,axi_id=ID/
      perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_wr_trans_filt,counter=3,axi_mask=ID_MASK,axi_id=ID/
      perf stat -a -I 1000 -e imx9_ddr0/eddrtq_pm_rd_beat_filt,counter=4,axi_mask=ID_MASK,axi_id=ID/

    Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Link: https://lore.kernel.org/r/20230418102910.2065651-1-xu.yang_2@nxp.com
    [will: Remove redundant error message on platform_get_irq() failure]
    Signed-off-by: Will Deacon <will@kernel.org>

Signed-off-by: Mark Salter <msalter@redhat.com>
2025-01-04 12:21:35 -05:00