Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Alejandro Vallejo
On 27/11/2023 12:24, Jan Beulich wrote: > On 27.11.2023 13:17, Alejandro Vallejo wrote: >> On 27/11/2023 08:40, Jan Beulich wrote: >>> On 23.11.2023 18:30, Alejandro Vallejo wrote: @@ -1498,27 +1511,36 @@ static int cf_check lapic_save_regs(struct vcpu *v, hvm_domain_context_t *h)

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Alejandro Vallejo
On 27/11/2023 12:20, Andrew Cooper wrote: > On 27/11/2023 12:08 pm, Alejandro Vallejo wrote: >> On 24/11/2023 22:05, Andrew Cooper wrote: diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 5cb87f8649..cd4701c5a2 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Jan Beulich
On 27.11.2023 13:17, Alejandro Vallejo wrote: > On 27/11/2023 08:40, Jan Beulich wrote: >> On 23.11.2023 18:30, Alejandro Vallejo wrote: >>> @@ -1498,27 +1511,36 @@ static int cf_check lapic_save_regs(struct vcpu *v, >>> hvm_domain_context_t *h) >>>*/ >>> static void lapic_load_fixup(struct

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Andrew Cooper
On 27/11/2023 12:08 pm, Alejandro Vallejo wrote: > On 24/11/2023 22:05, Andrew Cooper wrote: >>> diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c >>> index 5cb87f8649..cd4701c5a2 100644 >>> --- a/xen/arch/x86/hvm/vlapic.c >>> +++ b/xen/arch/x86/hvm/vlapic.c >>> @@ -1061,13 +1061,2

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Alejandro Vallejo
On 27/11/2023 08:40, Jan Beulich wrote: On 23.11.2023 18:30, Alejandro Vallejo wrote: @@ -1498,27 +1511,36 @@ static int cf_check lapic_save_regs(struct vcpu *v, hvm_domain_context_t *h) */ static void lapic_load_fixup(struct vlapic *vlapic) { -uint32_t id = vlapic->loaded.id; +u

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Alejandro Vallejo
On 24/11/2023 22:05, Andrew Cooper wrote: diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 5cb87f8649..cd4701c5a2 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -1061,13 +1061,26 @@ static const struct hvm_mmio_ops vlapic_mmio_ops = { .writ

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-27 Thread Jan Beulich
On 23.11.2023 18:30, Alejandro Vallejo wrote: > @@ -1498,27 +1511,36 @@ static int cf_check lapic_save_regs(struct vcpu *v, > hvm_domain_context_t *h) > */ > static void lapic_load_fixup(struct vlapic *vlapic) > { > -uint32_t id = vlapic->loaded.id; > +uint32_t good_ldr = x2apic_ldr_fr

Re: [PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-24 Thread Andrew Cooper
A few minor grammar notes. "x86/vlapic: In x2APIC ..." On 23/11/2023 5:30 pm, Alejandro Vallejo wrote: > Both Intel and AMD manuals agree that on x2APIC mode, the APIC LDR and ID > registers are derivable from each other through a fixed formula. > > Xen uses that formula, but applies it to vCPU

[PATCH v4] xen/x86: On x2APIC mode, derive LDR from APIC ID

2023-11-23 Thread Alejandro Vallejo
Both Intel and AMD manuals agree that on x2APIC mode, the APIC LDR and ID registers are derivable from each other through a fixed formula. Xen uses that formula, but applies it to vCPU IDs (which are sequential) rather than x2APIC IDs (which are not, at the moment). As I understand it, this is an