Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17929009ybl; Thu, 2 Jan 2020 15:01:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzkCLbkmA2QPTkjRt61cabsfnHkjJAMC/tbMJlnvgIUlIcTN2X91GDlq29x59ssnpj4yfI1 X-Received: by 2002:a9d:7f83:: with SMTP id t3mr72579706otp.115.1578006085783; Thu, 02 Jan 2020 15:01:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578006085; cv=none; d=google.com; s=arc-20160816; b=GFsSh/bLAIgLRRmvJBfJo1mxIMqjup64wPcyPgrWqp5fCGPda7sPWM+LV2q5P2FwQJ iHdC29Tq8K7U7UceQwURC3q6haxhoLk/X1aaUpSsz8CDo+1Vp4Vvulddtq1DyzlEo8DS xDmuQ7KI7knCAvSkEPrsC9j026hIEzJeG8mZbykaLow0WXn8lRlnyOthBjCOc+peSl0o 5N03kfzxnGNhutw+ioX0rcpr7kujK/712y6k5dln3jKcB336u00RHDj0uSBCUsoZSs3f 28pq2+Px/0aSLxuNmstCtylKrHliSXEizoLBHLGhu2Vyygnb35fL/qCzavL7hXJSx29d SGzg== 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=Z11Hx0CfTTB29UYk4e/bbzJyWfl4lNsi8rd9piJ0aHs=; b=xExyNXqFAIWDyDbbFQnWUvgVz5M6Wx1azAFkzZps7TVM5UVHfTOurgIQ1PDsu10fu8 ddkP5O1/4cIPNcP0k2yku5dqGl6CR6m4d9Qh/FVw1r0MnXUCV5tqZ4KQmPpymxdkKzhj WMU4vfSzOyQqimivhKNIjR8qVq22qW93YO3Dn+RAM7RYNYpaUpIDWY7fl+xpaExyNrtu +hhpROUwJSrKjvWu2eFNSAZehAyDQO5t5m7cxfujLag1Xdh+t0GLkrFcaPag06X5NJNF +/sB9kwRtlOjV4C3LLSvMZ3H0yODCLvgFP6Vyz7gQKENSQTVCTOEHy5ozaStGg2zoYtT n9Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EcATy+zT; 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 p20si28487707otk.73.2020.01.02.15.01.13; Thu, 02 Jan 2020 15:01:25 -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=EcATy+zT; 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 S1727818AbgABW75 (ORCPT + 99 others); Thu, 2 Jan 2020 17:59:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:53500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbgABWNg (ORCPT ); Thu, 2 Jan 2020 17:13:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2D2A922525; Thu, 2 Jan 2020 22:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003215; bh=1+1H71gkxh1RMYV0boeJNEBPTmDAqEBkqTBL8rFOMXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcATy+zTYMRPF3UYFbNEsm3I3wx8Tczouin9vlkKTFEukAKuIAFz9h1O3klXxUh59 7L3tlvNfQ8YN3DZ9u49X58Z+FHHm1VZfqOPKeI3qTnnuNvVaDz3rPuRD0wp+DbH2dp PJCqaldRuDzdHRFlILnwzEb7RaLCAvI6SerTFPRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyrel Datwyler , Bjorn Helgaas , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 068/191] PCI: rpaphp: Correctly match ibm, my-drc-index to drc-name when using drc-info Date: Thu, 2 Jan 2020 23:05:50 +0100 Message-Id: <20200102215837.241451641@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Tyrel Datwyler [ Upstream commit 4f9f2d3d7a434b7f882b72550194c9278f4a3925 ] The newer ibm,drc-info property is a condensed description of the old ibm,drc-* properties (ie. names, types, indexes, and power-domains). When matching a drc-index to a drc-name we need to verify that the index is within the start and last drc-index range and map it to a drc-name using the drc-name-prefix and logical index. Fix the mapping by checking that the index is within the range of the current drc-info entry, and build the name from the drc-name-prefix concatenated with the starting drc-name-suffix value and the sequential index obtained by subtracting ibm,my-drc-index from this entries drc-start-index. Signed-off-by: Tyrel Datwyler Acked-by: Bjorn Helgaas Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1573449697-5448-10-git-send-email-tyreld@linux.ibm.com Signed-off-by: Sasha Levin --- drivers/pci/hotplug/rpaphp_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index abb10b3c0b70..32eab1776cfe 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c @@ -248,9 +248,10 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name, /* Should now know end of current entry */ /* Found it */ - if (my_index <= drc.last_drc_index) { + if (my_index >= drc.drc_index_start && my_index <= drc.last_drc_index) { + int index = my_index - drc.drc_index_start; sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix, - my_index); + drc.drc_name_suffix_start + index); break; } } -- 2.20.1