From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273768; cv=none; d=zohomail.com; s=zohoarc; b=eVDe3a0p4TcwAXirqYmzEzUXiqQaVdU6+svVraHr/VZiWYYJ4dVG/bXiM8ITIChoCKohbCQTsYE/d5JVKsuFfmi0hz0u/Kb3FJPZH51k0bB9f8CJ4yXatE4ya7Wi4RaKK4lyV9k9ldfEK5djyEasqlTCS0m96I/kLfF8cJqjPJM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273768; h=Content-Transfer-Encoding:Cc: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=jf1VGujtece+sgrlTdeq9JiiLbbG5le4coO4jmGjzMs=; b=GCbSFotWtdCe1DaXD64jxjS4tWgqctzmSBsiXf5lWb2qVtaVGEqxivFEhb3i8JrZF3D1axBy8rpyAVcA7dp79JtAPf44aea3n/uKwNKPzKTjVLppTB7Kiq4nLULEDaO3nEp4bdNCX/KJO9euLLYOYfegOhTgW4mzouQ9cu5LgcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1617273768769975.2012260165712; Thu, 1 Apr 2021 03:42:48 -0700 (PDT) Received: from localhost ([::1]:51188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRuml-0000HP-EM for importer@patchew.org; Thu, 01 Apr 2021 06:42:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulH-000736-Pb for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:15 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:46804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulF-0002N4-Sc for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:15 -0400 Received: by mail-ot1-x32d.google.com with SMTP id 68-20020a9d0f4a0000b02901b663e6258dso1647702ott.13 for ; Thu, 01 Apr 2021 03:41:13 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:12 -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 :mime-version:content-transfer-encoding; bh=jf1VGujtece+sgrlTdeq9JiiLbbG5le4coO4jmGjzMs=; b=qVfeYxG05PVTr+WDX4E0hcCtnnuGyFkGgbUy/HDUW9ROB28HCtfQnSlyhxKF4jGTjU Tgc4O4JkleK169+lvjDS+MFLAeXn8ot5/RpB+CqgNukwYVeWfp9UF/ChqS0cIWg7kH9o s5Ktf0DAm5aNdAbdN2/RkyCgslo+dJ93GjCUmCff1ZVunJk48wJERxxzKjGEBQYXca7u ziT2wlz7fUch5+ur+l3PrHXPkKwEJ0f/+1ta4cbUuiLWCFPRZZLey5HYn2/IOQ9wyfbN mYdiKkLVZ7Qyw6/FYh5fC8XaGSWkpmnmwzsMjzsPGVDwlDKsmdXu/eAdr/8+i3RRG6kW t0NQ== 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:mime-version:content-transfer-encoding; bh=jf1VGujtece+sgrlTdeq9JiiLbbG5le4coO4jmGjzMs=; b=IIgZLjOtar+i8i6qr0RqDTNBGTnPzV3tLQE1hBLMKtyu0yK6DYEGZhuy3JiynZ2nq2 iJVXXlqKXNixymmBliVO1v8QTMRmTNU9+/4VYFuA9eC7Ra6rf7R2GcIf3MOL16lkO2h2 Mofm2bjVzHVlzCC0W41bmSdn1mKU/Nwc9P4GeH303b8NIby3aKUItNxJK3xgqbGR+ELt kDa7aI/ChTz7bp9WGou9O7iUyzhChb6RBOG+AwlKGa0mjDuswa5knUHVDo8j79ppQ/kY VVWDKzQ/IRcfeolxmsOxV5h98so7tCOYmELn5QfzZX4R+dm5Mg4+x/xWZxLkZQ9lyh8X 4LZA== X-Gm-Message-State: AOAM533dwg8ptGGBR7j3xC+gxz0whJixFNq8RyKN7+JeMUJ2rP+vTRDP rbshFCXbm4zo9hXrPIOWVFEgLhp5XbUdSXo= X-Google-Smtp-Source: ABdhPJzwpt6fA3TATq9NRPha2pCXNjuHDgXh84k+i5QwOtigvTVGGItzm/pSmdRJtyJRZ5cxeBhpng== X-Received: by 2002:a9d:761a:: with SMTP id k26mr6178705otl.193.1617273672763; Thu, 01 Apr 2021 03:41:12 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 1/6] Update linux header with new arm64 NV macro Date: Thu, 1 Apr 2021 10:40:53 +0000 Message-Id: <87d2a40fa0a6775dd5a6af9b0d1609c1bf2a9610.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=haibo.xu@linaro.org; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Haibo Xu --- linux-headers/asm-arm64/kvm.h | 2 ++ linux-headers/linux/kvm.h | 1 + 2 files changed, 3 insertions(+) diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h index b6a0eaa32a..77b995a26c 100644 --- a/linux-headers/asm-arm64/kvm.h +++ b/linux-headers/asm-arm64/kvm.h @@ -106,6 +106,7 @@ struct kvm_regs { #define KVM_ARM_VCPU_SVE 4 /* enable SVE for this CPU */ #define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5 /* VCPU uses address authentication= */ #define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication= */ +#define KVM_ARM_VCPU_HAS_EL2 7 /* Support nested virtualization */ =20 struct kvm_vcpu_init { __u32 target; @@ -334,6 +335,7 @@ struct kvm_vcpu_events { #define KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS 6 #define KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO 7 #define KVM_DEV_ARM_VGIC_GRP_ITS_REGS 8 +#define KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ 9 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT 10 #define KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_MASK \ (0x3fffffULL << KVM_DEV_ARM_VGIC_LINE_LEVEL_INFO_SHIFT) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 020b62a619..ce4630c4db 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1056,6 +1056,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_ENFORCE_PV_FEATURE_CPUID 190 #define KVM_CAP_SYS_HYPERV_CPUID 191 #define KVM_CAP_DIRTY_LOG_RING 192 +#define KVM_CAP_ARM_EL2 193 =20 #ifdef KVM_CAP_IRQ_ROUTING =20 --=20 2.17.1 From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273909; cv=none; d=zohomail.com; s=zohoarc; b=HVrh8zTOPx/lg4AAqymgbG6Xkp7S+yCBcPjl5xFJfcIr4DoassZcNvNZRSpWYqXW0SmO0i93/kpe6WExlQjHjgeSN0HXK9o10vbQClceFxjb8sBl1WDFK4bVxdLrs0koCGaLqPvEDvoBFsokr3WjwP2+icWhN0C8LxO/7hjCpyY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273909; h=Content-Transfer-Encoding:Cc: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=3J/atxW6sPYnXqaJSp9SobS3v6A+MNQfu9eol6wNQ30=; b=HONEPW9r4LWlB8x72xbmCI9+aqvxMVn0h/F9Yuw7As8C0qBtfBHRN5re9W7upKGTCHYbzWDXZduW4XlCJmBVI6f/LLg4o57kAIIk3IoMvtVaSq9zx6LJby5gzJ6TtUVTJ8DZPrargtVkZc79DWnBdyuCwjDZd9obQeCILAxMkeg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1617273909410699.4507066063436; Thu, 1 Apr 2021 03:45:09 -0700 (PDT) Received: from localhost ([::1]:58860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRup2-0003SN-7g for importer@patchew.org; Thu, 01 Apr 2021 06:45:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulI-00073u-Vb for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:16 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:38541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulG-0002NU-TM for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:16 -0400 Received: by mail-ot1-x32e.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so1704517otk.5 for ; Thu, 01 Apr 2021 03:41:14 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:13 -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 :mime-version:content-transfer-encoding; bh=3J/atxW6sPYnXqaJSp9SobS3v6A+MNQfu9eol6wNQ30=; b=dpKvgMHTPSzyIKbJhiri2sFTjWxsjGFao1XKwc+U6eEhNSxfpoO7HhWzqAGch+d7TV /A9rsjXl4aHUH6N4zrjhhZof+Kd06pyFSVBpgNl+Lj/FmlZtMxEf5gMQtAKGPk8Jl0d8 NREr0VOGv4u830hUNq18l0SWNdEWal6zrLckKCUzNWlCCSqWgXvyZ9yCEVOoixnlLZQl ocG1uyHZv4AVKqJyHTjqKH38Oh2HsRdXp0UlxyqtNkM9XrtfoBf3EFQLlfapItdUJojs q3MLJIHDhZAAZkLPab0eGzG37trWEDyO5+sRrEUVIRn9Sir/g5nhLjwrWpnXdVKeANZI b/ug== 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:mime-version:content-transfer-encoding; bh=3J/atxW6sPYnXqaJSp9SobS3v6A+MNQfu9eol6wNQ30=; b=BwapS4D2o5rQW+D3k+nB6GIzgp9vWCqe9iiyZZ4V9zWSLYbqP9HUxeo1gZ9AiBtOrv JQOl+kkZrJz7OHuYR1HcfdXvXs/RPNL+TM4Kr8jVUvqu7kI1A3s+BgO2FtqZqKjeEmr3 A+WZSlbqHw++8VWQw9ZuUGPq1ie+ikZHQA6l8jz0dIfq0ilTwYBNEbJu7fjuN9rN5c4j jWtfEl/idD6fkagmTQCYbiNOMBiiZnYqurRZ0s0MNc11UEa7QSZtqvsPvgzVHoREg1Rx lKQWNSkoQmtNIj8d/X6U0a1KNwxrpzmaY/++BUl5vH9491EnA5pQLTDYG+pA0MKad+0K 24vg== X-Gm-Message-State: AOAM532cRCv5EKH5lOtHmkvPuYyY4tTDFx1BavbTk9Kvdd7Ir5+jfIff zstAx8F/uVmxmYYBOxE+hvD8iPZT4xz1CKA= X-Google-Smtp-Source: ABdhPJy1B80o/sZrRHmvqhMGCvWUlBQfEw6N8pxa1uRjYJKoyXizTRH42UEsO2bk1dDCijmAghUpUw== X-Received: by 2002:a9d:798a:: with SMTP id h10mr6297800otm.170.1617273673703; Thu, 01 Apr 2021 03:41:13 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 2/6] target/arm/kvm: Add helper to detect el2 when using KVM Date: Thu, 1 Apr 2021 10:40:54 +0000 Message-Id: <65b8771bfecada08bf02c9cf87c2f0f9cdf943b3.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=haibo.xu@linaro.org; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Haibo Xu --- target/arm/kvm64.c | 5 +++++ target/arm/kvm_arm.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index dff85f6db9..9cacaf2eb8 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -721,6 +721,11 @@ bool kvm_arm_steal_time_supported(void) return kvm_check_extension(kvm_state, KVM_CAP_STEAL_TIME); } =20 +bool kvm_arm_el2_supported(void) +{ + return kvm_check_extension(kvm_state, KVM_CAP_ARM_EL2); +} + QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN !=3D 1); =20 void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index 34f8daa377..7d7fc7981b 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -285,6 +285,14 @@ void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **= errp); */ bool kvm_arm_steal_time_supported(void); =20 +/** + * kvm_arm_el2_supported: + * + * Returns: true if KVM can enable el2(nested virtualization) + * and false otherwise. + */ +bool kvm_arm_el2_supported(void); + /** * kvm_arm_aarch32_supported: * @@ -398,6 +406,11 @@ static inline bool kvm_arm_steal_time_supported(void) return false; } =20 +static inline bool kvm_arm_el2_supported(void) +{ + return false; +} + /* * These functions should never actually be called without KVM support. */ --=20 2.17.1 From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273998; cv=none; d=zohomail.com; s=zohoarc; b=AcJUNBacfnNYRr7K3gJr3Qa9UoD6sddv3WfaiS8bWhyeWDEpRWg2Pp4qfEibt9j/rii2ZiQ3TsT/ESjoz9qa+zW7Owk1V4Rqj3lXT2JtyIlE5e/8tS8SYE+L82DLO3hJMgIKPwwioZvA3ZyALiPAwwqlMyHGwksL5kTZIN150rM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273998; h=Content-Transfer-Encoding:Cc: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=+OpEDkbIB7gVmSFeUBZiFRPGe0lGXnIYEfiFDB8srwo=; b=jtI+WllpYKgsmudyK8U67/x083gwQJd2SaaRGzRO/LLDC3iAfgv+qaIn026zFLv2GjYgqg70bjPbLeBQMBCed7jM2eCa8aBHh5iDFP3FN2EMir/WWSvcFYVUhHlvS6KT0dwnIRj96q+1Kvcf+KHh8CrcA6avn65ygxTjIwCCGtA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 161727399890310.5854543870106; Thu, 1 Apr 2021 03:46:38 -0700 (PDT) Received: from localhost ([::1]:35716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRuqT-0005fc-Sg for importer@patchew.org; Thu, 01 Apr 2021 06:46:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulJ-00075I-PU for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:17 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]:40739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulI-0002Oq-0k for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:17 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id j20-20020a4ad6d40000b02901b66fe8acd6so442052oot.7 for ; Thu, 01 Apr 2021 03:41:15 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:14 -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 :mime-version:content-transfer-encoding; bh=+OpEDkbIB7gVmSFeUBZiFRPGe0lGXnIYEfiFDB8srwo=; b=yBPfJBcTU5P/NHP0A4PrO7SZY2KygV9ZaEVBnzrf8K1c5UB1z/xjklQqOHpwTvF0Tk ykcZIBzEdbuDTc1a3tjRldR8upaIQytvmf5t1IvmCFLQacf8tywoXHMp1/qhrpZNx3qE i6acTlkhPmIGADG8dr4H7HbbjcB+sMbX1cNpfffavEMBeYKYWQ6QUI5jG37MI365Y0kV WSrXR9OwJ7EFeS6KlEMSz37smoOBqHunUEyQpnIJT0LP0TNRLDBC/D7UQ5njfNCH48Il ZkZTW4uPdCMDW+lZnTgvJZHpmAFWiMnMJiEM7IznJ5vKLPz3pIl5YEzEh47AUsyT/6Us oVng== 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:mime-version:content-transfer-encoding; bh=+OpEDkbIB7gVmSFeUBZiFRPGe0lGXnIYEfiFDB8srwo=; b=MWDjsQuppFJU6KEqBn/9EgytvCSp0cpsEppNU6R7fpO7nXvInXOr54JCz+84cvzoKx wX5Xopnz3W+R5v81Y8FTOjkS0tU3SXhuN+Ho3DkEsFN9EMGRaTKOku1Ps1TGu/oi9mgc AmcZiUOFYuDjLfnXDevAqydo8Ve/pT2+kDlw1lxYdHlMzEC9iKYSa4c5dN65l91VN9Sn x9iMrYIALtVm33Ho+JljsQdGkj8o6Twxc82J7lqI2fD+u2p8YsdL289TEsAiVSGXEJvq P+Bdun11GfkfJgMer/Ec6KjV8zDt4bwkH7vBBkRf0fx1QUaOTgA50+wNe6n2F3tWlghY IjtQ== X-Gm-Message-State: AOAM533EOpqQVMckeVn/CvkmQf/vghfdZtXrgSG4VtQOtiLkS7uXNwNs SREHEGU+hdl2J7eY4r2UcGSRrIwA/EliWl8= X-Google-Smtp-Source: ABdhPJwnqfleV3yNn00YUDMSqo+E1aObG4t41clRoBMUABZ2DghUoGbXWro4ya+EkOEtLTT77cNRMQ== X-Received: by 2002:a4a:ca94:: with SMTP id x20mr6626942ooq.86.1617273674654; Thu, 01 Apr 2021 03:41:14 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 3/6] target/arm/kvm: Add an option to turn on/off el2 support Date: Thu, 1 Apr 2021 10:40:55 +0000 Message-Id: <80d8bac17a21b41b36cde3eec6c9681b93f43d7c.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2c; envelope-from=haibo.xu@linaro.org; helo=mail-oo1-xc2c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Adds an el2=3D[on/off] option to enable/disable el2(nested virtualization) support in KVM guest vCPU. Signed-off-by: Haibo Xu --- target/arm/cpu.c | 11 ++++++++++ target/arm/cpu.h | 4 ++++ target/arm/cpu64.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ae04884408..30cc330f50 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1349,6 +1349,17 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **= errp) return; } } + + /* + * Currently, vCPU feature 'el2' only supported in KVM mode. + */ + if (kvm_enabled()) { + arm_cpu_el2_finalize(cpu, &local_err); + if (local_err !=3D NULL) { + error_propagate(errp, local_err); + return; + } + } } =20 if (kvm_enabled()) { diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 193a49ec7f..19fa9cfbfd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -203,10 +203,12 @@ typedef struct { # define ARM_MAX_VQ 16 void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); +void arm_cpu_el2_finalize(ARMCPU *cpu, Error **errp); #else # define ARM_MAX_VQ 1 static inline void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { } static inline void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) { } +static inline void arm_cpu_el2_finalize(ARMCPU *cpu, Error **errp) { } #endif =20 typedef struct ARMVectorReg { @@ -1058,6 +1060,7 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned= vq); void aarch64_sve_change_el(CPUARMState *env, int old_el, int new_el, bool el0_a64); void aarch64_add_sve_properties(Object *obj); +void aarch64_add_el2_properties(Object *obj); =20 /* * SVE registers are encoded in KVM's memory in an endianness-invariant fo= rmat. @@ -1089,6 +1092,7 @@ static inline void aarch64_sve_change_el(CPUARMState = *env, int o, int n, bool a) { } static inline void aarch64_add_sve_properties(Object *obj) { } +static inline void aarch64_add_el2_properties(Object *obj) { } #endif =20 void aarch64_sync_32_to_64(CPUARMState *env); diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index f0a9e968c9..3f3f2c5495 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -603,6 +603,58 @@ static Property arm_cpu_pauth_property =3D static Property arm_cpu_pauth_impdef_property =3D DEFINE_PROP_BOOL("pauth-impdef", ARMCPU, prop_pauth_impdef, false); =20 +void arm_cpu_el2_finalize(ARMCPU *cpu, Error **errp) +{ + if (cpu->has_el2) { + if (!kvm_enabled() || !kvm_arm_el2_supported()) { + error_setg(errp, "'el2' cannot be enabled on this host"); + return; + } + } + + if (cpu->has_el2) { + set_feature(&cpu->env, ARM_FEATURE_EL2); + } else { + unset_feature(&cpu->env, ARM_FEATURE_EL2); + } +} + +static bool arm_get_el2(Object *obj, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + return cpu->has_el2; +} + +static void arm_set_el2(Object *obj, bool value, Error **errp) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + if (value) { + if (!kvm_enabled() || !kvm_arm_el2_supported()) { + error_setg(errp, "'el2' cannot be enabled on this host"); + return; + } + set_feature(&cpu->env, ARM_FEATURE_EL2); + } else { + unset_feature(&cpu->env, ARM_FEATURE_EL2); + } + + cpu->has_el2 =3D value; +} + +void aarch64_add_el2_properties(Object *obj) +{ + /* + * vCPU feature 'el2' is only available in KVM mode, and is + * disabled by default to keep in line with that in TCG mode. + */ + ARM_CPU(obj)->has_el2 =3D false; + object_property_add_bool(obj, "el2", arm_get_el2, arm_set_el2); + object_property_set_description(obj, "el2", "Set off to disable " + "nested virtulization."); +} + /* -cpu max: if KVM is enabled, like -cpu host (best possible with this ho= st); * otherwise, a CPU with as many features enabled as our emulation support= s. * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; --=20 2.17.1 From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273782; cv=none; d=zohomail.com; s=zohoarc; b=djyALQbLZxEK4TTPg4nO6FTaee7oJbIZ+NNILzzhVUeJ8AErufuHyMLMzJDpsVSpYl8bFuDWiQyNFzLKKJmupgR9dJtt6jNXNSfN0OwbtcR9v7jxjS94T+RURI7MlX/k7mwgpby5wl/KGfKeSWuY5Ms5fuQ89xDQ8bJuHPK0H08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273782; h=Content-Transfer-Encoding:Cc: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=ZOQB26mZhLmXCQu+JfKJIpuDxvkGsibNUVfx4FrnidQ=; b=bC6M3Zwpd9Avhz3spAb5vkUayax+yL1yDOhYv3q+xRYy/BeinOaNM8QN+Xf1v4gEH+5oMRWg10EafCZ2TplvidRuvX6hKCJK1lr5Yp2XK0VUztVAHC5qpLSCmbkvJ1YxLf+ypRHNuusjp+yEpCCSD8HwTwwnCt/VPnCpvBl72XY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1617273782874777.1025315257539; Thu, 1 Apr 2021 03:43:02 -0700 (PDT) Received: from localhost ([::1]:52392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRumz-0000no-NU for importer@patchew.org; Thu, 01 Apr 2021 06:43:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulK-00077i-Kw for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:18 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:41503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulI-0002Pi-Ow for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:18 -0400 Received: by mail-ot1-x32f.google.com with SMTP id l12-20020a9d6a8c0000b0290238e0f9f0d8so1681719otq.8 for ; Thu, 01 Apr 2021 03:41:16 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:15 -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 :mime-version:content-transfer-encoding; bh=ZOQB26mZhLmXCQu+JfKJIpuDxvkGsibNUVfx4FrnidQ=; b=cEOgnCkFngCcBDovQ0d30yVK1Z1NZCncTf6hUxqx3v+dJzXrrgNdqilRaZcnb7lYhQ pGEhtJbr2Pa2RfOKbURro47fhxQCJ8T0u4garYxmJ6nvucZGxofsfngTyIVFDVN6OQ/0 gSR7jGHCY0c6kpn5Z8kj5/w1GgrQxKD8heymweLpFMqBYGT8fLDTz7OJjK8OdJ4s4OPy 6dcneIdcNnh4JR+iRS/9dW7hgWE6fnWm6mb3toWlonb4/OccEDRFTugwquC56OyQ525n tgNTVK/hxgoJWC6TMYvSD5ZWXdNbzdgyNmVbNlRW+63mqr3VfU8hRIcl1ZEBotXWLc8t Ssqw== 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:mime-version:content-transfer-encoding; bh=ZOQB26mZhLmXCQu+JfKJIpuDxvkGsibNUVfx4FrnidQ=; b=YPaAgMpWShgV6r8MHFRKB6SDPSyQ42zIX8nUgyOn5rY5R5Apd0E8N+71U9Mza0B647 I7XBdK2pmA2UnK8nNKNfFBsph7NJN0x3ttKONw60hB1r2Fusm3pREweNKxWyCCbG+u/A oHq/115lzzNdACsl4AXY6jyI1tMYwOKclGIrFjGkQoyxlegj1PsvgC7Pnucjh1pGOQJT RY2sWD0dmItjCfOZ8ZmRXDeOczJFtlddol5An05x30+sCQ+ojNAOJ+obh4P66SDi98VV DGzktDpoV9KXQHOIcov0T5XPg/iTqf0g3dz1RBbStuU/QaVQsmDoiJoGmx9s70E6ENeR /8Ww== X-Gm-Message-State: AOAM532jJLFijYCSSQL62ljrI3kWuWKfbr8mtN88AEOlLalUjlLBs/8z 8+/IBwFD/N0gzKYpLQ62xHwwOyv5P+zZeow= X-Google-Smtp-Source: ABdhPJwYs1eecXUC/z4idu7BAViNNHUUt7TDSq1SMFoKiPJw0wYnfEv6zv0u5vNnKeVHGt6IvVOGKQ== X-Received: by 2002:a9d:740a:: with SMTP id n10mr6385570otk.27.1617273675553; Thu, 01 Apr 2021 03:41:15 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 4/6] hw/intc/arm_gicv3: Enable support for setting vGIC maintenance IRQ Date: Thu, 1 Apr 2021 10:40:56 +0000 Message-Id: <49a4944e2f148c56938380b981afe154b7a8b7ee.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=haibo.xu@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Using the new VGIC KVM device attribute to set the maintenance IRQ. This is fixed to use IRQ 25(PPI 9), as a platform decision matching the arm64 SBSA recommendation. Signed-off-by: Haibo Xu --- hw/arm/virt.c | 5 +++++ hw/intc/arm_gicv3_common.c | 1 + hw/intc/arm_gicv3_kvm.c | 16 ++++++++++++++++ include/hw/intc/arm_gicv3_common.h | 1 + 4 files changed, 23 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index aa2bbd14e0..92d46ebcfe 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -663,6 +663,11 @@ static void create_gic(VirtMachineState *vms) qdev_prop_set_uint32(vms->gic, "redist-region-count[1]", MIN(smp_cpus - redist0_count, redist1_capacity)); } + + if (kvm_irqchip_in_kernel()) { + bool el2 =3D object_property_get_bool(OBJECT(first_cpu), "el2"= , NULL); + qdev_prop_set_bit(vms->gic, "has-virtualization-extensions", e= l2); + } } else { if (!kvm_irqchip_in_kernel()) { qdev_prop_set_bit(vms->gic, "has-virtualization-extensions", diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 58ef65f589..3ac10c8e61 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -495,6 +495,7 @@ static Property arm_gicv3_common_properties[] =3D { DEFINE_PROP_UINT32("num-irq", GICv3State, num_irq, 32), DEFINE_PROP_UINT32("revision", GICv3State, revision, 3), DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn,= 0), + DEFINE_PROP_BOOL("has-virtualization-extensions", GICv3State, virt_ext= n, 0), DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions, redist_region_count, qdev_prop_uint32, uint32_t), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 65a4c880a3..1e1ca66e2c 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -826,6 +826,22 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Er= ror **errp) kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CTRL, KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true, &error_abort= ); =20 + if (s->virt_extn) { + bool maint_irq_allowed; + uint32_t maint_irq =3D 25; + + maint_irq_allowed =3D + kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_MAINT_IR= Q, 0); + if (!maint_irq_allowed) { + error_setg(errp, "VGICv3 setting maintenance IRQ are not " + "supported by this host kernel"); + return; + } + + kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_MAINT_IRQ, + 0, &maint_irq, true, &error_abort); + } + kvm_arm_register_device(&s->iomem_dist, -1, KVM_DEV_ARM_VGIC_GRP_ADDR, KVM_VGIC_V3_ADDR_TYPE_DIST, s->dev_fd, 0); =20 diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3= _common.h index 91491a2f66..921ddc2c5f 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -220,6 +220,7 @@ struct GICv3State { uint32_t num_irq; uint32_t revision; bool security_extn; + bool virt_extn; bool irq_reset_nonsecure; bool gicd_no_migration_shift_bug; =20 --=20 2.17.1 From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273911; cv=none; d=zohomail.com; s=zohoarc; b=DN2WAD4NZS1XG4+TMpybqlt3wIo43A575qNx1fJYLMkZGG/ewuAu/S9YJqZtNXsOZXGDm+zepsz5+FVoTSVEos09OXprOb/8WsnBxS624QqTVYFCDMl0hvJp6dUW/3ZmJ9ntcwa3Tr4Ty5qmkgF2kGAfkmq2zUgrsLx4zWEIsGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273911; h=Content-Transfer-Encoding:Cc: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=7GP5EWBOufrga+3kB4LulNdONpwe1B1Vve3c5Unp/SM=; b=eY3nfASmoKVuU53ZZ4yDGKw53TWU9XPaa7fhDi7HSIolXZiH7M5jfy2zcjrx+mjYzGJr+1oQBhVUneIV/qdazWr0RX786OqNrPHsqp7gWIxxLVn6661rb7cw/7j+NG53VkHVFgacyqoyklQoYIU6crfq3E9q9mUUX4d8geqOg30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1617273911881906.0321042752524; Thu, 1 Apr 2021 03:45:11 -0700 (PDT) Received: from localhost ([::1]:58968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRup4-0003Uv-MI for importer@patchew.org; Thu, 01 Apr 2021 06:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulL-0007BD-UY for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:19 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:33481) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulJ-0002Q8-SS for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:19 -0400 Received: by mail-ot1-x333.google.com with SMTP id s11-20020a056830124bb029021bb3524ebeso1762092otp.0 for ; Thu, 01 Apr 2021 03:41:17 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:16 -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 :mime-version:content-transfer-encoding; bh=7GP5EWBOufrga+3kB4LulNdONpwe1B1Vve3c5Unp/SM=; b=N8s3VyqaA5j1K7gTuKQyZ3SwynhIrvrdaHQu0PtzeaOvtj2bxCwNErcsd+tjj80giN nNJ7ZO+NRfkMihBBGpXa8s7L4FgVFIk69th5ZObD7Z7u5Lhk7K8gnVD7aDkRas8OQ+Jo YBh3ICwegcaw98mXexDWCFNY+XF6sY4C8V7cuGiDUe41/0PewAuXWDhPeOq9Kf88n7AV Q+ZQZLrPSbLWJJeW7RZGp5BWEmtqcz1jciLuUZNqo95ZzdvEsFgzJ94m/gkgwMCKcX6k bRTMXTI/VW4Wh4JZIDG9wP8EFqiE57BJGGXzeS9kXLyzojAvlZmYZkI3MsblvvnLfAZa pQNA== 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:mime-version:content-transfer-encoding; bh=7GP5EWBOufrga+3kB4LulNdONpwe1B1Vve3c5Unp/SM=; b=RbMAi/JIbV3BezXaK86wF25z5a0wzMEQWMwVK2IPNIW5W8fASoSPXJNkrbeqyczrhB bLwNCpatGNOSHm7t5IZe8pYU+SI7VeS7NjafCgsvNp6ZZfubXSCCXnEWQJrpjb7OoS45 RY1GemZkP8aVDfxGAJ2qfOBOVjTyQ9J5FlquSd6h5DhCdHEkMvezlwXbAtD79Bjb2BSm sAkUo/Fn3++H33qR67wULKr7hjcJBkb4vx8a+7KlOX4NQRoa4H2vZm+rH54CRMHrJqW2 5RREadu03FY3Ga8syh0i6MsaYf3uMSPmkwu4i5SANLrcQ/3DDTTiDo3B4kOPUPrdGWga soIg== X-Gm-Message-State: AOAM5331xYvvj8ObHypSsuiEstrFWok+k9Y1WXjs0T0eWHgU3B0fo3OT m3/iWCOeAT4Y3JAMbmbOeKT5DPTZTuPdNGY= X-Google-Smtp-Source: ABdhPJzKlz2O/UEvWy+raEdJpCPr51k5efYj+PYR/Qrz1DDjSx2Pl2VZTssFf59q3juYx0S/xVLRsw== X-Received: by 2002:a05:6830:14d2:: with SMTP id t18mr2404432otq.50.1617273676505; Thu, 01 Apr 2021 03:41:16 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 5/6] target/arm/cpu: Enable 'el2' to work with host/max cpu Date: Thu, 1 Apr 2021 10:40:57 +0000 Message-Id: <37df1b1872f15086dd1d066e53dc1eedaf114051.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=haibo.xu@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Turn off the 'el2' cpu property by default to keep in line with that in TCG mode, i.e. we can now use '-cpu max|host,el2=3Don' to enable the nested virtualization. Signed-off-by: Haibo Xu --- hw/arm/virt.c | 14 ++++++++++---- target/arm/cpu.c | 3 ++- target/arm/cpu64.c | 1 + target/arm/kvm64.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 92d46ebcfe..74340e21bd 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -454,6 +454,7 @@ static void fdt_add_gic_node(VirtMachineState *vms) { MachineState *ms =3D MACHINE(vms); char *nodename; + bool has_el2 =3D object_property_get_bool(OBJECT(first_cpu), "el2", NU= LL); =20 vms->gic_phandle =3D qemu_fdt_alloc_phandle(ms->fdt); qemu_fdt_setprop_cell(ms->fdt, "/", "interrupt-parent", vms->gic_phand= le); @@ -491,7 +492,7 @@ static void fdt_add_gic_node(VirtMachineState *vms) 2, vms->memmap[VIRT_HIGH_GIC_REDIST2].siz= e); } =20 - if (vms->virt) { + if (vms->virt || has_el2) { qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts", GIC_FDT_IRQ_TYPE_PPI, ARCH_GIC_MAINT_IR= Q, GIC_FDT_IRQ_FLAGS_LEVEL_HI); @@ -1911,8 +1912,8 @@ static void machvirt_init(MachineState *machine) } =20 if (vms->virt && kvm_enabled()) { - error_report("mach-virt: KVM does not support providing " - "Virtualization extensions to the guest CPU"); + error_report("mach-virt: VM 'virtualization' feature is not suppor= ted " + "in KVM mode, please use CPU feature 'el2' instead"); exit(1); } =20 @@ -1950,11 +1951,16 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, "has_el3", false, NULL); } =20 - if (!vms->virt && object_property_find(cpuobj, "has_el2")) { + if (!vms->virt && !kvm_enabled() && + object_property_find(cpuobj, "has_el2")) { object_property_set_bool(cpuobj, "has_el2", false, NULL); } =20 if (vms->psci_conduit !=3D QEMU_PSCI_CONDUIT_DISABLED) { + if (kvm_enabled() && ARM_CPU(cpuobj)->has_el2) { + vms->psci_conduit =3D QEMU_PSCI_CONDUIT_SMC; + } + object_property_set_int(cpuobj, "psci-conduit", vms->psci_cond= uit, NULL); =20 diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 30cc330f50..9530a2c4bf 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1099,7 +1099,7 @@ static Property arm_cpu_rvbar_property =3D =20 #ifndef CONFIG_USER_ONLY static Property arm_cpu_has_el2_property =3D - DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, true); + DEFINE_PROP_BOOL("has_el2", ARMCPU, has_el2, false); =20 static Property arm_cpu_has_el3_property =3D DEFINE_PROP_BOOL("has_el3", ARMCPU, has_el3, true); @@ -2018,6 +2018,7 @@ static void arm_host_initfn(Object *obj) kvm_arm_set_cpu_features_from_host(cpu); if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { aarch64_add_sve_properties(obj); + aarch64_add_el2_properties(obj); } arm_cpu_post_init(obj); } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 3f3f2c5495..ae8811d09e 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -666,6 +666,7 @@ static void aarch64_max_initfn(Object *obj) =20 if (kvm_enabled()) { kvm_arm_set_cpu_features_from_host(cpu); + aarch64_add_el2_properties(obj); } else { uint64_t t; uint32_t u; diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 9cacaf2eb8..7bf892404f 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -500,6 +500,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) */ int fdarray[3]; bool sve_supported; + bool el2_supported; uint64_t features =3D 0; uint64_t t; int err; @@ -646,6 +647,7 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *= ahcf) } =20 sve_supported =3D ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_S= VE) > 0; + el2_supported =3D ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_E= L2) > 0; =20 kvm_arm_destroy_scratch_host_vcpu(fdarray); =20 @@ -660,6 +662,11 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures = *ahcf) ahcf->isar.id_aa64pfr0 =3D t; } =20 + /* Use the ARM_FEATURE_EL2 bit to keep inline with that in TCG mode. */ + if (el2_supported) { + features |=3D 1ULL << ARM_FEATURE_EL2; + } + /* * We can assume any KVM supporting CPU is at least a v8 * with VFPv4+Neon; this in turn implies most of the other @@ -861,6 +868,9 @@ int kvm_arch_init_vcpu(CPUState *cs) assert(kvm_arm_sve_supported()); cpu->kvm_init_features[0] |=3D 1 << KVM_ARM_VCPU_SVE; } + if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { + cpu->kvm_init_features[0] |=3D 1 << KVM_ARM_VCPU_HAS_EL2; + } =20 /* Do KVM_ARM_VCPU_INIT ioctl */ ret =3D kvm_arm_vcpu_init(cs); --=20 2.17.1 From nobody Thu May 2 00:29:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1617273933; cv=none; d=zohomail.com; s=zohoarc; b=ivI4Iq9GLDLrU9O8vrd/aihh50b3RgtDhDRls68Umau16/aY3PQnPG0noZV1KwJtGvVKSBAZvRG4V3TCO4f6T9LJLfr/h2migrZJzVr+tbsgX6/oPls6Dg7nK54gwYIOsYDVc4tmeR1S7NWmIa7JvDHVl171YkjKHeKxmTGGZY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617273933; h=Content-Transfer-Encoding:Cc: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=JjlPaXyuxmJc78UBaRD26ugJ56+ZZ/y7y6+y5dorLqk=; b=XCKTw8+I1g1LXP1BeTZqccdircE7sasZjhMu9cGcLDAZ4SPdjGbbbbY1nfGtBI3Qyaj7XnCJCAkTsTfjeabjyZD3Zb7hRYk0fOA2eRzLhF3v3yAXgzkvP0POFy6YigaO9OOphluW7RAbj/P4CQuawcI9we/S96XbT51/4EbF1Xo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail 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 1617273933168289.25955983066956; Thu, 1 Apr 2021 03:45:33 -0700 (PDT) Received: from localhost ([::1]:60130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRupP-0003zi-AB for importer@patchew.org; Thu, 01 Apr 2021 06:45:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRulM-0007E1-RY for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:20 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]:41506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRulK-0002RG-IA for qemu-devel@nongnu.org; Thu, 01 Apr 2021 06:41:20 -0400 Received: by mail-ot1-x332.google.com with SMTP id l12-20020a9d6a8c0000b0290238e0f9f0d8so1681811otq.8 for ; Thu, 01 Apr 2021 03:41:18 -0700 (PDT) Received: from localhost.localdomain ([147.75.106.138]) by smtp.gmail.com with ESMTPSA id a6sm1069066otq.79.2021.04.01.03.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 03:41:17 -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 :mime-version:content-transfer-encoding; bh=JjlPaXyuxmJc78UBaRD26ugJ56+ZZ/y7y6+y5dorLqk=; b=vYCxZJgC9IYUahRmaA1hiotepZBdCe/oSE2KE5ADOywUfuk97sQdRFvGPI8sSh6TOP uPJjSnzNicVOqN0084yEIY3u7409qZ4v0UevAmVvjo1H9q5roEvkZTPVsvmvuDAOSVIq 7xzHwvQX9SSTVMq1cnlmM8o7XRSFwekvqtbMDZvN3TJC953Ny3gJCZm8I8F7RHvwVbbt 76VpQpRjoMnd4bhBVTKOjDuKZcZno+W/ZSD531u2tiyYvofepvB3KoVd7hjY3044O6yx cy5GjeOQLL5SQSuJAsk0gn6IWGTdm+RiFzlMlULJPFwakQajxzSm1NIv1fRK2wQutVhS dc6A== 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:mime-version:content-transfer-encoding; bh=JjlPaXyuxmJc78UBaRD26ugJ56+ZZ/y7y6+y5dorLqk=; b=oLUtSk/966exq01R8weQhH6XeuAouIy6DgEIuehGu5fToq09pmc0lRZiamDbAgqakm A+NAOKJZubJWlyq8vx9eWEwAlxVQZ4BqDUQz6wKAn8eAfRi/hsaSsUO4K8z4RbymHvu3 AQJTrc2RneD+Ts2NBx1qb+WnI8gTxH1UD+MeK2XWeaHRcI0K8WM4wGBCFjRYOvg10KLx w3OYBw4UIEJiYdIXzkAIzUI1od5bDnvPL6tedcubVNhnxhqdFYm8WSiMlGDnJDA+T6x5 LayMG25k3Pl1lBsKcwOxJr24hq9zctHMHwpy218H49/irkpFOfogxD8LHSK5Xz27svgH uG+w== X-Gm-Message-State: AOAM531dhxmx7PhYncCwV4N5KqywKepfqzCTqs/vMF7Dnx/mIunDDYQK kfS008Ca7w8BkWVYaaQ0f/2znozLagFwcFw= X-Google-Smtp-Source: ABdhPJyRwnoAmwu/DxgoSwZSZIUdcGbtPFTuEW6tVQxgrYhuzPi1yYLtANW9vn48cGO5alSYOHz81Q== X-Received: by 2002:a05:6830:401c:: with SMTP id h28mr5936899ots.347.1617273677386; Thu, 01 Apr 2021 03:41:17 -0700 (PDT) From: Haibo Xu To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Subject: [PATCH v2 6/6] target/arm: Add vCPU feature 'el2' test. Date: Thu, 1 Apr 2021 10:40:58 +0000 Message-Id: <50db1700b4df48acbecfda077b2220a0e3cf6b49.1617272690.git.haibo.xu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=haibo.xu@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: , Cc: peter.maydell@linaro.org, drjones@redhat.com, richard.henderson@linaro.org, abologna@redhat.com, Haibo Xu , philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Haibo Xu --- target/arm/monitor.c | 2 +- tests/qtest/arm-cpu-features.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target/arm/monitor.c b/target/arm/monitor.c index 80c64fa355..6c39238925 100644 --- a/target/arm/monitor.c +++ b/target/arm/monitor.c @@ -90,7 +90,7 @@ QEMU_BUILD_BUG_ON(ARM_MAX_VQ > 16); * then the order that considers those dependencies must be used. */ static const char *cpu_model_advertised_features[] =3D { - "aarch64", "pmu", "sve", + "aarch64", "pmu", "sve", "el2", "sve128", "sve256", "sve384", "sve512", "sve640", "sve768", "sve896", "sve1024", "sve1152", "sve1280", "sve1408", "sve1536", "sve1664", "sve1792", "sve1920", "sve2048", diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index 8252b85bb8..be07bf0c76 100644 --- a/tests/qtest/arm-cpu-features.c +++ b/tests/qtest/arm-cpu-features.c @@ -509,6 +509,7 @@ static void test_query_cpu_model_expansion_kvm(const vo= id *data) if (g_str_equal(qtest_get_arch(), "aarch64")) { bool kvm_supports_steal_time; bool kvm_supports_sve; + bool kvm_supports_el2; char max_name[8], name[8]; uint32_t max_vq, vq; uint64_t vls; @@ -533,10 +534,12 @@ static void test_query_cpu_model_expansion_kvm(const = void *data) */ assert_has_feature(qts, "host", "kvm-steal-time"); assert_has_feature(qts, "host", "sve"); + assert_has_feature(qts, "host", "el2"); =20 resp =3D do_query_no_props(qts, "host"); kvm_supports_steal_time =3D resp_get_feature(resp, "kvm-steal-time= "); kvm_supports_sve =3D resp_get_feature(resp, "sve"); + kvm_supports_el2 =3D resp_get_feature(resp, "el2"); vls =3D resp_get_sve_vls(resp); qobject_unref(resp); =20 @@ -602,11 +605,17 @@ static void test_query_cpu_model_expansion_kvm(const = void *data) } else { g_assert(vls =3D=3D 0); } + + if (kvm_supports_el2) { + assert_set_feature(qts, "host", "el2", false); + assert_set_feature(qts, "host", "el2", true); + } } else { assert_has_not_feature(qts, "host", "aarch64"); assert_has_not_feature(qts, "host", "pmu"); assert_has_not_feature(qts, "host", "sve"); assert_has_not_feature(qts, "host", "kvm-steal-time"); + assert_has_not_feature(qts, "host", "el2"); } =20 qtest_quit(qts); --=20 2.17.1