Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2405300lqp; Sun, 24 Mar 2024 18:09:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKmhdfVQNbcMtzQaTL4ib9SPPtwbX2R5tIRIAo7Vu5DWzDsPTpy+iD4dLmyv4zFtGrGlVfjowl952/t0RLmPy7+y8ca4MwagXA4J00ug== X-Google-Smtp-Source: AGHT+IFtmApq70GY50MuLjeE40gkOJegTNrZc8dCXw/y53s+G6uaCnShNsfr84SQwQM95dp18caI X-Received: by 2002:a05:6a20:728a:b0:1a3:c8ab:5a7c with SMTP id o10-20020a056a20728a00b001a3c8ab5a7cmr2284921pzk.22.1711328985520; Sun, 24 Mar 2024 18:09:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328985; cv=pass; d=google.com; s=arc-20160816; b=hwz+5U7T1cV1PivWPUq6KckeoHk3VqG6RoDEvPxuEy4jgoPUNeJLjvCvfSYxvEl0wP 5vQ+OaF2QQC+bUjEuzQF/b93BkQHFp6nRmJ7rISamOwPBJWwcUckhRDTziPoSsR2yfYG MP1wK3Jq9cK9pbXLFd3OG/alsJlmB7DNhGCtYBuN/hPP+LM8pQ9lgOOzIybmwG4Hlg53 AU1SfdWk99+5vIBedaKfGhcNuRvfmwYX2mrQrPXjL6/g4nduQXEmPgFz5RyvKKf6pFan yLJ0HA8PFn4gBJRSutFw4NjuGbD6YR5Bq9VxQu2Pu5VhobxFlem4xwrWi6MCREnAxQrS w5Eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OR09WTm51imSMNQn/BKKm5E7+8Xmge5udZP8b27Owpo=; fh=UZBjq8x3IS5QFVi63dcFeSlw7nCVoeaE32RVP//6mHo=; b=xKrmL9AZZMnQ6SSFIS9PWvcNP0Qjx628hxFxGOOYUXRpRoKQ9cztWEdB8nCcd8ibBX ig4pyDUmq5c5kPTQljj/twmgqdlZQQwzEAFjcJqX/qaRe9oEDlyaAusiaA23EsqELbFT vtaLu5NK1Wy0wfMARPv/Qe2j1ml0rAM90oW9gW/gdNo+FJPEPehfVqBJ7jZOO0yM0fjW bOWOhkW3VzHp84j3gqHx9iy6NNi7m1sbCATjZOTTx9NSXmZbd1gYAmbrG5VERMQi6pc0 jNidBRzuR1AYWWv1GUQUxaDiWCp84MEuc0DZNpTN96b/MJcmIRCRtfMty2ZmkW5Ff63U SEWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X41zSqJQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113587-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113587-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b1-20020aa78101000000b006e688f7b061si4077440pfi.270.2024.03.24.18.09.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:09:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113587-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X41zSqJQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113587-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113587-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 34DBC2849EC for ; Mon, 25 Mar 2024 01:09:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F3191CB669; Sun, 24 Mar 2024 22:46:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X41zSqJQ" 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 6F4DA1CADD2; Sun, 24 Mar 2024 22:46:30 +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=1711320390; cv=none; b=e59ptfvjWNhJWbND5vpovWGv/buxsXQbI3Xudk+9wMmSwMVIkHeFcmIH64phZlEiVRTnt6Xt0uQzLzTiJLcFRwkQNrBrCNxxMn4X45vfGDTUrx26AnDJYOAFR1X43g2Mglu4BX5mZmF0nOBNRxZsCPBfxRXH9Wa99emBetFiFlQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320390; c=relaxed/simple; bh=akyCiPipqbgH9uYcbISvXDEQx3ozMU+L37j//NWRLHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sUopytKjTbpuNjrWTwqT9hpdrrOyqEwGzi2gCx4YnDIQHCN9WZfOBmj79/6uwMyP3UcOS9hpS+UVev3r8icAXcpb2mAVEUooL3B/pBGvWKC+Vf8WHKecX+LrCE9EKlrxqJzYI5jC87e7zQgfNWx2045vKGTtahu0jjOwXfbKaic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X41zSqJQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD109C43394; Sun, 24 Mar 2024 22:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320390; bh=akyCiPipqbgH9uYcbISvXDEQx3ozMU+L37j//NWRLHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X41zSqJQtKXyp/dSW+vUc4jiuvP/iLTnkTZR7m1H1saF7f+w4jZPe74fSCoVR8PD1 kADs8PpatqpOn4awAWyDpXQqPCZgCQudKcR7cunNe2d05WuyoIrasRx3jDTmGvXVM1 Mn+L/7gmq+QOPZiihtzgGZgpMA0cHvc8fQ4aEKQ/wOLSdnqjuyWyci5T140ymJHXUe 4mUAujbgADkp1ZrH/xXNNTce0ftcisZzNzWHvRAr+U4ixTEfHBUEQE9qAoiGTsECqS nGyBeWv+pVRKBwH58GGVAsbXbuesxFYQ3GU+uEhFNkqc+vbLEcjXjcLilzs3Bw6gp3 V4VY+zV7h6Opw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Subbaraya Sundeep , "David S . Miller" , Sasha Levin Subject: [PATCH 6.8 696/715] octeontx2-af: Use separate handlers for interrupts Date: Sun, 24 Mar 2024 18:34:35 -0400 Message-ID: <20240324223455.1342824-697-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Subbaraya Sundeep [ Upstream commit 50e60de381c342008c0956fd762e1c26408f372c ] For PF to AF interrupt vector and VF to AF vector same interrupt handler is registered which is causing race condition. When two interrupts are raised to two CPUs at same time then two cores serve same event corrupting the data. Fixes: 7304ac4567bc ("octeontx2-af: Add mailbox IRQ and msg handlers") Signed-off-by: Subbaraya Sundeep Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index d2a575a645d8a..6a911ea0cff9b 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -2531,10 +2531,9 @@ static void rvu_queue_work(struct mbox_wq_info *mw, int first, } } -static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq) +static irqreturn_t rvu_mbox_pf_intr_handler(int irq, void *rvu_irq) { struct rvu *rvu = (struct rvu *)rvu_irq; - int vfs = rvu->vfs; u64 intr; intr = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_PFAF_MBOX_INT); @@ -2548,6 +2547,18 @@ static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq) rvu_queue_work(&rvu->afpf_wq_info, 0, rvu->hw->total_pfs, intr); + return IRQ_HANDLED; +} + +static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq) +{ + struct rvu *rvu = (struct rvu *)rvu_irq; + int vfs = rvu->vfs; + u64 intr; + + /* Sync with mbox memory region */ + rmb(); + /* Handle VF interrupts */ if (vfs > 64) { intr = rvupf_read64(rvu, RVU_PF_VFPF_MBOX_INTX(1)); @@ -2889,7 +2900,7 @@ static int rvu_register_interrupts(struct rvu *rvu) /* Register mailbox interrupt handler */ sprintf(&rvu->irq_name[RVU_AF_INT_VEC_MBOX * NAME_SIZE], "RVUAF Mbox"); ret = request_irq(pci_irq_vector(rvu->pdev, RVU_AF_INT_VEC_MBOX), - rvu_mbox_intr_handler, 0, + rvu_mbox_pf_intr_handler, 0, &rvu->irq_name[RVU_AF_INT_VEC_MBOX * NAME_SIZE], rvu); if (ret) { dev_err(rvu->dev, -- 2.43.0