Re: [PATCH v2 3/3] KVM: SVM: Extend host physical APIC ID field to support more than 8-bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 12/3/2021 11:34 PM, Tom Lendacky wrote:
On 12/3/21 1:46 AM, Maxim Levitsky wrote:
On Thu, 2021-12-02 at 17:58 -0600, Suravee Suthikulpanit wrote:

@@ -63,6 +64,7 @@
  static DEFINE_HASHTABLE(svm_vm_data_hash, SVM_VM_DATA_HASH_BITS);
  static u32 next_vm_id = 0;
  static bool next_vm_id_wrapped = 0;
+static u64 avic_host_physical_id_mask;
  static DEFINE_SPINLOCK(svm_vm_data_hash_lock);
  /*
@@ -133,6 +135,20 @@ void avic_vm_destroy(struct kvm *kvm)
      spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);
  }
+static void avic_init_host_physical_apicid_mask(void)
+{
+    if (!x2apic_mode) {
Wonder why this is a exported  global variable and not function.
Not the patch fault though.
+        /* If host is in xAPIC mode, default to only 8-bit mask. */
+        avic_host_physical_id_mask = 0xffULL;
+    } else {
+        u32 count = get_count_order(apic_get_max_phys_apicid());
+
+        avic_host_physical_id_mask = BIT(count) - 1;
I think that there were some complains about using this macro and instead encouraged
to use 1 << x directly, but I see it used already in other places in avic.c so I don't know.

And I think it should be BIT_ULL() since avic_host_physical_id_mask is a u64.

Thanks,
Tom

I am not sure about complains on the use of the BIT macros. However, we can just use BIT_ULL() for now
and clean up the whole file at once later if needed.

Regards,
Suravee



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux