From patchwork Wed Apr 19 19:44:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Ricardo Ziviani X-Patchwork-Id: 9688757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A037602C9 for ; Wed, 19 Apr 2017 19:48:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A64B28174 for ; Wed, 19 Apr 2017 19:48:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DDB728423; Wed, 19 Apr 2017 19:48:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5B8728174 for ; Wed, 19 Apr 2017 19:48:13 +0000 (UTC) Received: from localhost ([::1]:50139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0vaH-0000rP-18 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Apr 2017 15:48:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0vY1-0008Po-L3 for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:45:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0vXy-0007R5-Cc for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:45:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d0vXx-0007Qd-Vq for qemu-devel@nongnu.org; Wed, 19 Apr 2017 15:45:50 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3JJiOHP010064 for ; Wed, 19 Apr 2017 15:45:48 -0400 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 29x0wjvhxr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 19 Apr 2017 15:45:48 -0400 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Apr 2017 16:45:45 -0300 Received: from d24relay04.br.ibm.com (9.18.232.146) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 19 Apr 2017 16:45:44 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3JJjhuP2359732 for ; Wed, 19 Apr 2017 16:45:43 -0300 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v3JJjhAP018412 for ; Wed, 19 Apr 2017 16:45:43 -0300 Received: from pacoca.ibm.com ([9.85.138.3]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v3JJjJ25018019; Wed, 19 Apr 2017 16:45:39 -0300 From: Jose Ricardo Ziviani To: qemu-devel@nongnu.org Date: Wed, 19 Apr 2017 16:44:43 -0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492631083-23965-1-git-send-email-joserz@linux.vnet.ibm.com> References: <1492631083-23965-1-git-send-email-joserz@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17041919-0020-0000-0000-000002A15DBC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17041919-0021-0000-0000-000030BE7B0D Message-Id: <1492631083-23965-3-git-send-email-joserz@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-19_16:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704190164 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 2/2] vfio: enable 8-byte reads/writes to vfio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aik@ozlabs.ru, pbonzini@redhat.com, alex.williamson@redhat.com, mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch enables 8-byte writes and reads to VFIO. Such implemention is already done but it's missing the 'case' to handle such accesses in both vfio_region_write and vfio_region_read and the MemoryRegionOps: impl.max_access_size and impl.min_access_size. After this patch, 8-byte writes such as: qemu_mutex_lock locked mutex 0x10905ad8 vfio_region_write (0001:03:00.0:region1+0xc0, 0x4140c, 4) vfio_region_write (0001:03:00.0:region1+0xc4, 0xa0000, 4) qemu_mutex_unlock unlocked mutex 0x10905ad8 goes like this: qemu_mutex_lock locked mutex 0x10905ad8 vfio_region_write (0001:03:00.0:region1+0xc0, 0xbfd0008, 8) qemu_mutex_unlock unlocked mutex 0x10905ad8 Signed-off-by: Jose Ricardo Ziviani --- hw/vfio/common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 145f2f4..43c8e98 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -119,6 +119,9 @@ void vfio_region_write(void *opaque, hwaddr addr, case 4: buf.dword = cpu_to_le32(data); break; + case 8: + buf.qword = cpu_to_le64(data); + break; default: hw_error("vfio: unsupported write size, %d bytes", size); break; @@ -173,6 +176,9 @@ uint64_t vfio_region_read(void *opaque, case 4: data = le32_to_cpu(buf.dword); break; + case 8: + data = le64_to_cpu(buf.qword); + break; default: hw_error("vfio: unsupported read size, %d bytes", size); break; @@ -194,6 +200,10 @@ const MemoryRegionOps vfio_region_ops = { .min_access_size = 1, .max_access_size = 8, }, + .impl = { + .min_access_size = 1, + .max_access_size = 8, + }, }; /*