Message ID | 20170509104506.30929-30-cdall@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 157EF60237 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 9 May 2017 10:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0860522701 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 9 May 2017 10:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF69B2833C; Tue, 9 May 2017 10:51:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 65C8822701 for <patchwork-linux-arm@patchwork.kernel.org>; Tue, 9 May 2017 10:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=d+so9PH8DFg0vYJxCVirPxN5SBAQXvb82v0AFLA+zTs=; b=jy/cHLhOZ9SYYB9fmxRnwIhbZ4 UcnUSwS8pYTeZ4m9adtALxn6mkTD2AhcyBiiL5/YYq9CO+oUk4AoOWa2MN3rQ1UCq4uDiVNNS73+q 8immh8fi9RJi600k3pvm5/bjBh/Ijlt00UFXaGDmofJWZ+DNuOXxqZl0izcRgBc+U7Tvp0TAcyZ9j ZRmvd2In7MTWZGIwENETLlMkVXvWfnxLc7FWYeWN+1KAm2i1oymj3P10xFYLwhHA69tgbuihjAraT +kVL94OYrDDQMpoYOXOZC6/CL3ymZiSzklUYgyn5EQkO6GmFhwjiw7dABwZH3XPvnSz6aSEmmYYek JzFMo16A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d82jo-0002NW-So; Tue, 09 May 2017 10:51:28 +0000 Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d82eV-0002uc-NX for linux-arm-kernel@lists.infradead.org; Tue, 09 May 2017 10:46:06 +0000 Received: by mail-qk0-x22c.google.com with SMTP id y201so42668289qka.0 for <linux-arm-kernel@lists.infradead.org>; Tue, 09 May 2017 03:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bJfEH7/cSysvX02HdqqLQB0iZrMlHqholvxFjcFwqzw=; b=OThIb/q5jrLwh4nkAOs/Ni/JTUWdQKLM6jJzbL97MFk9b0xQGaaFSy9a57EFzE54S7 QJdyqTOTn8s3OUfDrzbQjtD+tNxl0tjS6MXSR0lGOyy27fcpVk4GVM2asjaCxqnkt5zb H4iOUXxIPFeMqjs+HQz60e27D4+RJ6h2v/vdY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bJfEH7/cSysvX02HdqqLQB0iZrMlHqholvxFjcFwqzw=; b=jVv0ZLNAPcpRSmva+s1VbEyj/zjC+LHuLEY4lY0xczxpUQiSRTJtjTv6a0ubjdpD0d m+Cq+oWD7XIPzUulgbXzypX9+RD0iw2p3eb41hR6L0JaYZ6jLjQMNNOKAYf/TNTy3cuz B23HlOGcVdkSrj06hO8rIzOG5EvDQ1nztM8sxwS5n6iJ3TXgUIfINvc+fgXTV/BxQkne gcKq1xbSk666osk25fqNxVDgPtdxfTlWFbw58Caug5llNvMVy3pFrJ+Lmvwp8jmQc57k SLvulvr1xDSC0dp6+uyl3B60t/p6eyxuQQdPTOn5YcvwILBQ/LOK0qtHx0x6uhexASza 789A== X-Gm-Message-State: AN3rC/5rgDc5gGp+4TEr+4BtSuoAaCPSE2vXSBCyAdrpQrIkCrwEBIR4 lq/Y2QtwkLmIjWsQBhTX5w== X-Received: by 10.80.134.115 with SMTP id 48mr21268213edt.26.1494326740024; Tue, 09 May 2017 03:45:40 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id o30sm2331510edc.42.2017.05.09.03.45.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 03:45:39 -0700 (PDT) From: Christoffer Dall <cdall@linaro.org> To: Paolo Bonzini <pbonzini@redhat.com>, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com> Subject: [PULL 29/37] KVM: Add kvm_vcpu_get_idx to get vcpu index in kvm->vcpus Date: Tue, 9 May 2017 12:44:58 +0200 Message-Id: <20170509104506.30929-30-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170509104506.30929-1-cdall@linaro.org> References: <20170509104506.30929-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170509_034600_705310_ABC28CCF X-CRM114-Status: GOOD ( 11.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Christoffer Dall <cdall@linaro.org>, kvm@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>, Eric Auger <eric.auger@redhat.com>, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 2c14ad9..12eb26d 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -490,6 +490,17 @@ static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id) return NULL; } +static inline int kvm_vcpu_get_idx(struct kvm_vcpu *vcpu) +{ + struct kvm_vcpu *tmp; + int idx; + + kvm_for_each_vcpu(idx, tmp, vcpu->kvm) + if (tmp == vcpu) + return idx; + BUG(); +} + #define kvm_for_each_memslot(memslot, slots) \ for (memslot = &slots->memslots[0]; \ memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\