diff mbox series

[v4,10/16] hw/i386: Introduce apicid functions inside X86MachineState

Message ID 158161785243.48948.11368379114010493667.stgit@naples-babu.amd.com (mailing list archive)
State New, archived
Headers show
Series APIC ID fixes for AMD EPYC CPU model | expand

Commit Message

Babu Moger Feb. 13, 2020, 6:17 p.m. UTC
Introduce model specific apicid functions inside X86MachineState.
These functions will be loaded from X86CPUDefinition.

Signed-off-by: Babu Moger <babu.moger@amd.com>
---
 include/hw/i386/x86.h |    9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Igor Mammedov Feb. 24, 2020, 5:01 p.m. UTC | #1
On Thu, 13 Feb 2020 12:17:32 -0600
Babu Moger <babu.moger@amd.com> wrote:

> Introduce model specific apicid functions inside X86MachineState.
> These functions will be loaded from X86CPUDefinition.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
>  include/hw/i386/x86.h |    9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
> index 38c2d27910..75c2462770 100644
> --- a/include/hw/i386/x86.h
> +++ b/include/hw/i386/x86.h
> @@ -79,6 +79,15 @@ typedef struct {
>      uint16_t boot_cpus;
>      unsigned smp_dies;
>  
> +    /* Apic id specific handlers */
> +    uint32_t (*apicid_from_cpu_idx)(X86CPUTopoInfo *topo_info,
> +                                    unsigned cpu_index);
> +    void (*topo_ids_from_apicid)(apic_id_t apicid, X86CPUTopoInfo *topo_info,
> +                                 X86CPUTopoIDs *topo_ids);
> +    apic_id_t (*apicid_from_topo_ids)(X86CPUTopoInfo *topo_info,
> +                                      const X86CPUTopoIDs *topo_ids);
> +    uint32_t (*apicid_pkg_offset)(X86CPUTopoInfo *topo_info);
> +
>      /*
>       * Address space used by IOAPIC device. All IOAPIC interrupts
>       * will be translated to MSI messages in the address space.
> 
> 

Suggest to move defaults into this patch as well. i.e.
move parts that replace direct calls with hooks from 12/16
and set default hooks (i.e. non EPYC ones) in x86's machine_class_init().

This way It's immediately obvious what you are changing and then
followup EPYC related patch won't be cluttered by non related defaults
conversion.
Babu Moger Feb. 24, 2020, 5:30 p.m. UTC | #2
On 2/24/20 11:01 AM, Igor Mammedov wrote:
> On Thu, 13 Feb 2020 12:17:32 -0600
> Babu Moger <babu.moger@amd.com> wrote:
> 
>> Introduce model specific apicid functions inside X86MachineState.
>> These functions will be loaded from X86CPUDefinition.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>>  include/hw/i386/x86.h |    9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
>> index 38c2d27910..75c2462770 100644
>> --- a/include/hw/i386/x86.h
>> +++ b/include/hw/i386/x86.h
>> @@ -79,6 +79,15 @@ typedef struct {
>>      uint16_t boot_cpus;
>>      unsigned smp_dies;
>>  
>> +    /* Apic id specific handlers */
>> +    uint32_t (*apicid_from_cpu_idx)(X86CPUTopoInfo *topo_info,
>> +                                    unsigned cpu_index);
>> +    void (*topo_ids_from_apicid)(apic_id_t apicid, X86CPUTopoInfo *topo_info,
>> +                                 X86CPUTopoIDs *topo_ids);
>> +    apic_id_t (*apicid_from_topo_ids)(X86CPUTopoInfo *topo_info,
>> +                                      const X86CPUTopoIDs *topo_ids);
>> +    uint32_t (*apicid_pkg_offset)(X86CPUTopoInfo *topo_info);
>> +
>>      /*
>>       * Address space used by IOAPIC device. All IOAPIC interrupts
>>       * will be translated to MSI messages in the address space.
>>
>>
> 
> Suggest to move defaults into this patch as well. i.e.
> move parts that replace direct calls with hooks from 12/16
> and set default hooks (i.e. non EPYC ones) in x86's machine_class_init().
> 
> This way It's immediately obvious what you are changing and then
> followup EPYC related patch won't be cluttered by non related defaults
> conversion.
> 

Ok. Sure.
diff mbox series

Patch

diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 38c2d27910..75c2462770 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -79,6 +79,15 @@  typedef struct {
     uint16_t boot_cpus;
     unsigned smp_dies;
 
+    /* Apic id specific handlers */
+    uint32_t (*apicid_from_cpu_idx)(X86CPUTopoInfo *topo_info,
+                                    unsigned cpu_index);
+    void (*topo_ids_from_apicid)(apic_id_t apicid, X86CPUTopoInfo *topo_info,
+                                 X86CPUTopoIDs *topo_ids);
+    apic_id_t (*apicid_from_topo_ids)(X86CPUTopoInfo *topo_info,
+                                      const X86CPUTopoIDs *topo_ids);
+    uint32_t (*apicid_pkg_offset)(X86CPUTopoInfo *topo_info);
+
     /*
      * Address space used by IOAPIC device. All IOAPIC interrupts
      * will be translated to MSI messages in the address space.