Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3828661ioo; Wed, 25 May 2022 08:58:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdzao9XUrpp6Qcz9FQCkl9OyhElQRNuFBDWSARQN2MZeiRM7UCJC8PkEG3kWNZGeskHunS X-Received: by 2002:a05:6402:26d6:b0:42b:31b9:2064 with SMTP id x22-20020a05640226d600b0042b31b92064mr26171455edd.227.1653494285585; Wed, 25 May 2022 08:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653494285; cv=none; d=google.com; s=arc-20160816; b=VB84wDyMZn8wNKfowDSMgGD/l4/0bDDG4u4+j9m9X6baCi/XDDqGBRpzR9DCVLqq/Z iW0eP43F8EnTFZJ9tjb+5JBCpEXOvUJjFfX4oXJfkev/O42TSsXc+j8JpM2NgGm+o1uc +Q3pGQ/Qfa4lF6ZJVThsyO5rM5M647shMMHDRm1147QXSNy0k9wrHyKEvnFu0ymzWzHr pUdPknugJQtIoYatkwMVENnFBCXWx4dAoHFcBBH/ni7OvdISJ9Rvg1TkAnfnVtwfIDlX HuM7RLSROiRBEMs+fy8/lGZQZ1CZByJ85i0grQYbgHjYl5mINraHDX0FZdnHQxUy1Un9 mrTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U0pGt4+da6RvVcvQWF4AsfOWr2gYIstBG7gNPPm1/Q4=; b=w+xqXrfDwYCr8m1hjBSOXboAYuUdSiwCPt9bCqPzof/lJK/hIp7SMEArkc9JqhlbZW v65xsPCkDrXOuM1CeXT7SEQXY/P5SvkXlGNBZ63olIazYnJVPYqbBHdxrEVL+UfnZqyA ucbohfDW4aXPbl+FmvENQ/M5UEX0/WCuvXPhl3yc11KF1OZPJM2CTX5KYI/1ShVjtUVO IAR1508XeSy94tTG0R8zt6EmaZBY8SXk+umV+btTFUmyhOBW9oZMpMwTYz3jmv5bAdcY PQ2+/pOQdEYglr6Dzaw39uAzCpP/56sufcqc/gRdZqPcNhrqqq9t0aX4duwFMIYH4xdK MRng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="p4vY/C2Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa40-20020a1709076d2800b006df76385cc0si16607636ejc.352.2022.05.25.08.57.38; Wed, 25 May 2022 08:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="p4vY/C2Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbiEXTA6 (ORCPT + 99 others); Tue, 24 May 2022 15:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240747AbiEXTAa (ORCPT ); Tue, 24 May 2022 15:00:30 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5FF6A426; Tue, 24 May 2022 12:00:04 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24OIxw9J005356; Tue, 24 May 2022 18:59:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=U0pGt4+da6RvVcvQWF4AsfOWr2gYIstBG7gNPPm1/Q4=; b=p4vY/C2Y+tveYILhA9QBpKhSI5R4xizN3oe+aUvwUh7tzPk9Gh0K9LlP7FMLFLABk0Eq OaccTESbj6PpqEtMaHR2MK/orKbOBRAipWlAongVeF/ExLMgi0BVeWN9teXFr7C2pFMF JKcZRsXaXOsOEZC9CMDBk8yM7feIig/s6qwoFmQlXNrtx1FT+TJfKkdDkJfYGMXuCnZv WFzMUckWRAI1BrIolhyzdkd5rr63loengr/w6FIgDE1eZiZlDppVfGSxd5KaY5cxPGvB OyBLBO65AtCHipFpvMlFLXtmzSc4CkXaiE9OuH+iRj4eJ4TybJfTgg2dr6eJuru+++17 +w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g954sg017-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 18:59:57 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24OIxvQV005341; Tue, 24 May 2022 18:59:57 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g954sg010-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 18:59:57 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24OIr2ok007783; Tue, 24 May 2022 18:59:56 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma03wdc.us.ibm.com with ESMTP id 3g93v8rha9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 18:59:56 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24OIxtTf30277986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 May 2022 18:59:55 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C36CBE054; Tue, 24 May 2022 18:59:55 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 46258BE056; Tue, 24 May 2022 18:59:53 +0000 (GMT) Received: from li-c92d2ccc-254b-11b2-a85c-a700b5bfb098.ibm.com.com (unknown [9.163.3.233]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 24 May 2022 18:59:53 +0000 (GMT) From: Matthew Rosato To: linux-s390@vger.kernel.org Cc: alex.williamson@redhat.com, cohuck@redhat.com, schnelle@linux.ibm.com, farman@linux.ibm.com, pmorel@linux.ibm.com, borntraeger@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, gerald.schaefer@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com, frankja@linux.ibm.com, david@redhat.com, imbrenda@linux.ibm.com, vneethv@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, thuth@redhat.com, pasic@linux.ibm.com, pbonzini@redhat.com, corbet@lwn.net, jgg@nvidia.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v8 18/22] vfio-pci/zdev: add function handle to clp base capability Date: Tue, 24 May 2022 14:59:03 -0400 Message-Id: <20220524185907.140285-19-mjrosato@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220524185907.140285-1-mjrosato@linux.ibm.com> References: <20220524185907.140285-1-mjrosato@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qxe0RaXAq9p-1dK48yARuiZmNS2CdfA4 X-Proofpoint-GUID: ufPnF5hvKeonnfudN3ULypJeutfP2LR- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_09,2022-05-23_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 suspectscore=0 mlxlogscore=917 impostorscore=0 bulkscore=0 clxscore=1015 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2205240090 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function handle is a system-wide unique identifier for a zPCI device. With zPCI instruction interpretation, the host will no longer be executing the zPCI instructions on behalf of the guest. As a result, the guest needs to use the real function handle in order for firmware to associate the instruction with the proper PCI function. Let's provide that handle to the guest. Reviewed-by: Christian Borntraeger Reviewed-by: Pierre Morel Signed-off-by: Matthew Rosato --- drivers/vfio/pci/vfio_pci_zdev.c | 5 +++-- include/uapi/linux/vfio_zdev.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_zdev.c b/drivers/vfio/pci/vfio_pci_zdev.c index d0df85c8b204..183c2609eef7 100644 --- a/drivers/vfio/pci/vfio_pci_zdev.c +++ b/drivers/vfio/pci/vfio_pci_zdev.c @@ -24,14 +24,15 @@ static int zpci_base_cap(struct zpci_dev *zdev, struct vfio_info_cap *caps) { struct vfio_device_info_cap_zpci_base cap = { .header.id = VFIO_DEVICE_INFO_CAP_ZPCI_BASE, - .header.version = 1, + .header.version = 2, .start_dma = zdev->start_dma, .end_dma = zdev->end_dma, .pchid = zdev->pchid, .vfn = zdev->vfn, .fmb_length = zdev->fmb_length, .pft = zdev->pft, - .gid = zdev->pfgid + .gid = zdev->pfgid, + .fh = zdev->fh }; return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); diff --git a/include/uapi/linux/vfio_zdev.h b/include/uapi/linux/vfio_zdev.h index b4309397b6b2..78c022af3d29 100644 --- a/include/uapi/linux/vfio_zdev.h +++ b/include/uapi/linux/vfio_zdev.h @@ -29,6 +29,9 @@ struct vfio_device_info_cap_zpci_base { __u16 fmb_length; /* Measurement Block Length (in bytes) */ __u8 pft; /* PCI Function Type */ __u8 gid; /* PCI function group ID */ + /* End of version 1 */ + __u32 fh; /* PCI function handle */ + /* End of version 2 */ }; /** -- 2.27.0