mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-06 06:27:41 -07:00
x86 and machine queue, 2020-09-02
Bug fixes: * Revert EPYC topology patches that caused regressions (Babu Moger) * Memory leak fixes (Pan Nengyuan) QOM Cleanups: * Fix typo in AARCH64_CPU_GET_CLASS * Rename QOM macros for consistency and/or to avoid conflicts with other symbols * Move typedefs to header files * Correct instance/class sizes -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEEWjIv1avE09usz9GqKAeTb5hNxaYFAl9PhuUUHGVoYWJrb3N0 QHJlZGhhdC5jb20ACgkQKAeTb5hNxaa3bA//TxsYcYKfqPj6EyvW2FclxPA3Ziwz 0OOZFo+bZcx9OjLb+Zok6rBnV8j3T7pIvJqoaxsKAnIkF6SgxReu4UIJixQeTKB+ 4GRNUAaCX99NmO+VhuX7GY5argN3m3bM8T6BYLvraYxHDKe+Azxv8JuLC/BE7U9Z VKv1sm5ZSUnXlGvJ/Mdo9nZSZEW54pl6zNSpE7Lk/LLHzjlQswrOssSd0uQ7qfTt O1k9duR4d6U/yqpuEbopyaJAlozgaBxT+G60jmR0AxrOZ6wm6Y/27MHN8LPmqgby F+7Nc/P21gEVIziqxTJOIXsjd2OS+tuV2kPqpCTNuw23na1aBsS2ft0UY6MKTXcQ 17XoPgRowbHDKEPva/JoFL6NyaYDDBXVKssTXagCz3Na41OkXDRUEg4ofKKvFaOR j+nmkJsY6m+sDqzcwiMsjLUsZrDlCCEwKnTOt16hM8VddQYvEPczHSWh3DpPlfLU NmfqPD108qVDQi79oKFfPqN4J/a+6GM1NpsORS4f5RnRKpjp88LWMFp2BZOr13uN pyFtm8ouYoXrKu3VkFvTIjAfObDygk/2O5SVB0kL6VjCnIHD25Qzvkk3ivKER7iq DC3G3iSEkjBpwB6CaPpJHKCxCtwbj4nSEE7+cYBA13rkQ1rpOXCE/1r1TTLgFAkC 2yZTsa4P8YFN8mg= =Zbyt -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging x86 and machine queue, 2020-09-02 Bug fixes: * Revert EPYC topology patches that caused regressions (Babu Moger) * Memory leak fixes (Pan Nengyuan) QOM Cleanups: * Fix typo in AARCH64_CPU_GET_CLASS * Rename QOM macros for consistency and/or to avoid conflicts with other symbols * Move typedefs to header files * Correct instance/class sizes # gpg: Signature made Wed 02 Sep 2020 12:49:57 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: target/i386/sev: Plug memleak in sev_read_file_base64 target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features virtio: add Virtio*BusClass sizes Revert "hw/i386: Update structures to save the number of nodes per package" Revert "hw/386: Add EPYC mode topology decoding functions" Revert "target/i386: Cleanup and use the EPYC mode topology functions" Revert "hw/i386: Introduce apicid functions inside X86MachineState" Revert "i386: Introduce use_epyc_apic_id_encoding in X86CPUDefinition" Revert "hw/i386: Move arch_id decode inside x86_cpus_init" Revert "target/i386: Enable new apic id encoding for EPYC based cpus models" Revert "i386: Fix pkg_id offset for EPYC cpu models" tls-cipher-suites: Correct instance_size hda-audio: Set instance_size at base class rx: Move typedef RXCPU to cpu-qom.h rx: Rename QOM type check macros arm: Fix typo in AARCH64_CPU_GET_CLASS definition rdma: Rename INTERFACE_RDMA_PROVIDER_CLASS macro x86-iommu: Rename QOM type macros mos6522: Rename QOM macros imx_ccm: Rename IMX_GET_CLASS macro Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
ed215cec0f
34 changed files with 215 additions and 284 deletions
|
|
@ -47,14 +47,12 @@ typedef uint32_t apic_id_t;
|
|||
|
||||
typedef struct X86CPUTopoIDs {
|
||||
unsigned pkg_id;
|
||||
unsigned node_id;
|
||||
unsigned die_id;
|
||||
unsigned core_id;
|
||||
unsigned smt_id;
|
||||
} X86CPUTopoIDs;
|
||||
|
||||
typedef struct X86CPUTopoInfo {
|
||||
unsigned nodes_per_pkg;
|
||||
unsigned dies_per_pkg;
|
||||
unsigned cores_per_die;
|
||||
unsigned threads_per_core;
|
||||
|
|
@ -89,11 +87,6 @@ static inline unsigned apicid_die_width(X86CPUTopoInfo *topo_info)
|
|||
return apicid_bitwidth_for_count(topo_info->dies_per_pkg);
|
||||
}
|
||||
|
||||
/* Bit width of the node_id field per socket */
|
||||
static inline unsigned apicid_node_width_epyc(X86CPUTopoInfo *topo_info)
|
||||
{
|
||||
return apicid_bitwidth_for_count(MAX(topo_info->nodes_per_pkg, 1));
|
||||
}
|
||||
/* Bit offset of the Core_ID field
|
||||
*/
|
||||
static inline unsigned apicid_core_offset(X86CPUTopoInfo *topo_info)
|
||||
|
|
@ -114,100 +107,6 @@ static inline unsigned apicid_pkg_offset(X86CPUTopoInfo *topo_info)
|
|||
return apicid_die_offset(topo_info) + apicid_die_width(topo_info);
|
||||
}
|
||||
|
||||
#define NODE_ID_OFFSET 3 /* Minimum node_id offset if numa configured */
|
||||
|
||||
/*
|
||||
* Bit offset of the node_id field
|
||||
*
|
||||
* Make sure nodes_per_pkg > 0 if numa configured else zero.
|
||||
*/
|
||||
static inline unsigned apicid_node_offset_epyc(X86CPUTopoInfo *topo_info)
|
||||
{
|
||||
unsigned offset = apicid_die_offset(topo_info) +
|
||||
apicid_die_width(topo_info);
|
||||
|
||||
if (topo_info->nodes_per_pkg) {
|
||||
return MAX(NODE_ID_OFFSET, offset);
|
||||
} else {
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
||||
/* Bit offset of the Pkg_ID (socket ID) field */
|
||||
static inline unsigned apicid_pkg_offset_epyc(X86CPUTopoInfo *topo_info)
|
||||
{
|
||||
return apicid_node_offset_epyc(topo_info) +
|
||||
apicid_node_width_epyc(topo_info);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID
|
||||
*
|
||||
* The caller must make sure core_id < nr_cores and smt_id < nr_threads.
|
||||
*/
|
||||
static inline apic_id_t
|
||||
x86_apicid_from_topo_ids_epyc(X86CPUTopoInfo *topo_info,
|
||||
const X86CPUTopoIDs *topo_ids)
|
||||
{
|
||||
return (topo_ids->pkg_id << apicid_pkg_offset_epyc(topo_info)) |
|
||||
(topo_ids->node_id << apicid_node_offset_epyc(topo_info)) |
|
||||
(topo_ids->die_id << apicid_die_offset(topo_info)) |
|
||||
(topo_ids->core_id << apicid_core_offset(topo_info)) |
|
||||
topo_ids->smt_id;
|
||||
}
|
||||
|
||||
static inline void x86_topo_ids_from_idx_epyc(X86CPUTopoInfo *topo_info,
|
||||
unsigned cpu_index,
|
||||
X86CPUTopoIDs *topo_ids)
|
||||
{
|
||||
unsigned nr_nodes = MAX(topo_info->nodes_per_pkg, 1);
|
||||
unsigned nr_dies = topo_info->dies_per_pkg;
|
||||
unsigned nr_cores = topo_info->cores_per_die;
|
||||
unsigned nr_threads = topo_info->threads_per_core;
|
||||
unsigned cores_per_node = DIV_ROUND_UP((nr_dies * nr_cores * nr_threads),
|
||||
nr_nodes);
|
||||
|
||||
topo_ids->pkg_id = cpu_index / (nr_dies * nr_cores * nr_threads);
|
||||
topo_ids->node_id = (cpu_index / cores_per_node) % nr_nodes;
|
||||
topo_ids->die_id = cpu_index / (nr_cores * nr_threads) % nr_dies;
|
||||
topo_ids->core_id = cpu_index / nr_threads % nr_cores;
|
||||
topo_ids->smt_id = cpu_index % nr_threads;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate thread/core/package IDs for a specific topology,
|
||||
* based on APIC ID
|
||||
*/
|
||||
static inline void x86_topo_ids_from_apicid_epyc(apic_id_t apicid,
|
||||
X86CPUTopoInfo *topo_info,
|
||||
X86CPUTopoIDs *topo_ids)
|
||||
{
|
||||
topo_ids->smt_id = apicid &
|
||||
~(0xFFFFFFFFUL << apicid_smt_width(topo_info));
|
||||
topo_ids->core_id =
|
||||
(apicid >> apicid_core_offset(topo_info)) &
|
||||
~(0xFFFFFFFFUL << apicid_core_width(topo_info));
|
||||
topo_ids->die_id =
|
||||
(apicid >> apicid_die_offset(topo_info)) &
|
||||
~(0xFFFFFFFFUL << apicid_die_width(topo_info));
|
||||
topo_ids->node_id =
|
||||
(apicid >> apicid_node_offset_epyc(topo_info)) &
|
||||
~(0xFFFFFFFFUL << apicid_node_width_epyc(topo_info));
|
||||
topo_ids->pkg_id = apicid >> apicid_pkg_offset_epyc(topo_info);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make APIC ID for the CPU 'cpu_index'
|
||||
*
|
||||
* 'cpu_index' is a sequential, contiguous ID for the CPU.
|
||||
*/
|
||||
static inline apic_id_t x86_apicid_from_cpu_idx_epyc(X86CPUTopoInfo *topo_info,
|
||||
unsigned cpu_index)
|
||||
{
|
||||
X86CPUTopoIDs topo_ids;
|
||||
x86_topo_ids_from_idx_epyc(topo_info, cpu_index, &topo_ids);
|
||||
return x86_apicid_from_topo_ids_epyc(topo_info, &topo_ids);
|
||||
}
|
||||
/* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID
|
||||
*
|
||||
* The caller must make sure core_id < nr_cores and smt_id < nr_threads.
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
#define TYPE_X86_IOMMU_DEVICE ("x86-iommu")
|
||||
#define X86_IOMMU_DEVICE(obj) \
|
||||
OBJECT_CHECK(X86IOMMUState, (obj), TYPE_X86_IOMMU_DEVICE)
|
||||
#define X86_IOMMU_CLASS(klass) \
|
||||
#define X86_IOMMU_DEVICE_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(X86IOMMUClass, (klass), TYPE_X86_IOMMU_DEVICE)
|
||||
#define X86_IOMMU_GET_CLASS(obj) \
|
||||
#define X86_IOMMU_DEVICE_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
|
||||
|
||||
#define X86_IOMMU_SID_INVALID (0xffff)
|
||||
|
|
|
|||
|
|
@ -63,15 +63,6 @@ typedef struct {
|
|||
OnOffAuto smm;
|
||||
OnOffAuto acpi;
|
||||
|
||||
/* 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.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
OBJECT_CHECK(IMXCCMState, (obj), TYPE_IMX_CCM)
|
||||
#define IMX_CCM_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(IMXCCMClass, (klass), TYPE_IMX_CCM)
|
||||
#define IMX_GET_CLASS(obj) \
|
||||
#define IMX_CCM_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(IMXCCMClass, (obj), TYPE_IMX_CCM)
|
||||
|
||||
typedef struct IMXCCMState {
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ typedef struct MOS6522DeviceClass {
|
|||
uint64_t (*get_timer2_load_time)(MOS6522State *dev, MOS6522Timer *ti);
|
||||
} MOS6522DeviceClass;
|
||||
|
||||
#define MOS6522_DEVICE_CLASS(cls) \
|
||||
#define MOS6522_CLASS(cls) \
|
||||
OBJECT_CLASS_CHECK(MOS6522DeviceClass, (cls), TYPE_MOS6522)
|
||||
#define MOS6522_DEVICE_GET_CLASS(obj) \
|
||||
#define MOS6522_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(MOS6522DeviceClass, (obj), TYPE_MOS6522)
|
||||
|
||||
extern const VMStateDescription vmstate_mos6522;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#define INTERFACE_RDMA_PROVIDER "rdma"
|
||||
|
||||
#define INTERFACE_RDMA_PROVIDER_CLASS(klass) \
|
||||
#define RDMA_PROVIDER_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(RdmaProviderClass, (klass), \
|
||||
INTERFACE_RDMA_PROVIDER)
|
||||
#define RDMA_PROVIDER_GET_CLASS(obj) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue