Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5398695ybv; Tue, 11 Feb 2020 15:06:26 -0800 (PST) X-Google-Smtp-Source: APXvYqzsIcwYey7HLpKSZBxcUdjPJ6TAAjQNiGjO/woriSRYjwnq30e5pFOAQxdT50MPjEU790h4 X-Received: by 2002:a05:6830:10d7:: with SMTP id z23mr7073987oto.114.1581462386538; Tue, 11 Feb 2020 15:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581462386; cv=none; d=google.com; s=arc-20160816; b=g831ejyDAqetLQs+0mO4tVSN0qMznBKM+SaC6HAIIB14fwTf1aYfS62fVqO2E/y4m1 GwGe0mt0zZAc5+XWqJgG/yqNfkUvbjwIa4NysM+n+6DFHKcKxcLmnpqUbT6V8BNWS58t ye5nkJhHd5vlwjo5tIkvRvSxuCCHL5PNyVvdOx9+BwERpcBdPAZPQCqnpvSpBRSBz/nx tNihWW3GT4p60aG3GOljNM+Jy9wgFed4E/5qS8OC29ZKX71pAm36EObS5LpF+pF3jhIa 3r1y129WfLSeLC/XsAvyx/l3II1LMKqW6Kk2JZ+IMCCehk05tDmY27Z9pCbXI4D+ZFh2 Jwmw== 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=egySVQn95d75jOeqVctft40gVEWO2D/Q7wNGOIZKyvo=; b=yWaq5I1G2InuFqjTrFJKd/gkTrupCGbz/4XRHmMVeWEQsnoSIn9Sw1AhBVNnubQfir ZKJwhTnTPYgSNpt1fhC7hKZazi0PfK62HL7qyPVtv5ArC2daLODy5h8j9DOVRHbQCM1s Lo1TjolnnjGfwkfBHnYoEcCmts6NKc8n/132hNhiWWuTe6uVpfhU1SgDJjJyJxr/niZ1 U4f4lsjWvcl4GOJYTBnEjD2RAXtR1whCdGOuW9j4yxp4DT7qHVQzeE+lO8QULYIVYCep 7VLmbKtxFraRatObgODPJc4HrKAUqWD2HUGMRImxclWRjZjbsNBcg4+2yR82tMXoHp0b aWYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SC4VRpq+; 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 z1si2682021otq.21.2020.02.11.15.06.14; Tue, 11 Feb 2020 15:06:26 -0800 (PST) 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=SC4VRpq+; 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 S1727906AbgBKXFp (ORCPT + 99 others); Tue, 11 Feb 2020 18:05:45 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27247 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727799AbgBKXFo (ORCPT ); Tue, 11 Feb 2020 18:05:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581462343; 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=egySVQn95d75jOeqVctft40gVEWO2D/Q7wNGOIZKyvo=; b=SC4VRpq+jbSyokbJtns/gZcAGpHxJiq4RjkjMt0hN0EBincum/11dxtjaFz4gddt0sdoGI 0TAYbIHpXWK3vPAr2FHfKzw5yYtcLo8rUDQX9ZsmYaylfSXbM4JaCb9HKuyT3pEJy0Dwb/ UtsHV+oajzos2yZVCag+NwdB6r04zTI= 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-12-JMS2qA9-Nkez43ezurFWCA-1; Tue, 11 Feb 2020 18:05:39 -0500 X-MC-Unique: JMS2qA9-Nkez43ezurFWCA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A559B107ACC4; Tue, 11 Feb 2020 23:05:37 +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 9DDCD5C1B2; Tue, 11 Feb 2020 23:05:34 +0000 (UTC) Subject: [PATCH 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 Date: Tue, 11 Feb 2020 16:05:34 -0700 Message-ID: <158146233422.16827.5520548241096752615.stgit@gimli.home> In-Reply-To: <158145472604.16827.15751375540102298130.stgit@gimli.home> References: <158145472604.16827.15751375540102298130.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.16 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. 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);