Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2462845pxj; Mon, 10 May 2021 03:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuo1eO9GJaZ0JNqMuhDqyGX5D/+lCaAyYC1XQKv/9hwLSZAxwtUGSsfVX+ALjNXrMTzmau X-Received: by 2002:a02:764e:: with SMTP id z75mr21053480jab.113.1620643264362; Mon, 10 May 2021 03:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643264; cv=none; d=google.com; s=arc-20160816; b=HdohhCY/Qyu45lkKnoLLwfWm1A7toDPYArgaFIkb4n0cbs3nd9vsOMCtJ2O19W52qo 5CuTdKmJycwZdLIAa37ybwSzbHMnvrca8eC9dnIPbLQyGPaQp1yu+6cAMQMgQALtDPiG 7SKlbKwWJuEy10IFu7ZbvyYAC2sZj6MHREF0TXc/o0QsmAmp4206iErq/u9ktZrDHxR5 5yMpG1OkGKaXSVnf79xH2f3kMJXcq2mb2k/Aw8DmxwnRHi802aPsm515gTWmwnIC1Mg9 GlK1owYfHQ2u2PAOP75ZyAV47hjADbBTTcmzFYwmrhvtWS55ZN0lh3Pafo6wi5CAPSyZ 5AHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1f3aJYhEFaAZC/QQ4AvpkPtnD38z5pXOdyXkjCN/ZpQ=; b=UZz2EhZx8URob3jC0cd0a80O0v1Af8ko/pYsyxcrSpZ58gmhr4rXp9wwdfXLu9zzBJ 4pkbY/MMYQMEc7mtM6uyZqS+WJLegEEQC9JlQA7xLbYw0d6X+e2Z/ltLNALeAuxFxt1o qeJjaIVSchds8DGqjwHUMDkvQ+sx6scONQAXN9fI28S9eOQDvvdoJvmdd1MTa2RK+vUh TRXsa/dl1am370F/5rZwnQWvBKJD0asRHgH4FlaWL5vWI0U4nfJUP3ydLPdC4M8Oy6TK yZZsE38DHgHWys+Qroyfdfy2uNwWtyaIzBjziy4YnpTlNb9GPkhR/z3gHrK5d60bdAEm hzow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zWq6/ZSe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si15426636jai.80.2021.05.10.03.40.52; Mon, 10 May 2021 03:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zWq6/ZSe"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbhEJKlX (ORCPT + 99 others); Mon, 10 May 2021 06:41:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:41610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232359AbhEJKe0 (ORCPT ); Mon, 10 May 2021 06:34:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBBD3610A7; Mon, 10 May 2021 10:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642487; bh=U0vtZbOtbv/37FXM9sZyIvdfbCrAXZDCzwUYtGaShgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zWq6/ZSepJQDCZco7E0ZAc1KPh5GD/CuG/qfDZv5y8a3jH+W5wKknovqeXVKD+z8M 7Dlo5DaWVUw+1CjTEw69yR2SPQ6m7lyimdGKXZk5IW1i92Sf3fak9Jd8frcDIEliPg 8D4mBcb9SMNHiMm2BLLbY87sFlMo6IgoZd7xtrT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Kim , Amber Lin , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 087/184] drm/amdgpu: mask the xgmi number of hops reported from psp to kfd Date: Mon, 10 May 2021 12:19:41 +0200 Message-Id: <20210510101953.029576436@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510101950.200777181@linuxfoundation.org> References: <20210510101950.200777181@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Kim [ Upstream commit 4ac5617c4b7d0f0a8f879997f8ceaa14636d7554 ] The psp supplies the link type in the upper 2 bits of the psp xgmi node information num_hops field. With a new link type, Aldebaran has these bits set to a non-zero value (1 = xGMI3) so the KFD topology will report the incorrect IO link weights without proper masking. The actual number of hops is located in the 3 least significant bits of this field so mask if off accordingly before passing it to the KFD. Signed-off-by: Jonathan Kim Reviewed-by: Amber Lin Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index 65aae75f80fd..ce1048bad158 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c @@ -311,15 +311,22 @@ int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_dev } +/* + * NOTE psp_xgmi_node_info.num_hops layout is as follows: + * num_hops[7:6] = link type (0 = xGMI2, 1 = xGMI3, 2/3 = reserved) + * num_hops[5:3] = reserved + * num_hops[2:0] = number of hops + */ int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev, struct amdgpu_device *peer_adev) { struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info; + uint8_t num_hops_mask = 0x7; int i; for (i = 0 ; i < top->num_nodes; ++i) if (top->nodes[i].node_id == peer_adev->gmc.xgmi.node_id) - return top->nodes[i].num_hops; + return top->nodes[i].num_hops & num_hops_mask; return -EINVAL; } -- 2.30.2