Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9092467pxu; Mon, 28 Dec 2020 06:27:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZbox+sfcFTnYfPTZR8J7xL4fqaS4LeUuX2neRMPzSwfBCt+ArwDsYXPE6rPjyqoS4NOgd X-Received: by 2002:a17:906:254b:: with SMTP id j11mr42007051ejb.326.1609165642957; Mon, 28 Dec 2020 06:27:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165642; cv=none; d=google.com; s=arc-20160816; b=JvE1DlosLnWhNF1PkWDNqefvWQZYejITvoGgSwXKUjjaRRPBAcfuq8CMZHZNIeySOC yCB/fNJffLfWaA3J+EEcLkQZCaGQmFVV71MO4yOaOI9OQWf66a9QDgvYGTofr+IgokHc mLIRY1mfnaFO+QfVBAXc8044cd6PkXwILf5jDYo9u+yvpP4SWUX4wh21jY+lpq2glgon wp1tRlR8DGTLR1sR92Q7Cvscr/s7maoFa3yMxX9m4PRnoi0ZumTl0C4s93/f4AMFBs4S TlLPUJosSllXJyQIuRUyF1Ti4bapcuHdp0RLOJcv1yrI5F7aSIi1AYT5zpg8FAY4Kuz7 K4Fg== 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=jD594tqAO9wDMtEJtuHBA888Qyx0OSD3qWsuefzQRh4=; b=nyplIfFDJ1LCtnQ9kxaLh3Z2R1Sp4tjpUcHv9Zd99Gje9n1Q1tulMCleZHQfJaJKrn UHRF7aWpZGr0FvRPjvekPL+ppRDD5CyEd5vd/xu3xUr0yqBK7F+Kn2qKZtDxgKBuJPBF ZLtdZUhsQ9DAh3cWmKuEclt+sJ2t4XQKizaZV8ey2maaKWdd4LOlXG1W1uvcQoJPnG7d f15eRiMRI+/qynU0uJIripqeDIwK13cHuRtgRIA7/zNUbLgo/qK6ISqBBlffWpSmNHt6 5cvoy0bkVUSSs8rDwrM5BOv3a04opVWM6Otxm50pWze7VSYQtwkv3ZB921k4kaicCL+4 k7Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IoK7g8YA; 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 p17si18365727ejw.23.2020.12.28.06.26.59; Mon, 28 Dec 2020 06:27:22 -0800 (PST) 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=IoK7g8YA; 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 S2503160AbgL1OY4 (ORCPT + 99 others); Mon, 28 Dec 2020 09:24:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:60642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503138AbgL1OYu (ORCPT ); Mon, 28 Dec 2020 09:24:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D017207B2; Mon, 28 Dec 2020 14:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165474; bh=C/gBNapSyXLn8ieLTufOfneQYnWUQ9QESDsfm6uBEFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoK7g8YAC5fqnz3JSERnwgrK6eldq8oJvLtQd2uLp5bZorWeL29n/OVwR69+sNCd7 XDYF+jluRRuTRF0Bfs1sCPaKwzp7qcZECIiUnD5O40zv22PMW5QXCXxJ+8/SOtxlvg hl/LtoJzFOnaLqlUnWQvQ9GpHLdOqvb+jMiy/f4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Alex Williamson Subject: [PATCH 5.10 514/717] vfio/pci/nvlink2: Do not attempt NPU2 setup on POWER8NVL NPU Date: Mon, 28 Dec 2020 13:48:32 +0100 Message-Id: <20201228125045.596140962@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Alexey Kardashevskiy commit d22f9a6c92de96304c81792942ae7c306f08ac77 upstream. We execute certain NPU2 setup code (such as mapping an LPID to a device in NPU2) unconditionally if an Nvlink bridge is detected. However this cannot succeed on POWER8NVL machines as the init helpers return an error other than ENODEV which means the device is there is and setup failed so vfio_pci_enable() fails and pass through is not possible. This changes the two NPU2 related init helpers to return -ENODEV if there is no "memory-region" device tree property as this is the distinction between NPU and NPU2. Tested on - POWER9 pvr=004e1201, Ubuntu 19.04 host, Ubuntu 18.04 vm, NVIDIA GV100 10de:1db1 driver 418.39 - POWER8 pvr=004c0100, RHEL 7.6 host, Ubuntu 16.10 vm, NVIDIA P100 10de:15f9 driver 396.47 Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver") Cc: stable@vger.kernel.org # 5.0 Signed-off-by: Alexey Kardashevskiy Signed-off-by: Alex Williamson Signed-off-by: Greg Kroah-Hartman --- drivers/vfio/pci/vfio_pci_nvlink2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/vfio/pci/vfio_pci_nvlink2.c +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c @@ -231,7 +231,7 @@ int vfio_pci_nvdia_v100_nvlink2_init(str return -EINVAL; if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) - return -EINVAL; + return -ENODEV; mem_node = of_find_node_by_phandle(mem_phandle); if (!mem_node) @@ -393,7 +393,7 @@ int vfio_pci_ibm_npu2_init(struct vfio_p int ret; struct vfio_pci_npu2_data *data; struct device_node *nvlink_dn; - u32 nvlink_index = 0; + u32 nvlink_index = 0, mem_phandle = 0; struct pci_dev *npdev = vdev->pdev; struct device_node *npu_node = pci_device_to_OF_node(npdev); struct pci_controller *hose = pci_bus_to_host(npdev->bus); @@ -408,6 +408,9 @@ int vfio_pci_ibm_npu2_init(struct vfio_p if (!pnv_pci_get_gpu_dev(vdev->pdev)) return -ENODEV; + if (of_property_read_u32(npu_node, "memory-region", &mem_phandle)) + return -ENODEV; + /* * NPU2 normally has 8 ATSD registers (for concurrency) and 6 links * so we can allocate one register per link, using nvlink index as