From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831389; cv=none; d=zohomail.com; s=zohoarc; b=M1kDQtcKuBOFhLRBQEAA11Lt4mjPudgcLzlcgmK4P/eG6iBuijl59qcjro7cvCzX+HdRjD9PjuSfakcpgoWN3icRasYFf1EhfyeUyJlznr0zqg6S80md3BZI8grZudqHRt+2oJmRyC3gVrelDtn6vuckkYChqFwmjzPcph7J0AA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831389; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VfBRUwqCiQv4p1UR7m5zW9f9shYxpP7YYg6Wfun0ZnE=; b=CxD7rIZqa/wApf/9rDpHm6Gh6tNngXg9DqVvW4F/M5JNlZvKXj01KmbIyuhnyjtc0SVsaWjQ6bjCscSV0ZJbloX7k7oURJ9K7J5qbKIpMjc4csFO5VNT5qp1C4SBfG3KdBLVCp8lbxTC091tAfbEYfzYSkt01iQQrTxKUi1ZENA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615831389471168.13816384504014; Mon, 15 Mar 2021 11:03:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-DuXK4V-sOcevu-3PhrW2OA-1; Mon, 15 Mar 2021 14:03:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DEB581431F; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03EFA1F050; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B7B3057DC4; Mon, 15 Mar 2021 18:02:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2oNc007488 for ; Mon, 15 Mar 2021 14:02:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6409517C53; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1E545D9C0; Mon, 15 Mar 2021 18:02:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0EE9E1800636; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831388; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VfBRUwqCiQv4p1UR7m5zW9f9shYxpP7YYg6Wfun0ZnE=; b=M+AluzAiTBFApdjp02+gyEEquhfHle/ZbDJpGX4aC+HcP1JQIYUVX7vMdcBQGhwesohi+6 fL34NrVbjS84m4ERK9vvi1UM6orPab7rbw7lBOxZDrLAiBwFylELiTACyPqAy2qYiYbVff +CIxnVIXsSfEmost9KXOmdXKzZqzSyY= X-MC-Unique: DuXK4V-sOcevu-3PhrW2OA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 01/13] hw/usb/bus: Remove the "full-path" property Date: Mon, 15 Mar 2021 19:02:28 +0100 Message-Id: <20210315180240.1597240-2-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Thomas Huth This property was only required for the pc-1.0 and earlier machine types. Since these have been removed now, we can delete the property as well. Signed-off-by: Thomas Huth Message-Id: <20210302120152.118042-1-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- include/hw/usb.h | 1 - hw/usb/bus.c | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index abfbfc5284c2..9f42394efaea 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -216,7 +216,6 @@ struct USBEndpoint { }; =20 enum USBDeviceFlags { - USB_DEV_FLAG_FULL_PATH, USB_DEV_FLAG_IS_HOST, USB_DEV_FLAG_MSOS_DESC_ENABLE, USB_DEV_FLAG_MSOS_DESC_IN_USE, diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 064f94e9c3cc..df7411fea8e4 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -19,8 +19,6 @@ static void usb_qdev_unrealize(DeviceState *qdev); static Property usb_props[] =3D { DEFINE_PROP_STRING("port", USBDevice, port_path), DEFINE_PROP_STRING("serial", USBDevice, serial), - DEFINE_PROP_BIT("full-path", USBDevice, flags, - USB_DEV_FLAG_FULL_PATH, true), DEFINE_PROP_BIT("msos-desc", USBDevice, flags, USB_DEV_FLAG_MSOS_DESC_ENABLE, true), DEFINE_PROP_STRING("pcap", USBDevice, pcap_filename), @@ -596,11 +594,8 @@ static char *usb_get_dev_path(DeviceState *qdev) { USBDevice *dev =3D USB_DEVICE(qdev); DeviceState *hcd =3D qdev->parent_bus->parent; - char *id =3D NULL; + char *id =3D qdev_get_dev_path(hcd); =20 - if (dev->flags & (1 << USB_DEV_FLAG_FULL_PATH)) { - id =3D qdev_get_dev_path(hcd); - } if (id) { char *ret =3D g_strdup_printf("%s/%s", id, dev->port->path); g_free(id); --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831382; cv=none; d=zohomail.com; s=zohoarc; b=ck4aI4kFznNUY9uyD0X2RSZAtcK2wRz3J/U+de0SQXLONxfuxKZRxHR0eda0j0tB0NzOy7hQR8O5GTb3J+9oM6rrr3CmGQhG6m7iNEH1/JkKuhPU2n9t/lhlhFrv+RdHYUucRo+p+cfWGc8tugo1Gt78OdW8G4C0UBNYeUFoFi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aA1OmuGwGeb5S9GO0UwDSwAHfUVsIWifVjYQl8QB5Rc=; b=jfC4oUODBZtBOzHUjVHyzTCHoAjVedsZ60zhgyCcNLDNz4JA2UgkJpQ0VoWsBIglkpC47f22m1K1jwbV8iTF7Hh9N6eCLViKjRu1S3rUB8NCmpPoTIj9WB9L21um2xeZP9waqqbYPBuwr+j9s7QYw9OBz/soUw4u8lbdz8DuzFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831382335431.237229823833; Mon, 15 Mar 2021 11:03:02 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-559-q6qxCXfbOxqcI0O5N_GJfA-1; Mon, 15 Mar 2021 14:02:58 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F73C1015C8A; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF7B61045E83; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5B39018155DE; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2nVN007468 for ; Mon, 15 Mar 2021 14:02:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DF1D19EF2; Mon, 15 Mar 2021 18:02:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1468620DE; Mon, 15 Mar 2021 18:02:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1DC7C1800637; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831381; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aA1OmuGwGeb5S9GO0UwDSwAHfUVsIWifVjYQl8QB5Rc=; b=Vgc+S1gE4hpn3jI4K73B7nwzpn6JzOqN5jt9GRabsyhp7tBcLr+o8lQ9KM+KpB+LTJwdQg x4ZnpcTwTnNKwhzRpyRpzsX/OiIO6liczIjOBRDESk5OdqEhIN0yyxsB3XwUaChTgSPVvm SHQPwUhN4/aUWaK9JnDtrO0hg+zwV7Q= X-MC-Unique: q6qxCXfbOxqcI0O5N_GJfA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 02/13] usb: remove support for -usbdevice parameters Date: Mon, 15 Mar 2021 19:02:29 +0100 Message-Id: <20210315180240.1597240-3-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini No device needs them anymore and in fact they're undocumented. Remove the code. The only change in behavior is that "-usbdevice braille:hello" now reports an error, which is a bugfix. Signed-off-by: Paolo Bonzini Cc: Gerd Hoffmann Signed-off-by: Thomas Huth Message-Id: <20210310173323.1422754-2-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- include/hw/usb.h | 2 +- hw/usb/bus.c | 32 +++++++------------------------- hw/usb/dev-serial.c | 2 +- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index 9f42394efaea..436e07b30404 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -499,7 +499,7 @@ void usb_bus_new(USBBus *bus, size_t bus_size, void usb_bus_release(USBBus *bus); USBBus *usb_bus_find(int busnr); void usb_legacy_register(const char *typename, const char *usbdevice_name, - USBDevice *(*usbdevice_init)(const char *params)); + USBDevice *(*usbdevice_init)(void)); USBDevice *usb_new(const char *name); bool usb_realize_and_unref(USBDevice *dev, USBBus *bus, Error **errp); USBDevice *usb_create_simple(USBBus *bus, const char *name); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index df7411fea8e4..07083349f51b 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -310,13 +310,13 @@ typedef struct LegacyUSBFactory { const char *name; const char *usbdevice_name; - USBDevice *(*usbdevice_init)(const char *params); + USBDevice *(*usbdevice_init)(void); } LegacyUSBFactory; =20 static GSList *legacy_usb_factory; =20 void usb_legacy_register(const char *typename, const char *usbdevice_name, - USBDevice *(*usbdevice_init)(const char *params)) + USBDevice *(*usbdevice_init)(void)) { if (usbdevice_name) { LegacyUSBFactory *f =3D g_malloc0(sizeof(*f)); @@ -658,27 +658,17 @@ void hmp_info_usb(Monitor *mon, const QDict *qdict) } =20 /* handle legacy -usbdevice cmd line option */ -USBDevice *usbdevice_create(const char *cmdline) +USBDevice *usbdevice_create(const char *driver) { USBBus *bus =3D usb_bus_find(-1 /* any */); LegacyUSBFactory *f =3D NULL; Error *err =3D NULL; GSList *i; - char driver[32]; - const char *params; - int len; USBDevice *dev; =20 - params =3D strchr(cmdline,':'); - if (params) { - params++; - len =3D params - cmdline; - if (len > sizeof(driver)) - len =3D sizeof(driver); - pstrcpy(driver, len, cmdline); - } else { - params =3D ""; - pstrcpy(driver, sizeof(driver), cmdline); + if (strchr(driver, ':')) { + error_report("usbdevice parameters are not supported anymore"); + return NULL; } =20 for (i =3D legacy_usb_factory; i; i =3D i->next) { @@ -702,15 +692,7 @@ USBDevice *usbdevice_create(const char *cmdline) return NULL; } =20 - if (f->usbdevice_init) { - dev =3D f->usbdevice_init(params); - } else { - if (*params) { - error_report("usbdevice %s accepts no params", driver); - return NULL; - } - dev =3D usb_new(f->name); - } + dev =3D f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name); if (!dev) { error_report("Failed to create USB device '%s'", f->name); return NULL; diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index b58c4eb90822..63047d79cfd1 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -614,7 +614,7 @@ static void usb_serial_realize(USBDevice *dev, Error **= errp) s->intr =3D usb_ep_get(dev, USB_TOKEN_IN, 1); } =20 -static USBDevice *usb_braille_init(const char *unused) +static USBDevice *usb_braille_init(void) { USBDevice *dev; Chardev *cdrv; --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831395; cv=none; d=zohomail.com; s=zohoarc; b=Bvx3PdfCHpVqADdc88kO6yyPpDfRbDmypAvPpdg5JJoose+swB1sTr0JAw2G9UyNLf3TQugx0mMs9QwgwovQeV3Jjx1falRWky6M50zCUirlvMAbGM3kVhvQhjdUn62Vob1lTW/05t/1yedXASMTrqyQDtVL64vhUUg09CKQD1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831395; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ygQwWUbVHD9Tjrq5dt/JuUHJDByWcAzz9Zas95IVSQg=; b=kWOkjhwP27RuLVX0bc4S8ERmrDCkCv/JMhj5eKEM788MdjPF51DbnoGeu7ucn4iwRsizcEhwHkjiPNHLER9Ti4opiEGHyZUWDkPQ1GwXICJLPnsGYIqdpJXlp8lg2NVyCpxM3SdCSJdmvYVpr6yiE4jcAmt1Ebe0aUU2VMRCH2A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831395722145.7884483362502; Mon, 15 Mar 2021 11:03:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-U0xzlyUqPmmM-RK10HJCSA-1; Mon, 15 Mar 2021 14:03:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7EC7F108BD11; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58C425D9DC; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1613157DC6; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2nIJ007474 for ; Mon, 15 Mar 2021 14:02:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 69BE05C8B3; Mon, 15 Mar 2021 18:02:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A62015FC17; Mon, 15 Mar 2021 18:02:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 289761800638; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ygQwWUbVHD9Tjrq5dt/JuUHJDByWcAzz9Zas95IVSQg=; b=LE32ueYvUGoaP/4YZ6l5TPjZyyuL/OXy/vXXFOevR6F3RIsNXM7I0CntZN4Q8Uur4eE3Td cXgF4vOgLcPhWPev9dgY1CN0CyzlWkffDIEmsH3SBKz2Aoz+ZK8SuBgSzhRMoXyWGNUZl9 lJ/icWgNvt2L+BTQ7wQPjnGx1dth68U= X-MC-Unique: U0xzlyUqPmmM-RK10HJCSA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 03/13] usb: remove '-usbdevice u2f-key' Date: Mon, 15 Mar 2021 19:02:30 +0100 Message-Id: <20210315180240.1597240-4-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini It never worked. Signed-off-by: Paolo Bonzini Cc: Gerd Hoffmann Signed-off-by: Thomas Huth Message-Id: <20210310173323.1422754-3-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/usb/u2f.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/usb/u2f.c b/hw/usb/u2f.c index bc09191f063e..56001249a449 100644 --- a/hw/usb/u2f.c +++ b/hw/usb/u2f.c @@ -346,7 +346,6 @@ static const TypeInfo u2f_key_info =3D { static void u2f_key_register_types(void) { type_register_static(&u2f_key_info); - usb_legacy_register(TYPE_U2F_KEY, "u2f-key", NULL); } =20 type_init(u2f_key_register_types) --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831395; cv=none; d=zohomail.com; s=zohoarc; b=CLidN0cZuWy7ZvGtPj9+DOXQQgAbRIXoM8Sbp+gpOhWXq5OX72kIxkkq5Asxpn52d7aw6nqHjg2XiN9pJyYPN4VXLkwFv+GyhSYB/U7Fh/AMKFiCc2iT3UtvtnaQxsJPJCCTRSuML6gRiZ7Hi9Qg0PuRSwzHi5dj18WT1xOVeko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831395; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/uHLEGvCG1f0K3tZ2b//O9keiLqt2WcVC28SzoejUKk=; b=P/KHCOCGWUlNQFdVHCDJ5Sif+tGZPIc/xFwl3BKZI8/eishdgKl3E9wkOAvvwchhajphttZXNuyJiqZBwFxa4uqc1havu3ruFMmAa+nlrEMTn1+6sunnw3Joxc0AtTB8mfKKtelltDmiQBhZ4JuHaa08RP0A/nLrDO/WkcGW/Ic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615831395435370.86038685582025; Mon, 15 Mar 2021 11:03:15 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-442-xBpIxc5VMc-Hat4CLgLROQ-1; Mon, 15 Mar 2021 14:03:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9BF2184610D; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A02C7614F5; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5E25A1800B9A; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2nfQ007475 for ; Mon, 15 Mar 2021 14:02:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66B7C614F5; Mon, 15 Mar 2021 18:02:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A29521B49F; Mon, 15 Mar 2021 18:02:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 390F8180063C; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/uHLEGvCG1f0K3tZ2b//O9keiLqt2WcVC28SzoejUKk=; b=Nj9abHc4c3jPlzzSzFfne6evfcLchk1hsUL5XveQirWHgN/BjEFYRP3l2kG4ZYsUEGc3hW MT7St9FWq9mSECktRn0x2ZVQAqCAYusTM+yX7GLFVkIAYB/yCiXX/8Sm1Hnp8MLu2C/J9K EZEIqNsRGiaz5EfeulR9xRlULyhpaFI= X-MC-Unique: xBpIxc5VMc-Hat4CLgLROQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 04/13] usb: Un-deprecate -usbdevice (except for -usbdevice audio which gets removed) Date: Mon, 15 Mar 2021 19:02:31 +0100 Message-Id: <20210315180240.1597240-5-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Thomas Huth When trying to remove the -usbdevice option, there were complaints that "-usbdevice braille" is still a very useful shortcut for some people. Thus we never remove this option. Since it's not such a big burden to keep it around, and it's also convenient in the sense that you don't have to worry to enable a host controller explicitly with this option, we should remove it from he deprecation list again. However, there is one exception: "-usbdevice audio" should go away, since audio devices without "audiodev=3D..." parameter are also on the deprecation list and you cannot use "-usbdevice audio" with "audiodev". Signed-off-by: Thomas Huth Message-Id: <20210310173323.1422754-4-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/usb/dev-audio.c | 1 - softmmu/vl.c | 2 -- docs/system/deprecated.rst | 9 --------- docs/system/removed-features.rst | 8 ++++++++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index e1486f81e06b..f5cb2467929a 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -1024,7 +1024,6 @@ static const TypeInfo usb_audio_info =3D { static void usb_audio_register_types(void) { type_register_static(&usb_audio_info); - usb_legacy_register(TYPE_USB_AUDIO, "audio", NULL); } =20 type_init(usb_audio_register_types) diff --git a/softmmu/vl.c b/softmmu/vl.c index b7673b96134d..a750dae6b1ef 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3180,8 +3180,6 @@ void qemu_init(int argc, char **argv, char **envp) qemu_opts_parse_noisily(olist, "usb=3Don", false); break; case QEMU_OPTION_usbdevice: - error_report("'-usbdevice' is deprecated, please use " - "'-device usb-...' instead"); olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "usb=3Don", false); add_device_config(DEV_USB, optarg); diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 5e3a31c12361..62a64a8c41e1 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -21,15 +21,6 @@ deprecated. System emulator command line arguments -------------------------------------- =20 -``-usbdevice`` (since 2.10.0) -''''''''''''''''''''''''''''' - -The ``-usbdevice DEV`` argument is now a synonym for setting -the ``-device usb-DEV`` argument instead. The deprecated syntax -would automatically enable USB support on the machine type. -If using the new syntax, USB support must be explicitly -enabled via the ``-machine usb=3Don`` argument. - ``-drive file=3Djson:{...{'driver':'file'}}`` (since 3.0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/system/removed-features.rst b/docs/system/removed-feature= s.rst index 83148dcfda6a..82e7fcc51715 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -38,6 +38,14 @@ or ``-display default,show-cursor=3Don`` instead. QEMU 5.0 introduced an alternative syntax to specify the size of the trans= lation block cache, ``-accel tcg,tb-size=3D``. =20 +``-usbdevice audio`` (removed in 6.0) +''''''''''''''''''''''''''''''''''''' + +This option lacked the possibility to specify an audio backend device. +Use ``-device usb-audio`` now instead (and specify a corresponding USB +host controller or ``-usb`` if necessary). + + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831456; cv=none; d=zohomail.com; s=zohoarc; b=SRP+wmY2vsQfhTg56UklTGHacYVSQNmZJ6Lkfu/y5meTI63yni281gXhbskFE2NZIOnIYiOufpWUtpzEDdh/x4HdBh81uObQQ3CtEa+rpUEoNyKKKuIuNKff7uMrez+4LxDevE/PfliWuQGenJzK+aibvVVe3PRSoV5wI+AXmLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831456; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=huqkUy18l+tgvGXoVwJB415sdhmTp4pcSpPxpRgc3QQ=; b=gbHJUq+Z9/HjXAPg20CkcEm8yUpIwVt6iORFnWpxv/QJWLWJfhvK/gnUfy+iCcQ8lsPGa/p0C1b7XngfDU2j8HSb7PWu1SPBtVOC9IQSRf+Eyg1ppW4lwvHp4M50AZhuf3kqJKf/92yTGO0+GOfTOS4Pu2KRocoA5g0Cj30rYMs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615831456178539.9475304341161; Mon, 15 Mar 2021 11:04:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-473-SWgMpBFAM0CeykLSnNsq3A-1; Mon, 15 Mar 2021 14:03:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F2CF8018A2; Mon, 15 Mar 2021 18:03:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3A0710023AB; Mon, 15 Mar 2021 18:03:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8E38E1800B9B; Mon, 15 Mar 2021 18:03:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2vtw007589 for ; Mon, 15 Mar 2021 14:02:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id A61D062692; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C17045D755; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 44010180063D; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831455; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=huqkUy18l+tgvGXoVwJB415sdhmTp4pcSpPxpRgc3QQ=; b=XuSig7Kg9a6MDHnXlflmNFiLNwezEA7F9x4l/Dk2R1osjFLZ5te4xmyApkdHIJlnT9T/Xg sJM2nhx3XaO58GvIyN8cNgOFJExcbD/NFTifUNt1YmrOU9UnKWS8sGFS3BgovX/9brVV3G Q/T+KgPpJ0l4GIcYnC3b2ZvSdr82ZKo= X-MC-Unique: SWgMpBFAM0CeykLSnNsq3A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 05/13] usb: Document the missing -usbdevice options Date: Mon, 15 Mar 2021 19:02:32 +0100 Message-Id: <20210315180240.1597240-6-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Thomas Huth , libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Thomas Huth There are some more -usbdevice options that have never been mentioned in the documentation. Now that we removed -usbdevice from the list of deprecated features again, we should document them properly. While we're at it, also sort them alphabetically. Signed-off-by: Thomas Huth Message-Id: <20210310173323.1422754-5-thuth@redhat.com> Signed-off-by: Gerd Hoffmann --- qemu-options.hx | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/qemu-options.hx b/qemu-options.hx index 622d3bfa5a7d..fe83ea09b25e 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1705,7 +1705,7 @@ ERST =20 DEFHEADING() =20 -DEFHEADING(USB options:) +DEFHEADING(USB convenience options:) =20 DEF("usb", 0, QEMU_OPTION_usb, "-usb enable on-board USB host controller (if not enabled b= y default)\n", @@ -1723,9 +1723,31 @@ DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice, QEMU_ARCH_ALL) SRST ``-usbdevice devname`` - Add the USB device devname. Note that this option is deprecated, - please use ``-device usb-...`` instead. See the chapter about + Add the USB device devname, and enable an on-board USB controller + if possible and necessary (just like it can be done via + ``-machine usb=3Don``). Note that this option is mainly intended for + the user's convenience only. More fine-grained control can be + achieved by selecting a USB host controller (if necessary) and the + desired USB device via the ``-device`` option instead. For example, + instead of using ``-usbdevice mouse`` it is possible to use + ``-device qemu-xhci -device usb-mouse`` to connect the USB mouse + to a USB 3.0 controller instead (at least on machines that support + PCI and do not have an USB controller enabled by default yet). + For more details, see the chapter about :ref:`Connecting USB devices` in the System Emulation Users Guide. + Possible devices for devname are: + + ``braille`` + Braille device. This will use BrlAPI to display the braille + output on a real or fake device (i.e. it also creates a + corresponding ``braille`` chardev automatically beside the + ``usb-braille`` USB device). + + ``ccid`` + Smartcard reader device + + ``keyboard`` + Standard USB keyboard. Will override the PS/2 keyboard (if present= ). =20 ``mouse`` Virtual Mouse. This will override the PS/2 mouse emulation when @@ -1737,9 +1759,10 @@ SRST position without having to grab the mouse. Also overrides the PS/2 mouse emulation when activated. =20 - ``braille`` - Braille device. This will use BrlAPI to display the braille - output on a real or fake device. + ``wacom-tablet`` + Wacom PenPartner USB tablet. + + ERST =20 DEFHEADING() --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831397; cv=none; d=zohomail.com; s=zohoarc; b=ZkDQhAej5RPpGSjSNk4w0G6QYVhWBB3y6o9HQ8SvXA2sqKxtsvn4Pv3Y3JlgQUW6Kep6N+kseSEq3GL8vag88aoR7yVhYsesMNG+tfz0m88J3XB0jd6ibuM7TqYvuUGQedQ7znvfxogK5Yn/RgB7tdE55YozEqF1cdVL39VDN3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831397; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y3BP8S1xbszljfPp+4vCq5/+Fv9XvvK8lpAPToA1Fu8=; b=I/9L/+8OvUnxCqehcJy9TTs39lDrip/1jp6yyeDHN/GZe7z4QMhCZDhP7r562J13LqFP4djJ7/P3b8jQTzApRBejQj1/sK3cz4KIQPDrcKG5EwqDuJ+kiW2IzRl5EUz7CBDzAvVJMATzmuxJkiNnVgBbxSJEcj36OtMrUONXeJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615831397026223.33311819731853; Mon, 15 Mar 2021 11:03:17 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-L6pUuqb-NgGDLMfMu6OQrA-1; Mon, 15 Mar 2021 14:03:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F498817472; Mon, 15 Mar 2021 18:03:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08B0A5D762; Mon, 15 Mar 2021 18:03:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B1F0A57DC9; Mon, 15 Mar 2021 18:03:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2pRS007512 for ; Mon, 15 Mar 2021 14:02:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7FC2017C53; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C24F95D9C0; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4E559180063F; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831396; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y3BP8S1xbszljfPp+4vCq5/+Fv9XvvK8lpAPToA1Fu8=; b=Jsccrrlln8BVVTrUhFbtOkj93mPAAnn6KXlpUZmZxPjlgpg36iR0XEVxG3Z8Te3ahjlp2o NiS9vGMo/CacUUW+putjuw0aK12dRzndEQVrd8RndLurBiznMEOM9gBxfJDBT5LnsPkcgx ikWTGe4whr14G2vcv3A+vuS9tQAwJ/Y= X-MC-Unique: L6pUuqb-NgGDLMfMu6OQrA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 06/13] hw/southbridge: Add missing Kconfig dependency VT82C686 on USB_UHCI Date: Mon, 15 Mar 2021 19:02:33 +0100 Message-Id: <20210315180240.1597240-7-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , BALATON Zoltan , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 The VT82C686 south bridge provides a USB UHCI bus via a PCI function. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: BALATON Zoltan Message-Id: <20210309190802.830969-2-f4bug@amsat.org> Signed-off-by: Gerd Hoffmann --- hw/isa/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/isa/Kconfig b/hw/isa/Kconfig index c7f07854f7e7..2691eae2f0c6 100644 --- a/hw/isa/Kconfig +++ b/hw/isa/Kconfig @@ -47,6 +47,7 @@ config VT82C686 select ACPI_SMBUS select SERIAL_ISA select FDC + select USB_UHCI =20 config SMC37C669 bool --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831394; cv=none; d=zohomail.com; s=zohoarc; b=R2kvog3A4q1unv/yz7+Kys1ZY19yDUOC1Bn1LcBD62eNfVyLXA2BjimeBnKtVKzxkfwsWcreT785niyEZBpVbgfBg5SUA6xgmNFR1QphSAXl2JgXLfOh2+mI/3dZmSrIVUbn0Ao9ILya2kck8JrF1i1Wjjei6zOUAxzivXLtm8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831394; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aSx+0STUj1xpHQE7GWlBP/eH2KqEI77RcRN96kq8YNc=; b=WNDXGtGQdZS4A6QhsVizq+aB32j8STnrZ5QzlobE8ZWxh5BYONwV1lk2KOcKvuGZy5DkeIfEuu+a6510IQpY7UyZMx0/HKx/DsPO6orJhnshu8erPwYkKAqmFatR2PvUXABkLJ7gzMUcaBtaEj+sCNOaKPdfxzEwo1PRkERfOt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831394742927.6664667005128; Mon, 15 Mar 2021 11:03:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-z0S-8yjbNCCrWE-3qaUYwA-1; Mon, 15 Mar 2021 14:03:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 957E318460F3; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69B7D1821A; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 22B341800B99; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2pnu007504 for ; Mon, 15 Mar 2021 14:02:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5DC5C607CB; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD3CE5DEAD; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5BC3018007BD; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831393; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aSx+0STUj1xpHQE7GWlBP/eH2KqEI77RcRN96kq8YNc=; b=CudyLzNZnXbkkowIKH/iaxEpCJnzSYRR6P4nj0ekTN2ffSwb5POXbvl5s6lvDk7LMIr/jC jSilJ62JvYopQeVuLxgjAAcDUYxzhht5EF9wgiOh+6zFbULM1niTyslFXrVuU6K+KZuJLD SSACFt4BRgHTfaoP8QHmNTX1RWoanzM= X-MC-Unique: z0S-8yjbNCCrWE-3qaUYwA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 07/13] hw/usb/hcd-uhci: Expose generic prototypes to local header Date: Mon, 15 Mar 2021 19:02:34 +0100 Message-Id: <20210315180240.1597240-8-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 Extract generic UHCI prototypes into a new "hcd-uhci.h" local header so we can reuse them in other units. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210309190802.830969-3-f4bug@amsat.org> Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-uhci.h | 93 +++++++++++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-uhci.c | 60 ++---------------------------- 2 files changed, 96 insertions(+), 57 deletions(-) create mode 100644 hw/usb/hcd-uhci.h diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h new file mode 100644 index 000000000000..e61d8fcb1921 --- /dev/null +++ b/hw/usb/hcd-uhci.h @@ -0,0 +1,93 @@ +/* + * USB UHCI controller emulation + * + * Copyright (c) 2005 Fabrice Bellard + * + * Copyright (c) 2008 Max Krasnyansky + * Magor rewrite of the UHCI data structures parser and frame processor + * Support for fully async operation and multiple outstanding transact= ions + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#ifndef HW_USB_HCD_UHCI_H +#define HW_USB_HCD_UHCI_H + +#include "exec/memory.h" +#include "qemu/timer.h" +#include "hw/pci/pci.h" +#include "hw/usb.h" + +typedef struct UHCIQueue UHCIQueue; + +#define NB_PORTS 2 + +typedef struct UHCIPort { + USBPort port; + uint16_t ctrl; +} UHCIPort; + +typedef struct UHCIState { + PCIDevice dev; + MemoryRegion io_bar; + USBBus bus; /* Note unused when we're a companion controller */ + uint16_t cmd; /* cmd register */ + uint16_t status; + uint16_t intr; /* interrupt enable register */ + uint16_t frnum; /* frame number */ + uint32_t fl_base_addr; /* frame list base address */ + uint8_t sof_timing; + uint8_t status2; /* bit 0 and 1 are used to generate UHCI_STS_USBINT */ + int64_t expire_time; + QEMUTimer *frame_timer; + QEMUBH *bh; + uint32_t frame_bytes; + uint32_t frame_bandwidth; + bool completions_only; + UHCIPort ports[NB_PORTS]; + + /* Interrupts that should be raised at the end of the current frame. = */ + uint32_t pending_int_mask; + + /* Active packets */ + QTAILQ_HEAD(, UHCIQueue) queues; + uint8_t num_ports_vmstate; + + /* Properties */ + char *masterbus; + uint32_t firstport; + uint32_t maxframes; +} UHCIState; + +#define TYPE_UHCI "pci-uhci-usb" +DECLARE_INSTANCE_CHECKER(UHCIState, UHCI, TYPE_UHCI) + +typedef struct UHCIInfo { + const char *name; + uint16_t vendor_id; + uint16_t device_id; + uint8_t revision; + uint8_t irq_pin; + void (*realize)(PCIDevice *dev, Error **errp); + bool unplug; +} UHCIInfo; + +void uhci_data_class_init(ObjectClass *klass, void *data); +void usb_uhci_common_realize(PCIDevice *dev, Error **errp); + +#endif diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 5969eb86b31b..d6338c33d863 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -40,6 +40,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qom/object.h" +#include "hcd-uhci.h" =20 #define FRAME_TIMER_FREQ 1000 =20 @@ -50,8 +51,6 @@ =20 #define MAX_FRAMES_PER_TICK (QH_VALID / 2) =20 -#define NB_PORTS 2 - enum { TD_RESULT_STOP_FRAME =3D 10, TD_RESULT_COMPLETE, @@ -62,20 +61,8 @@ enum { =20 typedef struct UHCIState UHCIState; typedef struct UHCIAsync UHCIAsync; -typedef struct UHCIQueue UHCIQueue; -typedef struct UHCIInfo UHCIInfo; typedef struct UHCIPCIDeviceClass UHCIPCIDeviceClass; =20 -struct UHCIInfo { - const char *name; - uint16_t vendor_id; - uint16_t device_id; - uint8_t revision; - uint8_t irq_pin; - void (*realize)(PCIDevice *dev, Error **errp); - bool unplug; -}; - struct UHCIPCIDeviceClass { PCIDeviceClass parent_class; UHCIInfo info; @@ -107,43 +94,6 @@ struct UHCIQueue { int8_t valid; }; =20 -typedef struct UHCIPort { - USBPort port; - uint16_t ctrl; -} UHCIPort; - -struct UHCIState { - PCIDevice dev; - MemoryRegion io_bar; - USBBus bus; /* Note unused when we're a companion controller */ - uint16_t cmd; /* cmd register */ - uint16_t status; - uint16_t intr; /* interrupt enable register */ - uint16_t frnum; /* frame number */ - uint32_t fl_base_addr; /* frame list base address */ - uint8_t sof_timing; - uint8_t status2; /* bit 0 and 1 are used to generate UHCI_STS_USBINT */ - int64_t expire_time; - QEMUTimer *frame_timer; - QEMUBH *bh; - uint32_t frame_bytes; - uint32_t frame_bandwidth; - bool completions_only; - UHCIPort ports[NB_PORTS]; - - /* Interrupts that should be raised at the end of the current frame. = */ - uint32_t pending_int_mask; - - /* Active packets */ - QTAILQ_HEAD(, UHCIQueue) queues; - uint8_t num_ports_vmstate; - - /* Properties */ - char *masterbus; - uint32_t firstport; - uint32_t maxframes; -}; - typedef struct UHCI_TD { uint32_t link; uint32_t ctrl; /* see TD_CTRL_xxx */ @@ -160,10 +110,6 @@ static void uhci_async_cancel(UHCIAsync *async); static void uhci_queue_fill(UHCIQueue *q, UHCI_TD *td); static void uhci_resume(void *opaque); =20 -#define TYPE_UHCI "pci-uhci-usb" -DECLARE_INSTANCE_CHECKER(UHCIState, UHCI, - TYPE_UHCI) - static inline int32_t uhci_queue_token(UHCI_TD *td) { if ((td->token & (0xf << 15)) =3D=3D 0) { @@ -1213,7 +1159,7 @@ static USBPortOps uhci_port_ops =3D { static USBBusOps uhci_bus_ops =3D { }; =20 -static void usb_uhci_common_realize(PCIDevice *dev, Error **errp) +void usb_uhci_common_realize(PCIDevice *dev, Error **errp) { Error *err =3D NULL; PCIDeviceClass *pc =3D PCI_DEVICE_GET_CLASS(dev); @@ -1335,7 +1281,7 @@ static const TypeInfo uhci_pci_type_info =3D { }, }; =20 -static void uhci_data_class_init(ObjectClass *klass, void *data) +void uhci_data_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831383; cv=none; d=zohomail.com; s=zohoarc; b=YECzLmNog3Rjqm1ihttbvwHFXcO71sspJ/WohtNp/oN8vA+iEAclBncLQEbdyCDXM111YRFfnOQKy1M+FrOvmyEjoWkFsqzyWPiwCt6VJyoGNx3gMz+8fz2r+r8tnFdauknk7kLHT9QR39SHT2AD2H1IVd4xhZnDZGUdd9+34Ug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831383; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MzAN2TIAtzKIQCHNs4ewubbNW0R4HXiUsBmusDUXPrg=; b=HbRs2Ej/DySe6gzduAybzqzS99bUhsPV5n0hdnGXheE+iMnqaEI9MMzXYBJLplvL0EE6WkSvHMiYXHwf4pUTFh5ksqc6kiZo9W06qlWGFyHpZWEe1u0BuQK2p5ny8g0Xa0stHGqZTn6TyU1gUM97KAlgKwLW/yUlUdFwuOyeHD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1615831383806281.1923401730015; Mon, 15 Mar 2021 11:03:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-56-BZ2z3xTQOW644pN3mTkXEg-1; Mon, 15 Mar 2021 14:02:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 46B118042C3; Mon, 15 Mar 2021 18:02:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 216A61C4; Mon, 15 Mar 2021 18:02:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D26371800B72; Mon, 15 Mar 2021 18:02:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2pq3007502 for ; Mon, 15 Mar 2021 14:02:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 53A361B49F; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC8D96060F; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6C2FE18007BE; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831382; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MzAN2TIAtzKIQCHNs4ewubbNW0R4HXiUsBmusDUXPrg=; b=Bb6X/gz5/itNALEjSztb1TvUs6Y6pT9nMTgrR660DkywEwSUFnlnXApTlQR2wqt9iI331f zpbt4/9tDqzYPKFW34bFX59wEk2NWWgjyAQztD3KafcHFy/pE7F7nOVLLP/Ca1kP9nGiDL TI+L9OZ8yBRHDzWcaRFmuHKSPKzgLYU= X-MC-Unique: BZ2z3xTQOW644pN3mTkXEg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 08/13] hw/usb: Extract VT82C686 UHCI PCI function into a new unit Date: Mon, 15 Mar 2021 19:02:35 +0100 Message-Id: <20210315180240.1597240-9-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 Extract the VT82C686 PCI UHCI function into a new unit so it is only build when the VT82C686 south bridge is selected. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210309190802.830969-4-f4bug@amsat.org> Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-uhci.c | 23 -------------------- hw/usb/vt82c686-uhci-pci.c | 43 ++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/usb/meson.build | 1 + 4 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 hw/usb/vt82c686-uhci-pci.c diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index d6338c33d863..0cb02a643214 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1207,21 +1207,6 @@ void usb_uhci_common_realize(PCIDevice *dev, Error *= *errp) pci_register_bar(&s->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); } =20 -static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp) -{ - UHCIState *s =3D UHCI(dev); - uint8_t *pci_conf =3D s->dev.config; - - /* USB misc control 1/2 */ - pci_set_long(pci_conf + 0x40,0x00001000); - /* PM capability */ - pci_set_long(pci_conf + 0x80,0x00020001); - /* USB legacy support */ - pci_set_long(pci_conf + 0xc0,0x00002000); - - usb_uhci_common_realize(dev, errp); -} - static void usb_uhci_exit(PCIDevice *dev) { UHCIState *s =3D UHCI(dev); @@ -1318,14 +1303,6 @@ static UHCIInfo uhci_info[] =3D { .revision =3D 0x01, .irq_pin =3D 3, .unplug =3D true, - },{ - .name =3D "vt82c686b-usb-uhci", - .vendor_id =3D PCI_VENDOR_ID_VIA, - .device_id =3D PCI_DEVICE_ID_VIA_UHCI, - .revision =3D 0x01, - .irq_pin =3D 3, - .realize =3D usb_uhci_vt82c686b_realize, - .unplug =3D true, },{ .name =3D "ich9-usb-uhci1", /* 00:1d.0 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, diff --git a/hw/usb/vt82c686-uhci-pci.c b/hw/usb/vt82c686-uhci-pci.c new file mode 100644 index 000000000000..b109c2160335 --- /dev/null +++ b/hw/usb/vt82c686-uhci-pci.c @@ -0,0 +1,43 @@ +#include "qemu/osdep.h" +#include "hcd-uhci.h" + +static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp) +{ + UHCIState *s =3D UHCI(dev); + uint8_t *pci_conf =3D s->dev.config; + + /* USB misc control 1/2 */ + pci_set_long(pci_conf + 0x40, 0x00001000); + /* PM capability */ + pci_set_long(pci_conf + 0x80, 0x00020001); + /* USB legacy support */ + pci_set_long(pci_conf + 0xc0, 0x00002000); + + usb_uhci_common_realize(dev, errp); +} + +static UHCIInfo uhci_info[] =3D { + { + .name =3D "vt82c686b-usb-uhci", + .vendor_id =3D PCI_VENDOR_ID_VIA, + .device_id =3D PCI_DEVICE_ID_VIA_UHCI, + .revision =3D 0x01, + .irq_pin =3D 3, + .realize =3D usb_uhci_vt82c686b_realize, + .unplug =3D true, + } +}; + +static const TypeInfo vt82c686b_usb_uhci_type_info =3D { + .parent =3D TYPE_UHCI, + .name =3D "vt82c686b-usb-uhci", + .class_init =3D uhci_data_class_init, + .class_data =3D uhci_info, +}; + +static void vt82c686b_usb_uhci_register_types(void) +{ + type_register_static(&vt82c686b_usb_uhci_type_info); +} + +type_init(vt82c686b_usb_uhci_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index 5ca3c9f851f9..b6ab3d25a751 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1180,6 +1180,7 @@ S: Odd Fixes F: hw/mips/fuloong2e.c F: hw/isa/vt82c686.c F: hw/pci-host/bonito.c +F: hw/usb/vt82c686-uhci-pci.c F: include/hw/isa/vt82c686.h =20 Loongson-3 virtual platforms diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 653192cff6fa..6e3159798e93 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -32,6 +32,7 @@ softmmu_ss.add(when: 'CONFIG_USB_DWC3', if_true: files('h= cd-dwc3.c')) softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c')) softmmu_ss.add(when: 'CONFIG_IMX_USBPHY', if_true: files('imx-usb-phy.c')) +softmmu_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686-uhci-pci.= c')) specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-us= b2-ctrl-regs.c')) specific_ss.add(when: 'CONFIG_XLNX_USB_SUBSYS', if_true: files('xlnx-usb-s= ubsystem.c')) =20 --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831407; cv=none; d=zohomail.com; s=zohoarc; b=RnbShhMZ3fNmBa2iihuoz+deavqnp/X8/rliqvK1+B5XeapQmjRlxZ4+s4HMJ0NW6FI2NsKsnVjDJJN0kB3mry2XordoyKhqb61Xk/rmdizwnyJaa1/6qg8MVx0Wz/P6hTWor2QZksN1A+yZwdXnemllH/X2MjRgqmPKkFDztRc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831407; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VdfoDktG6lIFQgHBnGuruhduXWRdfmaLgecDFEBNAVU=; b=XM6a6x+ekMn4XB/wNqny9WZ7MBUkmJ1NBLlK1ET+/yGgEqt2VA2SXC+1EfgolXWSPrPbtdWkopG+W+1cnXx17erRkwRwHRjp4R+7mR3rRxNgBynfTU/7q43nEDWNoUNbP+S7fj9Xx7zCZNFVhCCiurr1X89eS2st/rf3pZFnCjo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831406673436.36535020717395; Mon, 15 Mar 2021 11:03:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-127-K-tYxdg9Mwy7y6jG60RQ-g-1; Mon, 15 Mar 2021 14:03:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4864D108BD10; Mon, 15 Mar 2021 18:03:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21B8D18A69; Mon, 15 Mar 2021 18:03:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D625B181A0E0; Mon, 15 Mar 2021 18:03:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2v86007576 for ; Mon, 15 Mar 2021 14:02:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CACB610F0; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC56660C0F; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 795EC18007BF; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831405; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VdfoDktG6lIFQgHBnGuruhduXWRdfmaLgecDFEBNAVU=; b=X8v44tLiJpU36z/jcdL+sGOsw617ppb71OH9K8k/UwHy9XD/rmJMvpyTNkrKFHeSdILWIO MMYY9Qby68SCZ/PxkY9wkvFQ5MhMxowj6B1jfQxWrqhN0ax7iJDLfZA0XI5FCB5yPn/CfQ jhqXwUuwCgIsOouPiKdZ76LGyzWOzWU= X-MC-Unique: K-tYxdg9Mwy7y6jG60RQ-g-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 09/13] usb/storage: move declarations to usb/msd.h header Date: Mon, 15 Mar 2021 19:02:36 +0100 Message-Id: <20210315180240.1597240-10-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In preparation for splitting the usb-storage.c file move declarations to the new usb/msd.h header file. Signed-off-by: Gerd Hoffmann Message-Id: <20210312090425.772900-2-kraxel@redhat.com> --- include/hw/usb/msd.h | 54 ++++++++++++++++++++++++++++++++++++++++++++ hw/usb/dev-storage.c | 48 +++++---------------------------------- 2 files changed, 60 insertions(+), 42 deletions(-) create mode 100644 include/hw/usb/msd.h diff --git a/include/hw/usb/msd.h b/include/hw/usb/msd.h new file mode 100644 index 000000000000..7538c54569bf --- /dev/null +++ b/include/hw/usb/msd.h @@ -0,0 +1,54 @@ +/* + * USB Mass Storage Device emulation + * + * Copyright (c) 2006 CodeSourcery. + * Written by Paul Brook + * + * This code is licensed under the LGPL. + */ + +#include "hw/usb.h" +#include "hw/scsi/scsi.h" + +enum USBMSDMode { + USB_MSDM_CBW, /* Command Block. */ + USB_MSDM_DATAOUT, /* Transfer data to device. */ + USB_MSDM_DATAIN, /* Transfer data from device. */ + USB_MSDM_CSW /* Command Status. */ +}; + +struct usb_msd_csw { + uint32_t sig; + uint32_t tag; + uint32_t residue; + uint8_t status; +}; + +struct MSDState { + USBDevice dev; + enum USBMSDMode mode; + uint32_t scsi_off; + uint32_t scsi_len; + uint32_t data_len; + struct usb_msd_csw csw; + SCSIRequest *req; + SCSIBus bus; + /* For async completion. */ + USBPacket *packet; + /* usb-storage only */ + BlockConf conf; + bool removable; + bool commandlog; + SCSIDevice *scsi_dev; +}; + +typedef struct MSDState MSDState; +#define TYPE_USB_STORAGE "usb-storage-dev" +DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE_DEV, + TYPE_USB_STORAGE) + +void usb_msd_transfer_data(SCSIRequest *req, uint32_t len); +void usb_msd_command_complete(SCSIRequest *req, size_t resid); +void usb_msd_request_cancelled(SCSIRequest *req); +void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req); +void usb_msd_handle_reset(USBDevice *dev); diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index a5f76fc00120..027e29dda3f5 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -14,6 +14,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "hw/usb.h" +#include "hw/usb/msd.h" #include "desc.h" #include "hw/qdev-properties.h" #include "hw/scsi/scsi.h" @@ -29,43 +30,6 @@ #define MassStorageReset 0xff #define GetMaxLun 0xfe =20 -enum USBMSDMode { - USB_MSDM_CBW, /* Command Block. */ - USB_MSDM_DATAOUT, /* Transfer data to device. */ - USB_MSDM_DATAIN, /* Transfer data from device. */ - USB_MSDM_CSW /* Command Status. */ -}; - -struct usb_msd_csw { - uint32_t sig; - uint32_t tag; - uint32_t residue; - uint8_t status; -}; - -struct MSDState { - USBDevice dev; - enum USBMSDMode mode; - uint32_t scsi_off; - uint32_t scsi_len; - uint32_t data_len; - struct usb_msd_csw csw; - SCSIRequest *req; - SCSIBus bus; - /* For async completion. */ - USBPacket *packet; - /* usb-storage only */ - BlockConf conf; - bool removable; - bool commandlog; - SCSIDevice *scsi_dev; -}; -typedef struct MSDState MSDState; - -#define TYPE_USB_STORAGE "usb-storage-dev" -DECLARE_INSTANCE_CHECKER(MSDState, USB_STORAGE_DEV, - TYPE_USB_STORAGE) - struct usb_msd_cbw { uint32_t sig; uint32_t tag; @@ -259,7 +223,7 @@ static void usb_msd_packet_complete(MSDState *s) usb_packet_complete(&s->dev, p); } =20 -static void usb_msd_transfer_data(SCSIRequest *req, uint32_t len) +void usb_msd_transfer_data(SCSIRequest *req, uint32_t len) { MSDState *s =3D DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent); USBPacket *p =3D s->packet; @@ -277,7 +241,7 @@ static void usb_msd_transfer_data(SCSIRequest *req, uin= t32_t len) } } =20 -static void usb_msd_command_complete(SCSIRequest *req, size_t resid) +void usb_msd_command_complete(SCSIRequest *req, size_t resid) { MSDState *s =3D DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent); USBPacket *p =3D s->packet; @@ -320,7 +284,7 @@ static void usb_msd_command_complete(SCSIRequest *req, = size_t resid) s->req =3D NULL; } =20 -static void usb_msd_request_cancelled(SCSIRequest *req) +void usb_msd_request_cancelled(SCSIRequest *req) { MSDState *s =3D DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent); =20 @@ -337,7 +301,7 @@ static void usb_msd_request_cancelled(SCSIRequest *req) } } =20 -static void usb_msd_handle_reset(USBDevice *dev) +void usb_msd_handle_reset(USBDevice *dev) { MSDState *s =3D (MSDState *)dev; =20 @@ -565,7 +529,7 @@ static void usb_msd_handle_data(USBDevice *dev, USBPack= et *p) } } =20 -static void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req) +void *usb_msd_load_request(QEMUFile *f, SCSIRequest *req) { MSDState *s =3D DO_UPCAST(MSDState, dev.qdev, req->bus->qbus.parent); =20 --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831453; cv=none; d=zohomail.com; s=zohoarc; b=iQIH0RJqrou91NmQmCw2tfJBMwPmS7CNLfzNL81wa0d5EaDUweP7Z9Uw1EhskE0bRh2851gefctvYgRY7YQiXDcsUlDxqHAVQNnlH6/Xe9CdjLc23nOMvEtNlUZILdbyWZ5hrshUmIMoOy4EGjQio9V7OSUB094MmqNwlq8ikLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831453; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l0ENLpXO9/OCXCt43VuaRTJBJGPkzvUN0C8va0TwKN8=; b=jWBq0+bqnVqC6mW3NCns7GKevjH1j10GxAvFmXoc8KUs78UM0MBFdJI4RDS1pp9bJQoqStRCyZt280IqRGfrZwZs6lr3zS5X+iYkZh9JuWlI/P/WgewAEc+yP4tcnV7DGaY68Rt5BDbJg9Xq7ecCWZQxa78J0X4Y2FZp4MRi8io= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16158314532541016.1896517166482; Mon, 15 Mar 2021 11:04:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-597-bfKxv8TqPUCwetBiIDrxJw-1; Mon, 15 Mar 2021 14:03:09 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EAD9E1015C8D; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFFD710023AB; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7D07E57DC6; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2qwX007523 for ; Mon, 15 Mar 2021 14:02:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68E305C8B3; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBB891C4; Mon, 15 Mar 2021 18:02:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 886941800840; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831452; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=l0ENLpXO9/OCXCt43VuaRTJBJGPkzvUN0C8va0TwKN8=; b=hkPRIY8HsrgxULzs1VtCYt10PyYD2RDokFxLx6i00jMkOg5BNXRsNDV2sgVh57LwiMjdeN APG97QEfCh2+hdItmpavoNOCoM3R0cWMF3K/zk153NnFY6c/UHkz9/qVE71mytdV0DjXxt y5kn8XhKeYUnq2Rqc4J3GGY+bRmTnng= X-MC-Unique: bfKxv8TqPUCwetBiIDrxJw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 10/13] usb/storage: move usb-bot device to separate source file Date: Mon, 15 Mar 2021 19:02:37 +0100 Message-Id: <20210315180240.1597240-11-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Pure code motion, no functional change. Signed-off-by: Gerd Hoffmann Message-Id: <20210312090425.772900-3-kraxel@redhat.com> --- hw/usb/dev-storage-bot.c | 63 ++++++++++++++++++++++++++++++++++++++++ hw/usb/dev-storage.c | 42 --------------------------- hw/usb/meson.build | 1 + 3 files changed, 64 insertions(+), 42 deletions(-) create mode 100644 hw/usb/dev-storage-bot.c diff --git a/hw/usb/dev-storage-bot.c b/hw/usb/dev-storage-bot.c new file mode 100644 index 000000000000..6aad026d1133 --- /dev/null +++ b/hw/usb/dev-storage-bot.c @@ -0,0 +1,63 @@ +/* + * USB Mass Storage Device emulation + * + * Copyright (c) 2006 CodeSourcery. + * Written by Paul Brook + * + * This code is licensed under the LGPL. + */ + +#include "qemu/osdep.h" +#include "qemu/typedefs.h" +#include "qapi/error.h" +#include "hw/usb.h" +#include "hw/usb/desc.h" +#include "hw/usb/msd.h" + +static const struct SCSIBusInfo usb_msd_scsi_info_bot =3D { + .tcq =3D false, + .max_target =3D 0, + .max_lun =3D 15, + + .transfer_data =3D usb_msd_transfer_data, + .complete =3D usb_msd_command_complete, + .cancel =3D usb_msd_request_cancelled, + .load_request =3D usb_msd_load_request, +}; + +static void usb_msd_bot_realize(USBDevice *dev, Error **errp) +{ + MSDState *s =3D USB_STORAGE_DEV(dev); + DeviceState *d =3D DEVICE(dev); + + usb_desc_create_serial(dev); + usb_desc_init(dev); + if (d->hotplugged) { + s->dev.auto_attach =3D 0; + } + + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), + &usb_msd_scsi_info_bot, NULL); + usb_msd_handle_reset(dev); +} + +static void usb_msd_class_bot_initfn(ObjectClass *klass, void *data) +{ + USBDeviceClass *uc =3D USB_DEVICE_CLASS(klass); + + uc->realize =3D usb_msd_bot_realize; + uc->attached_settable =3D true; +} + +static const TypeInfo bot_info =3D { + .name =3D "usb-bot", + .parent =3D TYPE_USB_STORAGE, + .class_init =3D usb_msd_class_bot_initfn, +}; + +static void register_types(void) +{ + type_register_static(&bot_info); +} + +type_init(register_types) diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 027e29dda3f5..3e613ecc886b 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -551,17 +551,6 @@ static const struct SCSIBusInfo usb_msd_scsi_info_stor= age =3D { .load_request =3D usb_msd_load_request, }; =20 -static const struct SCSIBusInfo usb_msd_scsi_info_bot =3D { - .tcq =3D false, - .max_target =3D 0, - .max_lun =3D 15, - - .transfer_data =3D usb_msd_transfer_data, - .complete =3D usb_msd_command_complete, - .cancel =3D usb_msd_request_cancelled, - .load_request =3D usb_msd_load_request, -}; - static void usb_msd_storage_realize(USBDevice *dev, Error **errp) { MSDState *s =3D USB_STORAGE_DEV(dev); @@ -613,22 +602,6 @@ static void usb_msd_storage_realize(USBDevice *dev, Er= ror **errp) s->scsi_dev =3D scsi_dev; } =20 -static void usb_msd_bot_realize(USBDevice *dev, Error **errp) -{ - MSDState *s =3D USB_STORAGE_DEV(dev); - DeviceState *d =3D DEVICE(dev); - - usb_desc_create_serial(dev); - usb_desc_init(dev); - if (d->hotplugged) { - s->dev.auto_attach =3D 0; - } - - scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), - &usb_msd_scsi_info_bot, NULL); - usb_msd_handle_reset(dev); -} - static const VMStateDescription vmstate_usb_msd =3D { .name =3D "usb-storage", .version_id =3D 1, @@ -734,14 +707,6 @@ static void usb_msd_instance_init(Object *obj) object_property_set_int(obj, "bootindex", -1, NULL); } =20 -static void usb_msd_class_bot_initfn(ObjectClass *klass, void *data) -{ - USBDeviceClass *uc =3D USB_DEVICE_CLASS(klass); - - uc->realize =3D usb_msd_bot_realize; - uc->attached_settable =3D true; -} - static const TypeInfo msd_info =3D { .name =3D "usb-storage", .parent =3D TYPE_USB_STORAGE, @@ -749,17 +714,10 @@ static const TypeInfo msd_info =3D { .instance_init =3D usb_msd_instance_init, }; =20 -static const TypeInfo bot_info =3D { - .name =3D "usb-bot", - .parent =3D TYPE_USB_STORAGE, - .class_init =3D usb_msd_class_bot_initfn, -}; - static void usb_msd_register_types(void) { type_register_static(&usb_storage_dev_type_info); type_register_static(&msd_info); - type_register_static(&bot_info); } =20 type_init(usb_msd_register_types) diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 6e3159798e93..518cd1fbbbea 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -41,6 +41,7 @@ softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hu= b.c')) softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hid.c')) softmmu_ss.add(when: 'CONFIG_USB_TABLET_WACOM', if_true: files('dev-wacom.= c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= .c')) +softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= -bot.c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c')) softmmu_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c')) softmmu_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c')) --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831449; cv=none; d=zohomail.com; s=zohoarc; b=hBRcGMt/RwPD+KMUSTmi7/wwzD4rvv8NYWpvCg7CpgZRmUzW2RkUUDU5FKWnaow9RldG6fmji8S1DpKeIsvCg18HVYRVSc1rSnPP4lkA+wCm9N7I4dyStrz+KQ36fPo+LiTprxCieNHfx9cnlQiXRf96+bL1dEL35na+ZWNVMls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831449; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wFNN6nJDXlEXvj7jL1UN7ZbkzKmEIDhAe1pdk9+/giU=; b=gIXG/u1l4iE9RcRNvFQtPuWC0u9HFJLN9/BokpHs7gORgYxlCEGS6SoxMGmOihC8SmgDf7plCeXj+BGIFhZ0he2ihPjZbQqE0LaQ3GFkofkGvmLchx+BoAvwatd5UTAmP4HM/Cztb+JCYfIkciXe7IwKOhZO/fcVROcbmZQvZyM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831449947497.086203013627; Mon, 15 Mar 2021 11:04:09 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-fvaFaz7MN1OG5i1v0E_Gyg-1; Mon, 15 Mar 2021 14:03:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CB68108BD16; Mon, 15 Mar 2021 18:03:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 343EE1757E; Mon, 15 Mar 2021 18:03:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E1731180103C; Mon, 15 Mar 2021 18:03:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2v3S007579 for ; Mon, 15 Mar 2021 14:02:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 889521378D; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9DC9610AF; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 98A981800841; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831448; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wFNN6nJDXlEXvj7jL1UN7ZbkzKmEIDhAe1pdk9+/giU=; b=LmoeXnyOKFS7k2H1+rW1ZRyaVPmOdUZxeXN8qJ9bPUS+FG7cKdKKDk8JlmmGOs4tR/H/4f MiagT4QwNpvLCCCuqGtUJ08zMCeO8hLl8axilA90Pht+vyes244Ol94NIK9HX3J4ffURFP 6jbllyUDBbrx6Eax/lf0IdNDWCAg530= X-MC-Unique: fvaFaz7MN1OG5i1v0E_Gyg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 11/13] usb/storage move usb-storage device to separate source file Date: Mon, 15 Mar 2021 19:02:38 +0100 Message-Id: <20210315180240.1597240-12-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Pure code motion, no functional change. Signed-off-by: Gerd Hoffmann Message-Id: <20210312090425.772900-4-kraxel@redhat.com> --- hw/usb/dev-storage-classic.c | 156 +++++++++++++++++++++++++++++++++++ hw/usb/dev-storage.c | 135 ------------------------------ hw/usb/meson.build | 1 + 3 files changed, 157 insertions(+), 135 deletions(-) create mode 100644 hw/usb/dev-storage-classic.c diff --git a/hw/usb/dev-storage-classic.c b/hw/usb/dev-storage-classic.c new file mode 100644 index 000000000000..00cb34b22f02 --- /dev/null +++ b/hw/usb/dev-storage-classic.c @@ -0,0 +1,156 @@ +/* + * USB Mass Storage Device emulation + * + * Copyright (c) 2006 CodeSourcery. + * Written by Paul Brook + * + * This code is licensed under the LGPL. + */ + +#include "qemu/osdep.h" +#include "qemu/typedefs.h" +#include "qapi/error.h" +#include "qapi/visitor.h" +#include "hw/usb.h" +#include "hw/usb/desc.h" +#include "hw/usb/msd.h" +#include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" + +static const struct SCSIBusInfo usb_msd_scsi_info_storage =3D { + .tcq =3D false, + .max_target =3D 0, + .max_lun =3D 0, + + .transfer_data =3D usb_msd_transfer_data, + .complete =3D usb_msd_command_complete, + .cancel =3D usb_msd_request_cancelled, + .load_request =3D usb_msd_load_request, +}; + +static void usb_msd_storage_realize(USBDevice *dev, Error **errp) +{ + MSDState *s =3D USB_STORAGE_DEV(dev); + BlockBackend *blk =3D s->conf.blk; + SCSIDevice *scsi_dev; + + if (!blk) { + error_setg(errp, "drive property not set"); + return; + } + + if (!blkconf_blocksizes(&s->conf, errp)) { + return; + } + + if (!blkconf_apply_backend_options(&s->conf, !blk_supports_write_perm(= blk), + true, errp)) { + return; + } + + /* + * Hack alert: this pretends to be a block device, but it's really + * a SCSI bus that can serve only a single device, which it + * creates automatically. But first it needs to detach from its + * blockdev, or else scsi_bus_legacy_add_drive() dies when it + * attaches again. We also need to take another reference so that + * blk_detach_dev() doesn't free blk while we still need it. + * + * The hack is probably a bad idea. + */ + blk_ref(blk); + blk_detach_dev(blk, DEVICE(s)); + s->conf.blk =3D NULL; + + usb_desc_create_serial(dev); + usb_desc_init(dev); + scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), + &usb_msd_scsi_info_storage, NULL); + scsi_dev =3D scsi_bus_legacy_add_drive(&s->bus, blk, 0, !!s->removable, + s->conf.bootindex, s->conf.share_= rw, + s->conf.rerror, s->conf.werror, + dev->serial, + errp); + blk_unref(blk); + if (!scsi_dev) { + return; + } + usb_msd_handle_reset(dev); + s->scsi_dev =3D scsi_dev; +} + +static Property msd_properties[] =3D { + DEFINE_BLOCK_PROPERTIES(MSDState, conf), + DEFINE_BLOCK_ERROR_PROPERTIES(MSDState, conf), + DEFINE_PROP_BOOL("removable", MSDState, removable, false), + DEFINE_PROP_BOOL("commandlog", MSDState, commandlog, false), + DEFINE_PROP_END_OF_LIST(), +}; + +static void usb_msd_class_storage_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + USBDeviceClass *uc =3D USB_DEVICE_CLASS(klass); + + uc->realize =3D usb_msd_storage_realize; + device_class_set_props(dc, msd_properties); +} + +static void usb_msd_get_bootindex(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + USBDevice *dev =3D USB_DEVICE(obj); + MSDState *s =3D USB_STORAGE_DEV(dev); + + visit_type_int32(v, name, &s->conf.bootindex, errp); +} + +static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *nam= e, + void *opaque, Error **errp) +{ + USBDevice *dev =3D USB_DEVICE(obj); + MSDState *s =3D USB_STORAGE_DEV(dev); + int32_t boot_index; + Error *local_err =3D NULL; + + if (!visit_type_int32(v, name, &boot_index, errp)) { + return; + } + /* check whether bootindex is present in fw_boot_order list */ + check_boot_index(boot_index, &local_err); + if (local_err) { + goto out; + } + /* change bootindex to a new one */ + s->conf.bootindex =3D boot_index; + + if (s->scsi_dev) { + object_property_set_int(OBJECT(s->scsi_dev), "bootindex", boot_ind= ex, + &error_abort); + } + +out: + error_propagate(errp, local_err); +} + +static void usb_msd_instance_init(Object *obj) +{ + object_property_add(obj, "bootindex", "int32", + usb_msd_get_bootindex, + usb_msd_set_bootindex, NULL, NULL); + object_property_set_int(obj, "bootindex", -1, NULL); +} + +static const TypeInfo msd_info =3D { + .name =3D "usb-storage", + .parent =3D TYPE_USB_STORAGE, + .class_init =3D usb_msd_class_storage_initfn, + .instance_init =3D usb_msd_instance_init, +}; + +static void register_types(void) +{ + type_register_static(&msd_info); +} + +type_init(register_types) diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 3e613ecc886b..7b587ad051ff 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -19,9 +19,6 @@ #include "hw/qdev-properties.h" #include "hw/scsi/scsi.h" #include "migration/vmstate.h" -#include "sysemu/sysemu.h" -#include "sysemu/block-backend.h" -#include "qapi/visitor.h" #include "qemu/cutils.h" #include "qom/object.h" #include "trace.h" @@ -540,68 +537,6 @@ void *usb_msd_load_request(QEMUFile *f, SCSIRequest *r= eq) return NULL; } =20 -static const struct SCSIBusInfo usb_msd_scsi_info_storage =3D { - .tcq =3D false, - .max_target =3D 0, - .max_lun =3D 0, - - .transfer_data =3D usb_msd_transfer_data, - .complete =3D usb_msd_command_complete, - .cancel =3D usb_msd_request_cancelled, - .load_request =3D usb_msd_load_request, -}; - -static void usb_msd_storage_realize(USBDevice *dev, Error **errp) -{ - MSDState *s =3D USB_STORAGE_DEV(dev); - BlockBackend *blk =3D s->conf.blk; - SCSIDevice *scsi_dev; - - if (!blk) { - error_setg(errp, "drive property not set"); - return; - } - - if (!blkconf_blocksizes(&s->conf, errp)) { - return; - } - - if (!blkconf_apply_backend_options(&s->conf, !blk_supports_write_perm(= blk), - true, errp)) { - return; - } - - /* - * Hack alert: this pretends to be a block device, but it's really - * a SCSI bus that can serve only a single device, which it - * creates automatically. But first it needs to detach from its - * blockdev, or else scsi_bus_legacy_add_drive() dies when it - * attaches again. We also need to take another reference so that - * blk_detach_dev() doesn't free blk while we still need it. - * - * The hack is probably a bad idea. - */ - blk_ref(blk); - blk_detach_dev(blk, DEVICE(s)); - s->conf.blk =3D NULL; - - usb_desc_create_serial(dev); - usb_desc_init(dev); - scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev), - &usb_msd_scsi_info_storage, NULL); - scsi_dev =3D scsi_bus_legacy_add_drive(&s->bus, blk, 0, !!s->removable, - s->conf.bootindex, s->conf.share_= rw, - s->conf.rerror, s->conf.werror, - dev->serial, - errp); - blk_unref(blk); - if (!scsi_dev) { - return; - } - usb_msd_handle_reset(dev); - s->scsi_dev =3D scsi_dev; -} - static const VMStateDescription vmstate_usb_msd =3D { .name =3D "usb-storage", .version_id =3D 1, @@ -620,14 +555,6 @@ static const VMStateDescription vmstate_usb_msd =3D { } }; =20 -static Property msd_properties[] =3D { - DEFINE_BLOCK_PROPERTIES(MSDState, conf), - DEFINE_BLOCK_ERROR_PROPERTIES(MSDState, conf), - DEFINE_PROP_BOOL("removable", MSDState, removable, false), - DEFINE_PROP_BOOL("commandlog", MSDState, commandlog, false), - DEFINE_PROP_END_OF_LIST(), -}; - static void usb_msd_class_initfn_common(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -645,52 +572,6 @@ static void usb_msd_class_initfn_common(ObjectClass *k= lass, void *data) dc->vmsd =3D &vmstate_usb_msd; } =20 -static void usb_msd_class_storage_initfn(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - USBDeviceClass *uc =3D USB_DEVICE_CLASS(klass); - - uc->realize =3D usb_msd_storage_realize; - device_class_set_props(dc, msd_properties); -} - -static void usb_msd_get_bootindex(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - USBDevice *dev =3D USB_DEVICE(obj); - MSDState *s =3D USB_STORAGE_DEV(dev); - - visit_type_int32(v, name, &s->conf.bootindex, errp); -} - -static void usb_msd_set_bootindex(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - USBDevice *dev =3D USB_DEVICE(obj); - MSDState *s =3D USB_STORAGE_DEV(dev); - int32_t boot_index; - Error *local_err =3D NULL; - - if (!visit_type_int32(v, name, &boot_index, errp)) { - return; - } - /* check whether bootindex is present in fw_boot_order list */ - check_boot_index(boot_index, &local_err); - if (local_err) { - goto out; - } - /* change bootindex to a new one */ - s->conf.bootindex =3D boot_index; - - if (s->scsi_dev) { - object_property_set_int(OBJECT(s->scsi_dev), "bootindex", boot_ind= ex, - &error_abort); - } - -out: - error_propagate(errp, local_err); -} - static const TypeInfo usb_storage_dev_type_info =3D { .name =3D TYPE_USB_STORAGE, .parent =3D TYPE_USB_DEVICE, @@ -699,25 +580,9 @@ static const TypeInfo usb_storage_dev_type_info =3D { .class_init =3D usb_msd_class_initfn_common, }; =20 -static void usb_msd_instance_init(Object *obj) -{ - object_property_add(obj, "bootindex", "int32", - usb_msd_get_bootindex, - usb_msd_set_bootindex, NULL, NULL); - object_property_set_int(obj, "bootindex", -1, NULL); -} - -static const TypeInfo msd_info =3D { - .name =3D "usb-storage", - .parent =3D TYPE_USB_STORAGE, - .class_init =3D usb_msd_class_storage_initfn, - .instance_init =3D usb_msd_instance_init, -}; - static void usb_msd_register_types(void) { type_register_static(&usb_storage_dev_type_info); - type_register_static(&msd_info); } =20 type_init(usb_msd_register_types) diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 518cd1fbbbea..9e4da68e3b6c 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -42,6 +42,7 @@ softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hi= d.c')) softmmu_ss.add(when: 'CONFIG_USB_TABLET_WACOM', if_true: files('dev-wacom.= c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= .c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= -bot.c')) +softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= -classic.c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c')) softmmu_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c')) softmmu_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c')) --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831406; cv=none; d=zohomail.com; s=zohoarc; b=JPOqXnWtgVctriIr23WhfBlyfoAXbbX8R0wvVPCmWS11fTfVDl1hdqkM1sp5g4dnhrtFviOBuaU7sS6NrqMrdTqn1UMg0hFBaGXzF2KVTdsd8wvn3ikqPM9Fk15wteF4S8NndbLLsCI0RWtpuAhzq4PGMJnKSJwmt/+SktT89bQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831406; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NnYj+Ud94yZuYTKYu1oplzmvSJIFCNsTmjib9Tj3UNM=; b=SJiBu+GUqYeaOPUFu6vc7qNMthvLuL4cQQ+GnzEO6ltdD9MrZM+t4bkNLFsjqg+NXFg95g+rom8aFV9lrephFj9ccDfM5hMu3+EPy2rofyJgkHD1c29y5j5dbWiKlb/Kanz+Q0Ar/R2H5AAlK4CNiEWN0lz72M16FsICsGRyhK4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831406410244.81511625555686; Mon, 15 Mar 2021 11:03:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-stqjAncfOtuEiFkXU7IU6Q-1; Mon, 15 Mar 2021 14:03:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE46918460E8; Mon, 15 Mar 2021 18:03:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9A8D5D75A; Mon, 15 Mar 2021 18:03:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 69D1457DC3; Mon, 15 Mar 2021 18:03:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2vQA007588 for ; Mon, 15 Mar 2021 14:02:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E0A55D751; Mon, 15 Mar 2021 18:02:57 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0FB45D75A; Mon, 15 Mar 2021 18:02:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A4EB31800842; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831405; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NnYj+Ud94yZuYTKYu1oplzmvSJIFCNsTmjib9Tj3UNM=; b=eLJgG8/SmUYQWFM0+g38ASz3AZ3LGJEn3VGVSKvWyEENhsFdtzwrqVlcS5hlBZb0/7alEO paLr1mt27KblcVRnMcQskQ2lLphSPPcCrH5ueiugo6SI3ZXLHW/F/obB5TzbBiUQKkNfSR GvfNu9+3KaROvdfx00K6oKSUaY1VhX0= X-MC-Unique: stqjAncfOtuEiFkXU7IU6Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 12/13] usb/storage: add kconfig symbols Date: Mon, 15 Mar 2021 19:02:39 +0100 Message-Id: <20210315180240.1597240-13-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add new kconfig symbols so usb-storage and usb-bot can be enabled or disabled individually at build time. Signed-off-by: Gerd Hoffmann Message-Id: <20210312090425.772900-5-kraxel@redhat.com> --- hw/usb/Kconfig | 13 ++++++++++++- hw/usb/meson.build | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig index 40093d7ea6bf..53f8283ffdc1 100644 --- a/hw/usb/Kconfig +++ b/hw/usb/Kconfig @@ -66,11 +66,22 @@ config USB_TABLET_WACOM default y depends on USB =20 +config USB_STORAGE_CORE + bool + depends on USB + select SCSI + +config USB_STORAGE_CLASSIC + bool + default y + depends on USB + select USB_STORAGE_CORE + config USB_STORAGE_BOT bool default y depends on USB - select SCSI + select USB_STORAGE_CORE =20 config USB_STORAGE_UAS bool diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 9e4da68e3b6c..fb7a74e73ae8 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -40,9 +40,9 @@ specific_ss.add(when: 'CONFIG_XLNX_USB_SUBSYS', if_true: = files('xlnx-usb-subsyst softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hub.c')) softmmu_ss.add(when: 'CONFIG_USB', if_true: files('dev-hid.c')) softmmu_ss.add(when: 'CONFIG_USB_TABLET_WACOM', if_true: files('dev-wacom.= c')) -softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= .c')) +softmmu_ss.add(when: 'CONFIG_USB_STORAGE_CORE', if_true: files('dev-storag= e.c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= -bot.c')) -softmmu_ss.add(when: 'CONFIG_USB_STORAGE_BOT', if_true: files('dev-storage= -classic.c')) +softmmu_ss.add(when: 'CONFIG_USB_STORAGE_CLASSIC', if_true: files('dev-sto= rage-classic.c')) softmmu_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c')) softmmu_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c')) softmmu_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c')) --=20 2.29.2 From nobody Fri May 3 03:29:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615831402; cv=none; d=zohomail.com; s=zohoarc; b=CYxA+tnhmpb808wOAmU1qg7ejXNjXnYA7+gwrblg4NSm0BZOBzHc/+tkTr0M/JmJEcXfCj6jcLnX2kWGfELSjvAqDyAbHGAmmRSh4bSIoxD67CX/S6PAIT9GVjYEcRI6bHlol+dbAUq+oj/AGq00G7CVtG00eTRdZQRiyI7Qxp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615831402; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nqJow56vo8H02Enc88863yrq478CXxEGIatZH3j+5VQ=; b=hhPxt1SnX+RBwLhqP3LORlgkythO1Agg7S0qljSQphLifmKUzUljOr2wCuNfohDeklbTOHtcBF+DXThnG6k0tZSZzCRnFJHRzRkIg+9daRctQYghEq0LYPkiiVUutI+B0VNgt9NyEsIWFb85tjhZsUM1ZRq6Pn1TUBKlWV1pbAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1615831402797868.5966028475247; Mon, 15 Mar 2021 11:03:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-AK0XM5i-NEqkTI_4JAxhZg-1; Mon, 15 Mar 2021 14:03:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBD2F81871C; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDAE819D7C; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7810857DCD; Mon, 15 Mar 2021 18:03:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FI2qHF007533 for ; Mon, 15 Mar 2021 14:02:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id ABB715DEAD; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-141.ams2.redhat.com [10.36.112.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B8145D9C0; Mon, 15 Mar 2021 18:02:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AF5E71800843; Mon, 15 Mar 2021 19:02:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615831401; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nqJow56vo8H02Enc88863yrq478CXxEGIatZH3j+5VQ=; b=a3jdHyXAaJFTuSdyGM/cHHCvQjSMvfQiUFOkeEWbQH24I9wBba3FnNS6NUUBYnYsQiD+ON WWQVDxP502KCZdu1b+UGAbIw5JC1bcjdnWNmE3SoUNWXEQSikY/yUuYKSWtk1P/2ri7Vzd UAqnWQjv4wS5tlBsgw+EqGGUk2ZgX1c= X-MC-Unique: AK0XM5i-NEqkTI_4JAxhZg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 13/13] usb/storage: clear csw on reset Date: Mon, 15 Mar 2021 19:02:40 +0100 Message-Id: <20210315180240.1597240-14-kraxel@redhat.com> In-Reply-To: <20210315180240.1597240-1-kraxel@redhat.com> References: <20210315180240.1597240-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Gerd Hoffmann , Paolo Bonzini , Samuel Thibault , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Stale data in csw (specifically residue) can confuse the state machine and allows the guest trigger an assert(). So clear csw on reset to avoid this happening in case the guest resets the device in the middle of a request. Buglink: https://bugs.launchpad.net/qemu/+bug/1523811 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210312094954.796799-1-kraxel@redhat.com> --- hw/usb/dev-storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 7b587ad051ff..dca62d544fe9 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -313,6 +313,7 @@ void usb_msd_handle_reset(USBDevice *dev) usb_msd_packet_complete(s); } =20 + memset(&s->csw, 0, sizeof(s->csw)); s->mode =3D USB_MSDM_CBW; } =20 --=20 2.29.2