From patchwork Sat Feb 24 08:30:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 10240327 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 88704602B8 for ; Sat, 24 Feb 2018 08:31:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 766F129B7F for ; Sat, 24 Feb 2018 08:31:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6AE2D29B82; Sat, 24 Feb 2018 08:31:09 +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,FREEMAIL_FROM, 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 80A6F29B7F for ; Sat, 24 Feb 2018 08:31:08 +0000 (UTC) Received: from localhost ([::1]:49031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epVEX-0000P5-ME for patchwork-qemu-devel@patchwork.kernel.org; Sat, 24 Feb 2018 03:31:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epVDu-0008Vm-UO for qemu-devel@nongnu.org; Sat, 24 Feb 2018 03:30:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epVDr-0004xF-N7 for qemu-devel@nongnu.org; Sat, 24 Feb 2018 03:30:26 -0500 Received: from mout.web.de ([212.227.17.12]:52887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epVDr-0004sD-Dq for qemu-devel@nongnu.org; Sat, 24 Feb 2018 03:30:23 -0500 Received: from [192.168.1.10] ([95.157.57.47]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MBCBN-1ez68p2OzF-00AGn0; Sat, 24 Feb 2018 09:30:14 +0100 To: Peter Xu , "Michael S. Tsirkin" References: <2837d007-760a-f2c1-c8cd-6f7d4f6f0bbd@web.de> <20180222044013.GC18962@xz-mi> From: Jan Kiszka Message-ID: <2f5781cc-ced4-6df0-906e-cd456d722a6e@web.de> Date: Sat, 24 Feb 2018 09:30:12 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <20180222044013.GC18962@xz-mi> Content-Language: en-US X-Provags-ID: V03:K0:Mkd6+mHBOxFLb1vhdmRiMR3q2d074htbQz638k3abGfSVeexb9K 0G25kFR+zFEANpIB9OYois8Cb05sy7tJ5Ku1TFjBjycBA6hNZefMpMV0e9zArec45kXGdXR GZSvQ9ZFfEdkz6CeyafLhFqU2vydzFJwAFk8ZBtAcP6twUi7ibKU+0oEhau/xcm/MNEmKRs BRVt2klwM5St1zIXkjmCg== X-UI-Out-Filterresults: notjunk:1; V01:K0:iQ6QrU2sqDg=:qcjxRez+08VoS2PafVu75p h4T4CyILyZKAz32K15MAkV/q1l3iv2+bz7/y9f2yxAwCHbhuxSMoZSql+wIbsbzKi9kHO0UjY jPEI0ozFm+LPo36Rd1ogZj9i7tmgGD9se93TNJrrPZQFFEYyDWNcAP3GSkwEWXt0EihSgcAVf 2rxvwn1zVdLhPWdiWswOXWpGSMJkTckU7kIuwuD9VeFQgt9cPaMtJ8bSHTt0LG7cOSIx6TZsO B+4cidtgEumUbk01jucaVRl14PIZl0cbLUfBem3LAc2YXnBdN1GXaHxWr1Q86dQtW0tO19snH nH00n8mRtLlAHOUUnoiHUezIOhBGg5rwy/Rll6q7lwkcKtuHeTsIcauP60PyefUgZmjrx8Xt2 EV8HTnp1EuLNOpc02MGZ0fNy5sMkOcGasyxJBj8gJm0oxaSYghAm5wNk1z3bSdr7bYljJnODa TJGbAo2NctlwoChBN2Zd3mjCr9adRtUlapY61FaiIpUX3r1yTkhPNHAkEysdpXuILTXkMzVgH h2e4EBSm3cCG6bYntH+Z7usIKAtR8PDHqeLXu4Bc/7EKz41cb6ZfE0Hs4oK6CEuOrk2QWDPKG jmppkthXpd0xA6hgxoRhtXh10mkYiUlCL7iW/nVXg819vznoIT5zTLRsmOgjTtY9YFkH+u2oF 027F+dOUmHH0ZZchGkniU5YzfJtVYAxFL1XXS7w6VTFROBebVFFj1KZU8vY00wqtD1ou9vGwL QVTNUw2Iu9tfqM7+JrOv/LtWEmWEqEFVTK7rZb352UlTE5GhIQoqwQkwvT/Yev1fkbZJig6BO PhBb5vC+ht73DJjEjVaHMaw3O6k7JssqAvdtS1YPf8Z1+BYUqE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.12 Subject: [Qemu-devel] [PATCH v2] intel-iommu: Accept 64-bit writes to FEADDR 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: "Lloret, Luis" , qemu-devel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Jan Kiszka Xen is doing this [1] and currently triggers an abort. [1] http://xenbits.xenproject.org/gitweb/?p=xen.git;a=blob;f=xen/drivers/passthrough/vtd/iommu.c;h=daaed0abbdd06b6ba3d948ea103aadf02651e83c;hb=refs/heads/master#l1108 Reported-by: Luis Lloret Signed-off-by: Jan Kiszka Reviewed-by: Peter Xu --- hw/i386/intel_iommu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 2e841cde27..fb31de9416 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2129,8 +2129,15 @@ static void vtd_mem_write(void *opaque, hwaddr addr, /* Fault Event Address Register, 32-bit */ case DMAR_FEADDR_REG: - assert(size == 4); - vtd_set_long(s, addr, val); + if (size == 4) { + vtd_set_long(s, addr, val); + } else { + /* + * While the register is 32-bit only, some guests (Xen...) write to + * it with 64-bit. + */ + vtd_set_quad(s, addr, val); + } break; /* Fault Event Upper Address Register, 32-bit */