From patchwork Tue May 9 10:44:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9717567 Return-Path: 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 ABE7360237 for ; Tue, 9 May 2017 10:46:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DDD8282E8 for ; Tue, 9 May 2017 10:46:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92CC7283F2; Tue, 9 May 2017 10:46:48 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE06282E8 for ; Tue, 9 May 2017 10:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753195AbdEIKqq (ORCPT ); Tue, 9 May 2017 06:46:46 -0400 Received: from mail-qk0-f180.google.com ([209.85.220.180]:36490 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331AbdEIKpT (ORCPT ); Tue, 9 May 2017 06:45:19 -0400 Received: by mail-qk0-f180.google.com with SMTP id u75so75009691qka.3 for ; Tue, 09 May 2017 03:45:19 -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=qAfs++hSspfldOOZ5HrSRXLLFvOJQi/YGtjLubkTXSU=; b=h8EqSMdPUu4Ra2tgrJGJhSS5oknjeY9FI7oUQqhIw2aENn6dCtRIdE0xZqUwk4LqOu 3E35RRjXxDwGDcO/rVkoanne2tYwAx6r7D0ImMQmIKNgVVu1+oF14y+6iehLFvY/JJ6k DQfYmn550q7cu+PndB6kTKLSqiBQq+KUOR1X8= 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=qAfs++hSspfldOOZ5HrSRXLLFvOJQi/YGtjLubkTXSU=; b=IeQ28gV4BNGFmJn4A19steehBubl4+NnUqmdQwZSkknfTWB/q9b0J7P3Gh+pELz9it kYw11tlr+OjodEX+AHQRC9HKs1Jmqndsp3KxB14MTsStjVX2IThCDIf2S/LU5ahprW4T pds6WNY5TaiGvKH6JjFlNUGUUF3BmmkdqjDfj2EzLoYjdnyBERxcD+amLq950aeJ3Wvr RQz0qHPhoccyl8gvVAqg2NRxLs0GEfuwMEAugT3P/q0HfPl4kBwizyigQHXGfqGpS4FL in2K+h8x+2qokpf6JGzt/PSKeGJykLlrzJ2Ct0TAwwywX0E2YgSndWiase288HYmNMnD zy4Q== X-Gm-Message-State: AN3rC/6NfZjUcVA8MjZI8LCqp2r+WmuWBCbSQP1toIua7XrPMV4CKR4y o20fMpuTjBjAXMr2 X-Received: by 10.80.134.208 with SMTP id 16mr47574135edu.67.1494326718912; Tue, 09 May 2017 03:45:18 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 03:45:18 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Eric Auger Subject: [PULL 06/37] arm/arm64: vgic: turn vgic_find_mmio_region into public Date: Tue, 9 May 2017 12:44:35 +0200 Message-Id: <20170509104506.30929-7-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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Auger We plan to use vgic_find_mmio_region in vgic-its.c so let's turn it into a public function. Also let's take the opportunity to rename the region parameter into regions to emphasize this latter is an array of regions. Signed-off-by: Eric Auger Reviewed-by: Andre Przywara Acked-by: Marc Zyngier Acked-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-mmio.c | 11 +++++------ virt/kvm/arm/vgic/vgic-mmio.h | 5 +++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c index 2a5db13..1c17b2a 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.c +++ b/virt/kvm/arm/vgic/vgic-mmio.c @@ -446,13 +446,12 @@ static int match_region(const void *key, const void *elt) return 0; } -/* Find the proper register handler entry given a certain address offset. */ -static const struct vgic_register_region * -vgic_find_mmio_region(const struct vgic_register_region *region, int nr_regions, - unsigned int offset) +const struct vgic_register_region * +vgic_find_mmio_region(const struct vgic_register_region *regions, + int nr_regions, unsigned int offset) { - return bsearch((void *)(uintptr_t)offset, region, nr_regions, - sizeof(region[0]), match_region); + return bsearch((void *)(uintptr_t)offset, regions, nr_regions, + sizeof(regions[0]), match_region); } void vgic_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcr) diff --git a/virt/kvm/arm/vgic/vgic-mmio.h b/virt/kvm/arm/vgic/vgic-mmio.h index 98bb566..6eec91b 100644 --- a/virt/kvm/arm/vgic/vgic-mmio.h +++ b/virt/kvm/arm/vgic/vgic-mmio.h @@ -192,4 +192,9 @@ u64 vgic_sanitise_shareability(u64 reg); u64 vgic_sanitise_field(u64 reg, u64 field_mask, int field_shift, u64 (*sanitise_fn)(u64)); +/* Find the proper register handler entry given a certain address offset */ +const struct vgic_register_region * +vgic_find_mmio_region(const struct vgic_register_region *regions, + int nr_regions, unsigned int offset); + #endif