From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 1C5831EB5FD for ; Wed, 10 Jun 2026 00:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781051444; cv=none; b=b3bQmz4zQwvwapPVn/LKgof8ZI7pQres7lCGLyHtG2yFY6Ev1Fp3Xd2zdScLKNmA+eCgugR2y3Zmxr48WMAjpyG/2VZ/a0DVrSRsbyJ98f8Tm23EboJbtybxFNkaPRfVLWxroZazVbPGxWlV77Pz2z0gB+MYv0QRbxDcHfi1SR4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781051444; c=relaxed/simple; bh=JCtiZjmY4OkEjqJhiNZu5/8IUMYQ+m6GibjNsNyaBx8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=A6fiEBKs8mWl9mQ0pjdregB1yf7bYX0wTwk+s1gZQ9xyiY9FOFgHgnkfK1z7LnosyEb9Z8pdWq/l1QrNAATW9oI+77uWG2BJAZ/pi+AKcOXbUloQNNr7498SWBFo5HRINJxKZo34TZZwLY+F5JNzj4PMOJCRygFKoSdCkS0nhr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lynT2rhE; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lynT2rhE" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bd04e4fe3dso96929105ad.3 for ; Tue, 09 Jun 2026 17:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781051437; x=1781656237; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=do2TUutmZnLPdNANAnUC8W/tz3zTrIIAME11eTVG70I=; b=lynT2rhEzZeiwbIWee44XVLVCp494xiIKTjfgS+PC4Q7vmd3aqrUpo1R79xbs3rZYY gNWyq+8HPbmmhGwPaRnhIuxvxckyyXT7kBZB5OswpJZxYWGmn90hBqHWH+SgLFuhp9Uo 62bBD/VYAAeWPsNI7EHOVMqPlpAo8mkYFSM51dnX2XgjOWPvUw4prEArgGvgi6LKUeSJ GDTo52cfo/gtrylBB1cmt7CKs00vxNf4SAa9Fr8C3t9uUBuQDcMYnottJAltpYv9jAMg 3fyAoojITaqnGwoehJgzPgyFElQDLo5a2ELeT9OK3t4QbsTAh/pPhF4ZHq6qdHSYXpDD 2/Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781051437; x=1781656237; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=do2TUutmZnLPdNANAnUC8W/tz3zTrIIAME11eTVG70I=; b=H95CkCy8NFlKW01VuF3HZrWiUG0GIgOvil1SL1jdqM5XuLVvmSJ7Ws4mhebeK6T0Eq VpskCFqZUHh9AFDFVfOfCoYj2lGlNe6mmi61crKSiLqGGCFQsBsRc2T61DewgII26ANF DnWKHa9Du4kCDDahmsTUBEcWSkbr07qitrLNv5417UKRgQmiUAHBqDeNBdTPdVxRiQn7 ouxZD6uoqjczujt3tUakMfbUtstciDqHbc7Yj9g3/egaTd5BQzf8TWcTfG4QNrc7zqW/ PkSROvnhQGJ8eZRaBgeoNrUluZB7fnxL6GIl3FrcxVxn/xa8eskER0imzZZnZda13oqm tppA== X-Forwarded-Encrypted: i=1; AFNElJ/WT1c/qEQdMQVOYJ3ZofC1SEM2nnNLvSUSiWubp/6+MrI6xKWeQesKPJY4DOXhwFb2I4m60xEFC/ScAqQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7iNJ/KZK4ovEiLK+UV7O/CASJJzdhJR93eswDus9HkxKVzNfY 1sTCZ6dGDSxQaKlZe06RneWDvQxGRDOWbIosBSVnayvPDcryQ68bTYq0p/Lt37G0avCDAN80j42 Fiv0Oxw== X-Received: from plblq12.prod.google.com ([2002:a17:903:144c:b0:2bd:d6b8:a012]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f549:b0:2c0:b319:fb43 with SMTP id d9443c01a7336-2c1e849530dmr258612775ad.21.1781051437078; Tue, 09 Jun 2026 17:30:37 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 9 Jun 2026 17:30:29 -0700 In-Reply-To: <20260610003030.2957261-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260610003030.2957261-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.1099.g489fc7bff1-goog Message-ID: <20260610003030.2957261-5-seanjc@google.com> Subject: [PATCH v8 4/5] KVM: selftests: Add a helper to query enable_mediated_pmu module param From: Sean Christopherson To: Paolo Bonzini , Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed , Jim Mattson Content-Type: text/plain; charset="UTF-8" Add a utility to check whether or not the mediated PMU is enabled, pivoting on Intel vs. AMD since the module param is defined by vendor code. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/include/x86/processor.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h index e5a602c87273..7d3a27bc0d84 100644 --- a/tools/testing/selftests/kvm/include/x86/processor.h +++ b/tools/testing/selftests/kvm/include/x86/processor.h @@ -1394,6 +1394,14 @@ static inline bool kvm_is_pmu_enabled(void) return get_kvm_param_bool("enable_pmu"); } +static inline bool kvm_is_mediated_pmu_enabled(void) +{ + if (host_cpu_is_intel) + return get_kvm_intel_param_bool("enable_mediated_pmu"); + + return get_kvm_amd_param_bool("enable_mediated_pmu"); +} + static inline bool kvm_is_forced_emulation_enabled(void) { return !!get_kvm_param_integer("force_emulation_prefix"); -- 2.54.0.1099.g489fc7bff1-goog