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: 9717575 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 C1A6760237 for ; Tue, 9 May 2017 10:47:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4175283F9 for ; Tue, 9 May 2017 10:47:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8D472833C; Tue, 9 May 2017 10:47:13 +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=unavailable 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 362D8204C2 for ; Tue, 9 May 2017 10:47:13 +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=z5Ii5RXqONwBfI1J+re44PdgoXEqrHccdoJ8R9738bs=; b=cJyScnoyzLtO7x3VS5od1V1Uyx I96nP1F9gDV7MtVaNaQlw2szQxsRJVMT5PLmkZG1ye17JoKvbyFKHtyRkphdsMwI6aBagZeiO/KpY Vrq6tT3bU14Qswjue/Cx9MYO/8ihdoctI5BdLDcwZIvSzt4kIAJgElwtHBLgGn7uLzwIA3MRyf4z0 8njcRYMHQ8zLOiMPZi0RDHbpWWUDW5oiOQGlpp/Co9b2PmPF+CQReXNwTidyKSo7KlCso/q5/kWPx i4Zka66tUkwuqvkwqARMm2jbvOes3HveooIDg2psYqPGfCs3RH6vbWU5JlPeTSnipK6RF3FylGHrc W5kxq2+g==; 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 1d82fg-0004rO-5v; Tue, 09 May 2017 10:47:12 +0000 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d82eC-0002qO-4L for linux-arm-kernel@lists.infradead.org; Tue, 09 May 2017 10:45:43 +0000 Received: by mail-qk0-x22b.google.com with SMTP id k74so75277071qke.1 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=hYCXU8HQNjtCZPmZSPMOpCX6Cywx0Mv8wb6VWewSlk+AmRDMKDGGTE96pVvKSOaXTH gBP4sLT4vAUZWyLifHwtfIzXDdkn1dUYg6zkFpF/yANkYZU8BhKORZkY1fp5zKOdkF+9 HDXq8+5S3pQk+G0sceQD1NjRw8SBPjk6d5kD8EdCJuy74z7N3rb1rW34yly1rHjjxQ7U KKhcWYJGK/f1KZ08zFNV9KPr2lHZkaQMlR6v+tAJuhBgWbUf2z1Qb6rH5s0N7ZyWrnF6 6N4fEEtGGmYYMMUV3aVcM90CHPS4Uxi1Kwly23CHD64u3YuEmDOczt5oIxpvrsKzayxC M5+w== X-Gm-Message-State: AN3rC/6Aowf6GVfJwFOUEsMv0fcFNSjPg/VPnHwMz1IXIxZwyVgg0qWW vWBEoMcwUSM6BLNv 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170509_034540_427076_BA99AD0F X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Eric Auger , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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