gem5-dev@gem5.org

The gem5 Developer List

View all threads

[M] Change in gem5/gem5[develop]: configs: Add `--with-pmu` option to the simple Arm FS configs

RC
Richard Cooper (Gerrit)
Tue, May 9, 2023 2:40 PM

Richard Cooper has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/69957?usp=email )

Change subject: configs: Add --with-pmu option to the simple Arm FS
configs
......................................................................

configs: Add --with-pmu option to the simple Arm FS configs

Add an option to add a PMU to the CPUs in starter_fs.py and
baremetal.py. By default PMUs will not be added.

Also adds an --arm-ppi-number option. Each PMU will be connected to
its core using the specified PPI.

Change-Id: I9cfb5781f211338919550f2320a7133d88801f6a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69957
Tested-by: kokoro noreply+kokoro@google.com
Reviewed-by: Jason Lowe-Power power.jg@gmail.com
Maintainer: Bobby Bruce bbruce@ucdavis.edu

M configs/example/arm/baremetal.py
M configs/example/arm/starter_fs.py
2 files changed, 52 insertions(+), 0 deletions(-)

Approvals:
Jason Lowe-Power: Looks good to me, approved
Bobby Bruce: Looks good to me, approved
kokoro: Regressions pass

diff --git a/configs/example/arm/baremetal.py
b/configs/example/arm/baremetal.py
index 8ffd2b4..be72ebe 100644
--- a/configs/example/arm/baremetal.py
+++ b/configs/example/arm/baremetal.py
@@ -157,6 +157,11 @@
workload_class = workloads.workload_list.get(args.workload)
system.workload = workload_class(object_file, system)

  • if args.with_pmu:
  •    for cluster in system.cpu_cluster:
    
  •        interrupt_numbers = [args.pmu_ppi_number] * len(cluster)
    
  •        cluster.addPMUs(interrupt_numbers)
    
  • if args.exit_on_uart_eot:
        for uart in system.realview.uart:
            uart.end_on_eot = True
    

@@ -182,6 +187,15 @@
break

+def arm_ppi_arg(int_num: int) -> int:

  • """Argparse argument parser for valid Arm PPI numbers."""
  • PPIs (1056 <= int_num <= 1119) are not yet supported by gem5

  • int_num = int(int_num)
  • if 16 <= int_num <= 31:
  •    return int_num
    
  • raise ValueError(f"{int_num} is not a valid Arm PPI number")
  • def main():
    parser = argparse.ArgumentParser(epilog=doc)

@@ -258,6 +272,18 @@
help="Destination for the Tarmac trace output. [Default:
stdoutput]",
)
parser.add_argument(

  •    "--with-pmu",
    
  •    action="store_true",
    
  •    help="Add a PMU to each core in the cluster.",
    
  • )
  • parser.add_argument(
  •    "--pmu-ppi-number",
    
  •    type=arm_ppi_arg,
    
  •    default=23,
    
  •    help="The number of the PPI to use to connect each PMU to its  
    

core. "

  •    "Must be an integer and a valid PPI number (16 <= int_num <= 31).",
    
  • )

  • parser.add_argument(
    "--exit-on-uart-eot",
    action="store_true",
    help="Exit simulation if any of the UARTs receive an EOT. Many "
    diff --git a/configs/example/arm/starter_fs.py
    b/configs/example/arm/starter_fs.py
    index ebed188..07280bd 100644
    --- a/configs/example/arm/starter_fs.py
    +++ b/configs/example/arm/starter_fs.py
    @@ -177,6 +177,11 @@
    ]
    system.workload.command_line = " ".join(kernel_cmd)

  • if args.with_pmu:

  •    for cluster in system.cpu_cluster:
    
  •        interrupt_numbers = [args.pmu_ppi_number] * len(cluster)
    
  •        cluster.addPMUs(interrupt_numbers)
    
  • return system
    

@@ -198,6 +203,15 @@
break

+def arm_ppi_arg(int_num: int) -> int:

  • """Argparse argument parser for valid Arm PPI numbers."""
  • PPIs (1056 <= int_num <= 1119) are not yet supported by gem5

  • int_num = int(int_num)
  • if 16 <= int_num <= 31:
  •    return int_num
    
  • raise ValueError(f"{int_num} is not a valid Arm PPI number")
  • def main():
    parser = argparse.ArgumentParser(epilog=doc)

@@ -272,6 +286,18 @@
default="stdoutput",
help="Destination for the Tarmac trace output. [Default:
stdoutput]",
)

  • parser.add_argument(
  •    "--with-pmu",
    
  •    action="store_true",
    
  •    help="Add a PMU to each core in the cluster.",
    
  • )
  • parser.add_argument(
  •    "--pmu-ppi-number",
    
  •    type=arm_ppi_arg,
    
  •    default=23,
    
  •    help="The number of the PPI to use to connect each PMU to its  
    

core. "

  •    "Must be an integer and a valid PPI number (16 <= int_num <= 31).",
    
  • )
    parser.add_argument("--checkpoint", action="store_true")
    parser.add_argument("--restore", type=str, default=None)

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69957?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I9cfb5781f211338919550f2320a7133d88801f6a
Gerrit-Change-Number: 69957
Gerrit-PatchSet: 2
Gerrit-Owner: Richard Cooper richard.cooper@arm.com
Gerrit-Reviewer: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Jason Lowe-Power jason@lowepower.com
Gerrit-Reviewer: Jason Lowe-Power power.jg@gmail.com
Gerrit-Reviewer: Richard Cooper richard.cooper@arm.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Richard Cooper has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/69957?usp=email ) Change subject: configs: Add `--with-pmu` option to the simple Arm FS configs ...................................................................... configs: Add `--with-pmu` option to the simple Arm FS configs Add an option to add a PMU to the CPUs in `starter_fs.py` and `baremetal.py`. By default PMUs will not be added. Also adds an `--arm-ppi-number` option. Each PMU will be connected to its core using the specified PPI. Change-Id: I9cfb5781f211338919550f2320a7133d88801f6a Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69957 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Bobby Bruce <bbruce@ucdavis.edu> --- M configs/example/arm/baremetal.py M configs/example/arm/starter_fs.py 2 files changed, 52 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Bobby Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/configs/example/arm/baremetal.py b/configs/example/arm/baremetal.py index 8ffd2b4..be72ebe 100644 --- a/configs/example/arm/baremetal.py +++ b/configs/example/arm/baremetal.py @@ -157,6 +157,11 @@ workload_class = workloads.workload_list.get(args.workload) system.workload = workload_class(object_file, system) + if args.with_pmu: + for cluster in system.cpu_cluster: + interrupt_numbers = [args.pmu_ppi_number] * len(cluster) + cluster.addPMUs(interrupt_numbers) + if args.exit_on_uart_eot: for uart in system.realview.uart: uart.end_on_eot = True @@ -182,6 +187,15 @@ break +def arm_ppi_arg(int_num: int) -> int: + """Argparse argument parser for valid Arm PPI numbers.""" + # PPIs (1056 <= int_num <= 1119) are not yet supported by gem5 + int_num = int(int_num) + if 16 <= int_num <= 31: + return int_num + raise ValueError(f"{int_num} is not a valid Arm PPI number") + + def main(): parser = argparse.ArgumentParser(epilog=__doc__) @@ -258,6 +272,18 @@ help="Destination for the Tarmac trace output. [Default: stdoutput]", ) parser.add_argument( + "--with-pmu", + action="store_true", + help="Add a PMU to each core in the cluster.", + ) + parser.add_argument( + "--pmu-ppi-number", + type=arm_ppi_arg, + default=23, + help="The number of the PPI to use to connect each PMU to its core. " + "Must be an integer and a valid PPI number (16 <= int_num <= 31).", + ) + parser.add_argument( "--exit-on-uart-eot", action="store_true", help="Exit simulation if any of the UARTs receive an EOT. Many " diff --git a/configs/example/arm/starter_fs.py b/configs/example/arm/starter_fs.py index ebed188..07280bd 100644 --- a/configs/example/arm/starter_fs.py +++ b/configs/example/arm/starter_fs.py @@ -177,6 +177,11 @@ ] system.workload.command_line = " ".join(kernel_cmd) + if args.with_pmu: + for cluster in system.cpu_cluster: + interrupt_numbers = [args.pmu_ppi_number] * len(cluster) + cluster.addPMUs(interrupt_numbers) + return system @@ -198,6 +203,15 @@ break +def arm_ppi_arg(int_num: int) -> int: + """Argparse argument parser for valid Arm PPI numbers.""" + # PPIs (1056 <= int_num <= 1119) are not yet supported by gem5 + int_num = int(int_num) + if 16 <= int_num <= 31: + return int_num + raise ValueError(f"{int_num} is not a valid Arm PPI number") + + def main(): parser = argparse.ArgumentParser(epilog=__doc__) @@ -272,6 +286,18 @@ default="stdoutput", help="Destination for the Tarmac trace output. [Default: stdoutput]", ) + parser.add_argument( + "--with-pmu", + action="store_true", + help="Add a PMU to each core in the cluster.", + ) + parser.add_argument( + "--pmu-ppi-number", + type=arm_ppi_arg, + default=23, + help="The number of the PPI to use to connect each PMU to its core. " + "Must be an integer and a valid PPI number (16 <= int_num <= 31).", + ) parser.add_argument("--checkpoint", action="store_true") parser.add_argument("--restore", type=str, default=None) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69957?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I9cfb5781f211338919550f2320a7133d88801f6a Gerrit-Change-Number: 69957 Gerrit-PatchSet: 2 Gerrit-Owner: Richard Cooper <richard.cooper@arm.com> Gerrit-Reviewer: Bobby Bruce <bbruce@ucdavis.edu> Gerrit-Reviewer: Jason Lowe-Power <jason@lowepower.com> Gerrit-Reviewer: Jason Lowe-Power <power.jg@gmail.com> Gerrit-Reviewer: Richard Cooper <richard.cooper@arm.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>