From patchwork Fri Jun 5 15:06:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 49577 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31CB42154F for ; Fri, 5 Jun 2015 15:06:55 +0000 (UTC) Received: by wibut5 with SMTP id ut5sf5778336wib.0 for ; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=lhr1xqS0fOrCNY33QEaXo8xZj1BsAStLWlYaddFwLlI=; b=atTmITk5KI4kZI9mtwrtbkSNE4kQI8FcrVDnis3rPkNhWNONkAQ9VjtskGq2Pzk4Rx cG7fYsU3NIaIhNHu8xak4pqr5vgh04/n7EAHuIF9+AUpxzS/ChR2kRMcUdi0GB3p+Eav zC9QQm2mlmV4KnePH1bDSj6PVsHGknhfV1kCJmN1NIa6exVw8SIcqQ3boho+gzyF7dgk 5yXd5KgWiqRFSd0hNrRg8k0sccWCPDmzYHOLNPi9xEPspiij7wvMOC7tnMLRZ8+9L1AQ aKOYn6MfpOF7OJcqQfJ/9/AI0Z2jG3e5MRnjYqW/rjKzlr5kf2SNfjwc9wmsy+fFm5G+ NarA== X-Gm-Message-State: ALoCoQkkqDy45rp/WC2GWWo2Q/724Q1XMfUzH93wdyddLhzAfbx3YsW2WhXOaNbMsaxcO3/YhuXf X-Received: by 10.180.73.137 with SMTP id l9mr9002170wiv.5.1433516814471; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.2 with SMTP id t2ls383995laz.8.gmail; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) X-Received: by 10.112.135.131 with SMTP id ps3mr3781782lbb.84.1433516814309; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id dn7si5036955lbb.71.2015.06.05.08.06.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2015 08:06:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbqq2 with SMTP id qq2so47785293lbb.3 for ; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr3793951lae.19.1433516814225; Fri, 05 Jun 2015 08:06:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1507156lbb; Fri, 5 Jun 2015 08:06:53 -0700 (PDT) X-Received: by 10.180.218.195 with SMTP id pi3mr19113968wic.71.1433516810210; Fri, 05 Jun 2015 08:06:50 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id ei5si4572185wid.118.2015.06.05.08.06.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2015 08:06:50 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by wibdq8 with SMTP id dq8so22159677wib.1 for ; Fri, 05 Jun 2015 08:06:50 -0700 (PDT) X-Received: by 10.194.178.227 with SMTP id db3mr7194476wjc.82.1433516809929; Fri, 05 Jun 2015 08:06:49 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id dz4sm3827133wib.17.2015.06.05.08.06.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jun 2015 08:06:48 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com Cc: christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, patches@linaro.org, agraf@suse.de Subject: [PATCH v2 1/4] VFIO: platform: add reset struct and lookup table Date: Fri, 5 Jun 2015 17:06:29 +0200 Message-Id: <1433516792-16397-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433516792-16397-1-git-send-email-eric.auger@linaro.org> References: <1433516792-16397-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch introduces the vfio_platform_reset_combo struct that stores all the information useful to handle the reset modality: compat string, name of the reset function, name of the module that implements the reset function. A lookup table of such structures is added, currently containing a single sentinel element. A new type field is added in vfio_platform_device to store what kind of reset is associated to the device, if any. Signed-off-by: Eric Auger --- drivers/vfio/platform/vfio_platform_common.c | 6 ++++++ drivers/vfio/platform/vfio_platform_private.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index abcff7a..d970776 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -25,6 +25,12 @@ static DEFINE_MUTEX(driver_lock); +static const struct vfio_platform_reset_combo reset_lookup_table[] = { + { + .type = VFIO_PLATFORM_RESET_TYPE_MAX + }, +}; + static int vfio_platform_regions_init(struct vfio_platform_device *vdev) { int cnt = 0, i; diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index 5d31e04..d864124 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -49,6 +49,10 @@ struct vfio_platform_region { void __iomem *ioaddr; }; +enum vfio_platform_reset_type { + VFIO_PLATFORM_RESET_TYPE_MAX /* last element */, +}; + struct vfio_platform_device { struct vfio_platform_region *regions; u32 num_regions; @@ -56,6 +60,7 @@ struct vfio_platform_device { u32 num_irqs; int refcnt; struct mutex igate; + enum vfio_platform_reset_type type; /* * These fields should be filled by the bus specific binder @@ -69,6 +74,13 @@ struct vfio_platform_device { int (*get_irq)(struct vfio_platform_device *vdev, int i); }; +struct vfio_platform_reset_combo { + enum vfio_platform_reset_type type; + char *compat; + char *reset_function_name; + char *module_name; +}; + extern int vfio_platform_probe_common(struct vfio_platform_device *vdev, struct device *dev); extern struct vfio_platform_device *vfio_platform_remove_common