Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2167856iob; Sat, 30 Apr 2022 01:00:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYUrbo49nRVB6/+R7qr2EerhdDtdniLQDc0AKp9Dt1+ZbZrGjkvGH3QubuJsy5dPfVbFhn X-Received: by 2002:a05:6a00:1a4d:b0:50d:5921:1a8f with SMTP id h13-20020a056a001a4d00b0050d59211a8fmr2441851pfv.64.1651305614302; Sat, 30 Apr 2022 01:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651305614; cv=none; d=google.com; s=arc-20160816; b=H+UEWkQmbPAIXgGfaOHQohm1mvMzgBTd+s6v0CqJIOmhr+FSzf4VuhezTjGCjDlmu7 JDtf8zBCuaIzjS7HsK/eI0QIvJnU4Qg/RjFUaCXz+DE7EIvNl1Dta3UOtjc+pZm7t97k g4FqqecnVq0bSPZQmDfdbkqmSBX70nIshbAKM8eucNl6QHAHNJhpuL4jd1qU5jOb/7+v 1Q5Qlkp8BFLyXU38ax7aIemYzXCigpINZROryMT9D98Feiu19VxnSh3hTtKgELzLtRMc 44DXs8w/LXZfGtdoea1xZrqVLSz5OlWLBALtQRHWph0yKQm8GIdnRL3RamxyErVKpW2m YqRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=UW7K9N3A3auzYpRLwTp+c3IV2cf0c6gZLPYYx8hXS9s=; b=T9R8SSXrUwxcGfzhBrZph+fVqGIdSTrNarg1McKYEC1YxVhBG6gxyG4da8D06zTXmQ hDFaeAo5eZqVAvlvU3fbrM4sGaAZLHJp9QT3QHQlY9mRs80f3gBm2FAV8zZPXHKInpD3 CBCXNcdvalkUDUnmxjbCyySSGD2ekhsWHK9TnfhZ899v0foPq5VbQMPgWKfUoRcOYYOW AvosiBspePRiVUrtut08LccY8QqJD0Rux+wE3o6gVtMTL2AWQivDSnIqpfjNO0kao8cA 7WzIcadKfTC40Z+Wz2y4wn3UwtPUFeRGUPI5MA2fe4Ndmae51Em1KVzALg0iywQlCxgE 3ZlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=u36OGIG+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=NSeo9lGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na9-20020a17090b4c0900b001bf24ef7511si13918637pjb.125.2022.04.30.01.00.00; Sat, 30 Apr 2022 01:00:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=u36OGIG+; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=NSeo9lGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380725AbiD2UcM (ORCPT + 99 others); Fri, 29 Apr 2022 16:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380708AbiD2UcK (ORCPT ); Fri, 29 Apr 2022 16:32:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19DAD5EA5; Fri, 29 Apr 2022 13:28:50 -0700 (PDT) Date: Fri, 29 Apr 2022 20:28:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651264129; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UW7K9N3A3auzYpRLwTp+c3IV2cf0c6gZLPYYx8hXS9s=; b=u36OGIG+Cq/IUfL9YHrSaCABD2b0EmQXlAW+OHbWijM2MYVnlFZJd4M0mg4w93vwUYuZHW zjltlO4l3MCqTAkNPivlnexfO2fTEBsDPsrT806rTQ8HxogpTsWWFKjg5cBnjcBGP1KBZD azY6MQSqZvLUQEG+aoV4FNINFYWIk5ZVQklnxrZpvTzRdCjQjtXCY5lW0qTcDMpxK5SS2+ um2gLp+I7x+xTCcIyYqNKdcp5pAYXUvpgt9SfzJ02GZ176di7pPypuEmOOg2v/MIZe83nG rrhYuQHEPFl6ZHEWDDI7V04aBtPEkkuiOh6mEvydRwmj8KkKXP7OHXOGpv578A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651264129; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UW7K9N3A3auzYpRLwTp+c3IV2cf0c6gZLPYYx8hXS9s=; b=NSeo9lGTTEjR2OwRI/pGzg3AwhJufXsat0tDdZGfwsm2g0GhcN27mw1NPEM1vUwsh/o7jB VvJJ4M6uYS+Y3jBw== From: "tip-bot2 for Sandipan Das" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] kvm: x86/cpuid: Fix CPUID leaf 0xA Cc: Vasant Hegde , Sandipan Das , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C54bc7fe4cadf6bdef823bab1fba43d4891d2e1a9=2E16505?= =?utf-8?q?15382=2Egit=2Esandipan=2Edas=40amd=2Ecom=3E?= References: =?utf-8?q?=3C54bc7fe4cadf6bdef823bab1fba43d4891d2e1a9=2E165051?= =?utf-8?q?5382=2Egit=2Esandipan=2Edas=40amd=2Ecom=3E?= MIME-Version: 1.0 Message-ID: <165126412838.4207.9648561218200979307.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: fafd15ab6dc1fdfff66908e6d9231b124e1875cf Gitweb: https://git.kernel.org/tip/fafd15ab6dc1fdfff66908e6d9231b124e1875cf Author: Sandipan Das AuthorDate: Thu, 21 Apr 2022 11:16:59 +05:30 Committer: Peter Zijlstra CommitterDate: Fri, 29 Apr 2022 11:06:27 +02:00 kvm: x86/cpuid: Fix CPUID leaf 0xA On some x86 processors, CPUID leaf 0xA provides information on Architectural Performance Monitoring features. It advertises a PMU version which Qemu uses to determine the availability of additional MSRs to manage the PMCs. Upon receiving a KVM_GET_SUPPORTED_CPUID ioctl request for the same, the kernel constructs return values based on the x86_pmu_capability irrespective of the vendor. This leaf and the additional MSRs are not supported on AMD processors. If PerfMonV2 is detected, the PMU version is set to 2 and guest startup breaks because of an attempt to access a non-existent MSR. Return zeros to avoid this. Fixes: a6c06ed1a60a ("KVM: Expose the architectural performance monitoring CPUID leaf") Reported-by: Vasant Hegde Signed-off-by: Sandipan Das Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/54bc7fe4cadf6bdef823bab1fba43d4891d2e1a9.1650515382.git.sandipan.das@amd.com --- arch/x86/kvm/cpuid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index b24ca7f..ae1d963 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -887,6 +887,12 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function) union cpuid10_eax eax; union cpuid10_edx edx; + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) { + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; + break; + } + perf_get_x86_pmu_capability(&cap); /*