From patchwork Thu Jul 23 11:08:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 51389 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id CCEF820323 for ; Thu, 23 Jul 2015 11:09:03 +0000 (UTC) Received: by laah7 with SMTP id h7sf40387643laa.2 for ; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=tyZ9UI+2C09F/dAF+fFiLxzBDwzkucJqfBRGfhZCUb8=; b=OHskFudDKUUXespFfh5/93G7OqxoUSADdbiHVLhyNSTTudcuIhMmqsMGV30q4K0TTE C82A0mY6EG1lLvpyh3+4m6hj4xvbOdVqGApkGPhcoB/aErxiTGVeIT4FPLUR1JyfA+zW X1pSOY660Mhj0ptrA6j5oCIsQcLzj1v3DvT/mAxC8ozlLjEsud9dhRIfmVxdyNfr8yX2 Fa9Y1wuHe6Y54NCWtsBqXDzecNhZoFKCArnq95saZXloHTyj3y0hPHY+7iXv+KsmnhjY JbHeY4UxIDjKzEaPFk92YZGsgbWCnMrai7iIMnedpUTTHsUeDXhOMUynB9uJThksy4Z0 O4nA== X-Gm-Message-State: ALoCoQkj0HfH7AxcWJP4ao0LhhnXHRdXQ3kn3KjWq/Vf/PqrYZebkRw8mGNeSZD/yNwb/NofJo2d X-Received: by 10.180.79.10 with SMTP id f10mr10376054wix.3.1437649742446; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.101 with SMTP id z5ls198737laz.65.gmail; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) X-Received: by 10.112.205.161 with SMTP id lh1mr7211618lbc.43.1437649742289; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id yg5si3880937lab.174.2015.07.23.04.09.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jul 2015 04:09:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbqi7 with SMTP id qi7so74813684lbb.3 for ; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr7396530lak.56.1437649742157; Thu, 23 Jul 2015 04:09:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.7.198 with SMTP id l6csp486427lba; Thu, 23 Jul 2015 04:09:01 -0700 (PDT) X-Received: by 10.152.205.67 with SMTP id le3mr7267078lac.50.1437649741681; Thu, 23 Jul 2015 04:09:01 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id xh9si3893332lac.122.2015.07.23.04.09.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Jul 2015 04:09:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZIEN0-0003cc-J8; Thu, 23 Jul 2015 12:08:58 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Paolo Bonzini , Keith Busch , Kevin Wolf , "Michael S. Tsirkin" , qemu-block@nongnu.org Subject: [PATCH 3/5] hw/block/nvme.c: Use pow2ceil() rather than hand-calculation Date: Thu, 23 Jul 2015 12:08:56 +0100 Message-Id: <1437649738-13885-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437649738-13885-1-git-send-email-peter.maydell@linaro.org> References: <1437649738-13885-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use pow2ceil() to round up to the next power of 2, rather than an inline calculation. Signed-off-by: Peter Maydell --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 40d4880..5da41b2 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -805,7 +805,7 @@ static int nvme_init(PCIDevice *pci_dev) n->num_namespaces = 1; n->num_queues = 64; - n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4); + n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); n->ns_size = bs_size / (uint64_t)n->num_namespaces; n->namespaces = g_new0(NvmeNamespace, n->num_namespaces);