Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp521305imu; Thu, 20 Dec 2018 00:31:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/XOZVV9yTYCbwBUmhS/qMw6S0OmbeENmFsOBn27sQNp2B/n8A08owaDOivZMl2KuNHgiCTq X-Received: by 2002:a62:190e:: with SMTP id 14mr23393293pfz.70.1545294691724; Thu, 20 Dec 2018 00:31:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545294691; cv=none; d=google.com; s=arc-20160816; b=toYzH8SKAlLE2jc2MLnMuaXrDNT7l3FgTxiFPJwU+JA2oVlotrqjHB19kdgL3+U8y2 G830vBQxl24h7D4F0co59WkdDpqfS0VO1wY8MpRE/5kIyEXKhiOnBU4GDO+9gJiU6DkB 57xR/HgdaLOte1URnuNRKL+XV70z+yhoIOH07PHFxb7VCFUh6Jxg6uo800AHnFs9E26f FQ3Oa8KgJth52R94oLvNJtd4zny/I41IkOQSdaloTb3mRY6UdPYCkXpaOVDiKhwFgdKM aTCUMkRpWnvvg85d8r1Z865VWOVKnnYbd6ybCuA+/AYpHYXQ4Ihp+u0Nue6801p0/pym +F+Q== 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=rkVOcOwUeOF0HwqTJB1XsGmMRYI14pALBmBijdVetkM=; b=sg1HZuAQwPkCn7URE30+iCmsOZvRJM56tPfNjJJIVCiHmAS313Oo9dJkKGFALZ89En r5S06fNx802sWyp9Fh+wxIfeS9O3Z6aZpQZN+uWqik4sl4MHz+/Cy6nuTLGBxmFmIkvp W4ghorldYD4+uGu0hs/qNywZQqmBcUKoSbmWNV2T9M44sdXRES/ZI6V9fehV3+iSxh4T YJOt21p36tPKuZqW4+V7SKWdZSIPJQPuU3txTt/rWHDHZ86bCk11lFLC5RhgDtgbKfhQ 32amCBQ4f80x8H5MkiS+0GjR9aRRKG267gXwTQqCCpFj+/vY6HmHVX4nl19hvKbBgMGg oOLg== 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 v25si18537750pfg.135.2018.12.20.00.31.14; Thu, 20 Dec 2018 00:31: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 S1730805AbeLTIYC (ORCPT + 99 others); Thu, 20 Dec 2018 03:24:02 -0500 Received: from ozlabs.ru ([107.173.13.209]:53954 "EHLO ozlabs.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727667AbeLTIYC (ORCPT ); Thu, 20 Dec 2018 03:24:02 -0500 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id BC72BAE8010F; Thu, 20 Dec 2018 03:23:57 -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 01/20] powerpc/ioda/npu: Call skiboot's hot reset hook when disabling NPU2 Date: Thu, 20 Dec 2018 19:23:31 +1100 Message-Id: <20181220082350.58113-2-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 The skiboot firmware has a hot reset handler which fences the NVIDIA V100 GPU RAM on Witherspoons and makes accesses no-op instead of throwing HMIs: https://github.com/open-power/skiboot/commit/fca2b2b839a67 Now we are going to pass V100 via VFIO which most certainly involves KVM guests which are often terminated without getting a chance to offline GPU RAM so we end up with a running machine with misconfigured memory. Accessing this memory produces hardware management interrupts (HMI) which bring the host down. To suppress HMIs, this wires up this hot reset hook to vfio_pci_disable() via pci_disable_device() which switches NPU2 to a safe mode and prevents HMIs. Signed-off-by: Alexey Kardashevskiy Acked-by: Alistair Popple Reviewed-by: David Gibson --- Changes: v2: * updated the commit log --- arch/powerpc/platforms/powernv/pci-ioda.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 9ee7a30..29c6837 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3676,6 +3676,15 @@ static void pnv_pci_release_device(struct pci_dev *pdev) pnv_ioda_release_pe(pe); } +static void pnv_npu_disable_device(struct pci_dev *pdev) +{ + struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev); + struct eeh_pe *eehpe = edev ? edev->pe : NULL; + + if (eehpe && eeh_ops && eeh_ops->reset) + eeh_ops->reset(eehpe, EEH_RESET_HOT); +} + static void pnv_pci_ioda_shutdown(struct pci_controller *hose) { struct pnv_phb *phb = hose->private_data; @@ -3720,6 +3729,7 @@ static const struct pci_controller_ops pnv_npu_ioda_controller_ops = { .reset_secondary_bus = pnv_pci_reset_secondary_bus, .dma_set_mask = pnv_npu_dma_set_mask, .shutdown = pnv_pci_ioda_shutdown, + .disable_device = pnv_npu_disable_device, }; static const struct pci_controller_ops pnv_npu_ocapi_ioda_controller_ops = { -- 2.17.1