From patchwork Mon Oct 14 16:02:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 176263 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4715071ill; Mon, 14 Oct 2019 09:14:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLY578duABykKAm97/sS1IYOaaSiTvLO/HMLj4SlaFPGaPSI3TMQpo4YIxIICd057xP72J X-Received: by 2002:a17:906:360e:: with SMTP id q14mr29006559ejb.313.1571069665638; Mon, 14 Oct 2019 09:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571069665; cv=none; d=google.com; s=arc-20160816; b=kxQsGUbtdCV3Xs+SudTRzzD0y2wIIQxXkX83uh+rRj3hH40QHYWOAblnjkmDhCavEL AfIJd1o7XDuyRVKnVXZPtE8ezr0JtC1u2B2Q2JuQcqc4hqwuVK1lZbYicsesJZbIWwdS SctkjhD9lpnZQb3m0+JViCNwtlB5VR/zZA3XiBwMHjqXCdtW2PpAgU84wKUtdMMtivtK ScKR5Nv0igD7ilHyE+wQ4gOC8s6TrG3jhPfu+JPXZW2MtVx3oZLcvme6uK4idd821lBU wmoH8bDci+cRY8gt4i16Bl+nRVfJ0AtEBhIPUY5o3NBzytJlnTbPVWeyWNAv8DFfccFP cOlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mUu/crkcybfRwlc27TBLyKHlAqm7Yf19HYM5Zi4VawI=; b=y25R3dMDjTV0gTy+n7F8v6j4KmEByIqmU+I4SqBjmGUYH9QE4YWt/2GUKwHDN8Lecx jkvtpoi9t7vjl2Ddj2uSTS5G3maStpmKJSlI6ZEa+Pr+4r5SN3DJAI5jZOQJsJrXGfqO RVBs6UMIGf7UDvO6m8rbRjvuqO0gww73IInXKfbhTD+oxo/oCZFrpekpsLpAtF+R23Jy gbv8Ym0dQSt/xZgBjjrGItMGsl3QYNd133YQQKr3sjBzJOlkPndYeyN/JAmJnQqxmpyN NTPXzCT8Rjx1Gqy7l6BON7mBuN8MzIZVmo1kVkXamk25JJJe14cLsu7pFberiR3rzGW3 EVvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRVbvWRz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q4si11517804eji.152.2019.10.14.09.14.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 09:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cRVbvWRz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iK2zI-0007TE-5w for patch@linaro.org; Mon, 14 Oct 2019 12:14:24 -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) 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-Received: by 2002:a05:6000:103:: with SMTP id o3mr2571323wrx.357.1571069053252; Mon, 14 Oct 2019 09:04:13 -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) 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 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger Host kernel within [4.18, 5.3] report an erroneous KVM_MAX_VCPUS=512 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(-) -- 2.20.1 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) int kvm_arch_init(MachineState *ms, KVMState *s) { + int ret = 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) cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE); - 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 = -EINVAL; + } + + return ret; } unsigned long kvm_arch_vcpu_id(CPUState *cpu)