From patchwork Fri Jul 24 12:33:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 51439 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id EB7C622D94 for ; Fri, 24 Jul 2015 12:33:25 +0000 (UTC) Received: by lbbvz8 with SMTP id vz8sf7022113lbb.2 for ; Fri, 24 Jul 2015 05:33:24 -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=Hg6WIzNckad5uvPu4jWJmjTSRPEvUmWsk5HzaQdzdXOaxs5arE/zlVAITXDdaIzG4V iYm8guZNJ/Kie5OmlclODPlkBs/m/6q7BdLpSS7ZV20WIntBtrwEyl2ubHZ7SXQFcgKo MCPuTED9p4eNtyX2yheWd6iKwWE1fvBrDeyHzyvyqYcEgfbTLwrJkGN/SJCacvi+UtpU ECri6QxyR17q9yHnTOQFoTy50O3qMjX2QsnMTRGrlPqJGZ8ytH4r6kxIRGA9KDV1u6Je iMdCMDExaonCyWURsDMKJC3aSj2sMw9lrYLpagGpUU9G/rOqUsIX3B+ZHsfe8nc6szVF enlA== X-Gm-Message-State: ALoCoQn2Y8HbS5eAL2XpC0CZFbuFJfIQd9CHqsvO5T3kxmW2vvlSp7NwC3NFLJxVyvnq8ypZGBav X-Received: by 10.152.237.36 with SMTP id uz4mr6098972lac.1.1437741204883; Fri, 24 Jul 2015 05:33:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.104 with SMTP id u8ls388347lae.31.gmail; Fri, 24 Jul 2015 05:33:24 -0700 (PDT) X-Received: by 10.112.24.233 with SMTP id x9mr13747850lbf.7.1437741204738; Fri, 24 Jul 2015 05:33:24 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id a5si7390218lbq.168.2015.07.24.05.33.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 05:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbyj8 with SMTP id yj8so14287920lbb.0 for ; Fri, 24 Jul 2015 05:33:24 -0700 (PDT) X-Received: by 10.112.55.207 with SMTP id u15mr13393608lbp.88.1437741204653; Fri, 24 Jul 2015 05:33:24 -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 l6csp1150341lba; Fri, 24 Jul 2015 05:33:23 -0700 (PDT) X-Received: by 10.66.65.205 with SMTP id z13mr30786939pas.65.1437741200642; Fri, 24 Jul 2015 05:33:20 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id u4si11751044pdm.243.2015.07.24.05.33.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 24 Jul 2015 05:33:20 -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 1ZIcA4-0005Se-So; Fri, 24 Jul 2015 13:33:12 +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 v2 3/6] hw/block/nvme.c: Use pow2ceil() rather than hand-calculation Date: Fri, 24 Jul 2015 13:33:09 +0100 Message-Id: <1437741192-20955-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437741192-20955-1-git-send-email-peter.maydell@linaro.org> References: <1437741192-20955-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.177 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);