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=-6.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 2E1F1C2D0A8 for ; Wed, 23 Sep 2020 17:07:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE79620BED for ; Wed, 23 Sep 2020 17:07:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JKu/cKpu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbgIWRH3 (ORCPT ); Wed, 23 Sep 2020 13:07:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38116 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbgIWRH2 (ORCPT ); Wed, 23 Sep 2020 13:07:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600880847; 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=lCCKD50VB6ysGiusHqpWTIv/KmfW8J9HjWEMiCZ49xs=; b=JKu/cKpudogF92POa1HicZLcpbtbiE+KM7Sf6foGD2pVNrCpXXg+TEUop4Z1jJcSlhXgmq DMpDE68QjAKwy+6WCpzBmi4A1GLKDKm6DUOkeu7RMHpC3a7SsIn7L2AxTZAslP6kQMViiG ZQ9NQNp/VB9MFbjP91fk2jjUYUeqUbs= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-03dP22W7PYaKGx9CfOn9ig-1; Wed, 23 Sep 2020 13:07:26 -0400 X-MC-Unique: 03dP22W7PYaKGx9CfOn9ig-1 Received: by mail-wm1-f71.google.com with SMTP id c200so166770wmd.5 for ; Wed, 23 Sep 2020 10:07:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=lCCKD50VB6ysGiusHqpWTIv/KmfW8J9HjWEMiCZ49xs=; b=KinimJo614MZXIKwOC3AzvsTOkrd0CgYeNV/z3de01Yz88AC23oGMg+lKvoSi13IU7 cXCvCcKEKgI5QOGVOni87sXKS3wRVq13I4Ki5vZW+ayKpcsD4AW1mPaEZbmRG+WT3mcJ 6LYyMbHZsGuAxD84jozEfJvXVyuMgBDYI5bsGV1Id+RqVgtZbK+ELfOyZqohoRV+hWUM fmhv2QeghcrGPfIP/p+qTf9D7+8Jhqo+L8UIcGYtPa+uTtzjrKL1FzFBPQ8npMaGkYnJ q9psFoTupNrUGnVDrNY5VbpJAGyKIRsWdKYpj3y88HJEqc9hySA278kcauJ5Zj6yGDrS y0Fg== X-Gm-Message-State: AOAM532r7O6YSLpCFEsseEWsvBAHZP3ve4AMYGOzfxgRWodaOlWMJfMm Nt97Ge+ndDw0uAblYleEzhqsCtZ/V9dBwUwJQxMNf8cNWwlpe3zDKdGW9DeZzubGLlXY/dKi0PW GRDls9lslnUD0nZT9NJ0y5MUS X-Received: by 2002:a1c:4886:: with SMTP id v128mr510599wma.139.1600880844313; Wed, 23 Sep 2020 10:07:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCTnefL3+7phQEIxiRq7WpGLt9gBwjnmt9g3u/ONU7vVvcSqUmmyhcncSU48t9tHwhf48huw== X-Received: by 2002:a1c:4886:: with SMTP id v128mr510585wma.139.1600880844128; Wed, 23 Sep 2020 10:07:24 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:15f1:648d:7de6:bad9? ([2001:b07:6468:f312:15f1:648d:7de6:bad9]) by smtp.gmail.com with ESMTPSA id c14sm400588wrm.64.2020.09.23.10.07.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Sep 2020 10:07:23 -0700 (PDT) Subject: Re: [PATCH v2 2/3] KVM: VMX: Replace MSR_IA32_RTIT_OUTPUT_BASE_MASK with helper function To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200923163629.20168-1-sean.j.christopherson@intel.com> <20200923163629.20168-3-sean.j.christopherson@intel.com> From: Paolo Bonzini Message-ID: <0a215e25-798d-3f17-0fcb-885806f2351b@redhat.com> Date: Wed, 23 Sep 2020 19:07:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200923163629.20168-3-sean.j.christopherson@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/09/20 18:36, Sean Christopherson wrote: > +static inline bool pt_output_base_valid(struct kvm_vcpu *vcpu, u64 base) > +{ > + /* The base must be 128-byte aligned and a legal physical address. */ > + return !(base & (~((1UL << cpuid_maxphyaddr(vcpu)) - 1) | 0x7f)); > +} The fact that you deemed a comment necessary says something already. :) What about: return !kvm_mmu_is_illegal_gpa(vcpu, base) && !(base & 0x7f); (where this new usage makes it obvious that mmu should have been vcpu). Paolo