Received: by 10.192.165.156 with SMTP id m28csp18009imm; Tue, 10 Apr 2018 15:28:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/88upjIFPRsAWysvrNDY1LNvoaj8SwtGtt5SdsiJWo/QqaebWX94zmfE4jNqArsBSelWa5 X-Received: by 2002:a17:902:8e83:: with SMTP id bg3-v6mr2345339plb.144.1523399310511; Tue, 10 Apr 2018 15:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523399310; cv=none; d=google.com; s=arc-20160816; b=v7+qEGeR3T6ioDZ9cizjPP+HvmqKjcYftGEPjjbyrFDDmOI920ZqR57zsZS2FHkIxG RWXnEWmPTKOt89RoMxtjzFylq2fKvAAQKQZUMpS2d6RfLNNBIDa4MClUlMzipmG5Yu3z HvzXlh4Y17r8vEMw8F3hTZRvgg+PQj/k42rnP9ZRBFfsw4sxYHBhLla+cM9rIYMBL2Ay 0CTS1EU3GSHHg5GkXHkIjzsq1dxi7Y8pb+7huxPcJ6RjOpV7psEyoi/aadu0rrDpAdMg 1uD+R9lqbZTtkJRY+Cb7elUjRSD/l5DNEUt5tvQDmAXcNwRZIPoU8VgMLpQYSe+iAyYP g/Jw== 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=FR9dURViGkVP+PPMx2TIQihMVNbRpO+JtysSj/Bns+4=; b=BML887oROb/lVxkfTLIB0dRtbsJLM+OUdH9GOQZR2nnreJWmN630gw1Q7BWpTIwntq F6IpGBDHQfDBw9DzVzmJygauO3CZ8/OUS1oBAaiErt4YCVzxWI31+bd7lqiwRNjvnWgM P9gzl/C8tcQRRCN9dZDOsGQrFKzbyFnvqsJEIci5vnfUdko2bHA4Mq4kKmkdp4wRkKUx TKJ0OfxHA7lL36uvHvq8sui1j8VfCnz2f6zr0E0IlyStt4c17gnyq9nYZBfjw8OFoCE7 37ZLP5RqNv9JB2sG1MAj4e+P1jgn19wxfCEPZDjaLyyVQm9Pa9KfZGy5tQgHw4ZaGZRi v9hg== 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 m18si2391414pgv.360.2018.04.10.15.27.53; Tue, 10 Apr 2018 15:28:30 -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 S1752847AbeDJWZA (ORCPT + 99 others); Tue, 10 Apr 2018 18:25:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36932 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796AbeDJWY6 (ORCPT ); Tue, 10 Apr 2018 18:24:58 -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 8E2CBD66; Tue, 10 Apr 2018 22:24:57 +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.16 18/18] nfp: use full 40 bits of the NSP buffer address Date: Wed, 11 Apr 2018 00:23:53 +0200 Message-Id: <20180410212759.535570297@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212758.564682823@linuxfoundation.org> References: <20180410212758.564682823@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.16-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 @@ -71,10 +71,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) @@ -427,8 +428,8 @@ __nfp_nsp_command_buf(struct nfp_nsp *ns 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);