From nobody Wed Feb 11 03:25:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528680973682576.409235714903; Sun, 10 Jun 2018 18:36:13 -0700 (PDT) Received: from localhost ([::1]:45804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSBki-0004Q3-Nw for importer@patchew.org; Sun, 10 Jun 2018 21:36:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSBSc-0006A0-JO for qemu-devel@nongnu.org; Sun, 10 Jun 2018 21:17:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSBSb-0003eT-Cn for qemu-devel@nongnu.org; Sun, 10 Jun 2018 21:17:30 -0400 Received: from mail-qt0-x229.google.com ([2607:f8b0:400d:c0d::229]:42493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSBSb-0003eE-7q; Sun, 10 Jun 2018 21:17:29 -0400 Received: by mail-qt0-x229.google.com with SMTP id y31-v6so18839372qty.9; Sun, 10 Jun 2018 18:17:29 -0700 (PDT) Received: from x1.local ([138.117.48.222]) by smtp.gmail.com with ESMTPSA id o5-v6sm28237223qtm.60.2018.06.10.18.17.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jun 2018 18:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C93wPRZfIOKCvkEaWbg0ZzCj5aiezhkzFf+gQ4uRENA=; b=ceLqD+tSKzNxFN4nqzRNrmTuiIbLDRlKdLxVjdd5kb8/+EoY9k9O0iX9j3xyAbz+rh 9JOtwF7ACe2cjbaOxX5ovQCSW57evUji98DGtd0h+Sl7QLfoO3SXCjvgEzYhW7IXLtld zSLolaLwSU0NBVUVY6V3OTtSOz6Gb5h/G0YJ4K9v4bLTixnplyx4YOypxK4luAMl7g6m 0v/aNe9Wa1BN4m2VbXBqZL9r6Yw3FfZQr4VMyfvfUbfgPEenn7YaC8l5CQ8qWCCTlgvK P8D1e4jpkGtrZoHGVyJjRJzNSFU9nxUZu/AmbZ42Hgc/gVINEaQpdTfKvWkwH2iuMLIH vByQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=C93wPRZfIOKCvkEaWbg0ZzCj5aiezhkzFf+gQ4uRENA=; b=Vy6vka4l1zet4qsAygCwyr8UMVirlQgLGxQKYUHhKTbHkjD9JIQzstP1jq407IRrnI AYiWECR1K20FxN/cnQR574lk3lbEA/BKn7OI3n7FqoYEoH0YT6CtmKeeNqh5mSyW88Dl M1j+LpuoX+2pWbwnGxEzJdVLwzhVDnXXserr63XvphJRYOEwuq2B03ybqYxquL6soWuE A1lZmcWMJqo/Od7ctJxIGKb7P7tC8lgaG7Uy0XXDFH7tC3VWAxa2LBw5hrRvmUIQ3akO bXxJkpX9br8s38sNhUhbCCvpjXNre7Abeq/Z8D57F31Hdi8oHlm1wWFPLa7drVN7SwXt dCpw== X-Gm-Message-State: APt69E0uUphW0CLDdAkN1snA6TU0wbOY6OrpSzh3eXbiUjEOni3zKwek RPRsq1oH8IKvMFr4CzaKLNudsPuaTLo= X-Google-Smtp-Source: ADUXVKJCdgcOosW+vVzgP1iW+DhmN/oRTu1z27NM0KSYsDMLs7BpwgsTCVoYToN4Sa2pixba1GLAaA== X-Received: by 2002:ac8:2b18:: with SMTP id 24-v6mr14426694qtu.73.1528679848815; Sun, 10 Jun 2018 18:17:28 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Thomas Huth , Stefan Weil Date: Sun, 10 Jun 2018 22:14:56 -0300 Message-Id: <20180611011501.10235-36-f4bug@amsat.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180611011501.10235-1-f4bug@amsat.org> References: <20180611011501.10235-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::229 Subject: [Qemu-devel] [PATCH v4 35/40] hw/usb: Use the IEC binary prefix definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 It eases code review, unit is explicit. Patch generated using: $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/ and modified manually. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/usb/ccid-card-passthru.c | 5 +++-- hw/usb/combined-packet.c | 3 ++- hw/usb/dev-smartcard-reader.c | 3 ++- hw/usb/redirect.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 25fb19b0d7..e6c73116cc 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -9,6 +9,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include #include "chardev/char-fe.h" #include "qemu/error-report.h" @@ -40,7 +41,7 @@ static const uint8_t DEFAULT_ATR[] =3D { 0x13, 0x08 }; =20 -#define VSCARD_IN_SIZE 65536 +#define VSCARD_IN_SIZE (64 * KiB) =20 /* maximum size of ATR - from 7816-3 */ #define MAX_ATR_SIZE 40 @@ -276,7 +277,7 @@ static void ccid_card_vscard_read(void *opaque, const u= int8_t *buf, int size) =20 if (card->vscard_in_pos + size > VSCARD_IN_SIZE) { error_report( - "no room for data: pos %d + size %d > %d. dropping connection= .", + "no room for data: pos %d + size %d > %llu. dropping connecti= on.", card->vscard_in_pos, size, VSCARD_IN_SIZE); ccid_card_vscard_drop_connection(card); return; diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 48cac87f6a..01a7ed0848 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -20,6 +20,7 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h" @@ -171,7 +172,7 @@ void usb_ep_combine_input_packets(USBEndpoint *ep) if ((p->iov.size % ep->max_packet_size) !=3D 0 || !p->short_not_ok= || next =3D=3D NULL || /* Work around for Linux usbfs bulk splitting + migration = */ - (totalsize =3D=3D 16348 && p->int_req)) { + (totalsize =3D=3D (16 * KiB - 36) && p->int_req)) { usb_device_handle_data(ep->dev, first); assert(first->status =3D=3D USB_RET_ASYNC); if (first->combined) { diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 2131e33d27..ec862c2082 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -35,6 +35,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" @@ -63,7 +64,7 @@ do { \ * or handle the migration complexity - VMState doesn't handle this case. * sizes are expected never to be exceeded, unless guest misbehaves. */ -#define BULK_OUT_DATA_SIZE 65536 +#define BULK_OUT_DATA_SIZE (64 * KiB) #define PENDING_ANSWERS_NUM 128 =20 #define BULK_IN_BUF_SIZE 384 diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 65a9196c1a..8580c08dbd 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -26,6 +26,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" @@ -1298,7 +1299,7 @@ static int usbredir_chardev_can_read(void *opaque) } =20 /* usbredir_parser_do_read will consume *all* data we give it */ - return 1024 * 1024; + return 1 * MiB; } =20 static void usbredir_chardev_read(void *opaque, const uint8_t *buf, int si= ze) --=20 2.17.1