From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964904AbbJVOKr (ORCPT ); Thu, 22 Oct 2015 10:10:47 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:61916 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757777AbbJVOKq (ORCPT ); Thu, 22 Oct 2015 10:10:46 -0400 From: Arnd Bergmann To: Eric Auger Cc: eric.auger@st.com, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: Re: [PATCH v2 6/6] vfio: platform: move get/put reset at open/release Date: Thu, 22 Oct 2015 16:10:06 +0200 Message-ID: <9413126.UTMuRq7fA0@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5628E41F.5050602@linaro.org> References: <1445506922-6005-1-git-send-email-eric.auger@linaro.org> <4304536.D7eNHjlsvD@wuerfel> <5628E41F.5050602@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:vwUNoy+YuJmKo706e3J5QpFKWfBOzZh1biMrMFVFVKi23MPNTza PqIQ24GEVSWr2R0tzAtZNMrIG9WtjU/VJoLGXImj6WGITyJymp5bWN9EEarEyhsyIh7+pXG KoaSfunZrMslhaMLbGehM6obOz8aApdNBy2alUk2MyvF14hDiFGnpkK2VinEmVx8kN9rH+g qTOlVOZHv6sWchX7CuZXA== X-UI-Out-Filterresults: notjunk:1;V01:K0:eMAsEkeUPvw=:5NvvUJ+bX4wUjHHS4wYt/T 8+sScpR2BMYUktYiPa8LC0D3AFEKgWYjQKwN0lPN2T+tq2zpG1gt2+wp5LP4PE/cZM3vUXSxm 05rEhP9L0MwrRL8bqbabpuxehRl5YkSfdlfWFpRcwi6Awui8x71oCBWnV6ru+4dh+EaXEPaJs 4Md67XwYQGYZtwCvUumi3hkcFLdX9pC4pM6lxDjow/p/zCptCO4KztahKvRlDOVVbqwEZI2gb 0GXG9OHY2iRp4E6cTf9cgSn3Iv0tur1423j53MNmqEQrekvnUW92X4vgTGMjGrR5A1r3UTSNe Es+J3WPBWdLgv5BGqXYGi4Celcd1jmc9Nxoi/Gckso0UKKhMqcqQKo6+gQBezI14BBk+D+irC nX4SKJ95tu4JrJfCuJIKV71Ad3a8FTIN1qe5GF0WppEfR2yxOYGSBtv9kvRp4KL976RuZhdV/ IPvwGFwbfxsUihKQWIloKgggx9JntY+Sn8pavdp9m1WqBSLgEFP6p7rlKO1FCoUP0GpZewgfv YftBtayvShdgRCdur0YDG+X+E1xMbVhu325In5qMwMsqBhxNHBt2nt9Yz2JUtf2Hmlag8klAV aqQW3nZtVTug0PbM501u9IaMToz8qrRoc2yGda7z3TQ90kIO1LR+VYxQ+zouCRIH6iAaXQuJu Bt6FQLlg+EkJq/NXadrqtognAnp6rs9Sox25BeZHbRBRR0FhtebSNL4JKlfLCiE1IxNp9Z/kG u9UgpXmEyukIzmDt Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 22 October 2015 15:26:55 Eric Auger wrote: > >> @@ -181,6 +182,8 @@ static int vfio_platform_open(void *device_data) > >> if (ret) > >> goto err_irq; > >> > >> + vfio_platform_get_reset(vdev); > >> + > >> if (vdev->reset) > >> vdev->reset(vdev); > >> > > > > This needs some error handling to ensure that the open() fails > > if there is no reset handler. > > Is that really what we want? The code was meant to allow the use case > where the VFIO platform driver would be used without such reset module. > > I think the imperious need for a reset module depends on the device and > more importantly depends on the IOMMU mapping. With QEMU VFIO > integration this is needed because the whole VM memory is IOMMU mapped > but in a simpler user-space driver context, we might live without. > > Any thought? I would think we need a reset driver for any device that can start DMA, otherwise things can go wrong as soon as you attach it to a different domain while there is ongoing DMA. Maybe we could just allow devices to be attached without a reset handler, but then disallow DMA on them? Arnd