From patchwork Mon Jan 6 18:23:43 2025 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: 855280 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp9582400wrq; Mon, 6 Jan 2025 10:24:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW7Kep0WYaMqNHdjUBYCfHJkryxizEqPxxqs/oA04RMOrBlmKhf5Id8kh/XSFbTFWkDbfLeLQ==@linaro.org X-Google-Smtp-Source: AGHT+IFBr/CcLO1Bde/4fE4SlgbNNDJt/cgNJYiREYAtDXTilpmEsBP9XsIOb+K40yhxcgVsbGup X-Received: by 2002:a05:620a:4412:b0:7b6:eab3:cdd4 with SMTP id af79cd13be357-7b9ba80fd9bmr8475616685a.50.1736187866281; Mon, 06 Jan 2025 10:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1736187866; cv=none; d=google.com; s=arc-20240605; b=fWNKYKZeBk2KkVqrjd7zUDvf52tItiv+9Zrt86JAd57tTsEwdGsuApP+VJ6ocpVkUu Y97Bg04tM17RA45DhhiveeFB0cJQnc1lvagX73wxyZemocmAtotl+uA9cHfqNgfe5OSt ZhO7OOv6ZnUGfmGSFJVqVwvhvYZGFcxLolbljJg9fLGobf5zLkKReTjvSzZfCQguvLnb /CItKXMdeyOXmeMfK1ZEdfsNuBxPvfrs4yVKZuZXim1oEtD4lnItX4UNRKBzjeABFoLY 3vUN7X41Col90+Ffj9u0Wp5FCjPIacDCvVLdIoe187dmmI+Oeb1oHiKTMhF04j8JBXw1 bApQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Zc910N+AlVa8sNqkW1fDdSYDbUFhwPoB/5c2YYYivWo=; fh=mMKks0ORFbfEEq2zL/VeNxn/ePDEwq948M6+Fw8T/Nw=; b=RtO1zPlELud/qe7n7cUPb94nS62lmWGulV4u8yO8f7lcq/4hnliDnDDazYWp23S3DH bK5PX0Rnq2e0UUcPYqvmbBZzzG2H7t+Zaoym3uGgEHYqtndUbJNcCnkXyXTGE8us1QRz IVHa9VS/1sXl1VOSHex/nPpWQrUf1Al+VCt1XYm6zJZ/aLv18hUnbdqs99lJVnrNib7g I+WVoDLmzUE+XKOrVg6ZVqwCN9n/cmAH3qjJBiaR7WaDq9VRbHYLYdvM9QJt6hwgWo7D D1NwH+k/7BsLDi06C/2s839oICnm2ix4zRxhwfSWA/9EiII3WMwfiwT7HLiBz5Cx/sMc PG4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NwAnbMoS; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac2ab9e7si4541288885a.40.2025.01.06.10.24.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Jan 2025 10:24:26 -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=NwAnbMoS; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUrlY-0002jC-Qa; Mon, 06 Jan 2025 13:23:52 -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 1tUrlV-0002iW-9a for qemu-devel@nongnu.org; Mon, 06 Jan 2025 13:23:49 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUrlT-0001nu-RK for qemu-devel@nongnu.org; Mon, 06 Jan 2025 13:23:49 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43621d27adeso101941645e9.2 for ; Mon, 06 Jan 2025 10:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736187825; x=1736792625; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Zc910N+AlVa8sNqkW1fDdSYDbUFhwPoB/5c2YYYivWo=; b=NwAnbMoS8EVZwgyU0zwQzcyGYGb+FL2nLGAXcydvmnBi16rLdAG3o8hnV3bjcxTxkP EHyFHTAgVI57zoWmk3r83H97MICZZqnlNvxw3KZrZb/6j6bzj8nZz6VhJRTWy+wG7MyB socDObxC0USZk6MxUdpVNftaTWb2SQradhnVZKWYkc7FPTrXlegvOhpl+XG/jMgRbVYa 1y3ELcZH5RbChOwF/x5vGDQFHQLnjr+ODuDlZGQBVaabdC5SgcK3toiyW+u4PjtVjjrP 9b5wyBL3VmTPyI6zWeundABw6bBjA47F2+Bvj4JaMPYuaIEkV+jBgnhQWww0XjXqI0lp lEpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736187825; x=1736792625; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Zc910N+AlVa8sNqkW1fDdSYDbUFhwPoB/5c2YYYivWo=; b=XKVpgvd3qdXCVhq6t5I8UcdkaW5G2hQtnfrOBVQFKaDPmJcOGOo44DU6vqRniWR4rz FttX6nZF/wTr2XlPogCrT570bjbFoPOXQbhHnJE3S+mHRbNsR5S7hIAF/ubfsqZpwtQ2 2cImByo9PiBLKB1jFh8DV/ECrENCLI/RoKGLNcwxQzS795DEAw7yedYrx5/Vdfc/1ds5 ARtPxW1Ia+kArQZkhdQE5LC1pu7ETtW0D85PO5dQSbsb40uGhYk4wRK5KvKLjFTSKTEu YHcf/y+qyt/TfiGHXw6Mzau1Kw+PxyLhHYFK9nkcRhMWm5fCN6e6rOOgXzozTYacFszM jZdA== X-Gm-Message-State: AOJu0YwXt2rFDWavkGohZpoH03tBND/zAK7dgEviObdrRvB+8ivuQvGM sU9SehVqk+DIq684OSDPu92AqyaHvSel+42jONtmwm9GI6Dt1q0BT2bAosWA5gNLFCdpH/KeOaN zZ3Y= X-Gm-Gg: ASbGnctRwbmLQ9eZBE4cA3nOFFOwJFGx1/7X9/23rOitQ44TrMXQ+VvlQKOgao3MWRq hFN2nGrb7pDDQ8srtbWR9c31wGcWuKp7Lfg8jxFa9xUeVLLXO17CRRIL1XGi/Dub6fBLnAS6y4s QYkXzl1x+tGYRVWw8z3PP/lRoX7uNnGIRHYYFwPz+NGw1ftun85RRLUjRABdbKETQTVUBn/A1Tz vjXgavyDrrm9gyKoKaZnRtH2HCN71i3ZSjtyUubQ2It87gDrf9CLP6AVcll1pVmRPzHQbtcysM4 Wc4hnZyDUYygmFvJcQPv4GC1hf/ymtk= X-Received: by 2002:a05:6000:144b:b0:385:fb2c:6021 with SMTP id ffacd0b85a97d-38a223ff339mr54211455f8f.39.1736187825609; Mon, 06 Jan 2025 10:23:45 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acc02sm47920579f8f.104.2025.01.06.10.23.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 Jan 2025 10:23:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , Thomas Huth , Alistair Francis , Peter Maydell , qemu-arm@nongnu.org, Daniel Henrique Barboza , "Edgar E . Iglesias" , Eduardo Habkost , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH] target/arm/arm-powerctl: Restrict to ARM cores Date: Mon, 6 Jan 2025 19:23:43 +0100 Message-ID: <20250106182343.35859-1-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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.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 When running on a heterogeneous setup, the CPU_FOREACH() macro in arm_get_cpu_by_id() iterates on all vCPUs, regardless they are ARM or not. Check the CPU class type and skip the non-ARM instances. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: Peter Maydell --- target/arm/arm-powerctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index 20c70c7d6bb..a080a6ab79f 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -36,9 +36,11 @@ CPUState *arm_get_cpu_by_id(uint64_t id) DPRINTF("cpu %" PRId64 "\n", id); CPU_FOREACH(cpu) { - ARMCPU *armcpu = ARM_CPU(cpu); + if (!object_class_dynamic_cast((ObjectClass *)cpu->cc, TYPE_ARM_CPU)) { + continue; + } - if (arm_cpu_mp_affinity(armcpu) == id) { + if (arm_cpu_mp_affinity((ARMCPU *)cpu) == id) { return cpu; } }