Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp614888ybp; Fri, 11 Oct 2019 01:19:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGNhtRkhfJoDaq9+H1x4KFK2mnII0VGUQSO3JiIaRGHF92DGtMzM7OXEDkJe4v+JgzZEvE X-Received: by 2002:a17:906:85d7:: with SMTP id i23mr12715951ejy.332.1570781990751; Fri, 11 Oct 2019 01:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570781990; cv=none; d=google.com; s=arc-20160816; b=UrtpXJguotR8k3L6FsYfqOAo59pIXr6iDDLZBt1yRNMTbuHsWwEp8hKuV9kNSDVA4X D78rqNybn+mM1kMBVg4fGRYpqdra6dRlFiFFeP3sGnMPDytvr/eRzgLuhLWU7n8ep9Fs XVEi9ATwOu94WjeBEDUfDfLpt01ejHhRbi0X3he/DmEmgkEnCIFMsjqJbXEK434HBFos DSd20VfiuwP8sGxmfnyQxDRu+SVoIoGvTJSXUIVTK78RCtgjpCWQ/n6IFjk6+yDmngH/ yY9maWXDqPivv1F1DWKgTa9CAjy0s6t9vbrDl82Zu2EWjE2vueClY36qBvy/33LuK2C1 +gQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Woy9Np2rcMAXse4xxV+3nkdh6gXxNQFOCQLm2nr2XBo=; b=s3qLZv6tZ0cYb4u80hqX5vEqYvMBBh/XBGdSCNL1q1Sywrf/UTzbYG1p0zoewBL5uB +RWcj9G+gtoSAmEJpfDr7bnb3SBdn9uelV0POC5qLKCkxoqXHdn4sTCodAfMk6gmAQK3 xYMkCnlqRgXnPq82iWwEXEQs4PUq/n/KYIqz+cXPEXmA0Yy32IiJOIF/rmJWVkm+cnXp 5CKRM0mMU1zL9YJVVbNfPGkGewViZarj/DdXnHD+AFKRaN0F2hy0W1FvwIfiPRuziX/z U/MBfpObIabWE3HNWuXpQqh1uJHZxZ61XwBLHBftpVDjsnOyi+bP67O8goum4D0Wp3nl b28A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1si5106719ede.255.2019.10.11.01.19.27; Fri, 11 Oct 2019 01:19:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbfJKISh (ORCPT + 99 others); Fri, 11 Oct 2019 04:18:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55360 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbfJKISh (ORCPT ); Fri, 11 Oct 2019 04:18:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D43618CB8E8; Fri, 11 Oct 2019 08:18:36 +0000 (UTC) Received: from jason-ThinkPad-X1-Carbon-6th.redhat.com (ovpn-12-241.pek2.redhat.com [10.72.12.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id C97D21001B08; Fri, 11 Oct 2019 08:18:10 +0000 (UTC) From: Jason Wang To: kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, kwankhede@nvidia.com, alex.williamson@redhat.com, mst@redhat.com, tiwei.bie@intel.com Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, cohuck@redhat.com, maxime.coquelin@redhat.com, cunming.liang@intel.com, zhihong.wang@intel.com, rob.miller@broadcom.com, xiao.w.wang@intel.com, haotian.wang@sifive.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, daniel@ffwll.ch, farman@linux.ibm.com, pasic@linux.ibm.com, sebott@linux.ibm.com, oberpar@linux.ibm.com, heiko.carstens@de.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, akrowiak@linux.ibm.com, freude@linux.ibm.com, lingshan.zhu@intel.com, idos@mellanox.com, eperezma@redhat.com, lulu@redhat.com, parav@mellanox.com, christophe.de.dinechin@gmail.com, kevin.tian@intel.com, Jason Wang Subject: [PATCH V3 3/7] modpost: add support for mdev class id Date: Fri, 11 Oct 2019 16:15:53 +0800 Message-Id: <20191011081557.28302-4-jasowang@redhat.com> In-Reply-To: <20191011081557.28302-1-jasowang@redhat.com> References: <20191011081557.28302-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 11 Oct 2019 08:18:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to parse mdev class id table. Signed-off-by: Jason Wang --- drivers/vfio/mdev/vfio_mdev.c | 2 ++ scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/drivers/vfio/mdev/vfio_mdev.c b/drivers/vfio/mdev/vfio_mdev.c index fd2a4d9a3f26..891cf83a2d9a 100644 --- a/drivers/vfio/mdev/vfio_mdev.c +++ b/drivers/vfio/mdev/vfio_mdev.c @@ -125,6 +125,8 @@ static struct mdev_class_id id_table[] = { { 0 }, }; +MODULE_DEVICE_TABLE(mdev, id_table); + static struct mdev_driver vfio_mdev_driver = { .name = "vfio_mdev", .probe = vfio_mdev_probe, diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 054405b90ba4..6cbb1062488a 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -231,5 +231,8 @@ int main(void) DEVID(wmi_device_id); DEVID_FIELD(wmi_device_id, guid_string); + DEVID(mdev_class_id); + DEVID_FIELD(mdev_class_id, id); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index c91eba751804..d365dfe7c718 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1335,6 +1335,15 @@ static int do_wmi_entry(const char *filename, void *symval, char *alias) return 1; } +/* looks like: "mdev:cN" */ +static int do_mdev_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD(symval, mdev_class_id, id); + + sprintf(alias, "mdev:c%02X", id); + return 1; +} + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { @@ -1407,6 +1416,7 @@ static const struct devtable devtable[] = { {"typec", SIZE_typec_device_id, do_typec_entry}, {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, + {"mdev", SIZE_mdev_class_id, do_mdev_entry}, }; /* Create MODULE_ALIAS() statements. -- 2.19.1