Skip to contentSkip to conversation

ioreq-server: handle the lack of a default emulator properly

PATCH In review Paul Durrant 3 participants 13 messages Sep 30, 2014 – Oct 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ioreq-server: handle the lack of a default emulator properly

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +32 -3
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
+                uint32_t data = ~0;
+
+                for ( i = 0; i < p->count; i++ )
+                    hvm_copy_to_guest_phys(p->data + step * i, &data,
+                                           p->size);
+            }
+        }
+        /* FALLTHRU */
+    default:
+        p->state = STATE_IORESP_READY;
+        hvm_io_assist(p);
+        break;
+    }
+
+    return 1;
+}
+
 bool_t hvm_send_assist_req(ioreq_t *p)
 {
     struct hvm_ioreq_server *s = hvm_select_ioreq_server(current->domain, p);
 
     if ( !s )
-        return 0;
+        return hvm_complete_assist_req(p);
 
     return hvm_send_assist_req_to_ioreq_server(s, p);
 }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

Quoted 8 lines

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 24 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +1 -2
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2632

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;

'i' must be unsigned or larger, given p->count being uint32_t.

~Andrew

Quoted 27 lines
xen/arch/x86/hvm/hvm.c +18 -1
+                uint32_t data = ~0;
+
+                for ( i = 0; i < p->count; i++ )
+                    hvm_copy_to_guest_phys(p->data + step * i, &data,
+                                           p->size);
+            }
+        }
+        /* FALLTHRU */
+    default:
+        p->state = STATE_IORESP_READY;
+        hvm_io_assist(p);
+        break;
+    }
+
+    return 1;
+}
+
 bool_t hvm_send_assist_req(ioreq_t *p)
 {
     struct hvm_ioreq_server *s = hvm_select_ioreq_server(current->domain, p);
 
     if ( !s )
-        return 0;
+        return hvm_complete_assist_req(p);
 
     return hvm_send_assist_req_to_ioreq_server(s, p);
 }
#2 lore raw
Quoted 47 lines · Andrew Cooper
Quoted 6 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

Quoted 8 lines

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 27 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +1 -2
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,
     return 0;
 }
 
Quoted 4 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3 -0
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Hmm - I am not sure where the space following -> appeared from, but I meant "( p->type )". Apologies.

~Andrew

#3 lore raw
In reply to Andrew Cooper
Quoted 57 lines

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 8 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests

are

Quoted 6 lines

completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++-

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

Quoted 9 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

<Sigh> Yes, missed that one.

Quoted 11 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2632

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
Quoted 2 lines

'i' must be unsigned or larger, given p->count being uint32_t.

Theoretically true I guess, but I can't see an I/O ever having that many reps!

Paul

Quoted 31 lines

~Andrew

Quoted 28 lines
xen/arch/x86/hvm/hvm.c +18 -1
+                uint32_t data = ~0;
+
+                for ( i = 0; i < p->count; i++ )
+                    hvm_copy_to_guest_phys(p->data + step * i, &data,
+                                           p->size);
+            }
+        }
+        /* FALLTHRU */
+    default:
+        p->state = STATE_IORESP_READY;
+        hvm_io_assist(p);
+        break;
+    }
+
+    return 1;
+}
+
 bool_t hvm_send_assist_req(ioreq_t *p)
 {
     struct hvm_ioreq_server *s = hvm_select_ioreq_server(current-
 domain, p);
 
     if ( !s )
-        return 0;
+        return hvm_complete_assist_req(p);
 
     return hvm_send_assist_req_to_ioreq_server(s, p);

}

#4 lore raw
Quoted 76 lines · Paul Durrant
Quoted 56 lines

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 8 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests

are

Quoted 6 lines

completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++-

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

Quoted 8 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

<Sigh> Yes, missed that one.

Quoted 10 lines
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
Quoted 5 lines
Quoted 2 lines

'i' must be unsigned or larger, given p->count being uint32_t.

Theoretically true I guess, but I can't see an I/O ever having that many reps!

Paul

I would certainly hope not as well, but in the case that some bug somewhere else manages to set the top bit of p->count, a bounded loop is better than an unbounded loop.

~Andrew

#5 lore raw
In reply to Paul Durrant
Quoted 61 lines
Quoted 61 lines
Quoted 1 line · On 30.09.14 at 11:43, <[email protected]> wrote:

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 8 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests

are

Quoted 6 lines

completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++-

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +0 -0
     return 0;
 }
 
Quoted 8 lines
Quoted 6 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3 -0
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

<Sigh> Yes, missed that one.

And I can fix that while committing...

Jan

#6 lore raw
Quoted 82 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 30 September 2014 10:49
To: Andrew Cooper; Paul Durrant
Cc: [email protected]; Keir (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 7 lines
Quoted 7 lines
Quoted 1 line · On 30.09.14 at 11:43, <[email protected]> wrote:

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack

of a

Quoted 5 lines
Quoted 5 lines

default emulator properly

Quoted 2 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU

only

Quoted 1 line
Quoted 1 line
Quoted 1 line

registers to handle config space accesses for the PCI device it

implements

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for

the

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

case where no ioreq server matches a particular request. Read requests

are

Quoted 1 line

completed with 0xf's in the data buffer, writes and all other I/O req

types

Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35

++++++++++++++++++++++++++++++++-

Quoted 30 lines
Quoted 29 lines

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Quoted 4 lines
Quoted 1 line

<Sigh> Yes, missed that one.

And I can fix that while committing...

Ok. Thanks,

Paul

Quoted 1 line

Jan

#7 lore raw
In reply to Jan Beulich
Quoted 82 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 30 September 2014 10:49
To: Andrew Cooper; Paul Durrant
Cc: [email protected]; Keir (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 7 lines
Quoted 7 lines
Quoted 1 line · On 30.09.14 at 11:43, <[email protected]> wrote:

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack

of a

Quoted 5 lines
Quoted 5 lines

default emulator properly

Quoted 2 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU

only

Quoted 1 line
Quoted 1 line
Quoted 1 line

registers to handle config space accesses for the PCI device it

implements

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for

the

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

case where no ioreq server matches a particular request. Read requests

are

Quoted 1 line

completed with 0xf's in the data buffer, writes and all other I/O req

types

Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35

++++++++++++++++++++++++++++++++-

Quoted 30 lines
Quoted 29 lines

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Quoted 4 lines
Quoted 1 line

<Sigh> Yes, missed that one.

And I can fix that while committing...

BTW, can I take that as an ack?

Paul

#8 lore raw
Quoted 83 lines
Quoted 83 lines
Quoted 1 line · On 02.10.14 at 11:54, <[email protected]> wrote:

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 30 September 2014 10:49
To: Andrew Cooper; Paul Durrant
Cc: [email protected]; Keir (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 7 lines
Quoted 7 lines
Quoted 1 line · On 30.09.14 at 11:43, <[email protected]> wrote:

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack

of a

Quoted 5 lines
Quoted 5 lines

default emulator properly

Quoted 2 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU

only

Quoted 1 line
Quoted 1 line
Quoted 1 line

registers to handle config space accesses for the PCI device it

implements

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

This patch introduces an I/O completion handler into the hypervisor for

the

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

case where no ioreq server matches a particular request. Read requests

are

Quoted 1 line

completed with 0xf's in the data buffer, writes and all other I/O req

types

Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35

++++++++++++++++++++++++++++++++-

Quoted 30 lines
Quoted 29 lines

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

<Sigh> Yes, missed that one.

And I can fix that while committing...

BTW, can I take that as an ack?

Sure, but is that still relevant considering that the patch got committed already?

Jan

#9 lore raw
Quoted 104 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 02 October 2014 11:28
To: Paul Durrant
Cc: Andrew Cooper; [email protected]; Keir (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack of a default emulator properly

Quoted 7 lines
Quoted 7 lines
Quoted 1 line · On 02.10.14 at 11:54, <[email protected]> wrote:

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 30 September 2014 10:49
To: Andrew Cooper; Paul Durrant
Cc: [email protected]; Keir (Xen.org)
Subject: RE: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the lack

of a

Quoted 9 lines
Quoted 9 lines

default emulator properly

Quoted 7 lines
Quoted 7 lines
Quoted 1 line · On 30.09.14 at 11:43, <[email protected]> wrote:

-----Original Message-----
From: Andrew Cooper
Sent: 30 September 2014 10:29
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH v3 for 4.5] ioreq-server: handle the

lack

Quoted 5 lines
Quoted 5 lines

of a

Quoted 4 lines
Quoted 4 lines

default emulator properly

Quoted 1 line · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit

a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

problem with PCI bus enumeration. Because, with my patches,

QEMU

Quoted 4 lines
Quoted 4 lines

only

Quoted 1 line
Quoted 1 line
Quoted 1 line

registers to handle config space accesses for the PCI device it

implements

Quoted 1 line
Quoted 1 line
Quoted 1 line

all other attempts by the guest to access 0xcfc go nowhere and this

was

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

causing the vcpu to wedge up because nothing was completing the

I/O.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

This patch introduces an I/O completion handler into the hypervisor

for

Quoted 2 lines
Quoted 2 lines

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

case where no ioreq server matches a particular request. Read

requests

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

are

Quoted 1 line

completed with 0xf's in the data buffer, writes and all other I/O req

types

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

are ignored.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message

concerning

Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines

the removal of list_is_singular().

Quoted 7 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35

++++++++++++++++++++++++++++++++-

Quoted 9 lines
Quoted 9 lines

--

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 7 lines
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server

*hvm_select_ioreq_server(struct domain *d,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,

Quoted 5 lines
xen/arch/x86/hvm/hvm.c +0 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type !=

IOREQ_TYPE_PIO) )

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server · line 2389

Quoted 1 line
xen/arch/x86/hvm/hvm.c +1 -0
+    if ( p->type != IOREQ_TYPE_COPY && p->type !=

IOREQ_TYPE_PIO )

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 5 lines

xen/arch/x86/hvm/hvm.c bool_t

Quoted 4 lines
xen/arch/x86/hvm/hvm.c +0 -0
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t

hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,

Quoted 9 lines

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

<Sigh> Yes, missed that one.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

And I can fix that while committing...

BTW, can I take that as an ack?

Sure, but is that still relevant considering that the patch got committed already?

Ok, that's fine then :-) I just pulled staging and didn't see it. I'll check again.

Paul

Quoted 1 line

Jan

#10 lore raw
In reply to Andrew Cooper
Quoted 68 lines
Quoted 1 line
Quoted 1 line · On 30.09.14 at 11:29, <[email protected]> wrote:
Quoted 6 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

Quoted 8 lines

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 14 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server 

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct 

hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2632

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
Quoted 1 line

'i' must be unsigned or larger, given p->count being uint32_t.

No (or else similar changes would be needed elsewhere) - the field being uint32_t doesn't imply the full value range to be used. This is an ioreq_t, which we fill ourselves. Remember the code I pointed you to yesterday? The correctness of the above follows from similar implications afaict.

Jan

#11 lore raw
Quoted 65 lines · Jan Beulich
Quoted 65 lines
Quoted 1 line
Quoted 1 line · On 30.09.14 at 11:29, <[email protected]> wrote:
Quoted 6 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

Quoted 8 lines

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 14 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server 

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct 

hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
Quoted 9 lines
Quoted 1 line

'i' must be unsigned or larger, given p->count being uint32_t.

No (or else similar changes would be needed elsewhere) - the field being uint32_t doesn't imply the full value range to be used. This is an ioreq_t, which we fill ourselves. Remember the code I pointed you to yesterday? The correctness of the above follows from similar implications afaict.

Jan

It is a matter of defensive coding. Just because we do not expect p->size * p->count to be greater than a page doesn't mean that some bug wont cause it to happen.

At this point, the different between a signed and unsigned i is a bounded or unbounded loop.

~Andrew

#12 lore raw
Quoted 74 lines
Quoted 1 line
Quoted 1 line · On 30.09.14 at 11:52, <[email protected]> wrote:
Quoted 65 lines · Jan Beulich
Quoted 65 lines
Quoted 1 line
Quoted 1 line · On 30.09.14 at 11:29, <[email protected]> wrote:
Quoted 6 lines · Paul Durrant

I started porting QEMU over to use the new ioreq server API and hit a problem with PCI bus enumeration. Because, with my patches, QEMU only registers to handle config space accesses for the PCI device it implements all other attempts by the guest to access 0xcfc go nowhere and this was causing the vcpu to wedge up because nothing was completing the I/O.

Quoted 8 lines

This patch introduces an I/O completion handler into the hypervisor for the case where no ioreq server matches a particular request. Read requests are completed with 0xf's in the data buffer, writes and all other I/O req types are ignored.

Cc Keir Fraser <[email protected]>
Cc Jan Beulich <[email protected]>

One bug, couple of nits.

It is probably worth having a sentence in the commit message concerning the removal of list_is_singular().

xen/arch/x86/hvm/hvm.c static struct hvm_ioreq_server

Quoted 14 lines

---
v3: - Fix for backwards string instruction emulation

v2: - First non-RFC submission
- Removed warning on unemulated MMIO accesses

 xen/arch/x86/hvm/hvm.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/hvm.c +0 -0
index 5c7e0a4..e6611ed 100644
@@ -2386,8 +2386,7 @@ static struct hvm_ioreq_server 

*hvm_select_ioreq_server(struct domain *d,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +1 -2
     if ( list_empty(&d->arch.hvm_domain.ioreq_server.list) )
         return NULL;
 
-    if ( list_is_singular(&d->arch.hvm_domain.ioreq_server.list) ||
-         (p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO) )
+    if ( p->type != IOREQ_TYPE_COPY && p->type != IOREQ_TYPE_PIO )
         return d->arch.hvm_domain.default_ioreq_server;
 
     cf8 = d->arch.hvm_domain.pci_cf8;
@@ -2618,12 +2617,42 @@ bool_t hvm_send_assist_req_to_ioreq_server(struct 

hvm_ioreq_server *s,

xen/arch/x86/hvm/hvm.c bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s, · line 2622

Quoted 6 lines
xen/arch/x86/hvm/hvm.c +3 -0
     return 0;
 }
 
+static bool_t hvm_complete_assist_req(ioreq_t *p)
+{
+    switch (p->type)

Style: ( p-> type )

Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10 -0
+    {
+    case IOREQ_TYPE_COPY:
+    case IOREQ_TYPE_PIO:
+        if ( p->dir == IOREQ_READ )
+        {
+            if ( !p->data_is_ptr )
+                p->data = ~0ul;
+            else
+            {
+                int i, step = p->df ? -p->size : p->size;
Quoted 6 lines
Quoted 1 line

'i' must be unsigned or larger, given p->count being uint32_t.

No (or else similar changes would be needed elsewhere) - the field being uint32_t doesn't imply the full value range to be used. This is an ioreq_t, which we fill ourselves. Remember the code I pointed you to yesterday? The correctness of the above follows from similar implications afaict.

Quoted 6 lines

It is a matter of defensive coding. Just because we do not expect p->size * p->count to be greater than a page doesn't mean that some bug wont cause it to happen.

At this point, the different between a signed and unsigned i is a bounded or unbounded loop.

Again - if you strongly feel about this, submit a patch to fix it everywhere. When I fixed the backward string ops here, I did consider what you refer to above but in the end didn't think it was worth forcing the compiled code to grow (due to added REX prefixes) for no real reason.

Jan