mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	x86@kernel.org, pbonzini@redhat.com, joro@8bytes.org,
	mlevitsk@redhat.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, peterz@infradead.org, hpa@zytor.com,
	thomas.lendacky@amd.com, jon.grimm@amd.com
Subject: Re: [PATCH v3 3/3] KVM: SVM: Extend host physical APIC ID field to support more than 8-bit
Date: Tue, 1 Feb 2022 21:56:55 +0700	[thread overview]
Message-ID: <45c0c1c2-f660-afb4-9631-e73cbbe60465@amd.com> (raw)
In-Reply-To: <Yc3qt/x1YPYKe4G0@google.com>

Sean,

On 12/31/2021 12:21 AM, Sean Christopherson wrote:
> On Mon, Dec 13, 2021, Suravee Suthikulpanit wrote:
>> The AVIC physical APIC ID table entry contains the host physical
>> APIC ID field, which the hardware uses to keep track of where each
>> vCPU is running. Originally, the field is an 8-bit value, which can
>> only support physical APIC ID up to 255.
>>
>> To support system with larger APIC ID, the AVIC hardware extends
>> this field to support up to the largest possible physical APIC ID
>> available on the system.
>>
>> Therefore, replace the hard-coded mask value with the value
>> calculated from the maximum possible physical APIC ID in the system.
> 
> ...
> 
>> +static void avic_init_host_physical_apicid_mask(void)
>> +{
>> +	if (!x2apic_mode) {
>> +		/* If host is in xAPIC mode, default to only 8-bit mask. */
>> +		avic_host_physical_id_mask = 0xffULL;
> 
> Use GENMASK(7:0) instead of open coding the equivalent.  Oh, and
> avic_host_physical_id_mask doesn't need to be a u64, it's hard capped at 12 bits
> and so can be a simple int.
> 

Actually, shouldn't it be u16 since the value returned from kvm_cpu_get_apicid()
would typically be 16-bit value (despite it has int as a return type).

Regards,
Suravee

  parent reply	other threads:[~2022-02-01 14:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 11:31 [PATCH v3 0/3] svm: avic: Allow AVIC support on system w/ physical APIC ID > 255 Suravee Suthikulpanit
2021-12-13 11:31 ` [PATCH v3 1/3] KVM: SVM: Refactor AVIC hardware setup logic into helper function Suravee Suthikulpanit
2021-12-30 17:26   ` Sean Christopherson
2022-02-01 11:02     ` Suthikulpanit, Suravee
2021-12-13 11:31 ` [PATCH v3 2/3] x86/apic: Add helper function to get maximum physical APIC ID Suravee Suthikulpanit
2021-12-13 11:31 ` [PATCH v3 3/3] KVM: SVM: Extend host physical APIC ID field to support more than 8-bit Suravee Suthikulpanit
2021-12-30 17:21   ` Sean Christopherson
2022-02-01 12:58     ` Suthikulpanit, Suravee
2022-02-01 21:57       ` Sean Christopherson
2022-02-02  7:32         ` Suthikulpanit, Suravee
2022-02-02 15:53           ` Sean Christopherson
2022-02-02 16:05             ` Sean Christopherson
2022-02-02  4:07       ` Suthikulpanit, Suravee
2022-02-01 14:56     ` Suthikulpanit, Suravee [this message]
2021-12-20  4:53 ` [PATCH v3 0/3] svm: avic: Allow AVIC support on system w/ physical APIC ID > 255 Suravee Suthikulpanit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45c0c1c2-f660-afb4-9631-e73cbbe60465@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jon.grimm@amd.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome