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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 403BEC31E5B for ; Mon, 17 Jun 2019 16:33:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 18466208C4 for ; Mon, 17 Jun 2019 16:33:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TytBfvAr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18466208C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=23mJ7eOA/aPAb+ATP7BEuin4BGqM6M9EAuCsS2bB1lE=; b=TytBfvArNw3G1N/stIyi2r6zr enWWkxd+7Zw03cynKmO1DOibD+sqSgrly24JOkGLJbDCxtKkrbs6DeR6ewLYc+znsQc8wMXRMjRkV nOCw/OydAsQnL4SLBs2W3nJY7wePMMKrQ5icVqDGIL5ug1kQlulmXoAjoQjv8OxQeCjkKt2n+wOXU AHWBhZAP6VHcj2FHEkavAiRuulotoRjXu8rrpgHRfMyDd8VpTg3QUK6CrZD04GcdPks6hmmQGDw+F cSCWMJs5ePn2IL6t1JogUJhCiBZhzkc+Geb+RwmrtYo4AESYgRryv2yWBmYS5EgH8dVAQo11kUooI qAtMP7nrQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcuZp-0005y4-Dt; Mon, 17 Jun 2019 16:33:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hcuZl-0005xV-BY for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2019 16:33:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8BDF328; Mon, 17 Jun 2019 09:33:44 -0700 (PDT) Received: from [10.1.196.93] (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 528A83F718; Mon, 17 Jun 2019 09:33:43 -0700 (PDT) Subject: Re: [PATCH v9 4/5] KVM: arm/arm64: remove pmc->bitmask To: andrew.murray@arm.com References: <20190612190450.7085-1-andrew.murray@arm.com> <20190612190450.7085-5-andrew.murray@arm.com> <6a8e4fdd-d8cf-f3fb-55cd-2d06805b0eb9@arm.com> <20190613093957.GG49779@e119886-lin.cambridge.arm.com> <5e18d747-1d82-8eed-ef1c-de86c5b3a7e7@arm.com> <20190617154311.GM20984@e119886-lin.cambridge.arm.com> From: Suzuki K Poulose Message-ID: Date: Mon, 17 Jun 2019 17:33:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190617154311.GM20984@e119886-lin.cambridge.arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190617_093345_443339_C97A1811 X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: julien.thierry@arm.com, marc.zyngier@arm.com, christoffer.dall@arm.com, james.morse@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/06/2019 16:43, Andrew Murray wrote: > On Thu, Jun 13, 2019 at 05:50:43PM +0100, Suzuki K Poulose wrote: >> >> >> On 13/06/2019 10:39, Andrew Murray wrote: >>> On Thu, Jun 13, 2019 at 08:30:51AM +0100, Julien Thierry wrote: >>>>> index ae1e886d4a1a..88ce24ae0b45 100644 >>>>> --- a/virt/kvm/arm/pmu.c >>>>> +++ b/virt/kvm/arm/pmu.c >>>>> @@ -47,7 +47,10 @@ u64 kvm_pmu_get_counter_value(struct kvm_vcpu *vcpu, u64 select_idx) >>>>> counter += perf_event_read_value(pmc->perf_event, &enabled, >>>>> &running); >>>>> - return counter & pmc->bitmask; >>>>> + if (select_idx != ARMV8_PMU_CYCLE_IDX) >>>>> + counter = lower_32_bits(counter); >>>> >>>> Shouldn't this depend on PMCR.LC as well? If PMCR.LC is clear we only >>>> want the lower 32bits of the cycle counter. >>> >>> Yes that's correct. The hunk should look like this: >>> >>> - return counter & pmc->bitmask; >>> + if (!(select_idx == ARMV8_PMU_CYCLE_IDX && >>> + __vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_LC)) >>> + counter = lower_32_bits(counter); >>> + >>> + return counter; >> >> May be you could add a macro : >> >> #define vcpu_pmu_counter_is_64bit(vcpu, idx) ? > > Yes I think a helper would be useful - though I'd prefer the name > 'kvm_pmu_idx_is_long_cycle_counter'. This seems a little clearer as > you could otherwise argue that a chained counter is also 64 bits. When you get to add 64bit PMU counter (v8.5), this would be handy. So having it de-coupled from the cycle counter may be a good idea. Anyways, I leave that to you. Cheers Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel