Received: by 10.192.165.156 with SMTP id m28csp54699imm; Tue, 10 Apr 2018 16:15:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+kn53OYK6ocgK4kbvMQLUweSgKQMV+Nxh9+1FDiF+TpPhoXXoPC+imMCVm9/uoOsW0K1rU X-Received: by 2002:a17:902:5305:: with SMTP id b5-v6mr2447557pli.326.1523402147822; Tue, 10 Apr 2018 16:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402147; cv=none; d=google.com; s=arc-20160816; b=KcWsKX62XPSoxuyNUF36Egb6zwH+rLP20e1/2Ykfvl2pj+kLzognytJqNFfN5VYuBX 3GggNN4VjFL0L4U9I196rThVIwuugIt4spQ0bLChqv9bNmSHCZWRMFjq5jhKmJO84Ypz DyREU9iV6YKy9xGFgSh8EsqilCgT+iyd1GSGdjeRPBSFw4bL5NUZaH0IDvNfiX9dh0bQ 8BwrdELfkFS/MNABL5+vo/LIobPLhlaOAFKOjUqW+1L3YSyVlUffW7uTDy9aMBsd3tBj QLcdcEIg0iNPqIuT7ZvkbF9NejsAJFyAC/tZ0VCf7YbM1RqHYwGYg4wKGXGcdKsk7nkT NUcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IUrBv36s8zWoiM6yaTR03OMANKF74uCn5cvI7a5X8iM=; b=Qo8Fi2DzSIofK7t/BR1XimuBzzXqRRWfYgMGCJ1qJBTMqLwjy31KjZXmoPBsifBs42 DfEID5DBTJ+GHZfF/99Q1RDPu9LUSCQBg5O0964VcMhiaNQgOBetw7kneKqWMOdD7fYL o9YUhwG5CJQCT9f1hKYfa+HhWktQ0sP8QyqATA2p3fWvNKt3BodManulJLtwFBAC+DXJ aO5/6QbBk3Q1zfZWWaBWERtLXyImH2KcHfpjcMNr23VUH5Xy9BTcT91ZM4HKBadPjSxf ClqAx5pNjDwVWH66PlSQofqCH3CvpZ049IwljfMP3UeJyBga95nmwf6LI9oxMt+lx6sT ZzdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si2418683pgf.125.2018.04.10.16.15.10; Tue, 10 Apr 2018 16:15:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755590AbeDJXKS (ORCPT + 99 others); Tue, 10 Apr 2018 19:10:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41188 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755167AbeDJWdI (ORCPT ); Tue, 10 Apr 2018 18:33:08 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0865AC64; Tue, 10 Apr 2018 22:33:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dirk van der Merwe , Jakub Kicinski , "David S. Miller" Subject: [PATCH 4.15 155/168] nfp: use full 40 bits of the NSP buffer address Date: Wed, 11 Apr 2018 00:24:57 +0200 Message-Id: <20180410212807.683545279@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dirk van der Merwe [ Upstream commit 1489bbd10e16079ce30a53d3c22a431fd47af791 ] The NSP default buffer is a piece of NFP memory where additional command data can be placed. Its format has been copied from host buffer, but the PCIe selection bits do not make sense in this case. If those get masked out from a NFP address - writes to random place in the chip memory may be issued and crash the device. Even in the general NSP buffer case, it doesn't make sense to have the PCIe selection bits there anymore. These are unused at the moment, and when it becomes necessary, the PCIe selection bits should rather be moved to another register to utilise more bits for the buffer address. This has never been an issue because the buffer used to be allocated in memory with less-than-38-bit-long address but that is about to change. Fixes: 1a64821c6af7 ("nfp: add support for service processor access") Signed-off-by: Dirk van der Merwe Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c +++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.c @@ -68,10 +68,11 @@ /* CPP address to retrieve the data from */ #define NSP_BUFFER 0x10 #define NSP_BUFFER_CPP GENMASK_ULL(63, 40) -#define NSP_BUFFER_PCIE GENMASK_ULL(39, 38) -#define NSP_BUFFER_ADDRESS GENMASK_ULL(37, 0) +#define NSP_BUFFER_ADDRESS GENMASK_ULL(39, 0) #define NSP_DFLT_BUFFER 0x18 +#define NSP_DFLT_BUFFER_CPP GENMASK_ULL(63, 40) +#define NSP_DFLT_BUFFER_ADDRESS GENMASK_ULL(39, 0) #define NSP_DFLT_BUFFER_CONFIG 0x20 #define NSP_DFLT_BUFFER_SIZE_MB GENMASK_ULL(7, 0) @@ -412,8 +413,8 @@ static int nfp_nsp_command_buf(struct nf if (err < 0) return err; - cpp_id = FIELD_GET(NSP_BUFFER_CPP, reg) << 8; - cpp_buf = FIELD_GET(NSP_BUFFER_ADDRESS, reg); + cpp_id = FIELD_GET(NSP_DFLT_BUFFER_CPP, reg) << 8; + cpp_buf = FIELD_GET(NSP_DFLT_BUFFER_ADDRESS, reg); if (in_buf && in_size) { err = nfp_cpp_write(cpp, cpp_id, cpp_buf, in_buf, in_size);