From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932512AbbJPN1V (ORCPT ); Fri, 16 Oct 2015 09:27:21 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:54665 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932411AbbJPN1Q (ORCPT ); Fri, 16 Oct 2015 09:27:16 -0400 From: Arnd Bergmann To: Eric Auger Cc: Alex Williamson , Christoffer Dall , linux-arm-kernel@lists.infradead.org, eric.auger@st.com, b.reynal@virtualopensystems.com, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, thomas.lendacky@amd.com, patches@linaro.org, suravee.suthikulpanit@amd.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] VFIO: platform: AMD xgbe reset module Date: Fri, 16 Oct 2015 15:26:34 +0200 Message-ID: <3768580.4oTvTNW7Bh@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5620F665.5010903@linaro.org> References: <1444836792-2405-1-git-send-email-eric.auger@linaro.org> <1444927997.4059.470.camel@redhat.com> <5620F665.5010903@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:1L7j5YtCaZaveAmk3a5RIrngs+R2SAVDUxQaN61lk89FKeySLDF e72A60xxJRg0eu7n5GOk5t9EH4QTKIKnGmhvxYT18SOZDHyCAVC72uHbjYYyxBeJ96L1r99 zaVX2DihQUVe0PrH7ApCIGkCgcTsczxCKdnJe/ZHejkBevtzQi/Cbcw4uDWOWUCIlQyPG8e OuRWjqtuR7avyFEoVktEQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:UUFdeRMbBWY=:LfsJAozniRPSxX3cKpIlG3 r7xWWAwJlawzBxEOjMs+EWqrqo0XlYfWeKS6bt1Kckq1pGnbzq9REMFS7rUITaA+4kIElaoWZ PPdM0YfTWZfwEJMjeQDFQ6W4IycKA2Nu82+AosTRx6ZWy35pHdxwoc+xFEZFd5YrY2dSp6JEx V+QL8lMTrAopBMLGMsORtk8gvdHjVka7ydn8GyCXylyrZS0tBtei6r0ZnmtPCFn/XHRFmy67O 1Da12BImUD3bBx79xzux24eaXMJ+kYRmLytOsLN0XvkQ8sNfu4NG0RqN6QtPSwqy8wXXXSIsA Zc934h9sadU5KnYWclX+iGvpmL3KA1KuPwuAstIz2S+2LqmFBxz0wK3RGTmRCnfHrbE+3qbJb kF9CwfS73UL34C6zpOD+7cIZ6to2S243MRSg5EMjAcfD/LQcxPfRHi0RTpNHxHDU788w6nFOE +Ip1Mm1W7QPuedzBsv02UCci2LHxC77TBUEUKilD57PIKseMB0Iepp+v3DLkmxuTmp19J/hY4 djQhGj14bUf/5f85WNlINd2rYlmf3empTke4xsyhSzXTauJKiBU87LZZrVzSYBW0YF1xHNDho ickFdeC7FYK6etWvmoTf+vkPvHVMd3+LN4M4bwNm/Zi1GResgZ7SN1L5qiYdzHTkal2ZTtjHC Tl9mW5jUpyrFFDyDUmgU6XwK9ubp5G/FgKnsWtw3++2BYITqLU6CAtrDTQqZ+E0q9WW4e8/R0 nBjnzAP6LDcqfor7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 16 October 2015 15:06:45 Eric Auger wrote: > I've since forgotten his answer, but the fact that > > __symbol_get() is only defined for modules makes it moot, we either need > > to make symbol_get() work or define __symbol_get() for non-module > > builds. > I currently don't see any solution for any of those. The only solution I > can see is someone registers the reset function pointer to vfio. > > I think we could keep the existing reset modules, do the request_module > from VFIO, using their module name registered in the lookup table. But > instead of having the reset function in the look-up table we would have > the reset modules register their reset function pointer to VFIO. I think > this could work around the symbol_get issue. > > This still leaves the layer violation argument though. > > Assuming this works, would that be an acceptable solution, although I > acknowledge this does not perfectly fit into the driver model? I think it's possible to avoid the layering violation that way too, by loading the module based on the compatible string, with a module_alias. static void vfio_platform_get_reset(struct vfio_platform_device *vdev, struct device *dev) { const char *compat; int (*reset)(struct vfio_platform_device *); int ret, i; char modname[256]; ret = device_property_read_string(dev, "compatible", &compat); if (ret) return; reset = vfio_platform_lookup_reset(compat); if (!reset) { snprintf(modname, "vfio-reset:%s", compat); request_module(modname); reset = vfio_platform_lookup_reset(compat); } vdev->reset = reset; } --- #define module_vfio_reset_handler(compat, reset) \ MODULE_ALIAS("vfio_reset" compat); \ static int reset ## _module_init(void) \ { \ return vfio_reset_register(THIS_MODULE, compat, &reset); \ } I think that solution is good enough, as it avoids most of the problems with the current implementation but is a simple enough change. Arnd