Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp89360pxb; Thu, 30 Sep 2021 01:37:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0fKNh5lnNaOK/GETjOEOdv42EVWeevOKg+B/Jn9jz7kyvD/pGDHMeiU+zR9vllUyE0NLA X-Received: by 2002:a17:906:144e:: with SMTP id q14mr5034099ejc.19.1632991078001; Thu, 30 Sep 2021 01:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632991077; cv=none; d=google.com; s=arc-20160816; b=kzEqBG2FCbH5UypbWq8V7RuYuiedOMJ3sTqz/Eme/JO/iLMR84CUhRVqUZfzmfnW6X 385BxLyEoFm0bK8ZZyqw6q//s9XjtIvTSEDuLvLx0nBo9KvbpjzQKx0L5ErCH+LPMtmP xFEL6mE23LiPk8LL7wgpi8Wlm4B9GGLseFuZrkta1y4QoQ2LiX00CP/1fKlz1OqKKhGu zgybveCFijmls5nMFNBB0VfqEKhQuauUMYQ5jyHJcsicMWSn2DFjEMgMxXZvznI98Vza kdZHE/ya9G9G01svHjsRagddPGmUlpmyXd4G7NZ4lrO3wkDdRfgGIelob57hLz1vC3wv CJ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qZDlrtySWZ8aKYElfHM2QvkjVRqwG+Yrljzwwq0Gl48=; b=p3BXq4CXb/nrO434pqRpsBUxsTh9tQkUGmSJnzeqcmkIedIUMCySzXNlmUernc6srz U9yL3v2D/IAmvZ4SVzOTSicq6scTDsNrHHdrLOljLmLzHxNyDMk8BsG0TbxBVyAatL+m DH2Q5Kz/FTmJqFHfk2GOJCepB5x6FNNJA20MaY1u2cEa2fxwoWf/BMpCP5FNGI53BVr/ edvGnp77T8Z07GKeD9L9EGzepziZdTUbLymumVkNevsWVqUF4Tq7tKbcnuPRGzcHj6JC ei0Whl4i22GArPaiofbVhy5cud7EJG7FlvfAJ8tWwelL9qRhT8e7FB3Wv3UF0uDEoLFc C2ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iwn1wDd6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 9si2539847ejy.65.2021.09.30.01.37.33; Thu, 30 Sep 2021 01:37:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iwn1wDd6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348984AbhI3I1L (ORCPT + 99 others); Thu, 30 Sep 2021 04:27:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27577 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348048AbhI3I1K (ORCPT ); Thu, 30 Sep 2021 04:27:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632990327; 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=qZDlrtySWZ8aKYElfHM2QvkjVRqwG+Yrljzwwq0Gl48=; b=iwn1wDd6DugpCLFen0QeHSDkhmo38eEFP3atbfzEPOUzGIYOpxx2f8eX4Hj6yjUP9bu6qV Bs8wESJabcgVOZHc3lObe6x7v26yF0AtF96oSbse0KAXCsP6AEvYch9/q1dy4oWKSlIIn8 cc5ucGpMcExi0xVG2M8GzyvAAxW7rHE= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-z8g20zW5P4edOUrSh7Ue4A-1; Thu, 30 Sep 2021 04:25:26 -0400 X-MC-Unique: z8g20zW5P4edOUrSh7Ue4A-1 Received: by mail-ed1-f69.google.com with SMTP id e7-20020a50d4c7000000b003d871ecccd8so5407563edj.18 for ; Thu, 30 Sep 2021 01:25:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=qZDlrtySWZ8aKYElfHM2QvkjVRqwG+Yrljzwwq0Gl48=; b=22nSAHVf/UHKG13zztifLLhGgZK69/12jmLvhJ+QJYPtWvfrVXk5byiQDWLU43Uhwn ex/+nLBoLqOorJhmTiuIz4HF1a1LR0JCfwP2FaiVmquvwPgNV459Jp4qSLeKzhY6Z93t K3jhLhhLWdS+vX48JH+4I0o085Ydp5Ei5el9LAKrwwejkU/NmBshTPh9eVXtdUFAAa9I 8meJSxtklSP47xeL2aaoOd8rKcvckIsVyhiQzRxXQ497FxADukoXWJ2GkRIC1VaUqQq7 1yVlX0Lk+IZdZNxULhrPYfQ9pjYtVruKZcf4WF7W6cCo0CiDtEqCgLWz83QNM9+xfUOs H1sQ== X-Gm-Message-State: AOAM530btBAcZtREDPs3gpmZUVLw97GBjAL/CA5R4A/8VRSdBHPDflpB YUaIRKZx0Di7CKWNdNtUaqM6+Wdv12dyI322IgTQ4fjHyAPUohDOfAVY4jMe2L0RKHF7gvmFIUh DJttD3jS5eprccEj8imJzMMDS X-Received: by 2002:a17:906:4f82:: with SMTP id o2mr5306283eju.10.1632990325031; Thu, 30 Sep 2021 01:25:25 -0700 (PDT) X-Received: by 2002:a17:906:4f82:: with SMTP id o2mr5306267eju.10.1632990324849; Thu, 30 Sep 2021 01:25:24 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id k7sm1052460eds.96.2021.09.30.01.25.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 01:25:24 -0700 (PDT) Message-ID: <75632fa9-e813-266c-7b72-cf9d8142cebf@redhat.com> Date: Thu, 30 Sep 2021 10:25:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH 2/2] KVM: x86: Manually retrieve CPUID.0x1 when getting FMS for RESET/INIT Content-Language: en-US To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+f3985126b746b3d59c9d@syzkaller.appspotmail.com, Alexander Potapenko References: <20210929222426.1855730-1-seanjc@google.com> <20210929222426.1855730-3-seanjc@google.com> From: Paolo Bonzini In-Reply-To: <20210929222426.1855730-3-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/09/21 00:24, Sean Christopherson wrote: > * RESET since KVM emulates RESET before exposing the vCPU to userspace, > * i.e. it'simpossible for kvm_cpuid() to find a valid entry on RESET. > + * But, go through the motions in case that's ever remedied. Note, the > + * index for CPUID.0x1 is not significant, arbitrarily specify '0'. Just one nit, this comment change is not really needed because almost all callers are using '0' for the same reason. But, perhaps adding kvm_find_cpuid_entry_index and removing the last parameter from kvm_find_cpuid_entry would be a good idea. Also, the kvm_cpuid() reference needs to be changed, which I did upon commit. Paolo > */ > - eax = 1; > - if (!kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy, true)) > - eax = 0x600; > - kvm_rdx_write(vcpu, eax); > + cpuid_0x1 = kvm_find_cpuid_entry(vcpu, 1, 0); > + kvm_rdx_write(vcpu, cpuid_0x1 ? cpuid_0x1->eax : 0x600);