Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2620278lqp; Mon, 25 Mar 2024 04:49:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrqt7f6/VjZBAxePP9tLZGJkD6qsJAivXjrRIyWHLn0gXiOtQKaASqnhp1yaayrhaENulwlG6i1oO608jMMwAeieZLQJtZLEOB4GhPnA== X-Google-Smtp-Source: AGHT+IGExHvx4p2iKLA/SjNpSYOisGbd9N1sThDPN4Jtlxu6c1zIWDLBOiz39d0aBcLAm7GvZgoS X-Received: by 2002:a05:620a:1648:b0:78a:1a4:237d with SMTP id c8-20020a05620a164800b0078a01a4237dmr7049407qko.64.1711367351196; Mon, 25 Mar 2024 04:49:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367351; cv=pass; d=google.com; s=arc-20160816; b=ei4RPDYlsch0xKOZhVTpLqVpPRLp3PFZOl/3LNt8FnnGHbXToGKa2y2jQz0GLFhy8f iSApv1Io6FfWKXl5ngyRmKU+UAfdHnQRzd95Zmgawy9ef6NuhDVzZNkL6Smm/T/OHRbI 4lU1g8AzPBw44CEPriLxGBXhYvcEUYeVY2xUJiu0Nqbf3QACTi9bc3sTEvnCyjVdyprM RFKLDocX0+5jmc6oGln2F1KFBKdWEKSg5LkjMZPJPp/1TqnLmcEqUhaQqTYntI9sRPjt Tkq/VDeE+knSEFGGIp+su7Cm87ANIIUGcMQ55n+wM7Ac+DdYpRYKvBaraOA/dCh67w1l Qoig== 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=82MZk+A8WmzjTDydnNy3Dp6j/z2jpvqSS635oP1Maf8=; fh=UZBjq8x3IS5QFVi63dcFeSlw7nCVoeaE32RVP//6mHo=; b=nmfZWIw0Cm/e1CmCFLl3FB9QvewwxcRDTB0Z7EIYj6XK/mf7lhLTtNkjDhyCTLEkmm P2oM+NnEpm56kE6ZFCP5n9HolKYgZMwGgUraOSrdyEIdKpwI4/+ogdOwH/8F9gXMLgEl AEpv13RcF4UQu3CCYA61wl2f2oK1NT/hJoTxuGU33M4Wkq8aVfd44hcC3VKE5AvhrbLf 38vDaCJBlZl91YT2o6RdVlMydYbIlJmOzLQD8l8uNXcMHqOifZey48XL/QMyeRHtzdbj tiankNBhheyyHBAAAwerN39LtUL29pMsFJhsJ4e41GBWPXe4diDVkE9Gzi12uhXxXiAc qoag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MEQaDNv8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116221-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116221-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d26-20020a05620a137a00b00789fa5f4a52si5244694qkl.785.2024.03.25.04.49.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116221-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MEQaDNv8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116221-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116221-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EA0671C35084 for ; Mon, 25 Mar 2024 11:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7BAC3BFFC3; Mon, 25 Mar 2024 03:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MEQaDNv8" 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 9A0A217DC3E; Sun, 24 Mar 2024 23:44:11 +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=1711323852; cv=none; b=UoByqRADpevT+oXekIjh+dxPGKVigMEdCr/NVu29Q1h9MpqjNmEI/vIEN9dviK6tSjYnuGb13/waeE518XTcriLtw5anxsbiwzTkNecfIdKYPBi7/CLtDwz+88n5Gxj+g/BOvWoQhWPlcxsh7YKRi7dzSZ21pMg2TmDPyOJHYzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323852; c=relaxed/simple; bh=w1K52Csdl2eq1OaHzMItpQSYmWMb0G/2QmKQbj0IUKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VyHHgwOHfXb62dcVnA9ZGqu6olnuWnD3So28dy3WIBvnh4too2FRwuCDEyG94PAMbL6NDRgpHdLPFOHulL6f1RMhJf+83HgZNp1Yin3njWcGbwTknYPFv0vw9TpgJRy7OngVpTzrve/R4CLjjzcxiF+CHUM09H/UTPIe1h9/1Lc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MEQaDNv8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA990C433C7; Sun, 24 Mar 2024 23:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323851; bh=w1K52Csdl2eq1OaHzMItpQSYmWMb0G/2QmKQbj0IUKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MEQaDNv8bYD2oIQiWAM1DcuzCcrn0r5I5ugr3K01oFTIWn5x7ST0IRb6ZIO1RgtXg 8MvdsnA9vExSSNyo4OBNK3cyNs3HJtMI3zFe1Mhju9e927ecKa3AXUceHRQ6MkrKJF yamkNa3Y7/xY7GJ59uaxAuL4JbKOiigf1itkUt7jI8V+daO/ad/GkDPogwrkZf36bk hV1AH+iBLbwcxFWi6BqSkXVk9DcG3yOH5bPPHC790QWFzdtBM9NOnNmBuNAKIUHq79 Uk6LQ+UaTf0ubxttlId9eDgjtcZMuA+cILNJ2CDLo/LpFZYHiNCaTnVIWkrc6LrLMV ajZg3oOgxsxqw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Subbaraya Sundeep , "David S . Miller" , Sasha Levin Subject: [PATCH 5.10 229/238] octeontx2-af: Use separate handlers for interrupts Date: Sun, 24 Mar 2024 19:40:17 -0400 Message-ID: <20240324234027.1354210-230-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-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 acbc67074f59c..23b829f974de1 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -1969,10 +1969,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); @@ -1986,6 +1985,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)); @@ -2300,7 +2311,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