From nobody Fri Oct 24 20:18:50 2025 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 1520250725982491.3337199973057; Mon, 5 Mar 2018 03:52:05 -0800 (PST) Received: from localhost ([::1]:48806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esoez-0004Ap-7q for importer@patchew.org; Mon, 05 Mar 2018 06:52:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esoI1-00047Z-V8 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 06:28:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esoI0-0007Ki-Oi for qemu-devel@nongnu.org; Mon, 05 Mar 2018 06:28:21 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:53119) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esoHw-0007EZ-DW; Mon, 05 Mar 2018 06:28:16 -0500 Received: by mail-wm0-x242.google.com with SMTP id t3so15060263wmc.2; Mon, 05 Mar 2018 03:28:16 -0800 (PST) Received: from x1.local (ABayonne-654-1-79-224.w86-222.abo.wanadoo.fr. [86.222.222.224]) by smtp.gmail.com with ESMTPSA id k45sm11744388wrf.62.2018.03.05.03.28.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 03:28:14 -0800 (PST) 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=PpICu03Y2hdoUfZWzyZFQzJpk3duGFJoav2QlXLtXok=; b=ZGTzK/6eSNia1fDw7ednL1E+Px+wiYpbWtC/wbyQ/C6DRjsLIL9seT7oliWGn9wMa5 4y8rtVDdwfTAQkbBYzIeN9V+TLlkzPpqsRRtUFncTVyfd2N6sKbcTR1eD0yyHW6TDhOS E5WPxPSf3S9nTQBdEdVjyzZ/+UwBoU8Z2nmfO4I4dKI5Q/7oH9dkMiQrtt1sEeoe9d8V tv1PohugB5Zr6KRdQjkBURBj6f4Lik/6298VJhXvEPdxEsbvuzAGgeqLHM/S4Ff05MT2 X2x+uXcrHzTtxABDR9Cyl4QLSbaYiMAS+lxzxKk+/A36sUU/JcVYtD497wns5nWsWLhT p43Q== 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=PpICu03Y2hdoUfZWzyZFQzJpk3duGFJoav2QlXLtXok=; b=JDi3V8+hn095VdN/7+7PEUJkeBLr53tAq7TdqoBwN2taIaV+L17jQcLnBL5/SMtMe9 Zbxot9I3xFq9xobo5vkK+RTiLVF3fo89bEF9DCS1tG1prLXeFD0T4fbNd28XeK1N7304 PIA4iltAX2noYuQEYBGblA5cLnOWBp4gfe6zEOQ50flBglWz1Tt01lVsPZBOIB7TahM6 OzQqe4H3wJ8HkOTRY22ok9cIdVzf4XkD8DvCrxMstjjlZEEiovNVrhfAmCBNzXbbbpcN A30zZw/kadvux4cAZ0x9ePebNChx/8PFwvpUUbB1a+4vNkb5Po7SzjdXlKYzBFLxXq4F ZwRA== X-Gm-Message-State: AElRT7HnuG9hD9m4auatnqT2w+ngvvK+E0bOahMTpI08OrW7+oGBO0Cj mJlXAUQFiyQxenwMpvQFwpB6M4dWS3M= X-Google-Smtp-Source: AG47ELscgAerxv6kPqZKH+y0ABGpSSqkcE0Iw0A/Slkro7d0QAxYUXqtg4k+cahXO1+mN3LAIdnHJA== X-Received: by 10.28.93.82 with SMTP id r79mr7519342wmb.73.1520249295244; Mon, 05 Mar 2018 03:28:15 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-trivial@nongnu.org Date: Mon, 5 Mar 2018 08:27:29 -0300 Message-Id: <20180305112732.26471-28-f4bug@amsat.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180305112732.26471-1-f4bug@amsat.org> References: <20180305112732.26471-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: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v2 27/30] vfio/pci: use the BYTE-based 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: Alex Williamson , =?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/vfio/pci-quirks.c | 8 ++++---- hw/vfio/pci.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index e5779a7ad3..3c091106dd 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1255,9 +1255,9 @@ static int vfio_igd_gtt_max(VFIOPCIDevice *vdev) ggms =3D 1 << ggms; } =20 - ggms *=3D 1024 * 1024; + ggms *=3D M_BYTE; =20 - return (ggms / (4 * 1024)) * (gen < 8 ? 4 : 8); + return (ggms / (4 * K_BYTE)) * (gen < 8 ? 4 : 8); } =20 /* @@ -1514,7 +1514,7 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *= vdev, int nr) igd->vdev =3D vdev; igd->index =3D ~0; igd->bdsm =3D vfio_pci_read_config(&vdev->pdev, IGD_BDSM, 4); - igd->bdsm &=3D ~((1 << 20) - 1); /* 1MB aligned */ + igd->bdsm &=3D ~((1 * M_BYTE) - 1); /* 1MB aligned */ =20 memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_igd_index_qu= irk, igd, "vfio-igd-index-quirk", 4); @@ -1561,7 +1561,7 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *= vdev, int nr) * config offset 0x5C. */ bdsm_size =3D g_malloc(sizeof(*bdsm_size)); - *bdsm_size =3D cpu_to_le64((ggms_mb + gms_mb) * 1024 * 1024); + *bdsm_size =3D cpu_to_le64((ggms_mb + gms_mb) * M_BYTE); fw_cfg_add_file(fw_cfg_find(), "etc/igd-bdsm-size", bdsm_size, sizeof(*bdsm_size)); =20 diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 033cc8dea1..db337476ef 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1408,7 +1408,7 @@ static void vfio_pci_relocate_msix(VFIOPCIDevice *vde= v, Error **errp) } =20 /* 2GB max size for 32-bit BARs, cannot double if already > 1G */ - if (vdev->bars[target_bar].size > (1 * 1024 * 1024 * 1024) && + if (vdev->bars[target_bar].size > 1 * G_BYTE && !vdev->bars[target_bar].mem64) { error_setg(errp, "Invalid MSI-X relocation BAR %d, " "no space to extend 32-bit BAR", target_bar); --=20 2.16.2