Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp867791ybv; Wed, 19 Feb 2020 10:54:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzc5RoUAxbEBR2+ZWrhDocdAE8Q8ltSCYIT2p6Ic/orbyXj6Dv+VC4z3meZLhdL1Zjymmcn X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr21397298otr.16.1582138497280; Wed, 19 Feb 2020 10:54:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582138497; cv=none; d=google.com; s=arc-20160816; b=x1njRWSVv9M0/f5uJoDmQ1gY2sD9ER3OGNWdS+OGyuaNKxuvTo9YfUDeIgVmGv3x3e aFMpUQYdmOLOsmt9qrosN1D8cR0FIHl3byTx0GxgQ9hjutAKqKtK26RI8MS80xiqgprl uAntwtvc1BWiEWsxa9Wxx39tIclB0l+jNmpHmj30z+QNfR4JrwnZt2mrMlOYnCTFDAn7 5XkHFqix04OXp11GmHq8QLNjSTnpg6ErLFItxCXHWJLJbUGMeuIMAs8FBVc6Y/7r0UuW U6bEsKqf1Au3Hxp7ORiIIpCIDFNoM/ZCr7x0lobLtil2t+rR506OE3wJ3fTw7xNoLbmJ q/mQ== 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=U9/vAUbpN1pSejzjmu8gQCPtoyHteprgpCmmkhVnJAqateIxy9KEkP3XfRZ2PU8ANh T+WULcv1tOLArg898kJnkFF8nRe2Uo3zr8z4vfvM9d+J29TaZdWic5ijbiLZPre1k0ut HFpEXPD0C2pUiUhV0o0S61yToTKHP9Ij9XLUXrfe28RJTVArBh/RhTaWWWt/tTJhl8vL fKGGs8qAg65BdwSrGLScB4iXRB5jDX1gVEB2RpKhKX+nh+6IsAbeU/PFrMpPXsayRPgA fET7EWjbfBCpztOblC7w3a6Bos11EiHfmTFXt4eNXuZ0IT+R4ROLzhbOZr6yXGMXDKHe jcSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CISmMG5c; 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 b25si265061otp.212.2020.02.19.10.54.44; Wed, 19 Feb 2020 10:54:57 -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=CISmMG5c; 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 S1726875AbgBSSyO (ORCPT + 99 others); Wed, 19 Feb 2020 13:54:14 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:27192 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726788AbgBSSyN (ORCPT ); Wed, 19 Feb 2020 13:54:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582138452; 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=CISmMG5cLs2qzfer3eKUN80Kjx/zm90PNUkUIX+ZKkmcaB0jejfK4qMKs4rEDYab95UITd 9Sp8Pw/fUpLbDmiVkprSkZihjqmkTqPeKY94PJOxN3IH/HAZrz8aiSkqmWUNFrKRU+gqiE MWQGKiAIsk9jDpZLW56qORtE53jDEas= 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-200-Qz605BC0PPqDmW3OXCPl2Q-1; Wed, 19 Feb 2020 13:54:08 -0500 X-MC-Unique: Qz605BC0PPqDmW3OXCPl2Q-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E61B800D50; Wed, 19 Feb 2020 18:54:07 +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 3D7AE10001AE; Wed, 19 Feb 2020 18:54:04 +0000 (UTC) Subject: [PATCH v2 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: Wed, 19 Feb 2020 11:54:03 -0700 Message-ID: <158213844382.17090.14303032019487051956.stgit@gimli.home> In-Reply-To: <158213716959.17090.8399427017403507114.stgit@gimli.home> References: <158213716959.17090.8399427017403507114.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.84 on 10.5.11.22 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);