Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp520451imu; Thu, 20 Dec 2018 00:30:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/UlD80jFIBISZ6klgea3EmzLQVLfRuAY/HkYTyYEP1fw7d2+zteLAFEbKXDiNW06gaHyil8 X-Received: by 2002:a62:1a91:: with SMTP id a139mr14847173pfa.64.1545294631774; Thu, 20 Dec 2018 00:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545294631; cv=none; d=google.com; s=arc-20160816; b=jjK0yK3xZPCTxMesSeU6KDP7sYhy5npsS36yzNHwfU7mXilozS9+ZwyIBTCBxP2VLj rb3nVVEoujP7uZY7M/l/MqMPH/zRQuczQ3BcLCRhzytDAKqm0/noBHSFhYsW5SYT4dNP ubrJ0wi+nC0IkInv6cKV3yJwIoCGTeJV2aJ5y8HBn2Vxhq7o6fD+qnMJCFn37kyGc/UR DNJaLdQSHCUtATfetVQNKkgFia1lLFGveX57EdkxYkX30/mdl/zjus49w3g20SUumzF3 0Q6SIztRcDcrdyU3qsVUCI1RRrzirWuJ0gcGSNqnP49c7kprTPUJv/AVo0gfDOUHG1Xq 0Jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=syPsWrCBeKm1t9yu7YyL4uxLIX5wIUMq080rAHE56/k=; b=QnUseeqUn9krrnEYfi73WIE44peAFU+haFDcxBkoCg9+thelWOm8iJ2Z6Tzwgn/UI1 VT88c/iV0vtLwSdfJtS8J9LM5B3GH9Spa8dM+4K3SOI9w/MyKqQqQ1leeKrYRKUv8kGc Jr/8n2Emrxt4DMxs0S29JD8zjzEGcI/NzGZmX9ykSzFdbAf/l/1LC0najsDpyYUZM+XK zT9gue/6/2Dlh1W/U4HfnEaticGXEaUWKRqLqv8sVceYT72NsXEEC7Gm36L7NRT7NHxL v2YiiR8BlBzjdwmbwkuKVqzIR2LvasNltDBUTI6Rx3t/g0WBhAq2+tagbDLMCFIVKHDD /rKA== 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 43si17695727plb.176.2018.12.20.00.30.16; Thu, 20 Dec 2018 00:30:31 -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; 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 S1730914AbeLTIYY (ORCPT + 99 others); Thu, 20 Dec 2018 03:24:24 -0500 Received: from ozlabs.ru ([107.173.13.209]:54307 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730870AbeLTIYX (ORCPT ); Thu, 20 Dec 2018 03:24:23 -0500 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 5CDBBAE802FA; Thu, 20 Dec 2018 03:24:19 -0500 (EST) From: Alexey Kardashevskiy To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy , David Gibson , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Alistair Popple , Reza Arbab , Sam Bobroff , Piotr Jaroszynski , =?UTF-8?q?Leonardo=20Augusto=20Guimar=C3=A3es=20Garcia?= , Jose Ricardo Ziviani , Daniel Henrique Barboza , Alex Williamson , Paul Mackerras , linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH kernel v7 07/20] powerpc/pseries/npu: Enable platform support Date: Thu, 20 Dec 2018 19:23:37 +1100 Message-Id: <20181220082350.58113-8-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181220082350.58113-1-aik@ozlabs.ru> References: <20181220082350.58113-1-aik@ozlabs.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We already changed NPU API for GPUs to not to call OPAL and the remaining bit is initializing NPU structures. This searches for POWER9 NVLinks attached to any device on a PHB and initializes an NPU structure if any found. Signed-off-by: Alexey Kardashevskiy --- Changes: v5: * added WARN_ON_ONCE v4: * dropped "IBM,npu-vphb" compatible type on PHB and use the type of NVLink --- arch/powerpc/platforms/pseries/pci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index 41d8a4d..7725825 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "pseries.h" #if 0 @@ -237,6 +238,8 @@ static void __init pSeries_request_regions(void) void __init pSeries_final_fixup(void) { + struct pci_controller *hose; + pSeries_request_regions(); eeh_probe_devices(); @@ -246,6 +249,25 @@ void __init pSeries_final_fixup(void) ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable; ppc_md.pcibios_sriov_disable = pseries_pcibios_sriov_disable; #endif + list_for_each_entry(hose, &hose_list, list_node) { + struct device_node *dn = hose->dn, *nvdn; + + while (1) { + dn = of_find_all_nodes(dn); + if (!dn) + break; + nvdn = of_parse_phandle(dn, "ibm,nvlink", 0); + if (!nvdn) + continue; + if (!of_device_is_compatible(nvdn, "ibm,npu-link")) + continue; + if (!of_device_is_compatible(nvdn->parent, + "ibm,power9-npu")) + continue; + WARN_ON_ONCE(pnv_npu2_init(hose)); + break; + } + } } /* -- 2.17.1