Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1853435lqe; Tue, 9 Apr 2024 02:18:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV2U1N9vqveiOv8OPomD4CGsG2kPGaKVXo4bdGiNHhhBu3WrGgVl5z11UUhHm4jBXn7jR/mgsl3dY29P6mjG4Jmr74fBtvqbQ+BaWBhqw== X-Google-Smtp-Source: AGHT+IE9UxJeJdg5Toz6V/5BQQ8QmO3pWOkEyBcRz5DNEwkmzhb7sO3C8naCqcwpXsVpj15DGBUR X-Received: by 2002:a17:902:d1d4:b0:1e0:b2d5:5f46 with SMTP id g20-20020a170902d1d400b001e0b2d55f46mr9118025plb.46.1712654301153; Tue, 09 Apr 2024 02:18:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712654301; cv=pass; d=google.com; s=arc-20160816; b=J72ZZfB+jk9FNeAdenL3Z3WNzgSm5LihTHAM0XnYCRIjBtrNrzva68kSbl3XcFreKf yTHzuPFo6Uruo9IVGhleUDVlSh8TaaAEIIdoVAjWarUYHAFHbXOoAZ06A+pVkCrk0tot naQgSEzr5aPiZ+hYir2aLjAd/gj553yveJkbCoiD+bU+FXqRm/Sylu6r3cL6OsC2rdX0 OWvwY4f9MnjxyArqQT45xo7Tj/4eLgei7rG+faPTtxY7nMMNv/8N73iyPCr0S1Akb68D 4Bpcc7OPuiGcK0rZqFMyJCqFWjmcZKT0GPWej9X8HqquXDOSZL3MqYPi3idFChHXbT1v U2Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=iZNDVqbvbJbOp01LGO6Qp01I5l3QKdSxp5TQHKwyyzE=; fh=dwUtybg3nHP4rq5+z597bUsSYuPniap9CYARmMb5gDc=; b=VnUwmW2PbpTGMJI7IObOpHIwtNOrgjFpdXQa7n20ikuGGdVHDDq2THuHMNdx4c+L4x b4IyM+4qel4WQyFtvcA+LJ0tyjBEXdjrIDl92jkM97NYR/Y6RhP49lda/0SE2fqql963 FUPjYMWSSn7x2K9Pls6egsTEtAv7hQl9uZPAOLJ6vtRv+HNE69XPsyW/hVhZKFWFgXAa gpndH4j8BQxijF7XNkcldarri2WVqGIVstyJJcQjhtz7QvOc63Jufi3M7JSGPuLPJtUJ AeOpKFnEvvPYcDxpQLgnH0URbl548rPcU+zoWk8LXu0MnMuF/A5bSCnzhunwnHkWSrJp 7RPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="WJ/2kmNv"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-136533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p4-20020a170902e74400b001e0b89a6dbesi8170762plf.387.2024.04.09.02.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 02:18:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="WJ/2kmNv"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-136533-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CBC72B228DC for ; Tue, 9 Apr 2024 09:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 987AA7FBC1; Tue, 9 Apr 2024 09:16:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WJ/2kmNv"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DXJd+R0C" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 47E357F476; Tue, 9 Apr 2024 09:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712654198; cv=none; b=lVzwFxHSd8WYEGolX6/VCtocVT4j6JbtqB71D70QbngmMnj2YLC4h1m/F+JlsGtp/khOkehulUR+jYQ/2m9CLkMcqonJy2PNNFZnpHFllQ7ix70dLLS8BV+NVSZLWSEO0Dc6xe6Z0jDH+ZlSBZRBtD3fwSApXq27ZY7VLRK3y+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712654198; c=relaxed/simple; bh=PV3ABrpUzz7O86C+PI0/38DFjZ+AQp1PQ2wjp8NXC20=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=oZpoh6IskIaDlcsLaYLWLohJDrnn9qEKdGo73oHWOUk5AQitD+enkkHIDmVvGfDU9GRa53xljwwnhzFwmU6hDzDDLBhMBmOkN1L7hXcixHFv7wmDjkTY1CV1b8dxhhAIJ4A6/92LH4QkCjEbW6j7M6jaiPlC9x5h05+5joyg+T0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WJ/2kmNv; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DXJd+R0C; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 09 Apr 2024 09:16:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712654195; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iZNDVqbvbJbOp01LGO6Qp01I5l3QKdSxp5TQHKwyyzE=; b=WJ/2kmNvdech/bTo5JwaomhvDsA9XcphgzOUW5vteN6bgAELkmHdldFOStnEGm0zGbkGO2 5N0LncVx59GJV9oeM4a4pbc/W787oqPDZ88xVHPIrkJoPUC+KDCG/9rB3qXAyVyXzuLK7s ZQi/mUWpAcRQCtqmweHl5ZJoOOlzbR+oZXsYwtAEJtA2fTjNs6feXE235vUq/Uy6fAKgGn /7DiMEdyEBfLU2qpov1N8pk00CMsF1kjaq2f4CE9Siuvrb2u8aGBEtG85pjN4Y0x4ftfRe vk7v80bYJcPkzgEBFRtcvbrzDlnnQnSA1QADKyjRzoHCDoJx+2WbBlUES0PAYw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712654195; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iZNDVqbvbJbOp01LGO6Qp01I5l3QKdSxp5TQHKwyyzE=; b=DXJd+R0CVeZp0YuS4yVm3Qo4pNS00MeD+sNB581mUnBFF55wnfVPl0uuamwlxAiKpxBWfi Y9kLH2NHfsse7xCw== From: "tip-bot2 for Nianyao Tang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/urgent] irqchip/gic-v3-its: Fix VSYNC referencing an unmapped VPE on GIC v4.1 Cc: Nianyao Tang , Thomas Gleixner , Marc Zyngier , Zenghui Yu , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240406022737.3898763-1-tangnianyao@huawei.com> References: <20240406022737.3898763-1-tangnianyao@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171265419457.10875.5533397957548411107.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the irq/urgent branch of tip: Commit-ID: 80e9963fb3b5509dfcabe9652d56bf4b35542055 Gitweb: https://git.kernel.org/tip/80e9963fb3b5509dfcabe9652d56bf4b35542055 Author: Nianyao Tang AuthorDate: Sat, 06 Apr 2024 02:27:37 Committer: Thomas Gleixner CommitterDate: Tue, 09 Apr 2024 11:11:18 +02:00 irqchip/gic-v3-its: Fix VSYNC referencing an unmapped VPE on GIC v4.1 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 --- drivers/irqchip/irq-gic-v3-its.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index fca888b..2a537cb 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -786,6 +786,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, 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; @@ -798,6 +799,11 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, 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; @@ -832,7 +838,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its, 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,