From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: Corner cases of I/O bitmap Date: Tue, 3 Sep 2013 14:48:57 +0300 Message-ID: <20130903114857.GC22899@redhat.com> References: <20130903111912.GA22899@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=cp1255 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm , Paolo Bonzini , Jan Kiszka To: Arthur Chunqi Li Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12321 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932597Ab3ICLs7 convert rfc822-to-8bit (ORCPT ); Tue, 3 Sep 2013 07:48:59 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Sep 03, 2013 at 07:45:47PM +0800, Arthur Chunqi Li wrote: > On Tue, Sep 3, 2013 at 7:19 PM, Gleb Natapov wrote: > > On Mon, Aug 12, 2013 at 08:35:57PM +0800, Arthur Chunqi Li wrote: > >> Hi Gleb and Paolo, > >> There are some corner cases when testing I/O bitmaps, and I don't = know > >> the exact action of HW. > >> > > A little bit late but... > A little earlier mail, but you are warming up quickly, maybe it's a > tough time in the past week ;) > > > >> 1. If we set bit of 0x4000 in bitmap and call inl(0x3FFFF) or > >> inl(0x4000) in guest, what will get of exit information? > >> > > Spec says; > > execution of an I/O instruction causes a VM exit if any bit in the = I/O > > bitmaps corresponding to a port it accesses is 1. Note "any" here. = The > > exit will have address that instruction used, otherwise how can we = be > > able to emulate it properly. > > > >> 2. What will we get when calling inl(0xFFFF) in guest with/without > >> =93unconditional I/O exiting=94 VM-execution control and =93use I/= O bitmaps=94 > >> VM-execution control? > > In other words are you asking what happens if you do inl(0xFFFF) on= real > > HW? > > > > "The result of an attempt to address beyond the I/O address space l= imit of > > FFFFH is implementation-specific" > > > >> > >> I test the two cases in nested env. For the first one, I got norma= l > >> exit if any of the port accessed is masked in bitmap. For the seco= nd, > >> it will acts the same as other ports. And the SDM says "If an I/O > >> operation =93wraps around=94 the 16-bit I/O-port space (accesses p= orts > >> FFFFH and 0000H), the I/O instruction causes a VM exit." I cannot = find > >> the exact reaction of this case. > > What do you mean by "exact reaction"? > As to my understanding, any "wrap around" access to 0xFFFF will cause > VM exit even though mask of 0xFFFF is not set, but this is only my > guess. I cannot get what inl(0xFFFF) will result described in SDM. Bu= t > as what you said above, we do not need to test inl(0xFFFF) because we > are not expected to get a determined result. >=20 Implementation-specific behaviour is only for what happens on real HW. In non root operation spec says VM exit should happen and we should tes= t for that. -- Gleb.