From: David Gibson Date: Wed, 05 Dec 2018 04:21:28 +0000 Subject: Re: [PATCH kernel v4 01/19] powerpc/ioda/npu: Call skiboot's hot reset hook when disabling NPU2 Message-Id: <20181205042128.GB6757@umbus.fritz.box> MIME-Version: 1 Content-Type: multipart/mixed; boundary="b5gNqxB1S1yM7hjW" List-Id: References: <20181123055304.25116-1-aik@ozlabs.ru> <20181123055304.25116-2-aik@ozlabs.ru> In-Reply-To: <20181123055304.25116-2-aik@ozlabs.ru> To: Alexey Kardashevskiy Cc: Alex Williamson , Jose Ricardo Ziviani , Sam Bobroff , Alistair Popple , Daniel Henrique Barboza , linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, Piotr Jaroszynski , Oliver O'Halloran , Andrew Donnellan , Leonardo Augusto =?iso-8859-1?Q?Guimar=E3es?= Garcia , Reza Arbab --b5gNqxB1S1yM7hjW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 23, 2018 at 04:52:46PM +1100, Alexey Kardashevskiy wrote: > 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 >=20 > 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. >=20 > 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. >=20 > 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(+) >=20 > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/pla= tforms/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); > } > =20 > +static void pnv_npu_disable_device(struct pci_dev *pdev) > +{ > + struct eeh_dev *edev =3D pci_dev_to_eeh_dev(pdev); > + struct eeh_pe *eehpe =3D 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 =3D hose->private_data; > @@ -3720,6 +3729,7 @@ static const struct pci_controller_ops pnv_npu_ioda= _controller_ops =3D { > .reset_secondary_bus =3D pnv_pci_reset_secondary_bus, > .dma_set_mask =3D pnv_npu_dma_set_mask, > .shutdown =3D pnv_pci_ioda_shutdown, > + .disable_device =3D pnv_npu_disable_device, > }; > =20 > static const struct pci_controller_ops pnv_npu_ocapi_ioda_controller_ops= =3D { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --b5gNqxB1S1yM7hjW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlwHUkgACgkQbDjKyiDZ s5KYMw/+Mzh38UfXrz5NRRouaeOXLnXjSwpuiSQp96Ya6uIjdnLSSYr1oO31zA2c 0z0iLfTJ/es8QQ+DUdb9cZpDSyftTh9K7Hc4vupgZe8Pno3cjxNopo4efGO8GGgd 8B1rd8eDAdFGEENTesbhDB05Z1UlbPVe2+CiJmv+D2nu//rdAQJJao/OxDHacLUP p6luNjBrV7wAm1W4AVWDf/H9WtzTKdlBwpbpBwtCp/Mrwtf1nkWX+qWrk7rNuufC jr1EvhDvxX0bFjiFc4qvp61oeCLE4tsHH6o2HV/1NYVM5Lvk4LxVCrPaZ8GyozPO CvQvQvleCyEFFfmpv7+DSrsDzVwz1jXfOFCHqMeJsIRhnoLyUw9qVaavL55eFpEH ZZBc5G7khGXwVZoOiQRalgV1lEpa4UsSaNQLFGyv8n8UvnW/qaG2PUAUxrNPfrYU +P60J8VMqRctojlYAZ3wr/g44FlJ+sKKAMDOVX+7+jfVn81M3nXkB8rQvQAqA0iK 67rL/xBt/CTmJ0bxU4DB0+pBTo44f5dICtOQx85z3f6s7ydwdH2uE090c5Ip53/i /OdD6IDgmu+Rnji/5S8zI5ONpAe/lQecsA7FgNNkPDFl0BknY0EHGyKUB5Gkq8Ii tRc7ADG4hzZyeDZYyVyEpFPbpe0be9t6fLYTficwbntcxcTKNnw= =eqbb -----END PGP SIGNATURE----- --b5gNqxB1S1yM7hjW--