From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796292855; b=10Ov0x15NzJZFIO5iml0CJF9Pc1Glb5EIwZve/ok5qswYBH1RMHMYJfKZ54Shz04EF5i Ub1v7T7xVnI8Ubq5/RiNJgjC32bzk3Ov/88RH/VFDkpb3Uucnl3QE4IlyuNxBFzjUqQ/t fcYezcV4KQz7eWzjqoDXP0k/nqZpnOVbEFinNAMFIqXYAV1ntquEVPoL/Eirukghsx4ED KdS9Swl6Q3hqv/qq4MP2lhE8cTu6A1kQaF1GL+FhuQPW4CTFWK1c4fQYaluWypv/OlDqv d/YbnoqZ+oOhGM9+x8806LojS/MEar0YWlLwfOjHsRDZvsD8HH31KxFWlR7h27sjJCw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796292855; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=seiNw169UwitQEFXhWLxeimMKv254+oUx1hcDLV5aIA=; b=pYbQgk1Yp/lChGjqnEXz6dsK2TV5JjOreTBB3HyF+vF2INsg3Gg/buVSyWklgVQnwgWR eWbk0ZELuWYsA6BFFmzUvgB0UF9xrnfBLlupY2JRp2Via4j0r9eOAJh0kZ7M7k4EYxpTq OCY9/QWrDSOP5mK0C8VTlo1VX3DJsoaqf3eLYrWB46qaj7XX1nWBr2BJY/7InDwmzVHQ5 k/K60FUs2PLWO9oFotUNLEs5jGKc0X0QOPAetGoIyEsAajhfKqMTu43psYzFSHytntx8S 5TOz71bwPg/GtJ2usM5UT7oxuu/MgUJUidaduuLfwhlaxMyfKHkNjQV8fBeMVRi66zw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=E47p9p88; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C445606A32C for ; Thu, 3 Dec 2026 10:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=E47p9p88 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78DB11F000C1; Thu, 3 Dec 2026 10:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796292854; bh=seiNw169UwitQEFXhWLxeimMKv254+oUx1hcDLV5aIA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=E47p9p88lhg71d9POWbqiEp7Mt8bwqF1+s745ujIdwByoZA7d84Nsk1no+vypmBCs uj/6hPaTg2n8zj3CPaPOi9gG+bF1IBp/JEqBKTs382+MamKNor+RRpMLGNl4XLx+4U qbPgXJIXP7QdPLNy5zKkmM3PRilZC+AjdU6Vt0BMN6h2Wu1gEp4XaFn8vV7+I6VMV8 pnvK8RTjcfELr9AexTYfybmVspbs7mXxZio7kskwooC82egkRAuWE8hLwMydcvLc/W UgW4LFgGRoQ7RHoTSc+VsMOUG6aGU1T2hM6Xf5a0WVdt0A2T+SRYKIgJvbXwqdDfcl AOUrmhSIs9+uw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 1/5] riscv_cbqri: Add capacity controller core Reply-To: sashiko-reviews@lists.linux.dev To: "Drew Fustini" Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203-dfustini-atl-sc-cbqri-dt-v13-1-eaa688b1624c@kernel.org> References: <20261203-dfustini-atl-sc-cbqri-dt-v13-0-eaa688b1624c@kernel.org> <20261203-dfustini-atl-sc-cbqri-dt-v13-1-eaa688b1624c@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 10:14:14 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] riscv_cbqri: incomplete AT-mirror verification in cbqri_apply_cache_config() -- commit a00d96c0d30cb11391c930e3a47a96f149912607 Author: Drew Fustini riscv_cbqri: Add capacity controller core This commit adds the core driver for RISC-V CBQRI capacity controllers, including capability probing and MMIO operations to program and read back per-RCID capacity block masks. > diff --git a/drivers/resctrl/cbqri_devices.c b/drivers/resctrl/cbqri_devi= ces.c > new file mode 100644 > index 0000000000000..d6c2e08a5546d > --- /dev/null > +++ b/drivers/resctrl/cbqri_devices.c [ ... ] > +int cbqri_apply_cache_config(struct cbqri_controller *ctrl, u32 closid, > + const struct cbqri_cc_config *cfg) > +{ [ ... ] > + /* Capacity config limit operation for the AT half implied by cfg->at */ > + err =3D cbqri_cc_alloc_op(ctrl, CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > + closid, cfg->at, cfg->cbm); > + if (err < 0) > + return err; > + > + /* > + * CDP-off mirror: on AT-capable controllers, also program the > + * other AT half with the same mask so the two halves stay in sync. > + */ > + if (need_at_mirror) { > + u32 other =3D (cfg->at =3D=3D CBQRI_CONTROL_REGISTERS_AT_CODE) ? > + CBQRI_CONTROL_REGISTERS_AT_DATA : > + CBQRI_CONTROL_REGISTERS_AT_CODE; > + > + err =3D cbqri_cc_alloc_op(ctrl, > + CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > + closid, other, cfg->cbm); > + if (err < 0) { > + int rerr; > + > + /* > + * Best-effort revert of the cfg->at half so the two > + * halves stay in sync. A schemata read sees only one > + * half, so silent divergence would otherwise report > + * the new value as if the write had succeeded. > + */ > + rerr =3D cbqri_cc_alloc_op(ctrl, > + CBQRI_CC_ALLOC_CTL_OP_CONFIG_LIMIT, > + closid, cfg->at, saved_cbm); > + if (rerr < 0) > + pr_err_ratelimited("AT-mirror revert failed (err=3D%d), AT halves di= verged\n", > + rerr); > + return err; > + } > + } > + > + /* Read the limit back to verify the block mask landed */ > + err =3D cbqri_cc_alloc_op(ctrl, CBQRI_CC_ALLOC_CTL_OP_READ_LIMIT, > + closid, cfg->at, 0); > + if (err < 0) > + return err; > + > + /* > + * Read the capacity block mask and narrow to u32 to match resctrl's CBM > + * width. cbqri_probe_cc() rejects ncblks > 32 so the upper bits are > + * reserved zero. > + */ > + reg =3D cbqri_readq(ctrl->base + CBQRI_CC_BLOCK_MASK_OFF); > + if (lower_32_bits(reg) !=3D cfg->cbm) { > + pr_err_ratelimited("CBM verify mismatch (reg=3D%llx !=3D cbm=3D%llx)\n= ", > + reg, cfg->cbm); > + err =3D -EIO; > + } [Severity: Low] Can the two AT halves still diverge when need_at_mirror is true? The post-write CBQRI_CC_ALLOC_CTL_OP_READ_LIMIT check only reads back cfg->at, so a silent failure to apply cfg->cbm on the mirrored other half goes undetected and cbqri_apply_cache_config() returns 0. In addition, because cfg->at is verified after other has already been written, a readback error or mismatch on cfg->at returns -EIO without reverting other to saved_cbm. Verifying cfg->at before programming other, and then verifying other while reverting cfg->at to saved_cbm on either error or mismatch, would keep both halves checked and consistent. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-dfustini-a= tl-sc-cbqri-dt-v13-0-eaa688b1624c@kernel.org?part=3D1