From patchwork Wed Jan 10 19:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 761447 Delivered-To: patch@linaro.org Received: by 2002:a5d:6e02:0:b0:337:62d3:c6d5 with SMTP id h2csp2053021wrz; Wed, 10 Jan 2024 11:54:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaiXAPlcQo89fjguPUJ/KqtuWtFRzNIkNSr6+BM648KhQgHN7wHWjbF8NWFQDLdNyEQ/JV X-Received: by 2002:a05:6214:301e:b0:681:127f:8369 with SMTP id ke30-20020a056214301e00b00681127f8369mr7587qvb.35.1704916486092; Wed, 10 Jan 2024 11:54:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704916486; cv=none; d=google.com; s=arc-20160816; b=F3zGqj+2bJKGA6pDzF71QwiR3lJRFwfjGMLConfikNiZ5/M77RFQ6pyMPP+U7P8YnT /kAHtLawrNnTBVFewfWVjR5rQ29ooXqMb6w1ZTVAtX+3eu/xVirqZHCmDcjHbJfFfEB3 /qs/vOwB8nkyNcJYRN8JsEIjEpIRud2OdULcNfP1pAu1r0hL5yPsM7lWcgoxjdhk+gnt 8wztHt4VsoD9bc/nk+IoCJ9XPnf3M25WFKmZ1agNafGmEqB8Zk0Kz8CDmHYiJgIbUPSr 6wdcRODj5Yk1ClFL/flv9pk/XHzEif9M3hoKfcw3zCAgQtn01nGHZ2U5zhFufhYAIPtT /C9g== 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:cc:to :from:dkim-signature; bh=2aLkQ6Ut0DrpuWjeMaf8bgkuaiZex3z3XI0gOydKSEI=; fh=0Bn9ysFO5uhdOoEvdDNDnkwY7yFMuDt2XLw3k0zcWt8=; b=aOWhlvPjAvRwlTWufr2mmTHeGwTFIQ9wdf0HGonu7RCc0gnmf7WvMMssoK5T2EAawx Szfx8VbIThdGkaHIBXOwaOhZ+LH/4EO8uhDABgtXU6DYylgAOIjjQtMGL1LVg7hVbo1R LctB+G58SuXjB/BvD8AZJG8KF9bufPLVWGop5NditUtEQWS2TB+r0t8Mtdsm2hyOJWjk IjWZ9PS1z6fWM9YASDylUy43u4jEPtfyi8eG0SEX95AkdkN3TZ8lEL+4cZ8kM/xkw+Wq Bxm3dGU6mXfcMd/fGXOr0M7PWgsWmr8iZ+8BYi8kXNWNf1wudgXEveriyGwhL83ea2lc P36Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M9s/nf1n"; 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 oo3-20020a05620a530300b00781c523ebfasi4439809qkn.93.2024.01.10.11.54.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jan 2024 11:54:46 -0800 (PST) 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="M9s/nf1n"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNeew-0000QH-PS; Wed, 10 Jan 2024 14:54:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNeeu-0008Se-Cu for qemu-devel@nongnu.org; Wed, 10 Jan 2024 14:54:40 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNees-0002TT-If for qemu-devel@nongnu.org; Wed, 10 Jan 2024 14:54:40 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e4d515cdeso26627585e9.1 for ; Wed, 10 Jan 2024 11:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704916476; x=1705521276; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2aLkQ6Ut0DrpuWjeMaf8bgkuaiZex3z3XI0gOydKSEI=; b=M9s/nf1nMpIU3t5O5i6mBaKfW4RnMdTuo4w8N0xJCe/8PedQHllF2y+be3LAEt+V2G UPwE896s2tqPYmUXlC+7ifcHRFReei2zygSIucksMA5SX4YXKggCrNESbJwNX2IIFF6S M4oGdZp+uuMWoBNkv/URqdlbpqCacAtFte/V4KKGt3mN0O8lQQLlder9WygGPy8uNxzF V23O+oK8+FdOSafpOXX0Jlw+iDiA+65POjR1jT1wSZO4ixwMMnLjsZyljfYm8hA2NPIb 5HjDJavOwNntjpMXYERGqsVpDDw3tH57lRq9MnE8PnWGdlAll7FeWvCo9NfljJZ5xyIT 41Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704916476; x=1705521276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2aLkQ6Ut0DrpuWjeMaf8bgkuaiZex3z3XI0gOydKSEI=; b=bjPEsUNr9WRIcWxgGhBRcDNmFdcLjda1/7Mn1Vdi0EZGPhBj2guKV4JfdZQTFl1wXw JGVMaa6g8H3do2qbioxPr1mypROgbakuRXKzHEx8ECI3ClrwbH22oC46CZxNseLGaLRp 2XqBmuJALpBqBSJy8HfP1o2Qdc0e+FtNaSMFdZzLI2o+OkWnYrAe6yZU/BzWJ+p6ORaN BGCjwgcoYUVnf1VuVx5uEm8hmp3/I/1CsPiacPj7c4WbNcM6LHwYKYuaVL1D0ImtnT70 PrdFW3kbGZ5gd4aNQeZhaxjbcxufBw1wrnrxOaxUwPc1As8n9taqPN6Ubvx+oaCrngEI 5eOg== X-Gm-Message-State: AOJu0YyTppRal3MVRPjmFs3ghtK/+AWsVMZ+73ed1t9vAK6ewbeBGs2V CBVKvjIGJFINuw1AYX0eCKKSc+UuM8NQsy65fK4faRguu5Y= X-Received: by 2002:a05:600c:500e:b0:40e:47c2:1b5a with SMTP id n14-20020a05600c500e00b0040e47c21b5amr860534wmr.4.1704916476525; Wed, 10 Jan 2024 11:54:36 -0800 (PST) Received: from m1x-phil.lan (vau06-h02-176-184-43-236.dsl.sta.abo.bbox.fr. [176.184.43.236]) by smtp.gmail.com with ESMTPSA id fc19-20020a05600c525300b0040d839e7bb3sm3267484wmb.19.2024.01.10.11.54.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 10 Jan 2024 11:54:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcin Juszkiewicz , qemu-arm@nongnu.org, Kevin Wolf , Igor Mitsyanko , =?utf-8?q?Alex_Benn=C3=A9e?= , Radoslaw Biernacki , "Edgar E. Iglesias" , Leif Lindholm , Rob Herring , Markus Armbruster , Alistair Francis , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 09/14] hw/arm: Prefer arm_feature(EL2) over object_property_find(has_el2) Date: Wed, 10 Jan 2024 20:53:23 +0100 Message-ID: <20240110195329.3995-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240110195329.3995-1-philmd@linaro.org> References: <20240110195329.3995-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org The "has_el2" property is added to ARMCPU when the ARM_FEATURE_EL2 feature is available. Rather than checking whether the QOM property is present, directly check the feature. Suggested-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/vexpress.c | 3 ++- hw/arm/virt.c | 2 +- hw/cpu/a15mpcore.c | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index fd981f4c33..753a645c05 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -218,12 +218,13 @@ static void init_cpus(MachineState *ms, const char *cpu_type, /* Create the actual CPUs */ for (n = 0; n < smp_cpus; n++) { Object *cpuobj = object_new(cpu_type); + ARMCPU *cpu = ARM_CPU(cpuobj); if (!secure) { object_property_set_bool(cpuobj, "has_el3", false, NULL); } if (!virt) { - if (object_property_find(cpuobj, "has_el2")) { + if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { object_property_set_bool(cpuobj, "has_el2", false, NULL); } } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2793121cb4..35eb01a3dc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2146,7 +2146,7 @@ static void machvirt_init(MachineState *machine) object_property_set_bool(cpuobj, "has_el3", false, NULL); } - if (!vms->virt && object_property_find(cpuobj, "has_el2")) { + if (!vms->virt && arm_feature(cpu_env(cs), ARM_FEATURE_EL2)) { object_property_set_bool(cpuobj, "has_el2", false, NULL); } diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index afe3897901..7e456375e3 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -74,9 +74,12 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) &error_abort)); } /* Similarly for virtualization support */ - has_el2 = object_property_find(cpuobj, "has_el2") && - object_property_get_bool(cpuobj, "has_el2", &error_abort); - qdev_prop_set_bit(gicdev, "has-virtualization-extensions", has_el2); + has_el2 = arm_feature(cpu_env(cpu), ARM_FEATURE_EL2); + if (has_el2) { + qdev_prop_set_bit(gicdev, "has-virtualization-extensions", + object_property_get_bool(cpuobj, "has_el2", + &error_abort)); + } } if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) {