* [Qemu-devel] [PATCH] pvusb: set max grants only in initialise
@ 2018-12-06 13:39 Juergen Gross
2018-12-10 13:14 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Juergen Gross @ 2018-12-06 13:39 UTC (permalink / raw)
To: qemu-devel, xen-devel; +Cc: anthony.perard, kraxel, sstabellini, Juergen Gross
Don't call xen_be_set_max_grant_refs() in usbback_alloc(), as the
gnttabdev pointer won't be initialised yet. The call can easily be
moved to usbback_connect().
Signed-off-by: Juergen Gross <jgross@suse.com>
---
hw/usb/xen-usb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 5b2e21ed18..f5d5c91094 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -860,10 +860,14 @@ static int usbback_connect(struct XenDevice *xendev)
struct usbif_conn_sring *conn_sring;
int urb_ring_ref;
int conn_ring_ref;
- unsigned int i;
+ unsigned int i, max_grants;
TR_BUS(xendev, "start\n");
+ /* max_grants: for each request and for the rings (request and connect). */
+ max_grants = USBIF_MAX_SEGMENTS_PER_REQUEST * USB_URB_RING_SIZE + 2;
+ xen_be_set_max_grant_refs(xendev, max_grants);
+
usbif = container_of(xendev, struct usbback_info, xendev);
if (xenstore_read_fe_int(xendev, "urb-ring-ref", &urb_ring_ref)) {
@@ -1005,7 +1009,7 @@ static void usbback_alloc(struct XenDevice *xendev)
{
struct usbback_info *usbif;
USBPort *p;
- unsigned int i, max_grants;
+ unsigned int i;
usbif = container_of(xendev, struct usbback_info, xendev);
@@ -1021,10 +1025,6 @@ static void usbback_alloc(struct XenDevice *xendev)
QTAILQ_INIT(&usbif->req_free_q);
QSIMPLEQ_INIT(&usbif->hotplug_q);
usbif->bh = qemu_bh_new(usbback_bh, usbif);
-
- /* max_grants: for each request and for the rings (request and connect). */
- max_grants = USBIF_MAX_SEGMENTS_PER_REQUEST * USB_URB_RING_SIZE + 2;
- xen_be_set_max_grant_refs(xendev, max_grants);
}
static int usbback_free(struct XenDevice *xendev)
--
2.16.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] pvusb: set max grants only in initialise
2018-12-06 13:39 [Qemu-devel] [PATCH] pvusb: set max grants only in initialise Juergen Gross
@ 2018-12-10 13:14 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2018-12-10 13:14 UTC (permalink / raw)
To: Juergen Gross; +Cc: qemu-devel, xen-devel, anthony.perard, sstabellini
On Thu, Dec 06, 2018 at 02:39:23PM +0100, Juergen Gross wrote:
> Don't call xen_be_set_max_grant_refs() in usbback_alloc(), as the
> gnttabdev pointer won't be initialised yet. The call can easily be
> moved to usbback_connect().
Added to usb queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-10 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06 13:39 [Qemu-devel] [PATCH] pvusb: set max grants only in initialise Juergen Gross
2018-12-10 13:14 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).