Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754075AbbFEVPP (ORCPT ); Fri, 5 Jun 2015 17:15:15 -0400 Received: from mail-by2on0108.outbound.protection.outlook.com ([207.46.100.108]:17376 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932118AbbFEVPJ (ORCPT ); Fri, 5 Jun 2015 17:15:09 -0400 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none; Message-ID: <1433538892.2477.24.camel@freescale.com> Subject: Re: [PATCH v2 0/4] VFIO platform reset From: Scott Wood To: Rob Herring CC: Eric Auger , , "linux-arm-kernel@lists.infradead.org" , , , Alexander Graf , "linux-kernel@vger.kernel.org" , "Christoffer Dall" , Linaro Patches Date: Fri, 5 Jun 2015 16:14:52 -0500 In-Reply-To: References: <1433516792-16397-1-git-send-email-eric.auger@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0-fta1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:2:5800:3f7:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: CO2PR11CA0027.namprd11.prod.outlook.com (10.141.242.165) To BLUPR03MB1475.namprd03.prod.outlook.com (25.163.81.17) X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;2:/VV5f4sw2XriLQVascYr0PZhY8Y+r0hdU4U98BjJQORv0lZjkKcih7ljOIsSho8T;2:bo5kj1PI0iMyPF87Xb3ImnlbLgVHRtqhSAQClomYOLhDLM3emP7FJEit4WZUDc99pDbxrf8XzFqKgPx4iQn0udrpdUbPtk7Z74xHDQjlplsUvjK7588byVWJ3Hk16kxUq8rlvVDYYyUPydYVqFTZjA==;6:SiqM8a4tlpq5do0jCS6MaXDjVDHKzIWCI80VYSWrZAI52LsCcGVpdupxNQxkNkBe8zi5EchMGpWZdHO6b0OFmZ7vCgrgwegosb+uyWj0I51CpvMo9msFbPQIzdA2ABJwUW49wsbaqHKM8oeD1IXnrq9s6RmVBtsiQsCG89fuencwB/rohAYoM7k2+mjb2noD9Nayh2PVOW4SYAG3S6racIpz+xK09EvcQYfsnruDx18u1zxrUu6LsKZOYhIHay1u4oGReQqV89rQBKFUfCiu2mcXLiHLgcEGLUDmppK9J94lTZr9pj9l0ktzb6uvZaS0c4AxAaOisTf2Q/i4kAkM6BWTs+achOalHofWAB0NV8g91WiKsu2ZQ3bKfd2H5HZR7XbnjLKp7HG2Sq0PNJDZZTxR3dT/DVj7i2U4ee5aQzvO5TkXZTBtDVAx4aYrOzDN8cU9g2l0OzFK5Y+Ofro90hu75tAehBCc2Rhq6yILeVDQkCqsMxsj6QjaDfPbKSmu X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1475; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BLUPR03MB1475;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1475; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;3:U6/T6JKP5HCEmVQo44b5Xwq0hf62q95hrgo8yY9XOj0tqCxXBX9Z1CwmQfIkeLJcBsPF2c2VJ2H5YK51gdTGhROj4xgNT6qFhRTLTu7IgUEHKQY1jnLq4V5jTG908JKjZ89VOASe25ilB3t8CLBx7kcrZCMpWQHzxEF7GPUrMsgBF1+GNrkSbyMnktM3sPlzCLSBIOODoUAatuXkfkOAbv0Ppb9SucnqxD6NPtJTDgAfdj8pi5X+tlJvOia03FV/b/4dEObkxmZq/LX2vQIrukvA4qw8+5LZl0SdK6rey4yh+gvmjPF2mlciW5o1kNcb X-Forefront-PRVS: 05986C03E0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(377454003)(51704005)(377424004)(24454002)(46102003)(33646002)(5001960100002)(86362001)(122386002)(77156002)(62966003)(40100003)(47776003)(110136002)(2950100001)(92566002)(36756003)(189998001)(103116003)(42186005)(19580405001)(19580395003)(77096005)(50986999)(87976001)(50226001)(50466002)(76176999)(23676002)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1475;H:[IPv6:2601:2:5800:3f7:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;9:y3NxdK0t+PsPn81tezgTci99iEX7oq5vbei9EsZq7GnigjD1XeJTskaJCvFScJkiBI+zqsXncCqdPUZ+QblefDic/n88qb613doy6BhFHlB4+/puwI9spUceYmuOwh5UufEvC99SXvx71uV7jl6rwUsPUFk0r1g2GugngXpWsYGSDCGOUPN0vFgqVNagPEu3l0GE+2ihEI/Aps9Sv+OsviXPy2v/z/Log2Ms0foIysvUp53qmjfbZVcq7dk6ucGi7PcQxOotvB+dmm5M7CGxgZ2A68JfOsM1BrnFaDRlub1GJgDKigzE3lBjjQatNWLk+NypJVM6IyQGuTxWxPYNwwMs1msfMq0EUemEU77DBGLMklD2FMhBbAEVNvC7FCyIx4EII5ggEkHW4rXaYdvluXIB6nBrxmgEA8yCXGCtClQdL85vdIJeqEPLUTxNmgtaABI2i4pfkocign64jLpBLyxK0aU9hk2hjNBwJ/pa+fs01rj+q9IavvaDbzSFvZeGydG0BUx5UP182jLguBZTm0J14d0HZVjLhSkVRqZId6lhqpO2TTCgNZkovFfSpPsJIjtUQ24+fAFiwYX6Ri2uMFDX44Vgh5fkwgFqhIVyusfq/+M/j1FI4Ogn6VnWKr0lz3k2Wf+UW6g7+i7kBDMGNW5UTcVXgL7/Qhm5QMtEy8RvDXvE4ycrRpA52BLU/kFGH820ZdTeIzFwGCB4Lz0b0M179OFgakhIn9quVovYYhnbOIPHAHOiikSyjAthjvMLnhY/RPoIr3gO3K3Zh5Y7v5dZ7F8NrTtmD1zBsTc8jatgxhfarKWxgWnn2u9NXTHs1Azy2Oeiy1n5F1zZ8GW3Vw== X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1475;3:mKq0+sCoxQVokCmbIJa7kgsgbESjeQY6q81stYMCv8Iq/aAG/7lX4R/xSr93ATBJp7jtZoxVhkBQPp4OIAlH7nktrk1hAEo5BEpnk0PD1/bdWiwYk2prNm0JZKPSCm+12aUT7zowVU7H510L/kZ3NQ==;10:KFqgqGEPCGbCLnJQuHkDmp7uPhLUndn8vwAqPf7dnE1Cqol+dgchIZbpXciYoGHHZmrA+dYPNGAB/goZ7iiaoVi0hxkuCrCgEbVkXdw6OHQ=;6:h1FhTkiP9Bb117s+nIfo360SIjbNjlKiM7snPAPFq3AqXBlGc9C4TOuZEW7A6Wt+ X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2015 21:15:03.7018 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1475 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2035 Lines: 50 On Fri, 2015-06-05 at 13:05 -0500, Rob Herring wrote: > On Fri, Jun 5, 2015 at 10:06 AM, Eric Auger > wrote: > > In situations where the userspace driver is stopped abnormally and > > the > > VFIO platform device is released, the assigned HW device currently > > is > > left running. As a consequence the HW device might continue > > issuing IRQs > > and performing DMA accesses. > > > > On release, no physical IRQ handler is setup anymore. Also the DMA > > buffers > > are unmapped leading to IOMMU aborts. So there is no serious > > consequence. > > > > However when assigning that HW device again to another userspace > > driver, > > this latter might face some unexpected IRQs and DMA accesses, > > which are > > the result of the previous assignment. > > In general, shouldn't it just be a requirement that the drivers > handle > this condition. You have the same problem with firmware/bootloaders > leaving h/w not in reset state or kexec'ing to a new kernel. It's not the same situation. Firmware may leave HW in a non-reset state but it must not leave the HW doing DMA; there's nothing the OS could do about that as the OS could get corrupted before the driver has a chance to run (this is not fun to debug). Leaving interrupts potentially asserted would be bad as well, especially if the interrupt is shared. Likewise, with normal kexec drivers are supposed to quiesce the hardware first -- and with kdump, the affected DMA buffers are never reused. In order for the driver to handle this, it would need to reset/quiesce the device itself before enabling an IOMMU mapping. How would that work for virtualization scenarios where the guest does not see any IOMMU, and all vfio mappings are handled by QEMU or equivalent? -Scott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/