From patchwork Thu Jan 18 20:06:30 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: 763650 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a08:0:b0:337:62d3:c6d5 with SMTP id m8csp109787wrq; Thu, 18 Jan 2024 12:10:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4L0Cyce6tGp3KLlhCdb3JaNK9PsLMWOp8KgAKglgI1RvtbPD1kMQBvgHDTZLUbpVUaQ9x X-Received: by 2002:a05:620a:6009:b0:783:3af1:28e3 with SMTP id dw9-20020a05620a600900b007833af128e3mr202613qkb.124.1705608614640; Thu, 18 Jan 2024 12:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705608614; cv=none; d=google.com; s=arc-20160816; b=lQVnxvKWUuwfILaIJJB39Ht9hbTfhpsrzMBPqMB2CuzqvcdsShR4b33DZKNtccHRU2 YuB+fuYGyLA+9fRJXgzO3EODLY5GcFGHHYua6++lCEpWE2BjvnsMWk3qixpIw8lOglml Nmo+xAUo12zZj5znqjm0yfkwjDLwYgi3439O+pU5mpLGcpux9BvKY+f016Yut2+5sMVj C/t3UiGzsyCzyNND9TWcr0u0m/EM9gXM4MBOzOPEDCX+yG3DAMlYn34PFQGmNb1ayOFu ond62WSTxa62qB7idRaA7qRyoim/z93Do9Rr0kFT9r5AZwzE1glMTFcJBLBJYTDma53e oxVA== 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=X/ejlWr/vr3IWLu/MuGvfyfJuGNUVTGyi/ukONUd4RY=; fh=GY0J1BHXV8JCT94Jevwcoc+qV/LriKwcR3tgpDluTBE=; b=JBvBrx7f8b9DZXkQeEIM1XFYEZssLlsPmH+MhngZVX47hFqIWry/ldlCFrfTs/9RWg ieZtOunfppzIhhgA+pnA9B+9f2LzeAtlrMAyxdrq6VOsCoEt5zXKQ4PBeESjiUsebPVv hwAX79qHhOhqzQjTJ5u1f8mL4pKb+pk0xkeQQG7dhBd80N/cjqow3Y6z+tF4ntRZY+1g Tnkj8byIBs1+rJ25TLjZNS6on5AFtbI/A3d1tYyNCae9PrxBzgXvWZMSVNwd5hAOGOZW TcqXSXIS+4HZNH9Lczqq15ci/YoNdQkx/LMDqYVpOtEYP7J+kQ6FcsJWEp21mzntnYUK MmYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jIZfLol+; 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 f17-20020a05620a15b100b0078321bb769fsi14060508qkk.714.2024.01.18.12.10.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2024 12:10:14 -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=jIZfLol+; 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 1rQYg1-0003nc-8Z; Thu, 18 Jan 2024 15:07:49 -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 1rQYft-0003ds-1Y for qemu-devel@nongnu.org; Thu, 18 Jan 2024 15:07:41 -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 1rQYfr-0006yD-86 for qemu-devel@nongnu.org; Thu, 18 Jan 2024 15:07:40 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40e959b1867so303775e9.1 for ; Thu, 18 Jan 2024 12:07:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705608457; x=1706213257; 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=X/ejlWr/vr3IWLu/MuGvfyfJuGNUVTGyi/ukONUd4RY=; b=jIZfLol+HzDQ12tkeKHI3cCDdJPaRSgyQrSc014yhbIEYc0uTmWqxq955OKrR2Ao7P fHjOTEoUSfv7oMkviVeK7PL3EWDO+5Lmc76SVQFaDGITAi0bukuqN0UThGx4nEGbTbJ5 soTsW33GLMO1HHFsnqQWPnf48ct5rnmd+vcGq8nHjDM2xYxrJ5gxaVNUGXITw/HSuwh7 HCFpdCTISQl6QIaQ3itbGgLylZliTLckT7FBFygcMU1yHlahOoVxw8eT7tcYCQiHZHZ/ lSKjJdtH9voMTJJ5Qr8Bm5njrRGgkv+4RmS8PJLv7etvZ/1weBREtXZNU0V6Cz+yUPW3 0Lww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705608457; x=1706213257; 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=X/ejlWr/vr3IWLu/MuGvfyfJuGNUVTGyi/ukONUd4RY=; b=OzlZZedN0awB9mq2+GPmznOmrlP0RdhzeJ8yjaHvUAxyNTIMRflSiX3BbIANc6LBqP 9l5CctQVNVs9SGDhk9BH121VZO09kqFLC9HG+0WPL/BV2B/udLnZTiFT9Cl9vEy9Xtqa xK7d7CMHd/db4VqTIptResDVhPXD0yHsQMktyeoWNUyU+Vy6N3jNaLfWQQw30aOc7vRs YzOLjNA8ujKhpC6JtSBrn+gv8zuimQaLiexb9T7jKDLw7eSlhWO1bn7klbAAjRDoOpYo ZYgzoA+mR/yPYlIrLzqUJkrWxJmOeij6WUB3tAfj13eBet8xBrXzQ9CVWamMS5kzHEzH OgEQ== X-Gm-Message-State: AOJu0YzIXmqGZSbFbBX1X/o159qo7Y1ftv4A4lRL+KCU7kfWoWQQ7J3M ZeEwUXeWpyPcahO2pznOEc0Npj2d+Uxi7cRC8944GySfJlxto/msZqSmSZIxl9y7aWyQX1NZGly 7+IOJHpLC X-Received: by 2002:a05:600c:63d7:b0:40e:71e7:b2e4 with SMTP id dx23-20020a05600c63d700b0040e71e7b2e4mr900948wmb.60.1705608457713; Thu, 18 Jan 2024 12:07:37 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id u6-20020a05600c138600b0040d5a9d6b68sm30919468wmf.6.2024.01.18.12.07.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Jan 2024 12:07:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Igor Mitsyanko , qemu-arm@nongnu.org, Strahinja Jankovic , "Edgar E. Iglesias" , Igor Mammedov , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Eric Auger , Niek Linnenbank , "Michael S. Tsirkin" , Jan Kiszka , Marcin Juszkiewicz , Alistair Francis , Radoslaw Biernacki , Andrew Jeffery , Andrey Smirnov , Rob Herring , Shannon Zhao , Tyrone Ting , Beniamino Galvani , Alexander Graf , Leif Lindholm , Ani Sinha , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Paolo Bonzini , Jean-Christophe Dubois , Joel Stanley , Hao Wu , kvm@vger.kernel.org, Richard Henderson Subject: [PATCH 09/20] target/arm: Create arm_cpu_mp_affinity Date: Thu, 18 Jan 2024 21:06:30 +0100 Message-ID: <20240118200643.29037-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240118200643.29037-1-philmd@linaro.org> References: <20240118200643.29037-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 From: Richard Henderson Wrapper to return the mp affinity bits from the cpu. Signed-off-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/arm/cpu.h | 5 +++++ hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 6 +++--- hw/arm/xlnx-versal-virt.c | 3 ++- hw/misc/xlnx-versal-crl.c | 4 ++-- target/arm/arm-powerctl.c | 2 +- target/arm/hvf/hvf.c | 4 ++-- target/arm/tcg/psci.c | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 55a19e8539..d1584bdb3b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1173,6 +1173,11 @@ void arm_cpu_post_init(Object *obj); uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz); +static inline uint64_t arm_cpu_mp_affinity(ARMCPU *cpu) +{ + return cpu->mp_affinity; +} + #ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_arm_cpu; diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a22a2f43a5..2127778c1e 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -720,7 +720,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) build_append_int_noprefix(table_data, vgic_interrupt, 4); build_append_int_noprefix(table_data, 0, 8); /* GICR Base Address*/ /* MPIDR */ - build_append_int_noprefix(table_data, armcpu->mp_affinity, 8); + build_append_int_noprefix(table_data, arm_cpu_mp_affinity(armcpu), 8); /* Processor Power Efficiency Class */ build_append_int_noprefix(table_data, 0, 1); /* Reserved */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 3fc144236b..34cba9ebd8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -370,7 +370,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) for (cpu = 0; cpu < smp_cpus; cpu++) { ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu)); - if (armcpu->mp_affinity & ARM_AFF3_MASK) { + if (arm_cpu_mp_affinity(armcpu) & ARM_AFF3_MASK) { addr_cells = 2; break; } @@ -397,10 +397,10 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) if (addr_cells == 2) { qemu_fdt_setprop_u64(ms->fdt, nodename, "reg", - armcpu->mp_affinity); + arm_cpu_mp_affinity(armcpu)); } else { qemu_fdt_setprop_cell(ms->fdt, nodename, "reg", - armcpu->mp_affinity); + arm_cpu_mp_affinity(armcpu)); } if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) { diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 537118224f..841ef69df6 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -107,7 +107,8 @@ static void fdt_add_cpu_nodes(VersalVirt *s, uint32_t psci_conduit) ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i)); qemu_fdt_add_subnode(s->fdt, name); - qemu_fdt_setprop_cell(s->fdt, name, "reg", armcpu->mp_affinity); + qemu_fdt_setprop_cell(s->fdt, name, "reg", + arm_cpu_mp_affinity(armcpu)); if (psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) { qemu_fdt_setprop_string(s->fdt, name, "enable-method", "psci"); } diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c index ac6889fcf2..9bfa9baa15 100644 --- a/hw/misc/xlnx-versal-crl.c +++ b/hw/misc/xlnx-versal-crl.c @@ -67,9 +67,9 @@ static void crl_reset_cpu(XlnxVersalCRL *s, ARMCPU *armcpu, bool rst_old, bool rst_new) { if (rst_new) { - arm_set_cpu_off(armcpu->mp_affinity); + arm_set_cpu_off(arm_cpu_mp_affinity(armcpu)); } else { - arm_set_cpu_on_and_reset(armcpu->mp_affinity); + arm_set_cpu_on_and_reset(arm_cpu_mp_affinity(armcpu)); } } diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index 8850381565..6c86e90102 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -37,7 +37,7 @@ CPUState *arm_get_cpu_by_id(uint64_t id) CPU_FOREACH(cpu) { ARMCPU *armcpu = ARM_CPU(cpu); - if (armcpu->mp_affinity == id) { + if (arm_cpu_mp_affinity(armcpu) == id) { return cpu; } } diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index a537a5bc94..659401e12c 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -1016,7 +1016,7 @@ static void hvf_raise_exception(CPUState *cpu, uint32_t excp, static void hvf_psci_cpu_off(ARMCPU *arm_cpu) { - int32_t ret = arm_set_cpu_off(arm_cpu->mp_affinity); + int32_t ret = arm_set_cpu_off(arm_cpu_mp_affinity(arm_cpu)); assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS); } @@ -1045,7 +1045,7 @@ static bool hvf_handle_psci_call(CPUState *cpu) int32_t ret = 0; trace_hvf_psci_call(param[0], param[1], param[2], param[3], - arm_cpu->mp_affinity); + arm_cpu_mp_affinity(arm_cpu)); switch (param[0]) { case QEMU_PSCI_0_2_FN_PSCI_VERSION: diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c index 9080a91d9c..50d4b23d26 100644 --- a/target/arm/tcg/psci.c +++ b/target/arm/tcg/psci.c @@ -215,7 +215,7 @@ err: return; cpu_off: - ret = arm_set_cpu_off(cpu->mp_affinity); + ret = arm_set_cpu_off(arm_cpu_mp_affinity(cpu)); /* notreached */ /* sanity check in case something failed */ assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);