From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFC2C39FD6; Mon, 21 Oct 2024 10:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507565; cv=none; b=BwaBysVZrEe6EhAQ7ozcr3XCZcuM2SZ5iDj/538CI9fd8Na+adbXnqTcwEUKo/XTn+pA8whk+jM/JzQsohUZcS63/QgLiXX7jJBn9J70aw4NYSuwU2yvXVPlua7SblDd58WvwoTas53HuWAI2+6dBAJdzLuCKdOZJ6eO9YsBBFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729507565; c=relaxed/simple; bh=gXueZwIuC19mYYo1m90Kw+frLYttri0rqpGLZZhpkiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q050IP7AEU83jq/dwWD6qB7jMiOB361zd4uE7LAAoT6zNz9Q9rdbVIodYOGhBM8xvy559fOArfAxWx9CfxmTfLi/Fz4QRNqaWomlwNUppRbhb6aVqvztsYjOpo+UYoOEY1IsBeTUTqKxowbiGOYNWm3g3W6nzf2hNDp9Qyggomk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I90wpc4c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="I90wpc4c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F410C4CEC7; Mon, 21 Oct 2024 10:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729507564; bh=gXueZwIuC19mYYo1m90Kw+frLYttri0rqpGLZZhpkiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I90wpc4cgUUipIer4xfGDMXgC8H64Gyo7UZdmGIQtTtgM2zSf51v/76YQqirbUy/Y tMHZZMZSMKq6YYyI2hKcNi6B6OwnsEJfgJxXmoDFBwQDhklxZArtN7pzD4UEjYIckq ZhuD19iwZJBwXySoBh33hr3SWblWDF51BM83umcY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nianyao Tang , Thomas Gleixner , Marc Zyngier , Zenghui Yu Subject: [PATCH 5.15 28/82] irqchip/gic-v3-its: Fix VSYNC referencing an unmapped VPE on GIC v4.1 Date: Mon, 21 Oct 2024 12:25:09 +0200 Message-ID: <20241021102248.361324465@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241021102247.209765070@linuxfoundation.org> References: <20241021102247.209765070@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nianyao Tang commit 80e9963fb3b5509dfcabe9652d56bf4b35542055 upstream. As per the GICv4.1 spec (Arm IHI 0069H, 5.3.19): "A VMAPP with {V, Alloc}=={0, x} is self-synchronizing, This means the ITS command queue does not show the command as consumed until all of its effects are completed." Furthermore, VSYNC is allowed to deliver an SError when referencing a non existent VPE. By these definitions, a VMAPP followed by a VSYNC is a bug, as the later references a VPE that has been unmapped by the former. Fix it by eliding the VSYNC in this scenario. Fixes: 64edfaa9a234 ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP") Signed-off-by: Nianyao Tang Signed-off-by: Thomas Gleixner Reviewed-by: Marc Zyngier Reviewed-by: Zenghui Yu Link: https://lore.kernel.org/r/20240406022737.3898763-1-tangnianyao@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/irqchip/irq-gic-v3-its.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -779,6 +779,7 @@ static struct its_vpe *its_build_vmapp_c struct its_cmd_block *cmd, struct its_cmd_desc *desc) { + struct its_vpe *vpe = valid_vpe(its, desc->its_vmapp_cmd.vpe); unsigned long vpt_addr, vconf_addr; u64 target; bool alloc; @@ -791,6 +792,11 @@ static struct its_vpe *its_build_vmapp_c if (is_v4_1(its)) { alloc = !atomic_dec_return(&desc->its_vmapp_cmd.vpe->vmapp_count); its_encode_alloc(cmd, alloc); + /* + * Unmapping a VPE is self-synchronizing on GICv4.1, + * no need to issue a VSYNC. + */ + vpe = NULL; } goto out; @@ -825,7 +831,7 @@ static struct its_vpe *its_build_vmapp_c out: its_fixup_cmd(cmd); - return valid_vpe(its, desc->its_vmapp_cmd.vpe); + return vpe; } static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,