Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1103549pxb; Fri, 13 Nov 2020 04:26:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS0xnu9mLXwdMdeTENBozDtaRNtx/Ink3KvvD+cQDqmuK/HacRP++ke4FLoyORIU0jdgvj X-Received: by 2002:a17:907:1008:: with SMTP id ox8mr1592328ejb.189.1605270418729; Fri, 13 Nov 2020 04:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605270418; cv=none; d=google.com; s=arc-20160816; b=P2/+YUUzSm52H5OAXtNx+hQbqKScwDmlMKCalMUD5Ch78b5oZrt7ETTXYY8K02EAsv nuBvoQRJNPt2NSjulRVGLx09VM+3Y/OXljeZgct+kwnyGbTE45SHM0RiJsPv980iSQqi vtZtvhsyTo24OK1VJpRvZWO0mcvrsM6Q4haA3YnCtozBQ8otq3UlZ7M+ZXqU589s6k+R R74MV7A4/GGMPeLmLD4jpRuEbj2zCo7vM6QK0Q8qiRnPlB7rJ7VReDHHcje+yUXaDnxY r6/O0toB7IShNx1JZDxuaSmqpWdzR5OpUs0Vwt1EwRM+9azVxO2F4nORVWBngj8G2Bj0 BHHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7BWyNJ/Q300OGF9cLBgOGHjLo9xbM5tPawc6txYj2kk=; b=AoD0PuoMwU7V2CI4oZ9FDOXyn9Q38dVLS2xymL+i/iK1Qj9yfyTTvxDZhs9cGfdhnM XcksiWY1KgXwR0JB3DvqKCjCccNEyBDTZsZ+BZnoa/pWIgICVF0TI7JsdKnw2HToYd+V HX42YbI9V66z2L5O7ReKRlNNOVr0ckcRTBDFscLgFQvc1hO2B5okkkblwgpVGBmMB92n 4HTGG1l20cgESwZo12LHVpn0NVcz5KqR3VrrPDZZWdQF1HmkrQOmgL/vyCL3Xk9D+nXr q0zjUH4cN2Z/QFkwQlBfrh7Q0IlOu/j650eciHMpCMOyDjKvmQRG9d5meX2zeW2XEK0G Lagg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si6189084edu.275.2020.11.13.04.26.35; Fri, 13 Nov 2020 04:26:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726237AbgKMMZA (ORCPT + 99 others); Fri, 13 Nov 2020 07:25:00 -0500 Received: from 6.mo52.mail-out.ovh.net ([188.165.49.222]:54287 "EHLO 6.mo52.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbgKMMY5 (ORCPT ); Fri, 13 Nov 2020 07:24:57 -0500 X-Greylist: delayed 598 seconds by postgrey-1.27 at vger.kernel.org; Fri, 13 Nov 2020 07:24:56 EST Received: from mxplan5.mail.ovh.net (unknown [10.109.156.48]) by mo52.mail-out.ovh.net (Postfix) with ESMTPS id 1D58D204EF1; Fri, 13 Nov 2020 13:06:16 +0100 (CET) Received: from kaod.org (37.59.142.97) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Fri, 13 Nov 2020 13:06:15 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-97G002d415765a-705b-4da2-9b01-67ac23f9e562, 6CF58D6617F62A349CE936A1177A29C0D3476033) smtp.auth=clg@kaod.org Subject: Re: [RFC PATCH kernel 2/2] powerpc/pci: Remove LSI mappings on device teardown To: Alexey Kardashevskiy , CC: Rob Herring , Marc Zyngier , , Qian Cai , Frederic Barrat , Oliver O'Halloran , Thomas Gleixner , =?UTF-8?Q?Michal_Such=c3=a1nek?= References: <20201027090655.14118-1-aik@ozlabs.ru> <20201027090655.14118-3-aik@ozlabs.ru> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <6c6702bd-dff2-1d34-0f93-4f8011417c64@kaod.org> Date: Fri, 13 Nov 2020 13:06:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201027090655.14118-3-aik@ozlabs.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.97] X-ClientProxiedBy: DAG7EX2.mxp5.local (172.16.2.62) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: e67374c8-6bc1-40fc-bd7f-1a030246aa01 X-Ovh-Tracer-Id: 8554306020416981938 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedujedruddvhedgfeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfhisehtkeertddtfeejnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepjeekudeuudevleegudeugeekleffveeludejteffiedvledvgfekueefudehheefnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdeljeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheprghikhesohiilhgrsghsrdhruh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/27/20 10:06 AM, Alexey Kardashevskiy wrote: > From: Oliver O'Halloran > > When a passthrough IO adapter is removed from a pseries machine using hash > MMU and the XIVE interrupt mode, the POWER hypervisor expects the guest OS > to clear all page table entries related to the adapter. If some are still > present, the RTAS call which isolates the PCI slot returns error 9001 > "valid outstanding translations" and the removal of the IO adapter fails. > This is because when the PHBs are scanned, Linux maps automatically the > INTx interrupts in the Linux interrupt number space but these are never > removed. > > This problem can be fixed by adding the corresponding unmap operation when > the device is removed. There's no pcibios_* hook for the remove case, but > the same effect can be achieved using a bus notifier. > > Cc: Cédric Le Goater > Cc: Michael Ellerman > Signed-off-by: Oliver O'Halloran > Signed-off-by: Alexey Kardashevskiy Reviewed-by: Cédric Le Goater Thanks taking care of this. C. > --- > arch/powerpc/kernel/pci-common.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c > index be108616a721..95f4e173368a 100644 > --- a/arch/powerpc/kernel/pci-common.c > +++ b/arch/powerpc/kernel/pci-common.c > @@ -404,6 +404,27 @@ static int pci_read_irq_line(struct pci_dev *pci_dev) > return 0; > } > > +static int ppc_pci_unmap_irq_line(struct notifier_block *nb, > + unsigned long action, void *data) > +{ > + struct pci_dev *pdev = to_pci_dev(data); > + > + if (action == BUS_NOTIFY_DEL_DEVICE) > + irq_dispose_mapping(pdev->irq); > + > + return NOTIFY_DONE; > +} > + > +static struct notifier_block ppc_pci_unmap_irq_notifier = { > + .notifier_call = ppc_pci_unmap_irq_line, > +}; > + > +static int ppc_pci_register_irq_notifier(void) > +{ > + return bus_register_notifier(&pci_bus_type, &ppc_pci_unmap_irq_notifier); > +} > +arch_initcall(ppc_pci_register_irq_notifier); > + > /* > * Platform support for /proc/bus/pci/X/Y mmap()s. > * -- paulus. >