|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] nested VMX: fix I/O port exit emulation
>>> On 04.12.13 at 09:07, "Zhang, Yang Z" <yang.z.zhang@xxxxxxxxx> wrote:
> Jan Beulich wrote on 2013-12-04:
>>>>> On 04.12.13 at 02:51, "Zhang, Yang Z" <yang.z.zhang@xxxxxxxxx> wrote:
>>> Jan Beulich wrote on 2013-12-03:
>>>> @@ -2220,15 +2219,23 @@ int nvmx_n2_vmexit_handler(struct cpu_us
>>>> if ( ctrl & CPU_BASED_ACTIVATE_IO_BITMAP )
>>>> {
>>>> unsigned long qual;
>>>> - u16 port;
>>>> + u16 port, size;
>>>>
>>>> __vmread(EXIT_QUALIFICATION, &qual);
>>>> port = qual >> 16;
>>>> - bitmap = nvmx->iobitmap[port >> 15];
>>>> - if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 0x7)) )
>>>> - nvcpu->nv_vmexit_pending = 1;
>>>> + size = (qual & 7) + 1;
>>>> + do {
>>>> + const u8 *bitmap = nvmx->iobitmap[port >> 15];
>>>> +
>>>> + if ( bitmap[(port & 0x7fff) >> 3] & (1 << (port & 7)) )
>>>> + nvcpu->nv_vmexit_pending = 1;
>>>> + if ( !--size )
>>>> + break;
>>>> + if ( !++port )
>>>> + nvcpu->nv_vmexit_pending = 1;
>>>
>>> If port overflow, will it cause vmexit or maybe other fault like GP
>>> or just be ignored?
>>
>> The documentation is explicit here: It causes a VM exit. And hence the
>> emulation is doing so too.
>
> Ok. BTW, which chapter tells this? I didn't find the corresponding chapter
> in Intel SDM. :(
"25.1.3 Instructions That Cause VM Exits Conditionally" says
"â IN, INS/INSB/INSW/INSD, OUT, OUTS/OUTSB/OUTSW/OUTSD. The behavior of each of
these instructions
is determined by the settings of the âunconditional I/O exitingâ and âuse I/O
bitmapsâ VM-execution
controls:
â If both controls are 0, the instruction executes normally.
â If the âunconditional I/O exitingâ VM-execution control is 1 and the âuse I/O
bitmapsâ VM-execution
control
is 0, the instruction causes a VM exit.
â If the âuse I/O bitmapsâ VM-execution control is 1, the instruction causes a
VM exit if it attempts to access
an I/O port corresponding to a bit set to 1 in the appropriate I/O bitmap (see
Section 24.6.4). If an I/O
operation âwraps aroundâ the 16-bit I/O-port space (accesses ports FFFFH and
0000H), the I/O instruction
causes a VM exit (the âunconditional I/O exitingâ VM-execution control is
ignored if the âuse I/O bitmapsâ
VM-execution control is 1)."
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |