Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp851580rwd; Wed, 31 May 2023 06:22:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ69xRw2/x2JkCgfNzYrhtTX89txw55ykzE3VKpe/MHQ96ljPt5DQlpvydG2bGVWPmRjHIB1 X-Received: by 2002:a17:90a:dd46:b0:256:4e25:8a6e with SMTP id u6-20020a17090add4600b002564e258a6emr4503468pjv.11.1685539354257; Wed, 31 May 2023 06:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685539354; cv=none; d=google.com; s=arc-20160816; b=XXHXpghexZIEYG4lDOc74kyQ/+HsuACoAAMfvxoepdyiPEEylpTkeYw7kHTRKg069A L6rdli8GB4Apm03IcbwIHa08dBbNZ/UWdaDfb1EqXJ0K0qlAkuL2Pg9oHruuS0EZ31nD YsRfVhAzIV2F3dgpXQTYK5xib4CJAmeGCDxpZKNkH4+XLzcvDQCM+yeaqsnpSTjRPXaJ /jRTKPSALMns35U5vfr4nZ/6yxtn4S3JtHhEE0TJOhSnNjZvx0Dn97baGNyDIj7Gi7Dz pnwu8ZQ7RaGQWbxyW12BeLkv4jg2ECAecIamu8vIZ5eKipWADac3d8nnfXi7LnbNWpqQ xpbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ygumGN7X55a4YT6OXk5KW6eBqJUAFJLGuz5I8swlOKo=; b=HBK33cgHZ/dqdzKRcmy4qNR8EidU286Wll2/x+cY0h09PcIbtO217s2Go/Rx+KQF0Z G9Pv5wzwzcAcwyZGyx/IM2eKt02BSB26A+3Hcx969BEt6O9oQ3NvJuzu7dQR1eXcV+Jq 2FPwAKdnXdzqrZAusznrzaTzaKk2LIaZMXJW3nsexZ/kftyPp/rjab8xvJ1IMehc1dBI ZWIql8sDrRp6HDHtUHCnQiC9BMcJSbvGNqLp1yk9SSoOGsvzy/z9U8YOy6HiqVtFNec0 trcodHrV1So/w1jEAAX8gNk0X6gRXW5xoh4jOmFZ8C+kxKSOJrOkDyrbvcjuR1cyNohy ejIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CnV8glpb; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 199-20020a6302d0000000b0053f23ffad1csi986038pgc.544.2023.05.31.06.22.19; Wed, 31 May 2023 06:22:34 -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=@redhat.com header.s=mimecast20190719 header.b=CnV8glpb; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236101AbjEaM4u (ORCPT + 99 others); Wed, 31 May 2023 08:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236094AbjEaM4g (ORCPT ); Wed, 31 May 2023 08:56:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BE19192 for ; Wed, 31 May 2023 05:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685537696; 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=ygumGN7X55a4YT6OXk5KW6eBqJUAFJLGuz5I8swlOKo=; b=CnV8glpbU74MnqEso3qjjBbkMaTwLA4SjEFKmwA9lEoW2ozY5y0DCv5NuueXucpx790KvK Ag4p3z2mI3kti741p9/EbgPmT/s5oegHqjdI5MwjjHQCyPXZtnDMevaUBkR6TXijh3cCwN uzD6AsO5JPmOVMTEeTYDbgIRGVRS6Ak= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-uL-J-k3SN4eJADROjXuaEA-1; Wed, 31 May 2023 08:54:54 -0400 X-MC-Unique: uL-J-k3SN4eJADROjXuaEA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f6fa88a86bso25764305e9.0 for ; Wed, 31 May 2023 05:54:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685537693; x=1688129693; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ygumGN7X55a4YT6OXk5KW6eBqJUAFJLGuz5I8swlOKo=; b=O7ebd8MN2Xjqd8vbfBsFfHwS9HOm9nFuaQxcMlOs1d1JclGYiFTB7/BxhTf76GVqWK ZKdNQjSd89uPJ+zAfNgOe0juDiiCb8O0nruUZsLbO59ndRJcZ8LYf81hVenvPwFjYrBx gOQdlAU07NSEQADm2bYYUGwbX5aKrVYfLKOiXtDIJ//PFfNSjqwsM14vDka9Ec7WyoIe ypBBlqS9PfKnevumyQnM0FWUaL82+k6wI5yzSediGx6IkOj+gwV9PkGro8UnY3HjhbjV +GC62xcLGntK6E0sUKmfIKMbwqjMQlTqACRCSUgdre6aom11WUjcu63QonNV6bBiUCWJ AMCg== X-Gm-Message-State: AC+VfDzIdV4m2M2DLuZvj0Z2kzCUT0DbHewOOD9NH1DABpOZQskIGQVk vljFDQd4rRpE1CsECl9Iikxw5JmlqL0+7XJw4uxtl8zTLXyS3FoAPUrJpZA/6fF3Mbckvb3Vy/d 6xvMKSSTIo9YPFdVWnFasT6Av X-Received: by 2002:a7b:c443:0:b0:3f6:d2c:13f2 with SMTP id l3-20020a7bc443000000b003f60d2c13f2mr3633049wmi.41.1685537693631; Wed, 31 May 2023 05:54:53 -0700 (PDT) X-Received: by 2002:a7b:c443:0:b0:3f6:d2c:13f2 with SMTP id l3-20020a7bc443000000b003f60d2c13f2mr3633034wmi.41.1685537693348; Wed, 31 May 2023 05:54:53 -0700 (PDT) Received: from ?IPV6:2a01:e0a:280:24f0:eb4a:c9d8:c8bb:c0b0? ([2a01:e0a:280:24f0:eb4a:c9d8:c8bb:c0b0]) by smtp.gmail.com with ESMTPSA id n26-20020a7bcbda000000b003f60482024fsm20807853wmi.30.2023.05.31.05.54.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 May 2023 05:54:52 -0700 (PDT) Message-ID: Date: Wed, 31 May 2023 14:54:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/3] vfio: ap: realize the VFIO_DEVICE_GET_IRQ_INFO ioctl Content-Language: en-US To: Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, alex.williamson@redhat.com, borntraeger@linux.ibm.com References: <20230530223538.279198-1-akrowiak@linux.ibm.com> <20230530223538.279198-2-akrowiak@linux.ibm.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= In-Reply-To: <20230530223538.279198-2-akrowiak@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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 On 5/31/23 00:35, Tony Krowiak wrote: > Realize the VFIO_DEVICE_GET_IRQ_INFO ioctl to retrieve the information for > the VFIO device request IRQ. > > Signed-off-by: Tony Krowiak Reviewed-by: Cédric Le Goater Thanks, C. > --- > drivers/s390/crypto/vfio_ap_ops.c | 30 +++++++++++++++++++++++++++++- > include/uapi/linux/vfio.h | 9 +++++++++ > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c > index cfbcb864ab63..35cd90eee937 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -1750,7 +1750,32 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg) > > info.flags = VFIO_DEVICE_FLAGS_AP | VFIO_DEVICE_FLAGS_RESET; > info.num_regions = 0; > - info.num_irqs = 0; > + info.num_irqs = VFIO_AP_NUM_IRQS; > + > + return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; > +} > + > +static ssize_t vfio_ap_get_irq_info(unsigned long arg) > +{ > + unsigned long minsz; > + struct vfio_irq_info info; > + > + minsz = offsetofend(struct vfio_irq_info, count); > + > + if (copy_from_user(&info, (void __user *)arg, minsz)) > + return -EFAULT; > + > + if (info.argsz < minsz || info.index >= VFIO_AP_NUM_IRQS) > + return -EINVAL; > + > + switch (info.index) { > + case VFIO_AP_REQ_IRQ_INDEX: > + info.count = 1; > + info.flags = VFIO_IRQ_INFO_EVENTFD; > + break; > + default: > + return -EINVAL; > + } > > return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; > } > @@ -1770,6 +1795,9 @@ static ssize_t vfio_ap_mdev_ioctl(struct vfio_device *vdev, > case VFIO_DEVICE_RESET: > ret = vfio_ap_mdev_reset_queues(&matrix_mdev->qtable); > break; > + case VFIO_DEVICE_GET_IRQ_INFO: > + ret = vfio_ap_get_irq_info(arg); > + break; > default: > ret = -EOPNOTSUPP; > break; > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index 0552e8dcf0cb..b71276bd7f91 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -646,6 +646,15 @@ enum { > VFIO_CCW_NUM_IRQS > }; > > +/* > + * The vfio-ap bus driver makes use of the following IRQ index mapping. > + * Unimplemented IRQ types return a count of zero. > + */ > +enum { > + VFIO_AP_REQ_IRQ_INDEX, > + VFIO_AP_NUM_IRQS > +}; > + > /** > * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12, > * struct vfio_pci_hot_reset_info)