Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1968093ima; Thu, 25 Oct 2018 07:42:54 -0700 (PDT) X-Google-Smtp-Source: AJdET5eGrwvuGP7dSb6DQPFNjCcw41LYmdLlG9bN5Bh+Fg5vG/8YsUszZCNz6j/IKS07RdnKpXN5 X-Received: by 2002:a17:902:1129:: with SMTP id d38-v6mr1799246pla.270.1540478574089; Thu, 25 Oct 2018 07:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478574; cv=none; d=google.com; s=arc-20160816; b=WX2KGKmkwOVbT+jKW/E++PTGsZFnkuZ9Ata1xabt45KJX6i23Am7O75cbusa/FzU4L q9pisbre+NZvQgiiIOAy1WQG2AXXkIEvKxWbcVygwZ8DCW9bPq8dqxvWfKrTJeHnJf3m 5Kbww95WWdhvdpmuXG6JrEP+GqPDINBWxOVAL8/Aha7LRqUeYH0f0fAqotv2txB1SI1Q a8MBjDC2xocD0xVvbzLqyMqpikNVI1e+J8Vzmoeq+AwSrBYck9VQ7bgR2PikVYSkKvzy qcT51hjUKnKmP0b/nZ23I0LspRHvLuSx9Dcx18jZgyfeISPOTR1o4/SpoWSN+5fkWcdR XwDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=67WYmMPrWsCcRTBIDubEAnQBXGbMWopIRnvteCpqUxM=; b=J2qC9ZDfLk+/NmlqOceq5NJc6PRBp5QR5HIwG4JeEF6t/k8+AOxTc88m73A7QwAE3E 96SBaSiuOyQhWNDK3FVJib2Uwk8rGBsT4QGTjx0wNwqFGFftczH0TPEYYSxC2MZsIn7k kyV5h2ppeUgVEwbY1fXbCU2EObFzxQ8Jv982Ko0e/50bsuNHxas5Fn8zUosXmUtkDKNb KqLcrGrrSV1PG2BbPZ7LDEdugeI1hhmY1Xio8l7P13DHd92rAlvZSDWYFQpw6WDzbiZF mmf74v8rTWKmtk8ogf1d89BE7PIrEAp8xH+PEoTiXjvIMMLmUZAepgn03Ibgyz9UAL5/ /epw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HZPesPBs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6-v6si7958356pgb.62.2018.10.25.07.42.38; Thu, 25 Oct 2018 07:42:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HZPesPBs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728293AbeJYWsq (ORCPT + 99 others); Thu, 25 Oct 2018 18:48:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:57568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728270AbeJYWso (ORCPT ); Thu, 25 Oct 2018 18:48:44 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0941920869; Thu, 25 Oct 2018 14:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476948; bh=kV1vj+Q4IKHEvX910Wrx1w5TlOkueCJR6KSsJUUk4EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZPesPBsHTscne5oReBhR2/ytmww/qu3VDBzikzbkhuu4gK0MUMLYpxT++Yljvx4x UdS/JS7DQkT0RVfDng4lqdLuPAUiIWXWott/BYt49F9CuKLX+kcA4IsHSxU3e3cT9S t0DDBidyy8rDtMvD94SKzc9NVZAErqYBG255XXME= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Mintz, Yuval" , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.9 57/98] qed: Warn PTT usage by wrong hw-function Date: Thu, 25 Oct 2018 10:13:42 -0400 Message-Id: <20181025141423.213774-57-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Mintz, Yuval" [ Upstream commit 3a50d3518dcba44f8a0f9356b7140fe1499984ea ] PTT entries are per-hwfn; If some errneous flow is trying to use a PTT belonging to a differnet hwfn warn user, as this can break every register accessing flow later and is very hard to root-cause. Signed-off-by: Yuval Mintz Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_hw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_hw.c b/drivers/net/ethernet/qlogic/qed/qed_hw.c index 6e4fae9b1430..944749cfe092 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_hw.c +++ b/drivers/net/ethernet/qlogic/qed/qed_hw.c @@ -34,6 +34,7 @@ struct qed_ptt { struct list_head list_entry; unsigned int idx; struct pxp_ptt_entry pxp; + u8 hwfn_id; }; struct qed_ptt_pool { @@ -55,6 +56,7 @@ int qed_ptt_pool_alloc(struct qed_hwfn *p_hwfn) p_pool->ptts[i].idx = i; p_pool->ptts[i].pxp.offset = QED_BAR_INVALID_OFFSET; p_pool->ptts[i].pxp.pretend.control = 0; + p_pool->ptts[i].hwfn_id = p_hwfn->my_id; if (i >= RESERVED_PTT_MAX) list_add(&p_pool->ptts[i].list_entry, &p_pool->free_list); @@ -169,6 +171,11 @@ static u32 qed_set_ptt(struct qed_hwfn *p_hwfn, offset = hw_addr - win_hw_addr; + if (p_ptt->hwfn_id != p_hwfn->my_id) + DP_NOTICE(p_hwfn, + "ptt[%d] of hwfn[%02x] is used by hwfn[%02x]!\n", + p_ptt->idx, p_ptt->hwfn_id, p_hwfn->my_id); + /* Verify the address is within the window */ if (hw_addr < win_hw_addr || offset >= PXP_EXTERNAL_BAR_PF_WINDOW_SINGLE_SIZE) { -- 2.17.1