From patchwork Mon Jan 14 17:33:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 1973061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 461033FD86 for ; Mon, 14 Jan 2013 17:35:59 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TunuJ-0006pJ-Tf; Mon, 14 Jan 2013 17:33:14 +0000 Received: from mail-vb0-f45.google.com ([209.85.212.45]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TunuE-0006od-Sp for linux-arm-kernel@lists.infradead.org; Mon, 14 Jan 2013 17:33:07 +0000 Received: by mail-vb0-f45.google.com with SMTP id p1so3778181vbi.18 for ; Mon, 14 Jan 2013 09:33:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=q/h2UHrPOTDcoUy5RNR8yrjB3TzFwaZjrK1APGVu6nI=; b=doXttPAakWVKvdCoo0iyZmdK+wy24PexnOD14eTHL9RryRuLTjbyvypfahAk1/5KHD hVncfWEr28+kCALH/Ixye+nzyPmiMi2Uz+282W89aRoZI/pYaxuppw74SVvX8uBjsW2e 2jubuEHF2OzrSJ0CtufDKy78Np6Gjzuqk5MvEFN2G+PdWvorYfZ4Aou5bwc41DZ9fpuP MUnP42mkn9vivLBNWCjkyQb6ZEUDZIKzljbeLBj83O+h4PJ0m74n0Re8oxe71wXLQtBz ni2/1MzUrEu8sabvyG6XXSx0NyXugLWbwSVXYsKs/L+njDvc0yBgqZUvyxeTgL8+hNKk v+Og== MIME-Version: 1.0 Received: by 10.220.241.80 with SMTP id ld16mr13071093vcb.5.1358184785895; Mon, 14 Jan 2013 09:33:05 -0800 (PST) Received: by 10.221.7.71 with HTTP; Mon, 14 Jan 2013 09:33:05 -0800 (PST) X-Originating-IP: [72.80.83.148] In-Reply-To: <20130114162415.GF23505@n2100.arm.linux.org.uk> References: <20130108183811.46302.58543.stgit@ubuntu> <20130108183855.46302.40539.stgit@ubuntu> <20130114162415.GF23505@n2100.arm.linux.org.uk> Date: Mon, 14 Jan 2013 12:33:05 -0500 Message-ID: Subject: Re: [PATCH v5 03/14] KVM: ARM: Initial skeleton to compile KVM support From: Christoffer Dall To: Russell King - ARM Linux X-Gm-Message-State: ALoCoQmgdyIb5x2U/V2hNSeJ+mll3j05aUg/NYSOmvfH68Yz1j7v8c3+JtNe/tmUFwm83b3rduaJ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130114_123307_008527_DE43A29E X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.45 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kvm@vger.kernel.org, Marc Zyngier , Marcelo Tosatti , Rusty Russell , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Jan 14, 2013 at 11:24 AM, Russell King - ARM Linux wrote: > On Tue, Jan 08, 2013 at 01:38:55PM -0500, Christoffer Dall wrote: >> + /* -ENOENT for unknown features, -EINVAL for invalid combinations. */ >> + for (i = 0; i < sizeof(init->features)*8; i++) { >> + if (init->features[i / 32] & (1 << (i % 32))) { > > Isn't this an open-coded version of test_bit() ? indeed, nicely spotted: commit 608588674144e403ad0ea3c93066f3175bd5cf88 Author: Christoffer Dall Date: Mon Jan 14 12:30:07 2013 -0500 KVM: ARM: Use test-bit instead of open-coded version Makes the code more readable, also adds spaces around the asterisk. Cc: Russell King Signed-off-by: Christoffer Dall --- Thanks, -Christoffer diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 65ae563..2339d96 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -193,8 +193,8 @@ int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES); /* -ENOENT for unknown features, -EINVAL for invalid combinations. */ - for (i = 0; i < sizeof(init->features)*8; i++) { - if (init->features[i / 32] & (1 << (i % 32))) { + for (i = 0; i < sizeof(init->features) * 8; i++) { + if (test_bit(i, (void *)init->features)) { if (i >= KVM_VCPU_MAX_FEATURES) return -ENOENT; set_bit(i, vcpu->arch.features);