From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C408C4360F for ; Thu, 4 Apr 2019 23:16:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3528F206DF for ; Thu, 4 Apr 2019 23:16:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731111AbfDDXQu (ORCPT ); Thu, 4 Apr 2019 19:16:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:47206 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730972AbfDDXQt (ORCPT ); Thu, 4 Apr 2019 19:16:49 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x34N9lKw041195 for ; Thu, 4 Apr 2019 19:16:48 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rns8gmst7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Apr 2019 19:16:48 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Apr 2019 00:16:46 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 5 Apr 2019 00:16:43 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x34NGfT532309358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 4 Apr 2019 23:16:41 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A53D5204E; Thu, 4 Apr 2019 23:16:41 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 0910452054; Thu, 4 Apr 2019 23:16:41 +0000 (GMT) From: Halil Pasic To: kvm@vger.kernel.org, linux-s390@vger.kernel.org, Cornelia Huck , Martin Schwidefsky , Sebastian Ott Cc: Halil Pasic , virtualization@lists.linux-foundation.org, Christian Borntraeger , Viktor Mihajlovski , Vasily Gorbik , Janosch Frank , Claudio Imbrenda , Farhan Ali , Eric Farman Subject: [RFC PATCH 09/12] virtio/s390: use DMA memory for notifiers Date: Fri, 5 Apr 2019 01:16:19 +0200 X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190404231622.52531-1-pasic@linux.ibm.com> References: <20190404231622.52531-1-pasic@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19040423-0016-0000-0000-0000026B67A2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040423-0017-0000-0000-000032C77D6B Message-Id: <20190404231622.52531-10-pasic@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-04_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904040148 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Halil Pasic The hypervisor is supposed to poke the classic notifiers, if these are used, out of band with regards to ccw I/O. So these need to be allocated as DMA memory (which is shared memory for protected virtualization guests). Let us factor out notifiers in a satellite that is allocated as DMA memory to accommodate that. Signed-off-by: Halil Pasic --- drivers/s390/virtio/virtio_ccw.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c index 156166ae4df4..aa45a6a027ae 100644 --- a/drivers/s390/virtio/virtio_ccw.c +++ b/drivers/s390/virtio/virtio_ccw.c @@ -46,6 +46,11 @@ struct vq_config_block { #define VIRTIO_CCW_CONFIG_SIZE 0x100 /* same as PCI config space size, should be enough for all drivers */ +struct vcdev_dma_area { + unsigned long indicators; + unsigned long indicators2; +}; + struct virtio_ccw_device { struct virtio_device vdev; __u8 *status; @@ -59,8 +64,6 @@ struct virtio_ccw_device { spinlock_t lock; struct mutex io_lock; /* Serializes I/O requests */ struct list_head virtqueues; - unsigned long indicators; - unsigned long indicators2; struct vq_config_block *config_block; dma_addr_t config_block_dma_addr; bool is_thinint; @@ -69,16 +72,18 @@ struct virtio_ccw_device { unsigned int config_ready; void *airq_info; __u64 dma_mask; + struct vcdev_dma_area *dma_area; + dma_addr_t dma_area_dma_addr; }; static inline unsigned long *indicators(struct virtio_ccw_device *vcdev) { - return &vcdev->indicators; + return &vcdev->dma_area->indicators; } static inline unsigned long *indicators2(struct virtio_ccw_device *vcdev) { - return &vcdev->indicators2; + return &vcdev->dma_area->indicators2; } struct vq_info_block_legacy { @@ -1044,6 +1049,8 @@ static void virtio_ccw_release_dev(struct device *_d) vc_dma_free_struct(dev, vcdev->status); vc_dma_free_struct(dev, vcdev->config_block); + __vc_dma_free(&vcdev->vdev, PAGE_SIZE, vcdev->dma_area, + vcdev->dma_area_dma_addr); kfree(vcdev); } @@ -1325,6 +1332,12 @@ static int virtio_ccw_online(struct ccw_device *cdev) ret = -ENOMEM; goto out_free; } + vcdev->dma_area = __vc_dma_alloc(&vcdev->vdev, PAGE_SIZE, + &vcdev->dma_area_dma_addr); + if (!vcdev->dma_area) { + ret = -ENOMEM; + goto out_free; + } vcdev->is_thinint = virtio_ccw_use_airq; /* at least try */ @@ -1363,6 +1376,8 @@ static int virtio_ccw_online(struct ccw_device *cdev) if (vcdev) { vc_dma_free_struct(&vcdev->vdev, vcdev->status); vc_dma_free_struct(&vcdev->vdev, vcdev->config_block); + __vc_dma_free(&vcdev->vdev, PAGE_SIZE, vcdev->dma_area, + vcdev->dma_area_dma_addr); } kfree(vcdev); return ret; -- 2.16.4