From patchwork Thu Jun 19 09:21:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 32188 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 783E9206A0 for ; Thu, 19 Jun 2014 09:33:29 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id o8sf6079571qcw.11 for ; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=wxNt0ockQUFLa3nrIUhR1xw4f6sRuc3QGdNUixdYpKo=; b=mSGPqXc1cZ1P0SjKXKGZFAXevqZnmV5/1s2BNSF0+cm/7UagCUn9JDmV8ttE8AvQ2E S0JBqlDbf0Nx4mvspj/5fKS0olFSlMl1eyEs4cYq+jfrNkiQCP+jIVapVRszWFr12Ycy YMiO9aAWe4ZrhkL4ytSqYYo8XKxV9GqWLgb/axDUVzUJFVbhrugqvJAt18NMp/6pVed/ t+WDpK8eUc6yGrBylD49KiOUEGEgxXCf6tAeUD+ShPUzOlUncNDhcYoMtARw4aeruDfx vvhJD+9/kfChrS1xdPckXGvQkruhrH4mhFoRxjaLmZj76CC0NrkA7SR+ECqdbn7EPzfA YaBA== X-Gm-Message-State: ALoCoQnPrHumk14so349TOSEtBl1TK0RG9CJw2v5kE9YaT8r0ltvJsZ0s8iHtiNmcAhL/K+ILBsf X-Received: by 10.224.43.202 with SMTP id x10mr1704300qae.0.1403170409249; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.7 with SMTP id l7ls485663qge.63.gmail; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr2993722veb.11.1403170409162; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ds1si2112178vec.32.2014.06.19.02.33.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Jun 2014 02:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so1955543vcb.23 for ; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) X-Received: by 10.58.8.12 with SMTP id n12mr3122267vea.28.1403170409063; Thu, 19 Jun 2014 02:33:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp348787vcb; Thu, 19 Jun 2014 02:33:28 -0700 (PDT) X-Received: by 10.224.34.73 with SMTP id k9mr1472783qad.11.1403170408644; Thu, 19 Jun 2014 02:33:28 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id l4si5778205qag.11.2014.06.19.02.33.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 02:33:28 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxYgn-0003w5-5N; Thu, 19 Jun 2014 09:31:25 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WxYXe-0001B4-DR for linux-arm-kernel@lists.infradead.org; Thu, 19 Jun 2014 09:21:59 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.143]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 0ADC313FABF; Thu, 19 Jun 2014 04:21:37 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v2 4/9] arm/arm64: KVM: vgic: kill VGIC_MAX_CPUS Date: Thu, 19 Jun 2014 10:21:28 +0100 Message-Id: <1403169693-13982-5-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1403169693-13982-1-git-send-email-marc.zyngier@arm.com> References: <1403169693-13982-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140619_022158_539215_FC8AB9B8 X-CRM114-Status: GOOD ( 13.03 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 We now have the information about the number of CPU interfaces in the distributor itself. Let's get rid of VGIC_MAX_CPUS, and just rely on KVM_MAX_VCPUS where we don't have the choice. Yet. Signed-off-by: Marc Zyngier --- arch/arm/kvm/arm.c | 2 +- include/kvm/arm_vgic.h | 3 +-- virt/kvm/arm/vgic.c | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 9548bc9..14ba035 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -811,7 +811,7 @@ long kvm_arch_vm_ioctl(struct file *filp, switch (ioctl) { case KVM_CREATE_IRQCHIP: { if (vgic_present) - return kvm_vgic_create(kvm, VGIC_MAX_CPUS, VGIC_NR_IRQS); + return kvm_vgic_create(kvm, KVM_MAX_VCPUS, VGIC_NR_IRQS); else return -ENXIO; } diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index b5072b7..5853a67 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -29,13 +29,12 @@ #define VGIC_NR_SGIS 16 #define VGIC_NR_PPIS 16 #define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS) -#define VGIC_MAX_CPUS KVM_MAX_VCPUS #define VGIC_V2_MAX_LRS (1 << 6) #define VGIC_V3_MAX_LRS 16 /* Sanity checks... */ -#if (VGIC_MAX_CPUS > 8) +#if (KVM_MAX_VCPUS > 8) #error Invalid number of CPU interfaces #endif diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 4b1f0a6..07b6450 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1184,7 +1184,7 @@ static bool vgic_queue_sgi(struct kvm_vcpu *vcpu, int irq) sources = *vgic_get_sgi_sources(dist, vcpu_id, irq); - for_each_set_bit(c, &sources, VGIC_MAX_CPUS) { + for_each_set_bit(c, &sources, dist->nr_cpus) { if (vgic_queue_irq(vcpu, c, irq)) clear_bit(c, &sources); } @@ -1564,7 +1564,7 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) if (ret) return ret; - if (vcpu->vcpu_id >= VGIC_MAX_CPUS) + if (vcpu->vcpu_id >= dist->nr_cpus) return -EBUSY; for (i = 0; i < VGIC_NR_IRQS; i++) { @@ -2193,7 +2193,7 @@ static void vgic_destroy(struct kvm_device *dev) static int vgic_create(struct kvm_device *dev, u32 type) { - return kvm_vgic_create(dev->kvm, VGIC_MAX_CPUS, VGIC_NR_IRQS); + return kvm_vgic_create(dev->kvm, KVM_MAX_VCPUS, VGIC_NR_IRQS); } struct kvm_device_ops kvm_arm_vgic_v2_ops = {