From nobody Wed Oct 29 06:55:00 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; 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 1513515531847419.8129581273578; Sun, 17 Dec 2017 04:58:51 -0800 (PST) Received: from localhost ([::1]:54063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQYWg-0008OP-Nq for importer@patchew.org; Sun, 17 Dec 2017 07:58:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQYTI-0006S1-8x for qemu-devel@nongnu.org; Sun, 17 Dec 2017 07:55:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQYTF-0005vl-SB for qemu-devel@nongnu.org; Sun, 17 Dec 2017 07:55:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46670) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eQYTF-0005v2-Le for qemu-devel@nongnu.org; Sun, 17 Dec 2017 07:55:09 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id B17255F7B7; Sun, 17 Dec 2017 12:55:08 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D1157A214; Sun, 17 Dec 2017 12:55:06 +0000 (UTC) From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Sun, 17 Dec 2017 14:54:53 +0200 Message-Id: <20171217125457.3429-2-marcel@redhat.com> In-Reply-To: <20171217125457.3429-1-marcel@redhat.com> References: <20171217125457.3429-1-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 17 Dec 2017 12:55:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH V2 1/5] pci/shpc: Move function to generic header file 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: ehabkost@redhat.com, mst@redhat.com, yuval.shaia@oracle.com, pbonzini@redhat.com, marcel@redhat.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yuval Shaia This function should be declared in generic header file so we can utilize it. Signed-off-by: Yuval Shaia Signed-off-by: Marcel Apfelbaum Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci/shpc.c | 11 +---------- include/qemu/cutils.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c index 69fc14b218..3d22424fd2 100644 --- a/hw/pci/shpc.c +++ b/hw/pci/shpc.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/range.h" #include "qemu/error-report.h" #include "hw/pci/shpc.h" @@ -122,16 +123,6 @@ #define SHPC_PCI_TO_IDX(pci_slot) ((pci_slot) - 1) #define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1) =20 -static int roundup_pow_of_two(int x) -{ - x |=3D (x >> 1); - x |=3D (x >> 2); - x |=3D (x >> 4); - x |=3D (x >> 8); - x |=3D (x >> 16); - return x + 1; -} - static uint16_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk) { uint8_t *status =3D shpc->config + SHPC_SLOT_STATUS(slot); diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index f0878eaafa..4895334645 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -164,4 +164,14 @@ bool test_buffer_is_zero_next_accel(void); int uleb128_encode_small(uint8_t *out, uint32_t n); int uleb128_decode_small(const uint8_t *in, uint32_t *n); =20 +static inline int roundup_pow_of_two(int x) +{ + x |=3D (x >> 1); + x |=3D (x >> 2); + x |=3D (x >> 4); + x |=3D (x >> 8); + x |=3D (x >> 16); + return x + 1; +} + #endif --=20 2.13.5