Unverified Commit e076c150 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4120 arm_mpam: support mpam feature in OLK-6.6

Merge Pull Request from: @ci-robot 
 
PR sync from: Zeng Heng <zengheng4@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/CWXU373H4FGB3NVOHDZND26L4OW2ATUI/ 
MPAM feature could be enabled by CONFIG_ARM64_MPAM=y.
v2 Change log:
split part of patches that are associated with RDT drivers:
!4027:[OLK-6.6] Intel RDT non-contiguous CBM support

Amit Singh Tomar (1):
  fs/resctrl: Remove the limit on the number of CLOSID

Babu Moger (9):
  x86/resctrl: Add multiple tasks to the resctrl group at once
  x86/resctrl: Simplify rftype flag definitions
  x86/resctrl: Rename rftype flags for consistency
  x86/resctrl: Unwind properly from rdt_enable_ctx()
  x86/resctrl: Move default group file creation to mount
  x86/resctrl: Introduce "-o debug" mount option
  x86/resctrl: Display CLOSID for resource group
  x86/resctrl: Add support for the files of MON groups only
  x86/resctrl: Display RMID of resource group

James Morse (104):
  tick/nohz: Move tick_nohz_full_mask declaration outside the #ifdef
  x86/resctrl: kfree() rmid_ptrs from resctrl_exit()
  x86/resctrl: Create helper for RMID allocation and mondata dir
    creation
  x86/resctrl: Move rmid allocation out of mkdir_rdt_prepare()
  x86/resctrl: Track the closid with the rmid
  x86/resctrl: Access per-rmid structures by index
  x86/resctrl: Allow RMID allocation to be scoped by CLOSID
  x86/resctrl: Track the number of dirty RMID a CLOSID has
  x86/resctrl: Use __set_bit()/__clear_bit() instead of open coding
  x86/resctrl: Allocate the cleanest CLOSID by searching
    closid_num_dirty_rmid
  x86/resctrl: Move CLOSID/RMID matching and setting to use helpers
  x86/resctrl: Add cpumask_any_housekeeping() for limbo/overflow
  x86/resctrl: Queue mon_event_read() instead of sending an IPI
  x86/resctrl: Allow resctrl_arch_rmid_read() to sleep
  x86/resctrl: Allow arch to allocate memory needed in
    resctrl_arch_rmid_read()
  x86/resctrl: Make resctrl_mounted checks explicit
  x86/resctrl: Move alloc/mon static keys into helpers
  x86/resctrl: Make rdt_enable_key the arch's decision to switch
  x86/resctrl: Add helpers for system wide mon/alloc capable
  x86/resctrl: Add CPU online callback for resctrl work
  x86/resctrl: Allow overflow/limbo handlers to be scheduled on any-but
    cpu
  x86/resctrl: Add CPU offline callback for resctrl work
  x86/resctrl: Move domain helper migration into resctrl_offline_cpu()
  x86/resctrl: Separate arch and fs resctrl locks
  x86/resctrl: Add a helper to avoid reaching into the arch code
    resource list
  x86/resctrl: Move ctrlval string parsing links away from the arch code
  x86/resctrl: Add helper for setting CPU default properties
  x86/resctrl: Remove rdtgroup from update_cpu_closid_rmid()
  x86/resctrl: Export resctrl fs's init function
  x86/resctrl: Wrap resctrl_arch_find_domain() around rdt_find_domain()
  x86/resctrl: Move resctrl types to a separate header
  x86/resctrl: Add a resctrl helper to reset all the resources
  x86/resctrl: Move monitor init work to a resctrl init call
  x86/resctrl: Move monitor exit work to a restrl exit call
  x86/resctrl: Move max_{name,data}_width into resctrl code
  x86/resctrl: Stop using the for_each_*_rdt_resource() walkers
  x86/resctrl: Export the is_mbm_*_enabled() helpers to asm/resctrl.h
  x86/resctrl: Add resctrl_arch_is_evt_configurable() to abstract BMEC
  x86/resctrl: Change mon_event_config_{read,write}() to be arch helpers
  x86/resctrl: Allow resctrl_arch_mon_event_config_write() to return an
    error
  x86/resctrl: Allow an architecture to disable pseudo lock
  x86/resctrl: Make prefetch_disable_bits belong to the arch code
  x86/resctrl: Make resctrl_arch_pseudo_lock_fn() take a plr
  x86/resctrl: Move get_config_index() to a header
  x86/resctrl: Claim get_domain_from_cpu() for resctrl
  x86/resctrl: Describe resctrl's bitmap size assumptions
  x86/resctrl: Drop __init/__exit on assorted symbols
  fs/resctrl: Add boiler plate for external resctrl code
  x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl
  x86/resctrl: Move the filesystem portions of resctrl to live in '/fs/'
  arm64: head.S: Initialise MPAM EL2 registers and disable traps
  arm64: cpufeature: discover CPU support for MPAM
  KVM: arm64: Fix missing traps of guest accesses to the MPAM registers
  KVM: arm64: Disable MPAM visibility by default, and handle traps
  arm64: mpam: Context switch the MPAM registers
  untested: KVM: arm64: Force guest EL1 to use user-space's partid
    configuration
  ACPI / PPTT: Provide a helper to walk processor containers
  ACPI / PPTT: Find PPTT cache level by ID
  ACPI / PPTT: Add a helper to fill a cpumask from a processor container
  ACPI / PPTT: Add a helper to fill a cpumask from a cache_id
  cacheinfo: Expose the code to generate a cache-id from a device_node
  drivers: base: cacheinfo: Add helper to find the cache size from
    cpu+level
  ACPI / MPAM: Parse the MPAM table
  arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate
  arm_mpam: Add the class and component structures for ris firmware
    described
  arm_mpam: Add MPAM MSC register layout definitions
  arm_mpam: Add cpuhp callbacks to probe MSC hardware
  arm_mpam: Probe MSCs to find the supported partid/pmg values
  arm_mpam: Probe the hardware features resctrl supports
  arm_mpam: Merge supported features during mpam_enable() into
    mpam_class
  arm_mpam: Reset MSC controls from cpu hp callbacks
  arm_mpam: Add a helper to touch an MSC from any CPU
  arm_mpam: Extend reset logic to allow devices to be reset any time
  arm_mpam: Register and enable IRQs
  arm_mpam: Use the arch static key to indicate when mpam is enabled
  arm_mpam: Allow configuration to be applied and restored during cpu
    online
  arm_mpam: Probe and reset the rest of the features
  arm_mpam: Add helpers to allocate monitors
  arm_mpam: Add mpam_msmon_read() to read monitor value
  arm_mpam: Track bandwidth counter state for overflow and power
    management
  arm_mpam: Add helper to reset saved mbwu state
  arm_mpam: resctrl: Add boilerplate cpuhp and domain allocation
  arm_mpam: resctrl: Pick the caches we will use as resctrl resources
  arm_mpam: resctrl: Pick a value for num_rmid
  arm_mpam: resctrl: Implement resctrl_arch_reset_resources()
  arm_mpam: resctrl: Add resctrl_arch_get_config()
  arm_mpam: resctrl: Implement helpers to update configuration
  arm_mpam: resctrl: Add CDP emulation
  arm64: mpam: Add helpers to change a tasks and cpu mpam partid/pmg
    values
  arm_mpam: resctrl: Add rmid index helpers
  untested: arm_mpam: resctrl: Add support for MB resource
  untested: arm_mpam: resctrl: Add support for mbm counters
  arm_mpam: resctrl: Allow resctrl to allocate monitors
  arm_mpam: resctrl: Add resctrl_arch_rmid_read() and
    resctrl_arch_reset_rmid()
  untested: arm_mpam: resctrl: Allow monitors to be configured
  arm_mpam: resctrl: Add empty definitions for pseudo lock
  arm_mpam: resctrl: Add empty definitions for fine-grained enables
  arm_mpam: resctrl: Add dummy definition for free running counters
  arm64: mpam: Select ARCH_HAS_CPU_RESCTRL
  perf/arm-cmn: Stop claiming all the resources
  arm_mpam: resctrl: Tell resctrl about cpu/domain online/offline
  arm_mpam: resctrl: Call resctrl_exit() in the event of errors
  arm_mpam: resctrl: Update the rmid reallocation limit

Maciej Wieczor-Retman (1):
  x86/resctrl: Fix remaining kernel-doc warnings

Rob Herring (3):
  cacheinfo: Allow for >32-bit cache 'id'
  cacheinfo: Set cache 'id' based on DT data
  dt-bindings: arm: Add MPAM MSC binding

Rohit Mathew (2):
  arm_mpam: Probe for long/lwd mbwu counters
  arm_mpam: Use long MBWU counters if supported

Zeng Heng (1):
  arm_mpam: control memory bandwidth with hard limit flag


--
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I8T2RT 
 
Link:https://gitee.com/openeuler/kernel/pulls/4120

 

Reviewed-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: default avatarKevin Zhu <zhukeqian1@huawei.com>
Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: default avatarJason Zeng <jason.zeng@intel.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarXu Kuohai <xukuohai@huawei.com>
Reviewed-by: default avatarZucheng Zheng <zhengzucheng@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents e87ec244 eda57f11
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,8 @@ infrastructure:
     +------------------------------+---------+---------+
     | DIT                          | [51-48] |    y    |
     +------------------------------+---------+---------+
     | MPAM                         | [43-40] |    n    |
     +------------------------------+---------+---------+
     | SVE                          | [35-32] |    y    |
     +------------------------------+---------+---------+
     | GIC                          | [27-24] |    n    |
+20 −2
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ about the feature from resctrl's info directory.

To use the feature mount the file system::

 # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl
 # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl

mount options are:

@@ -46,6 +46,9 @@ mount options are:
"mba_MBps":
	Enable the MBA Software Controller(mba_sc) to specify MBA
	bandwidth in MBps
"debug":
	Make debug files accessible. Available debug files are annotated with
	"Available only with debug option".

L2 and L3 CDP are controlled separately.

@@ -306,7 +309,14 @@ All groups contain the following files:
"tasks":
	Reading this file shows the list of all tasks that belong to
	this group. Writing a task id to the file will add a task to the
	group. If the group is a CTRL_MON group the task is removed from
	group. Multiple tasks can be added by separating the task ids
	with commas. Tasks will be assigned sequentially. Multiple
	failures are not supported. A single failure encountered while
	attempting to assign a task will cause the operation to abort and
	already added tasks before the failure will remain in the group.
	Failures will be logged to /sys/fs/resctrl/info/last_cmd_status.

	If the group is a CTRL_MON group the task is removed from
	whichever previous CTRL_MON group owned the task and also from
	any MON group that owned the task. If the group is a MON group,
	then the task must already belong to the CTRL_MON parent of this
@@ -349,6 +359,10 @@ When control is enabled all CTRL_MON groups will also contain:
	file. On successful pseudo-locked region creation the mode will
	automatically change to "pseudo-locked".

"ctrl_hw_id":
	Available only with debug option. The identifier used by hardware
	for the control group. On x86 this is the CLOSID.

When monitoring is enabled all MON groups will also contain:

"mon_data":
@@ -362,6 +376,10 @@ When monitoring is enabled all MON groups will also contain:
	the sum for all tasks in the CTRL_MON group and all tasks in
	MON groups. Please see example section for more details on usage.

"mon_hw_id":
	Available only with debug option. The identifier used by hardware
	for the monitor group. On x86 this is the RMID.

Resource allocation rules
-------------------------

+227 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/arm/arm,mpam-msc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Arm Memory System Resource Partitioning and Monitoring (MPAM)

description: |
  The Arm MPAM specification can be found here:

  https://developer.arm.com/documentation/ddi0598/latest

maintainers:
  - Rob Herring <robh@kernel.org>

properties:
  compatible:
    items:
      - const: arm,mpam-msc                   # Further details are discoverable
      - const: arm,mpam-memory-controller-msc

  reg:
    maxItems: 1
    description: A memory region containing registers as defined in the MPAM
      specification.

  interrupts:
    minItems: 1
    items:
      - description: error (optional)
      - description: overflow (optional, only for monitoring)

  interrupt-names:
    oneOf:
      - items:
          - enum: [ error, overflow ]
      - items:
          - const: error
          - const: overflow

  arm,not-ready-us:
    description: The maximum time in microseconds for monitoring data to be
      accurate after a settings change. For more information, see the
      Not-Ready (NRDY) bit description in the MPAM specification.

  numa-node-id: true # see NUMA binding

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

patternProperties:
  '^ris@[0-9a-f]$':
    type: object
    additionalProperties: false
    description: |
      RIS nodes for each RIS in an MSC. These nodes are required for each RIS
      implementing known MPAM controls

    properties:
      compatible:
        enum:
            # Bulk storage for cache
          - arm,mpam-cache
            # Memory bandwidth
          - arm,mpam-memory

      reg:
        minimum: 0
        maximum: 0xf

      cpus:
        $ref: '/schemas/types.yaml#/definitions/phandle-array'
        description:
          Phandle(s) to the CPU node(s) this RIS belongs to. By default, the parent
          device's affinity is used.

      arm,mpam-device:
        $ref: '/schemas/types.yaml#/definitions/phandle'
        description:
          By default, the MPAM enabled device associated with a RIS is the MSC's
          parent node. It is possible for each RIS to be associated with different
          devices in which case 'arm,mpam-device' should be used.

    required:
      - compatible
      - reg

required:
  - compatible
  - reg

dependencies:
  interrupts: [ interrupt-names ]

additionalProperties: false

examples:
  - |
    /*
    cpus {
        cpu@0 {
            next-level-cache = <&L2_0>;
        };
        cpu@100 {
            next-level-cache = <&L2_1>;
        };
    };
    */
    L2_0: cache-controller-0 {
        compatible = "cache";
        cache-level = <2>;
        cache-unified;
        next-level-cache = <&L3>;

    };

    L2_1: cache-controller-1 {
        compatible = "cache";
        cache-level = <2>;
        cache-unified;
        next-level-cache = <&L3>;

    };

    L3: cache-controller@30000000 {
        compatible = "arm,dsu-l3-cache", "cache";
        cache-level = <3>;
        cache-unified;

        ranges = <0x0 0x30000000 0x800000>;
        #address-cells = <1>;
        #size-cells = <1>;

        msc@10000 {
            compatible = "arm,mpam-msc";

            /* CPU affinity implied by parent cache node's  */
            reg = <0x10000 0x2000>;
            interrupts = <1>, <2>;
            interrupt-names = "error", "overflow";
            arm,not-ready-us = <1>;
        };
    };

    mem: memory-controller@20000 {
        compatible = "foo,a-memory-controller";
        reg = <0x20000 0x1000>;

        #address-cells = <1>;
        #size-cells = <1>;
        ranges;

        msc@21000 {
            compatible = "arm,mpam-memory-controller-msc", "arm,mpam-msc";
            reg = <0x21000 0x1000>;
            interrupts = <3>;
            interrupt-names = "error";
            arm,not-ready-us = <1>;
            numa-node-id = <1>;
        };
    };

    iommu@40000 {
        reg = <0x40000 0x1000>;

        ranges;
        #address-cells = <1>;
        #size-cells = <1>;

        msc@41000 {
            compatible = "arm,mpam-msc";
            reg = <0 0x1000>;
            interrupts = <5>, <6>;
            interrupt-names = "error", "overflow";
            arm,not-ready-us = <1>;

            #address-cells = <1>;
            #size-cells = <0>;

            ris@2 {
                compatible = "arm,mpam-cache";
                reg = <0>;
                // TODO: How to map to device(s)?
            };
        };
    };

    msc@80000 {
        compatible = "foo,a-standalone-msc";
        reg = <0x80000 0x1000>;

        clocks = <&clks 123>;

        ranges;
        #address-cells = <1>;
        #size-cells = <1>;

        msc@10000 {
            compatible = "arm,mpam-msc";

            reg = <0x10000 0x2000>;
            interrupts = <7>;
            interrupt-names = "overflow";
            arm,not-ready-us = <1>;

            #address-cells = <1>;
            #size-cells = <0>;

            ris@0 {
                compatible = "arm,mpam-cache";
                reg = <0>;
                arm,mpam-device = <&L2_0>;
            };

            ris@1 {
                compatible = "arm,mpam-memory";
                reg = <1>;
                arm,mpam-device = <&mem>;
            };
        };
    };

...
+2 −0
Original line number Diff line number Diff line
@@ -18062,6 +18062,8 @@ S: Supported
F:	Documentation/arch/x86/resctrl*
F:	arch/x86/include/asm/resctrl.h
F:	arch/x86/kernel/cpu/resctrl/
F:	fs/resctrl/
F:	include/linux/resctrl*.h
F:	tools/testing/selftests/resctrl/
READ-COPY UPDATE (RCU)
+8 −0
Original line number Diff line number Diff line
@@ -1324,6 +1324,14 @@ config STRICT_MODULE_RWX
config ARCH_HAS_PHYS_TO_DMA
	bool

config ARCH_HAS_CPU_RESCTRL
	bool
	help
	  The 'resctrl' filesystem allows cpu controls of shared resources
	  such as caches and memory bandwidth to be configured. An architecture
	  selects this if it provides the arch-specific hooks for the filesystem
	  and needs the per-task closid/rmid properties.

config HAVE_ARCH_COMPILER_H
	bool
	help
Loading