Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp981664ybh; Wed, 11 Mar 2020 14:59:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsHtDfRJYPPLq6Ey0m4/j2Ic06Jm2FIf0Q3HZjbRnLEfWY40KlB+lG6ST2t1h93g+gCq4fu X-Received: by 2002:a9d:6e90:: with SMTP id a16mr3955712otr.72.1583963982608; Wed, 11 Mar 2020 14:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583963982; cv=none; d=google.com; s=arc-20160816; b=xP6Vf0FYWCU9vm5QIuI6EvmpVHdeyc87Gz5pBqexEt9xtYJmGtMAP7lM6u6jtvJ8+W x4bWXuv1oo7DdyvsVaJVkKzvAW84u879FOAGGFXWSiPWI2ll/G/LtGezIMraLh5gIwXj R+mnUmI1qplO360tuy8/ut2SOiUNkd7OEVCpB1OBSR3Zul1zEKIejbS8zp06mZZ3of98 y6H0UyP4NoFxmDtHHVlxYbj0FB7a1y/8xbxdQo+E6Mkfp+q6h19k5HAv9/rMnsxpAypZ Ns3wbq9EtnSX3lnzB087EuG+zXVJyzkiIdwhFdpepxrDlWwd5YLszd0I46dIlwY7pIHK 6EKw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=JvxF3s2C8+BX1cZ8mMuQEhyQrnMXU9w82UDzhSCaiB8=; b=HRRTAyJlRe/CA34YuDCXWd6wguwBGUdMlhF59Z1kVGxOpYK7BvRIfELXLDh5KHFId2 JT6WWhkPTUsNwiTOlkaB+6S9izhPQoe0o1gyhzQLNCrpiZa3rhAm2lNVK1A8DgBsH6Zs o3RpHUOidVCstRyPxqERoaCOOH2Wliueufkgrkh8XuIxFdbF/+1lihxcjYSXvRSEd5MC oXPU1VDTgn08HB679GKUcKV3yT/kB4x9TgQ2GV99BVHB/m6aqNrkVvod/JmtkwPq/jmn 9ZRt7gCdL05uyxTHRfPCxNae43ZTtZ/Uby4IL6w9Kj9Tt+dNNHF6bF6z02bs5ye1/DWn tsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B704Pjgi; 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=pass (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 g144si1633815oib.40.2020.03.11.14.59.30; Wed, 11 Mar 2020 14:59:42 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B704Pjgi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729782AbgCKV6w (ORCPT + 99 others); Wed, 11 Mar 2020 17:58:52 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:30167 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729717AbgCKV6w (ORCPT ); Wed, 11 Mar 2020 17:58:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583963930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JvxF3s2C8+BX1cZ8mMuQEhyQrnMXU9w82UDzhSCaiB8=; b=B704Pjgids5mmPJVEGjO3Yij9qgydRTpyj58sR9I/VKflOV/b0l6421o3Ee0JHes4G5hIS XTICDbG2ZDByx22XwtiTyirG0DUbiYuj3WKtxSJFjF5wauuV/zbr1Xv+qoLx0P83s0y9ov 0GoCLcnJYhG0SBqZnh1SUsMl05s1YG0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-YcxyrZaoO_SVGiiNVIWRkw-1; Wed, 11 Mar 2020 17:58:49 -0400 X-MC-Unique: YcxyrZaoO_SVGiiNVIWRkw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5DA8218A5508; Wed, 11 Mar 2020 21:58:47 +0000 (UTC) Received: from gimli.home (ovpn-116-28.phx2.redhat.com [10.3.116.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 096598D553; Wed, 11 Mar 2020 21:58:43 +0000 (UTC) Subject: [PATCH v3 2/7] vfio/pci: Implement match ops From: Alex Williamson To: kvm@vger.kernel.org Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dev@dpdk.org, mtosatti@redhat.com, thomas@monjalon.net, bluca@debian.org, jerinjacobk@gmail.com, bruce.richardson@intel.com, cohuck@redhat.com, kevin.tian@intel.com Date: Wed, 11 Mar 2020 15:58:43 -0600 Message-ID: <158396392362.5601.16302260004705199712.stgit@gimli.home> In-Reply-To: <158396044753.5601.14804870681174789709.stgit@gimli.home> References: <158396044753.5601.14804870681174789709.stgit@gimli.home> User-Agent: StGit/0.19-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This currently serves the same purpose as the default implementation but will be expanded for additional functionality. Reviewed-by: Cornelia Huck Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 379a02c36e37..2ec6c31d0ab0 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -1278,6 +1278,13 @@ static void vfio_pci_request(void *device_data, unsigned int count) mutex_unlock(&vdev->igate); } +static int vfio_pci_match(void *device_data, char *buf) +{ + struct vfio_pci_device *vdev = device_data; + + return !strcmp(pci_name(vdev->pdev), buf); +} + static const struct vfio_device_ops vfio_pci_ops = { .name = "vfio-pci", .open = vfio_pci_open, @@ -1287,6 +1294,7 @@ static const struct vfio_device_ops vfio_pci_ops = { .write = vfio_pci_write, .mmap = vfio_pci_mmap, .request = vfio_pci_request, + .match = vfio_pci_match, }; static int vfio_pci_reflck_attach(struct vfio_pci_device *vdev);