From nobody Thu Dec 18 17:54:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571069709; cv=none; d=zoho.com; s=zohoarc; b=QTg8jTGErFsl9Cyx8jdEKUiP9a4LGzuX2SHKk12yLcLaRwuZWIhxkPtI03P+eJwXD5Q4wdfrDFRXwloBUXDwzO2PYIY5uu86reL0MrCheOGAq/8FARByNVj07PscCTUZaCLyzUFenE08F1cjTGdfTutbINWzO4/QeyPZr0fAbAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571069709; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mUu/crkcybfRwlc27TBLyKHlAqm7Yf19HYM5Zi4VawI=; b=XCAbG3iTzljPaxwleqHH9Pf6xcbS2t26h+C4p8UKsWPS++fgzBc577Fvu26NeRKPz3z3LWEvaT7W4GVGdVIeKA4aM0d4ujMBk6iH/FhJcvAq+fIfbmNN6/NQ21KQLkkEunrqJzt2/kyrNWS0pZlutwS4NhEBrSjINf2tfmlyvp8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571069709086695.4034234973462; Mon, 14 Oct 2019 09:15:09 -0700 (PDT) Received: from localhost ([::1]:52964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2zz-0001GR-W8 for importer@patchew.org; Mon, 14 Oct 2019 12:15:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36595) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2pU-0003JA-BD for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iK2pT-0006ns-5O for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:16 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:46859) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iK2pS-0006mq-QL for qemu-devel@nongnu.org; Mon, 14 Oct 2019 12:04:15 -0400 Received: by mail-wr1-x443.google.com with SMTP id o18so20326772wrv.13 for ; Mon, 14 Oct 2019 09:04:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 5sm18029779wrk.86.2019.10.14.09.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 09:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mUu/crkcybfRwlc27TBLyKHlAqm7Yf19HYM5Zi4VawI=; b=cRVbvWRzpP/t9q006tIEyolsGUNF2FY1DqySFPOGmDnfrTco8kNvk7QUeTcd4WTTR1 jpoZLILBUwa8xYzcPWAgsa3ElXYU8tc/TWzrecF/EKnf/nMw5nsB1koGJDtUfL2yMEmF hc1qhcVXIBujzThAr6CDO9fFGKpJ+M0If1o83Q+7mJrgms9NGBQf0KkZBV8jE4gJfZU1 nhUkrfRBPG6JwILq5kWY9CgrBtGo9TKl1Vu/AXRJAkLOdTCq0a9EXQSrIlKF38tR62te yDgEIsgNgD1htANQsnhKMPxbq8DyYf+w/SS3Ef9gElZsZCeX93n9c5Sji5f/jGFD5THy uzZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mUu/crkcybfRwlc27TBLyKHlAqm7Yf19HYM5Zi4VawI=; b=pdZlbqLNHFmXHw7tLJQVM394NoEf2sqGPyarTCYJp3Ji17TlWwmxtmI0lOUfJ1y/ot PcRsjfF0lFAbKi4TrQ9tmE6XRd87dDTduD6GTok9AYg2+obNJcjnfxfvb4k5gjHMy4Td CuNi00BxM2/oyLDOE6wTencL6siHfFH1gHMiwV5XEjODPQ/Gkn5ODYkfhhBrimQx5vFl 55OM7aECV79Xbb2dt9X3b3AIothsW21iD6TYKL4Md5p4spDgwOvA3cl0uAtNzEoYcXfc QuuD/D95oGf4oDUtzGQHpsoqymm21fsOt+VXUl0z7H/WJmLO5Me3zE55AfH4zYW3DXPk 2uoQ== X-Gm-Message-State: APjAAAXjXQ7Phnotm+wK2htocpCP4kHkWnQEiqiKLwcj9WEqv1NQmmg6 t/aIif6N3NLE+SZuj6zewvkqcNcU3QLARA== X-Google-Smtp-Source: APXvYqzTtWuwrQpkW5CHvUZ0baiGO5wUSdFoGL3DyrIJdXpQnuzj1YZc2uABKj5rrrxaB+ebZhVuZQ== X-Received: by 2002:a05:6000:103:: with SMTP id o3mr2571323wrx.357.1571069053252; Mon, 14 Oct 2019 09:04:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/68] ARM: KVM: Check KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 for smp_cpus > 256 Date: Mon, 14 Oct 2019 17:02:59 +0100 Message-Id: <20191014160404.19553-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014160404.19553-1-peter.maydell@linaro.org> References: <20191014160404.19553-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Eric Auger Host kernel within [4.18, 5.3] report an erroneous KVM_MAX_VCPUS=3D512 for ARM. The actual capability to instantiate more than 256 vcpus was fixed in 5.4 with the upgrade of the KVM_IRQ_LINE ABI to support vcpu id encoded on 12 bits instead of 8 and a redistributor consuming a single KVM IO device instead of 2. So let's check this capability when attempting to use more than 256 vcpus within any ARM kvm accelerated machine. Signed-off-by: Eric Auger Reviewed-by: Richard Henderson Reviewed-by: Andrew Jones Acked-by: Marc Zyngier Message-id: 20191003154640.22451-4-eric.auger@redhat.com Signed-off-by: Peter Maydell --- target/arm/kvm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index b10581fa066..b473c63edb1 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -182,6 +182,7 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms) =20 int kvm_arch_init(MachineState *ms, KVMState *s) { + int ret =3D 0; /* For ARM interrupt delivery is always asynchronous, * whether we are using an in-kernel VGIC or not. */ @@ -195,7 +196,14 @@ int kvm_arch_init(MachineState *ms, KVMState *s) =20 cap_has_mp_state =3D kvm_check_extension(s, KVM_CAP_MP_STATE); =20 - return 0; + if (ms->smp.cpus > 256 && + !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) { + error_report("Using more than 256 vcpus requires a host kernel " + "with KVM_CAP_ARM_IRQ_LINE_LAYOUT_2"); + ret =3D -EINVAL; + } + + return ret; } =20 unsigned long kvm_arch_vcpu_id(CPUState *cpu) --=20 2.20.1