From nobody Tue Dec 16 11:45:12 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C136C77B75 for ; Wed, 19 Apr 2023 11:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232895AbjDSLLF (ORCPT ); Wed, 19 Apr 2023 07:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbjDSLLB (ORCPT ); Wed, 19 Apr 2023 07:11:01 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD2BF7A88 for ; Wed, 19 Apr 2023 04:10:20 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63b57c49c4cso2689620b3a.3 for ; Wed, 19 Apr 2023 04:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1681902617; x=1684494617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XmVkd/UrXriHJHxvxxsPlqAajEG3FYZbywzFeJQXIHk=; b=zPbQZG9UKwm7GRyIqZChI5pPpnjrvhb8Q5Cx0LVS9GCn0om8iAHe+VSMXHgYhN4iIE 8hHCqRn6dwTm2nsiT9GilKXMZ1FCN5xuGY6ikI9a3/jb7VDcGrJSy6OtfIdK3QlW6N6+ RxvuxkbB2fpmlt3qaEEq/XF6YsyaBgL3a3uLDu9C3fO+5Ry3wbbsbycb9tLDG71pLFqj 6Ph52NPqQie9WLd/4O6LUZjHBRNlMGRcO41aMzbPqSyM/UYae08hx6DIu6+5KiIvg/BL iP1p9QGFXCiDa/ohQY7K8Ow0ju7miafcpNFTqcaScbcUWUl3Y1ontHOlSlMSlZHcrBr2 V3aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681902617; x=1684494617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XmVkd/UrXriHJHxvxxsPlqAajEG3FYZbywzFeJQXIHk=; b=aWnw9Z/BjF0t7W4h75rW7ho2isMU9OcrOLddU7sJlE3zFoCoMSoAGADzTSn5zQAIfT +bRf1pHBVYPJDmDDZQH0QtqWLoc338bNtubNXFJnfSa/gYPMS+wkPT0yr2J6TlEZ2eVZ A+85gPZqW/OE7mBtAcQrcLCKhchtNB6roTkVqYj9ikxH1sF1v19e0wmjsuD79EGMm8Mi RmyG2zm8MK5KS/DWEK+oupMwBq99PN4+G3pHZyfOgopMi6DEa8OxjsKru4h4uFFDlXQs 0ODpBBTxeKgxkULBG8usK1cJmdvLW/3fVrZY3lFqR8kztJ8jX0VgHxxWoxbzXJ4B1OMb j4dw== X-Gm-Message-State: AAQBX9cBoRhdmGwUTzPfHhgdYAs6DF4OEqgyiskKNxnlCBWpn5vBvj2h mcYe6l22MRzlVl69vJV1KtXI+g== X-Google-Smtp-Source: AKy350Zyw3Ulaxp08aBwcGKciKhzrEtrdld4xIv32oyd3Jnf/nHEuPYG4H87WQ56JWkt1m7BYEv28Q== X-Received: by 2002:a17:902:c941:b0:1a6:387a:6572 with SMTP id i1-20020a170902c94100b001a6387a6572mr6089976pla.13.1681902616795; Wed, 19 Apr 2023 04:10:16 -0700 (PDT) Received: from x1.hsd1.or.comcast.net ([2601:1c2:1800:f680:eaf2:1d7a:7338:16cb]) by smtp.gmail.com with ESMTPSA id g12-20020a1709026b4c00b001a24cded097sm11180774plt.236.2023.04.19.04.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 04:10:16 -0700 (PDT) From: Drew Fustini To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Conor Dooley , Ved Shanbhogue , =?UTF-8?q?Kornel=20Dul=C4=99ba?= , Adrien Ricciardi , Nicolas Pitre , Fenghua Yu , Reinette Chatre , Babu Moger , Peter Newman , x86@kernel.org, Rob Herring , James Morse Cc: Drew Fustini Subject: [RFC PATCH 05/21] RISC-V: QoS: define prototypes for resctrl interface Date: Wed, 19 Apr 2023 04:10:55 -0700 Message-Id: <20230419111111.477118-6-dfustini@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230419111111.477118-1-dfustini@baylibre.com> References: <20230419111111.477118-1-dfustini@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Define the prototypes for the resctrl interface functions that are implemented on RISC-V. Co-developed-by: Adrien Ricciardi Signed-off-by: Adrien Ricciardi Signed-off-by: Drew Fustini --- include/linux/riscv_qos.h | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/include/linux/riscv_qos.h b/include/linux/riscv_qos.h index 95016810b575..537e503a8e99 100644 --- a/include/linux/riscv_qos.h +++ b/include/linux/riscv_qos.h @@ -3,6 +3,7 @@ #ifndef __LINUX_RISCV_QOS_H #define __LINUX_RISCV_QOS_H =20 +#include #include #include =20 @@ -31,4 +32,61 @@ struct cbqri_controller_info { =20 extern struct list_head cbqri_controllers; =20 +bool resctrl_arch_alloc_capable(void); +bool resctrl_arch_mon_capable(void); +bool resctrl_arch_is_llc_occupancy_enabled(void); +bool resctrl_arch_is_mbm_local_enabled(void); +bool resctrl_arch_is_mbm_total_enabled(void); + +struct rdt_resource; +/* + * Note about terminology between x86 (Intel RDT/AMD QoS) and RISC-V: + * CLOSID on x86 is RCID on RISC-V + * RMID on x86 is MCID on RISC-V + * CDP on x86 is AT (access type) on RISC-V + */ +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level ignored); +bool resctrl_arch_match_closid(struct task_struct *tsk, u32 closid); +bool resctrl_arch_match_rmid(struct task_struct *tsk, u32 closid, u32 rmid= ); +int resctrl_arch_mon_ctx_alloc_no_wait(struct rdt_resource *r, int evtid); +void resctrl_arch_mon_ctx_free(struct rdt_resource *r, int evtid, int ctx); +void resctrl_arch_reset_resources(void); +void resctrl_arch_rmid_idx_decode(u32 idx, u32 *closid, u32 *rmid); +u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid); +int resctrl_arch_set_cdp_enabled(enum resctrl_res_level ignored, bool ena= ble); +void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32= rmid); +void resctrl_arch_set_cpu_default_closid(int cpu, u32 closid); +void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 pmg= ); +u32 resctrl_arch_system_num_rmid_idx(void); +void resctrl_sched_in(void); + +static inline bool resctrl_arch_event_is_free_running(enum resctrl_event_i= d evt) +{ + /* must be true for resctrl L3 monitoring files to be created */ + return true; +} + +static inline unsigned int resctrl_arch_round_mon_val(unsigned int val) +{ + return val; +} + +/* Pseudo lock is not supported on RISC-V */ +static inline int resctrl_arch_pseudo_lock_fn(void *_plr) { return 0; } +static inline int resctrl_arch_measure_l2_residency(void *_plr) { return 0= ; } +static inline int resctrl_arch_measure_l3_residency(void *_plr) { return 0= ; } +static inline int resctrl_arch_measure_cycles_lat_fn(void *_plr) { return = 0; } +static inline u64 resctrl_arch_get_prefetch_disable_bits(void) { return 0;= } + +/* Not needed for RISC-V */ +bool resctrl_arch_match_iommu_closid(struct iommu_group *group, u32 closid= ); +bool resctrl_arch_match_iommu_closid_rmid(struct iommu_group *group, u32 c= losid, u32 rmid); +int resctrl_arch_set_iommu_closid_rmid(struct iommu_group *group, u32 clo= sid, u32 rmid); + +/* Not needed for RISC-V */ +static inline void resctrl_arch_enable_mon(void) { } +static inline void resctrl_arch_disable_mon(void) { } +static inline void resctrl_arch_enable_alloc(void) { } +static inline void resctrl_arch_disable_alloc(void) { } + #endif /* __LINUX_RISCV_QOS_H */ --=20 2.34.1