From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH] KVM: nSVM: Fix IOIO size reported on emulation Date: Mon, 30 Jun 2014 11:07:05 +0200 Message-ID: <53B128B9.1030205@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cHrpoFLnUx7ppFuJr0IW4uclNfpjvDUWF" Cc: Joerg Roedel , Valentine Sinitsyn To: Paolo Bonzini , kvm Return-path: Received: from mout.web.de ([212.227.17.12]:60060 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753017AbaF3JHS (ORCPT ); Mon, 30 Jun 2014 05:07:18 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cHrpoFLnUx7ppFuJr0IW4uclNfpjvDUWF Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable From: Jan Kiszka The access size of an in/ins is reported in dst_bytes, and that of out/outs in src_bytes. Signed-off-by: Jan Kiszka --- I'm seeing one more issue now: on emulation of "in (%dx),%eax", we leave to user space several times and check interception also several times after returning. We use dx to calculate the port number for the interception check. But at some point, user space (QEMU) decides to update that register during vmport access - and now we check the wrong port in the bitmap (namely port 0). Ideas? In general, the same interception checks are done multiple times. Once after the exit, then again during emulation. Can't we avoid this somehow?= arch/x86/kvm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3483ac9..1824949 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -4261,9 +4261,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcp= u, if (info->intercept =3D=3D x86_intercept_in || info->intercept =3D=3D x86_intercept_ins) { exit_info |=3D SVM_IOIO_TYPE_MASK; - bytes =3D info->src_bytes; - } else { bytes =3D info->dst_bytes; + } else { + bytes =3D info->src_bytes; } =20 if (info->intercept =3D=3D x86_intercept_outs || --=20 1.8.4.5 --cHrpoFLnUx7ppFuJr0IW4uclNfpjvDUWF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlOxKLkACgkQitSsb3rl5xTWvgCePLLo/139zBG3AkgAUJzeGkIh Y5EAn1M0Bcz+1Yp7ni8FrOYFLhDhDbrv =cFDy -----END PGP SIGNATURE----- --cHrpoFLnUx7ppFuJr0IW4uclNfpjvDUWF--