From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id A144FC433F5 for ; Thu, 25 Nov 2021 20:30:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3DF594B0CE; Thu, 25 Nov 2021 15:30:57 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ewx1vlMH7o5i; Thu, 25 Nov 2021 15:30:56 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3F44E4B134; Thu, 25 Nov 2021 15:30:56 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 208CF4B0CE for ; Thu, 25 Nov 2021 15:30:55 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G2tnLEzpojMj for ; Thu, 25 Nov 2021 15:30:54 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 164324B0C5 for ; Thu, 25 Nov 2021 15:30:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637872253; h=from:from: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=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=UBG5+HEPWvuaq32Vd1sMJvFDlWdt49r34Hi5FQAxzhWfAut+my2ywnkD8ujPZpcRQAtOJx 6u5BaNuyyGgjAsj4NZojQBBD50Cj1wbjkpvSoYtNIjv5lHcOQysLD6hkoZUJzMwSYDRVU8 oux8d1LCCYJE+i+EqH8tKYE4SpU7bnU= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-376-UMQXP9wsNqG2W_5A4vTzhQ-1; Thu, 25 Nov 2021 15:30:52 -0500 X-MC-Unique: UMQXP9wsNqG2W_5A4vTzhQ-1 Received: by mail-wm1-f72.google.com with SMTP id 138-20020a1c0090000000b00338bb803204so3773181wma.1 for ; Thu, 25 Nov 2021 12:30:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=n9o05XxefiuzZ5xOqtA8jjHlYZNSdwTj3TOu7Duq44teU6uh70lleMVN3+mEKsrxlM 9tJo9fuPvxpriTFLQAT2wBg+ldtBZjFMzHoyWAEyXLtqPX9Xd7ySvokWxrxo7CrHiiOJ N3l9bR8zgQnIlxWEarRXZvnU4CeUYRIVTcpcvx5x3j+um+eWJwj/ei0DjF2408tsZv3M xt37W72XTBZrYtEWJte60jAcF9eSu45T53TbrxLR+hMwYCfjVr1+uQpCML5FzbiGaaLq LaXf8DMZp8iArvElw3um6C7OZG+aW01YbDId392d5+ywJCqPwp+nEGh5Jcx0sChakt5Y OtuQ== X-Gm-Message-State: AOAM533ktm/1Ut48PNb/wsEFjiGRBjTjdMwnPOjXIPM4Grt2yCTUNru8 b4N6JLV8zeCn20bdWGOq+GlvB0K/meRwnpsa49yxo8x/hyj4rUrPteG8Uf9Rlr8EthhD64gp8c7 fq02uJeSlisFEpNSKrbXdOB1G X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186653wru.475.1637872251640; Thu, 25 Nov 2021 12:30:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0gaKevT6dubAbNdgl8Mlg1Ca3d8cwo7W4YwZVK8nM2ffYuZwM+HX5qjU1mVul0Cey+e9psA== X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186629wru.475.1637872251479; Thu, 25 Nov 2021 12:30:51 -0800 (PST) Received: from ?IPv6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id h2sm3566055wrz.23.2021.11.25.12.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Nov 2021 12:30:50 -0800 (PST) Subject: Re: [RFC PATCH v3 09/29] KVM: arm64: Hide IMPLEMENTATION DEFINED PMU support for the guest To: Reiji Watanabe , Marc Zyngier , kvmarm@lists.cs.columbia.edu References: <20211117064359.2362060-1-reijiw@google.com> <20211117064359.2362060-10-reijiw@google.com> From: Eric Auger Message-ID: Date: Thu, 25 Nov 2021 21:30:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20211117064359.2362060-10-reijiw@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eauger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Peter Shier , Will Deacon , linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Paolo Bonzini X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Reiji, On 11/17/21 7:43 AM, Reiji Watanabe wrote: > When ID_AA64DFR0_EL1.PMUVER or ID_DFR0_EL1.PERFMON is 0xf, which > means IMPLEMENTATION DEFINED PMU supported, KVM unconditionally > expose the value for the guest as it is. Since KVM doesn't support > IMPLEMENTATION DEFINED PMU for the guest, in that case KVM should > exopse 0x0 (PMU is not implemented) instead. s/exopse/expose > > Change cpuid_feature_cap_perfmon_field() to update the field value > to 0x0 when it is 0xf. is it wrong to expose the guest with a Perfmon value of 0xF? Then the guest should not use it as a PMUv3? Eric > > Fixes: 8e35aa642ee4 ("arm64: cpufeature: Extract capped perfmon fields") > Signed-off-by: Reiji Watanabe > --- > arch/arm64/include/asm/cpufeature.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index ef6be92b1921..fd7ad8193827 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -553,7 +553,7 @@ cpuid_feature_cap_perfmon_field(u64 features, int field, u64 cap) > > /* Treat IMPLEMENTATION DEFINED functionality as unimplemented */ > if (val == ID_AA64DFR0_PMUVER_IMP_DEF) > - val = 0; > + return (features & ~mask); > > if (val > cap) { > features &= ~mask; > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C464EC433F5 for ; Thu, 25 Nov 2021 20:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KmDbDPMSzllJ7gh6ZS4rF4DLtFTkuW6qQ/d1xW4/GQs=; b=vCVEtVU5UGAsPp3ya2Tt89v3aC Z9hl/VMmzOx67OrD0m4uxZRkhC/5/uxrY4rJKaLi/XlkIpGjhvehSjFGhvfgednbWsrF+213vH7yP r72ratbqcc7XdHgXFUoi2AOwWQKMfbvlHGrzHglADCmpiKyO8A91/ADEQaBUrVRPRBGukfxbTvDWc e/5074akLGRDCpWt8dNvuwuBmwIggROrqAhyyick/c+y89hNzzlaA4IuNmDlLFTNkT2m7TEm5hPnn eV1fB70XLMDnPVJgaIetDzZ+kRHuDTy3Rhm2k/Xs9WKS/JRoom1xQ95qn6sCConUWVfXYmjtYnL7m z1OHO/6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqLOZ-008b4L-Vs; Thu, 25 Nov 2021 20:31:04 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqLOS-008b2o-Jt for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 20:30:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637872255; h=from:from: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=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=Hr6UVGRwGNz/hsz0bRpfLvp4zdwqEr26NlY6W39lq+f/qX71kkrhDR+nuDmuPoPh12U2QK lCfzGkpFyM/WTq2rH4TC9bCYT44/BOsRFHE5hMnUoq1w2es09QnMFehWGpEh2QUR4cCAMv nNSDQ9d2QoUiFpk6+mnXLX4H697khq8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-dRWclrwsPlq7xsO7V8-ciA-1; Thu, 25 Nov 2021 15:30:53 -0500 X-MC-Unique: dRWclrwsPlq7xsO7V8-ciA-1 Received: by mail-wm1-f72.google.com with SMTP id a85-20020a1c7f58000000b0033ddc0eacc8so3649657wmd.9 for ; Thu, 25 Nov 2021 12:30:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=BHqp4/M4x8jTdsQVa9wiHKp+nxUGN2Tx8BLkws28Gk9ukAYH0B8VsIbHNPdlpI4DQM D1WUlbhJ8T/92Fd9TqTPFjXIjvT81mmekh8S4cr16S+xtlidQpusBr4+cWxxEQHlHPWY Zpygf2XmYfcC9hF9DHMXDEA/qezZ0nLdxNgespIGSN7U2WR//EC5cC0iZzPhQR8VmX5h Qqnv+yNUTZfbHlQR0rdJx5dE2XzZIl84a2eYQWlmtIQHJHchhArNdYZVdX/+Q9yXJQmr UPisX+CndRtj5WHxJcZSTRqcYYWux4ISttl2GPpIZCFH8Ry0ONxYxAQxtDh8dR1mJo3z 6Tgg== X-Gm-Message-State: AOAM533Kt/QCKYKXZ5l5Di/lfvFUZ4BNiNUqKbwagFqvDltDUiYQjHyw FNbhGjbxLNNqhVfMn+5VFmt/GXMufG/ibNJW/MT6qGNoA1rYbOTCJ5R0x3Ii+/3UyEWBRiHZ4do MvI/iHWsjEZq+u00sHK4TNmCum2Pd5SMQoo0APFUt47B1AtesLVKLJgCYLhW9foywqXA6kTv+eu 5ls0OogKpi X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186669wru.475.1637872251738; Thu, 25 Nov 2021 12:30:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0gaKevT6dubAbNdgl8Mlg1Ca3d8cwo7W4YwZVK8nM2ffYuZwM+HX5qjU1mVul0Cey+e9psA== X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186629wru.475.1637872251479; Thu, 25 Nov 2021 12:30:51 -0800 (PST) Received: from ?IPv6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id h2sm3566055wrz.23.2021.11.25.12.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Nov 2021 12:30:50 -0800 (PST) Subject: Re: [RFC PATCH v3 09/29] KVM: arm64: Hide IMPLEMENTATION DEFINED PMU support for the guest To: Reiji Watanabe , Marc Zyngier , kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Will Deacon , Peter Shier , Paolo Bonzini , linux-arm-kernel@lists.infradead.org References: <20211117064359.2362060-1-reijiw@google.com> <20211117064359.2362060-10-reijiw@google.com> From: Eric Auger Message-ID: Date: Thu, 25 Nov 2021 21:30:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20211117064359.2362060-10-reijiw@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eauger@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_123056_771691_98A18FBD X-CRM114-Status: GOOD ( 23.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Reiji, On 11/17/21 7:43 AM, Reiji Watanabe wrote: > When ID_AA64DFR0_EL1.PMUVER or ID_DFR0_EL1.PERFMON is 0xf, which > means IMPLEMENTATION DEFINED PMU supported, KVM unconditionally > expose the value for the guest as it is. Since KVM doesn't support > IMPLEMENTATION DEFINED PMU for the guest, in that case KVM should > exopse 0x0 (PMU is not implemented) instead. s/exopse/expose > > Change cpuid_feature_cap_perfmon_field() to update the field value > to 0x0 when it is 0xf. is it wrong to expose the guest with a Perfmon value of 0xF? Then the guest should not use it as a PMUv3? Eric > > Fixes: 8e35aa642ee4 ("arm64: cpufeature: Extract capped perfmon fields") > Signed-off-by: Reiji Watanabe > --- > arch/arm64/include/asm/cpufeature.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index ef6be92b1921..fd7ad8193827 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -553,7 +553,7 @@ cpuid_feature_cap_perfmon_field(u64 features, int field, u64 cap) > > /* Treat IMPLEMENTATION DEFINED functionality as unimplemented */ > if (val == ID_AA64DFR0_PMUVER_IMP_DEF) > - val = 0; > + return (features & ~mask); > > if (val > cap) { > features &= ~mask; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A9A6C433EF for ; Thu, 25 Nov 2021 20:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242258AbhKYUgH (ORCPT ); Thu, 25 Nov 2021 15:36:07 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51491 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357135AbhKYUeG (ORCPT ); Thu, 25 Nov 2021 15:34:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637872254; h=from:from: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=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=TASQIoYmL2vjnHpoNdfU97cmT0YpWCmIYRiyv7BcXfMtqCjtWSSmmK+WAcbBuMASdFHQoa ohunlHd2WS2R9GU6L0oQjQlLI8MaMyHRyEn2HG363FFLYnuYryE9V0W0whcs6lPuPVVvTC igqVvPg2YEswJLF6XugT+Wh2x+eKuvM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-gHNA8ShbNOqfyUga9CZ0jQ-1; Thu, 25 Nov 2021 15:30:53 -0500 X-MC-Unique: gHNA8ShbNOqfyUga9CZ0jQ-1 Received: by mail-wm1-f72.google.com with SMTP id 187-20020a1c02c4000000b003335872db8dso3770945wmc.2 for ; Thu, 25 Nov 2021 12:30:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dEpF0Ya03y+5CSbJ4wmHYDmPmNwCt74NIwf3iLZqZgg=; b=PWKISvHD42xeteCSVz/qUdbxelKpUapxpBCIOkO/F1hU999cLtbeVXNRapzw3xspsx +tD+XYMAFJmjjf2TJXUN/Hha/PMpv5NpG+koz6oPXSRkHX9HM6fymKqIvobro8wo/eqJ L1OihnX56w8n/3h9XkzdI1jwqFA0Ed5knAmPomdKZtJOVSFJBCGW2vW9s1t1T8loPqBa SO+LIutGBFnx9o+JYLTt8sB0wKLHUm7uahqREyEIG0JLH7GZuc2INhhA9OZiH6Axez0l hPN+hAoA6IyCmQ/vcpdFTIkmAcmcY4Njv6fz2o1evUP3kVl4VphSlPYV4TaMAVvvWpVa KOhw== X-Gm-Message-State: AOAM530qs/8dESDL1TnS2hCb9y/x5saN6M+oM8EhxzIVjO+lq1AGwhCV zMpX3jJUT5h0Uw1dEXP+7S8K6Ls3B7Seg8CqZ0EaGHwdnKgDZDVYJbbUb8W+vuYmvaBwTvBbcsh K+EltVheazcua X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186648wru.475.1637872251640; Thu, 25 Nov 2021 12:30:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0gaKevT6dubAbNdgl8Mlg1Ca3d8cwo7W4YwZVK8nM2ffYuZwM+HX5qjU1mVul0Cey+e9psA== X-Received: by 2002:a5d:6312:: with SMTP id i18mr10186629wru.475.1637872251479; Thu, 25 Nov 2021 12:30:51 -0800 (PST) Received: from ?IPv6:2a01:e0a:59e:9d80:527b:9dff:feef:3874? ([2a01:e0a:59e:9d80:527b:9dff:feef:3874]) by smtp.gmail.com with ESMTPSA id h2sm3566055wrz.23.2021.11.25.12.30.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Nov 2021 12:30:50 -0800 (PST) Subject: Re: [RFC PATCH v3 09/29] KVM: arm64: Hide IMPLEMENTATION DEFINED PMU support for the guest To: Reiji Watanabe , Marc Zyngier , kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, Will Deacon , Peter Shier , Paolo Bonzini , linux-arm-kernel@lists.infradead.org References: <20211117064359.2362060-1-reijiw@google.com> <20211117064359.2362060-10-reijiw@google.com> From: Eric Auger Message-ID: Date: Thu, 25 Nov 2021 21:30:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20211117064359.2362060-10-reijiw@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Reiji, On 11/17/21 7:43 AM, Reiji Watanabe wrote: > When ID_AA64DFR0_EL1.PMUVER or ID_DFR0_EL1.PERFMON is 0xf, which > means IMPLEMENTATION DEFINED PMU supported, KVM unconditionally > expose the value for the guest as it is. Since KVM doesn't support > IMPLEMENTATION DEFINED PMU for the guest, in that case KVM should > exopse 0x0 (PMU is not implemented) instead. s/exopse/expose > > Change cpuid_feature_cap_perfmon_field() to update the field value > to 0x0 when it is 0xf. is it wrong to expose the guest with a Perfmon value of 0xF? Then the guest should not use it as a PMUv3? Eric > > Fixes: 8e35aa642ee4 ("arm64: cpufeature: Extract capped perfmon fields") > Signed-off-by: Reiji Watanabe > --- > arch/arm64/include/asm/cpufeature.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index ef6be92b1921..fd7ad8193827 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -553,7 +553,7 @@ cpuid_feature_cap_perfmon_field(u64 features, int field, u64 cap) > > /* Treat IMPLEMENTATION DEFINED functionality as unimplemented */ > if (val == ID_AA64DFR0_PMUVER_IMP_DEF) > - val = 0; > + return (features & ~mask); > > if (val > cap) { > features &= ~mask; >