From patchwork Sat Jun 29 12:50:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13716920 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950422B9BE for ; Sat, 29 Jun 2024 12:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665463; cv=none; b=J/ezfau3Nc9LLLGZp8GDNsmj+8d0Qu4wI2R5K3hoVDPl1snnj7aoG2R5dQzCPcO1u/W7i5+jyiDCY2cog7e5QxmTzhffhWxYF+T7LVN1byZlwEqJKMq2dwje2laLZX0hyll8yhGHkcRcOx1ZsGVI8zOI7bdQq3LeqZZv3ombITQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665463; c=relaxed/simple; bh=hH0C+hMRrQebClCKrwJVUyAUbkOPif1mOqS4Fo/9xAg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bq19xn2xwtm5ux1a/Scm47t3Rfd40XUfPjaO5N3R3LRTkXJFNIiaCs0UDRH6TsD+knm63UyYKtfI9y7f3XShfY3uxxE6C5Z2T/lOmqCzxOqXalvDdjmGRfVzLeD25Ke8ACQ+cwHVLlyMd7SyPBrhgHnvxCAc2X+47DRfA8by0ZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=none smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=vEi/5Lfd; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="vEi/5Lfd" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3d561d685e7so1026461b6e.1 for ; Sat, 29 Jun 2024 05:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719665460; x=1720270260; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DvpsKqJKseTB8512E3EM/mcg58HxToRdE8EyOPRZHqA=; b=vEi/5LfdoVG/qRwmualVJan0xlUsUECTPAeOXzDY/OKW4516YZLQnjtJsKjE3ofFom D8RXCGgyJwuaEIJyWZha3SJo2kEPSn2ARosjPeDOUDwq8j/Fks09NawlT+rLyGeVp78O U9MzLkGFkPjAUz0jGCfy5JBinqMwaljgQPvDROVSi4PIkAk2jQumdoEm7vQNT0C0voIm ftpTZHQlbNe2YoGs2nFO8phsFyYev9vNruFcXIvishE5C5zl80enhSwXHPFU/QcqYWFX mq0PChEk03PMhAiUAA4qWwnmignDwXm9iNpWv3g6b/AsB0DrtHOPg8CN4g6A6jFdBp9C KPIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719665460; x=1720270260; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DvpsKqJKseTB8512E3EM/mcg58HxToRdE8EyOPRZHqA=; b=lRCyf0McRtDKdqEx+/ILlj5KCm6QeUrl0FHPpuoYCYmF+DRbhSb2Apbg0MX9cl+OWj DWHHnmdSXKvRhlZwOuoyY77YzUUyMqXonew1r9Dg1WNfwe8VeRyI3FuWu/fYXzvO42gj QYl60Q4tFKWP5LqfrElkHJC58CF9TUFCwACWozGrqzuavIfEXJ3YAWnVUs4M/AAhUWJe WlW9yg3f415kfNz8GKWIud0Tpmtu/K70UHQujQjgVfBqxKui8AcKZnxmr5QvhuL8CrWz BBLLgLgXBW2rPp/0FFuvfwYZpWhxH1AGYTxbvtI5QszYNZGQ+iRrcZuMnbIRxxBjpKU/ +vYw== X-Forwarded-Encrypted: i=1; AJvYcCV/Mc4R6qcoxl8q6ToDvE0EBtG2I79ynZsERlzHqdUiyanwwnRTj+ctX5qeAGeiho3CtAdYR8eQheyfsjaDdsMIyMod X-Gm-Message-State: AOJu0Yx/g2YRoQYpJ8bY5h7dbI7rc6AkurDVjKxjcNbIXMN8RSlKQEfP rfKX8TimsNCdm9sT7s4CWYBbGqBY7eoajb4mC9X8RCjEzR+VwFoxtSPktZM+jjU= X-Google-Smtp-Source: AGHT+IGnFk33QJj7zRJvjq34kT9S5rKVUvKwNykZ5WrLJUb8d4LshvqBoKRYEFxOAjs4b/IKgR0gEg== X-Received: by 2002:a05:6808:2204:b0:3d1:fc50:1aae with SMTP id 5614622812f47-3d6b2a2f0d4mr1188382b6e.7.1719665460603; Sat, 29 Jun 2024 05:51:00 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-708043b7145sm3322714b3a.148.2024.06.29.05.50.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Jun 2024 05:51:00 -0700 (PDT) From: Akihiko Odaki Date: Sat, 29 Jun 2024 21:50:32 +0900 Subject: [PATCH 1/3] tests/arm-cpu-features: Do not assume PMU availability Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240629-pmu-v1-1-7269123b88a4@daynix.com> References: <20240629-pmu-v1-0-7269123b88a4@daynix.com> In-Reply-To: <20240629-pmu-v1-0-7269123b88a4@daynix.com> To: Peter Maydell , Thomas Huth , Laurent Vivier , Paolo Bonzini Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Asahi Linux supports KVM but lacks PMU support. Signed-off-by: Akihiko Odaki --- tests/qtest/arm-cpu-features.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index 966c65d5c3e4..cfd6f7735354 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 void *data) assert_set_feature(qts, "host", "kvm-no-adjvtime", false); if (g_str_equal(qtest_get_arch(), "aarch64")) { + bool kvm_supports_pmu; bool kvm_supports_steal_time; bool kvm_supports_sve; char max_name[8], name[8]; @@ -537,11 +538,6 @@ static void test_query_cpu_model_expansion_kvm(const void *data) assert_has_feature_enabled(qts, "host", "aarch64"); - /* Enabling and disabling pmu should always work. */ - assert_has_feature_enabled(qts, "host", "pmu"); - assert_set_feature(qts, "host", "pmu", false); - assert_set_feature(qts, "host", "pmu", true); - /* * Some features would be enabled by default, but they're disabled * because this instance of KVM doesn't support them. Test that the @@ -551,11 +547,18 @@ static void test_query_cpu_model_expansion_kvm(const void *data) assert_has_feature(qts, "host", "sve"); resp = do_query_no_props(qts, "host"); + kvm_supports_pmu = resp_get_feature(resp, "pmu"); kvm_supports_steal_time = resp_get_feature(resp, "kvm-steal-time"); kvm_supports_sve = resp_get_feature(resp, "sve"); vls = resp_get_sve_vls(resp); qobject_unref(resp); + if (kvm_supports_pmu) { + /* If we have pmu then we should be able to toggle it. */ + assert_set_feature(qts, "host", "pmu", false); + assert_set_feature(qts, "host", "pmu", true); + } + if (kvm_supports_steal_time) { /* If we have steal-time then we should be able to toggle it. */ assert_set_feature(qts, "host", "kvm-steal-time", false); From patchwork Sat Jun 29 12:50:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13716921 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 706D72B9BE for ; Sat, 29 Jun 2024 12:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665469; cv=none; b=uJJBEX1N0N2Cq3B1Uyj2dgEM/FtYfD25Ifdcw+kbm0aBrw0ZqPKo5H91HwmtaCplh+YIFUCwix5d0Ph0dy151IFEO9JmspQX63JBwMJu4XiGiMLYC23X8tSLYP2nIjDRj+M+PLAjBA7YVV9Iyl0KxOulgqsAnpqh6HJDwaLtURk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665469; c=relaxed/simple; bh=k1k49SjjRKkxjnR5y8yDGKczXWO64Oj5yo/dBj0CY+0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IjVjefZSyzjaBN7THMq2ORwhUciImC+/SFDBtsch23IZIXDqoLcdYV9AOMxdlenAuu65G3GyjFxwbev+OSnz0pE/06Gem8gOjo4Ebj4MtfNl/7up5mhQK8I9nXPivtH6MiTDJ9jKR4ytLwkbRR9PwKUkc+50b3pVqVzfrnMyOlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=none smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=WK/frdcM; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="WK/frdcM" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-706a4a04891so1050962b3a.3 for ; Sat, 29 Jun 2024 05:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719665465; x=1720270265; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=p3Ff167L5PnEkX8Hjv5zeODUS2Rm0iaQ73J60qa2lyQ=; b=WK/frdcMZeduuhrkeWkmgKdb7N0EUzWZxb0bKr14iiHh4fW3wEUmOzDr2bD10zCbkT DB21abUJkBpuw3mFIlfH8yyVuLhVohUzy2mPxJBoCJttZq8GWMzYZNzm/UfRqFZwha/j 5QpsasRMCFB71n1yb5qOVTd8zG5aiwImJ7HRVHy+4Aqhcim9xwsJiyNYHlmuueSL9qLQ AlEPwxTMBW2O20rTljPR9PLxKELPXF2xutlJ+lvgxsROVsMxDokJ6mjih2SxTdHpcy+Q QR5p0aM5tFQG6G3uC3byYdyCrbj8F4nPvGmY3K3USOEHvgQ6qTg9M9MWc1hY35PCJixm bRag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719665465; x=1720270265; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p3Ff167L5PnEkX8Hjv5zeODUS2Rm0iaQ73J60qa2lyQ=; b=P4eNAn+Q8FPFxUN9FsDvzTQmN6UVj4JnrKRz17NmQ94h2U5RMhvrjZqR3ZVfj+xFae YWuh5LWlPNogHeDgqRDMh3KvRj1WZTVK4RkAPJz4ccSFpFOMbThdbWd53aF/F5EBXnG3 Uemgq85Y0ztsmSweGUOx779AD/Sd1wXxGsWJNS136VD6h2BzUIfX0VD6STfVUAcvKnHB OGQtTvN8L76C6l12RkB9Po5ILC8CXG+0gA24DtoR8zrUSW92FnOJISwBuTrLpKgKphFr Aokc/mNzQbWhSeeH6WvHQ/05EoJpuJVeJcURAA5FM7CMcDiONrEW+dtQUnUte192b17U vWLA== X-Forwarded-Encrypted: i=1; AJvYcCVC4AFHyV0y7e3VBL9eoBIS3zx9tBNyp3+QTI+JtpJnqRuK2diweYj1qKDM0W4uuYzSuEZ0w98kfRVcjrtw2zhDX3aN X-Gm-Message-State: AOJu0YwOGCl0/4Vt2LoNDIWptwbpteN8PtjPZHAD1WiXYm1cDCVa+V1f iuIy6Xo/AyP8nOng0u4IAQiirbUtRVFjBl5XGhw8VFkvVxwRyui1TUjGvphqlPY= X-Google-Smtp-Source: AGHT+IFCiPS0/8zesPRbyIYow94YbPB6IyyS94I3YzDOLPGWwQAW7sXt9gryc2zlfG/1uWsWHnbXag== X-Received: by 2002:a05:6a20:78a6:b0:1bd:2f6:e400 with SMTP id adf61e73a8af0-1bef624626bmr760352637.47.1719665464771; Sat, 29 Jun 2024 05:51:04 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fac1535b6esm31432145ad.156.2024.06.29.05.51.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Jun 2024 05:51:04 -0700 (PDT) From: Akihiko Odaki Date: Sat, 29 Jun 2024 21:50:33 +0900 Subject: [PATCH 2/3] target/arm: Always add pmu property Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240629-pmu-v1-2-7269123b88a4@daynix.com> References: <20240629-pmu-v1-0-7269123b88a4@daynix.com> In-Reply-To: <20240629-pmu-v1-0-7269123b88a4@daynix.com> To: Peter Maydell , Thomas Huth , Laurent Vivier , Paolo Bonzini Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 kvm-steal-time and sve properties are added for KVM even if the corresponding features are not available. Always add pmu property too. Signed-off-by: Akihiko Odaki --- target/arm/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 35fa281f1b98..0da72c12a5bd 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1770,9 +1770,10 @@ void arm_cpu_post_init(Object *obj) if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) { cpu->has_pmu = true; - object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu); } + object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu); + /* * Allow user to turn off VFP and Neon support, but only for TCG -- * KVM does not currently allow us to lie to the guest about its From patchwork Sat Jun 29 12:50:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 13716922 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 114EC54278 for ; Sat, 29 Jun 2024 12:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665470; cv=none; b=GqjIpQ4LK5IsABOQrUlqT+LaM7Ru9aLQSWALBm8OT4yEkiZv7i400WKfruKPluHJ67OOwtHLKV3CN4VhFMVZivJWROi+HDU+oVE8K0BDD1Pd4zF8gwcsYXQ/i8ikC4YI9SjTgRwIgBNY733EW0NTM5jxvb93oH5yjM35sgp7vvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719665470; c=relaxed/simple; bh=ntLWMZMdrDDVCvT8sW7kFT/q9aoNFN+t2v7TiuFBO5c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kvLCx6mmCZlq8K35w/ztkS9yLDQMEYmxqqSOcAfb4qTeDjmTderDV9PlKRDgj8YeCjuQc9diUH6gRRHbI07GiwDESkah5rs88y43c4XilqBjClGf18meovgBeQHjvKim56z41h2U9JtEEloo1L4llxnkwoqAyuZxeInXI5ZROIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=none smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=nhbEp9o9; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="nhbEp9o9" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso1204955a12.2 for ; Sat, 29 Jun 2024 05:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719665468; x=1720270268; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BLXk3fVoBHrMXW9NOMmJn9sejRtpsd5b8rXX3PkXa4Y=; b=nhbEp9o93zYY6pdzN7cVvKaPUea0xOZUm75xx6GK3IQOlaSrM3iCU9zNy1hNJDErUI CW7TUs7nbD8V53nedLiztm/UKuYXFUMD6+hkiDWQbXRBSFl9gA/SyT4AYoR/STTfWbbu Qz32iXwDcYE5+kvuzKthY/Sm/IINRM6/I2SrnLUOw20S3+vnOyKRHpP3kb6kR4/gIVGg FiuQanEmQ8il+0IfRHu2rIaWJlGHgxJjZNXeGEgJvr/j8PHiaRqh2K3+TGnbWLXSWeKS 6IrJEr1Iao2wqr+f7xEEVh5T/j7Ww0ysnbDsSq3X5R94XMJji3lDqmMc8vW+gMkG5wGt PBAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719665468; x=1720270268; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BLXk3fVoBHrMXW9NOMmJn9sejRtpsd5b8rXX3PkXa4Y=; b=no150anWoyPKaOXAFKKnpEU0jiOk9ldeS1h4e/jwaUW122FvGLzLbeuJZQJAShS0dV T+BHUSOe0Q7ndDNJorufkE2//c1rqnQy82Et40vhRL8svgTvsAmvfMYHQKNjkGpN5HxS 1MGk99dO6WoYtdm9F9uDYMshwUb+EeobAPL4SKGJ7WOb55+DZYxDS+9Cr+5G6waRw6RQ kb/OlIWliOf4rbQQRgc5ApTaILBtmDQtcWKZzu0CGZrehjlykltLxRJ9NyeS2ZNXx2TW veubEoWVHIH0XVTRFl9ryPicrF6PABM/btvVa9mIdzwYYblbRGxtPuo9ZwSvArDF+PpM 6fPw== X-Forwarded-Encrypted: i=1; AJvYcCXCqHOmgoTvMiPvbPRVfIsoNtRqhVmDRBeCAmSc86o5+H2eu/C/trxf5AJ3+AbrlPyy1u1/JtxWSHWgtZL1dDtLAGJ1 X-Gm-Message-State: AOJu0YzVeVuMc/Uh2zyatalnd5UMjA/YfvaIclhRQ4zTPSKll19koOft n8TqlsfZQttjAFlgBuNNx04o7Ph08ur1ZU1egGBBYjJCfUDUQhSnt2feZvSGm9Q= X-Google-Smtp-Source: AGHT+IG7G8Ijr8L2HKdiqhp40sGsy6gKftpsugRXAdDH+909J0VbPSV3RAHeQhyAI/SMsNkSSEd/nA== X-Received: by 2002:a05:6a20:1590:b0:1b5:ae2c:c729 with SMTP id adf61e73a8af0-1bef611bcf7mr1506320637.19.1719665468263; Sat, 29 Jun 2024 05:51:08 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fac10c8b3fsm31589815ad.5.2024.06.29.05.51.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Jun 2024 05:51:08 -0700 (PDT) From: Akihiko Odaki Date: Sat, 29 Jun 2024 21:50:34 +0900 Subject: [PATCH 3/3] target/arm/kvm: Report PMU unavailability Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240629-pmu-v1-3-7269123b88a4@daynix.com> References: <20240629-pmu-v1-0-7269123b88a4@daynix.com> In-Reply-To: <20240629-pmu-v1-0-7269123b88a4@daynix.com> To: Peter Maydell , Thomas Huth , Laurent Vivier , Paolo Bonzini Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 target/arm/kvm.c checked PMU availability but claimed PMU is available even if it is not. In fact, Asahi Linux supports KVM but lacks PMU support. Only advertise PMU availability only when it is really available. Fixes: dc40d45ebd8e ("target/arm/kvm: Move kvm_arm_get_host_cpu_features and unexport") Signed-off-by: Akihiko Odaki --- target/arm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 7cf5cf31dec4..6bb72c09be10 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -280,6 +280,7 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) if (kvm_arm_pmu_supported()) { init.features[0] |= 1 << KVM_ARM_VCPU_PMU_V3; pmu_supported = true; + features |= 1ULL << ARM_FEATURE_PMU; } if (!kvm_arm_create_scratch_host_vcpu(cpus_to_try, fdarray, &init)) { @@ -448,7 +449,6 @@ static bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) features |= 1ULL << ARM_FEATURE_V8; features |= 1ULL << ARM_FEATURE_NEON; features |= 1ULL << ARM_FEATURE_AARCH64; - features |= 1ULL << ARM_FEATURE_PMU; features |= 1ULL << ARM_FEATURE_GENERIC_TIMER; ahcf->features = features;