From patchwork Thu Dec 7 11:10:48 2023 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: 751068 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp361514wrb; Thu, 7 Dec 2023 03:11:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLViYAFgVov+3UxgBYIu+STXuZcciOF3j2gRfAW0HkAsT5/ezzXgbhNOSudY6wtF2HoTnw X-Received: by 2002:a05:6122:179c:b0:4b2:ebcb:9da8 with SMTP id o28-20020a056122179c00b004b2ebcb9da8mr2604042vkf.27.1701947515981; Thu, 07 Dec 2023 03:11:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701947515; cv=none; d=google.com; s=arc-20160816; b=D53TYGofBJYNtE9BylH7Ic9DYnCSMtfrzsc+Qk+8tUfSRAVODWTm0iEOKsTQp+Ff6m PpaZCA5PjJcJdI8/hN7IYRDN8sy1t81wBU5za7sCh/dGJ1Q52ZDMh1334lT9zq5BFew2 vBHfS/YgrXg//jwdg3mwYWxeJ/njIc8LWErHJhNmyv+8/OR6afZfYT20kfPw9Mdcfjhn 13R8X86u3U9KFgGyN2WksLOdVOW7v3QczYlDCtE0rkLLPbtfO0m2Th1RlZxlX8a57pir DgBd3bLC2B4Ib/p1820piRWtdYycQEQE3uLIUadnsWYKEfUrrTZa12+qVh3DmaAkyQCl 2vFw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=dXjSCK34R3h3M/dmvhhSfTZBGg4aHS/PwIXNQt3mFHo=; fh=DKQFoSm5rvXVk6AUqpSavFv+IR+qPwKdgcCOIx8jJm4=; b=h+kbdVomhBBR0AcMreQ/WxmpK4J6Y4DMSBcxDA0Q0IiVmWMVKBBnG2YU+vHZ6KhUWP dHGxZM/csglh69vwSWouPs2+k23y81Nk45dbycWBNZu78tBHm3L8aXgC1MboDq/eTIOT Sj94O6PZCqCrk5LCxHdsV+7Ev2DVguQObP9wknAfsY59BQQza+CUXCQPr8EQkFtZqzu/ vKBUXZONgKskP8scq8XQ6XqSQkKyrpNddDK+Wqy8uEKMQZWjMnbqr5zu5i/Zjs2XDzV6 0RSMW6KsCvIGw2UpBOTZ+dAG8czEeIr+N313QE5oODQHsvAmFhFTn7oz1JwMYzUoBv5d /3NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xCi6Avti; 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 x7-20020a0cfe07000000b0067a467d178csi1034458qvr.495.2023.12.07.03.11.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Dec 2023 03:11:55 -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=xCi6Avti; 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 1rBCHS-0002fK-OS; Thu, 07 Dec 2023 06:10:58 -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 1rBCHO-0002et-SA for qemu-devel@nongnu.org; Thu, 07 Dec 2023 06:10:55 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBCHM-0004fc-DM for qemu-devel@nongnu.org; Thu, 07 Dec 2023 06:10:54 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33350fcb2c7so554241f8f.2 for ; Thu, 07 Dec 2023 03:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701947450; x=1702552250; 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=dXjSCK34R3h3M/dmvhhSfTZBGg4aHS/PwIXNQt3mFHo=; b=xCi6Avti5xKEQm9LD9/SfZn/y2orBbrDkWY8PCl2PyFh+dD01GFD1BMxW0rlc3BVJy NtFMiz5OkmEf6i9rVtX0kZes/PXAdqcG6hkODhDU7bwrQPTc1vRhC99bjnTtv7A3ae3c gAw4Acd8ruucS9yKDlsXfeAVEiTGWkT7PBY7KZxv197oxrMRPWyhcCfvOMJIeU/rbusK /t9hVGqfBQjOQPAhRAL57iOK9/bMvCSfMqHeXpydgXfFOs/uLVI5eXeFBzlMDRJ+YP8x 4jkaY9QLOB+YSMlxOwQGyJenC8nXWx+cNI4xVKWLPllhz0op6J9cuBsqVMdfqDGF/6cb 4S8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701947450; x=1702552250; 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=dXjSCK34R3h3M/dmvhhSfTZBGg4aHS/PwIXNQt3mFHo=; b=rK4fhlf3OtvwzmAXaOgEAMuGMZCKau8XwPFeDpJOIjlFh7kDj7KUtIxOzVR5Isml7h 9hgrMpUr+GgnJU8PqWOjovALrWCRDCRUVqm6x8y4nw6Y3eWub1w+e0yihlx+PmIT0zzy OIzugZv4bp6fBlUWBf4c/Kw3FPriGb15g44YewU6ICgHupbEAky+r/eJW39G77cQZlZp YLG2PBZ89Ooz6VVRw12W5CXtaO3WnI+LuFe9liNGAAG8CWDoGARWGDCEsW2bdRMDjKeD fYaySyfSBwj0TbeQAcPL3mQ18Cb+nu9QaXFdgB0750XPD2G+DLYXnYrFfSjfYz1vr+xd 8MBA== X-Gm-Message-State: AOJu0YzhRhUBtPoHeA8ZFuo4ErXFihpp8sRTFvFA1iOpRgzoQ5coc5tT CGGMHAUmmIAUDPtk8uKr+UeXbE4H0DFnNcRz0Ho= X-Received: by 2002:adf:fac2:0:b0:333:2fd2:816a with SMTP id a2-20020adffac2000000b003332fd2816amr1413317wrs.135.1701947450369; Thu, 07 Dec 2023 03:10:50 -0800 (PST) Received: from m1x-phil.lan ([176.187.202.111]) by smtp.gmail.com with ESMTPSA id dh8-20020a0560000a8800b00334b3208700sm1163670wrb.49.2023.12.07.03.10.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Dec 2023 03:10:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH] target/arm: Restrict ARM_FEATURE_PMU to system emulation Date: Thu, 7 Dec 2023 12:10:48 +0100 Message-ID: <20231207111048.50568-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.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=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 ARM Performance Monitor Unit is not reachable from user emulation, restrict it to system emulation. Signed-off-by: Philippe Mathieu-Daudé --- target/arm/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 51f57fd5b4..60cf747fd6 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1410,6 +1410,7 @@ static Property arm_cpu_pmsav7_dregion_property = pmsav7_dregion, qdev_prop_uint32, uint32_t); +#ifndef CONFIG_USER_ONLY static bool arm_get_pmu(Object *obj, Error **errp) { ARMCPU *cpu = ARM_CPU(obj); @@ -1432,6 +1433,7 @@ static void arm_set_pmu(Object *obj, bool value, Error **errp) } cpu->has_pmu = value; } +#endif unsigned int gt_cntfrq_period_ns(ARMCPU *cpu) { @@ -1592,12 +1594,12 @@ void arm_cpu_post_init(Object *obj) if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) { qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property); } -#endif if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { cpu->has_pmu = true; object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu); } +#endif /* * Allow user to turn off VFP and Neon support, but only for TCG --