Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3469707imu; Sun, 11 Nov 2018 15:50:07 -0800 (PST) X-Google-Smtp-Source: AJdET5cHh+D4R9YmxxzXX8Qe6aVdyHoh97z3fo67SSiS0curzAS8lBw49UxL6tagku4TfLFACN1L X-Received: by 2002:a17:902:50ec:: with SMTP id c41-v6mr17388452plj.176.1541980207457; Sun, 11 Nov 2018 15:50:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980207; cv=none; d=google.com; s=arc-20160816; b=wTtqt7ORHjsdV56gNqIRA3SJRzuEEwh5hBm6xA+xx1loF2qf2Pk6/i1pJOKItVMAVE BNkb2fKXQEDHGl5N3UdopAvTCswFwY7QMLBN5wGZ1exfrCbJDVkKtiBRw6P5AShCo//B pZzecS8r+Hu/RcOM1AmUaFwpqo3NDCsFxG/7or2MNWRpA21zP+mgiNCe+BXyZJCemkkY OO3ljB9O5dQVSXaj3DYfXpyoF7wINKnPxVHzMu+ormutbdQO+vHD8D/nrI3WeGidpwDV xOZ7FZH1c7B4LPYenE5wni3Qk95g3UBlIOVXbd+emIV9lkSv9XTp7BbksiOgME/KkDW/ yY0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c3UP6lf5LoM11I/KQigDxzUMuzJLwwDZ8hDHvHYvJ/o=; b=UwHHeG+SR64mqsha7XgvbQnaWWmH21S+1oJ2WftJjhpnpNqi/5Tsl1QdUvOwR4yuBq X/y7L6Zap+t5QbjkEXqsan3vAYCEl+HWvGYowmNiC9rbm+JhjrJNFXri2ueebmjBP0ME F/ABbQQEN47Dq7CKjuyqOZ3+EIVf2CZQ28/Tr0RjdKy30uT9ql86hTLJPcbNXALRZoRH 93r0txdstpYAM1WkFF+Z4wHSc4WCj50mUG5HJ7++4VBmf1vKqNlBs0igwfGfHhp3KZkN qqnkCkm/kmrVFNHuYVzl0UZDz2kF/m5N5XePuEp0l9oFimHqTQB12r2EwXVDgJmidBcj T37Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h5I3Cf9G; 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 b65-v6si16289836plb.152.2018.11.11.15.49.52; Sun, 11 Nov 2018 15:50:07 -0800 (PST) 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=h5I3Cf9G; 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 S1733018AbeKLISj (ORCPT + 99 others); Mon, 12 Nov 2018 03:18:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:38646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733008AbeKLISi (ORCPT ); Mon, 12 Nov 2018 03:18:38 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 985B022502; Sun, 11 Nov 2018 22:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975322; bh=ZYknWdB9gz+w2r8yDu45eykRgA9Tp/bRwz1Tj27IRiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5I3Cf9G7gIk50lAC4ybwIGsnEmQLvsR5xAkNfk9OPBRWnM7ONtavGIazA5JMUgXU tE7ylkfgtYyLJz6gl4D4TCfQSCpJ4casc5f6ipiA8gln8Fr5U0VEy0mfngc87L58hP udBpPNsOPCXkindxu7oEXKY9Nh/lB0+2dwrboAeU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Lombard , Frederic Barrat , Andrew Donnellan , Michael Ellerman Subject: [PATCH 4.19 289/361] ocxl: Fix access to the AFU Descriptor Data Date: Sun, 11 Nov 2018 14:20:36 -0800 Message-Id: <20181111221656.532050290@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe Lombard commit 6f8e45f7eb1bee5efdbe4a9cfe4a45627403c5fb upstream. The AFU Information DVSEC capability is a means to extract common, general information about all of the AFUs associated with a Function independent of the specific functionality that each AFU provides. Write in the AFU Index field allows to access to the descriptor data for each AFU. With the current code, we are not able to access to these specific data when the index >= 1 because we are writing to the wrong location. All requests to the data of each AFU are pointing to those of the AFU 0, which could have impacts when using a card with more than one AFU per function. This patch fixes the access to the AFU Descriptor Data indexed by the AFU Info Index field. Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices") Cc: stable # 4.16 Signed-off-by: Christophe Lombard Signed-off-by: Greg Kroah-Hartman Acked-by: Frederic Barrat Acked-by: Andrew Donnellan Signed-off-by: Michael Ellerman --- drivers/misc/ocxl/config.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -280,7 +280,9 @@ int ocxl_config_check_afu_index(struct p u32 val; int rc, templ_major, templ_minor, len; - pci_write_config_word(dev, fn->dvsec_afu_info_pos, afu_idx); + pci_write_config_byte(dev, + fn->dvsec_afu_info_pos + OCXL_DVSEC_AFU_INFO_AFU_IDX, + afu_idx); rc = read_afu_info(dev, fn, OCXL_DVSEC_TEMPL_VERSION, &val); if (rc) return rc;