[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.4 11/12] target-i386: Topology & APIC ID u
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH for-1.4 11/12] target-i386: Topology & APIC ID utility functions |
Date: |
Mon, 21 Jan 2013 17:22:44 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 21.01.2013 17:10, schrieb Eduardo Habkost:
> On Mon, Jan 21, 2013 at 12:28:21PM +0100, Andreas Färber wrote:
>> Am 17.01.2013 21:59, schrieb Eduardo Habkost:
>>> diff --git a/target-i386/topology.h b/target-i386/topology.h
>>> new file mode 100644
>>> index 0000000..833ab47
>>> --- /dev/null
>>> +++ b/target-i386/topology.h
>>> @@ -0,0 +1,133 @@
>>> +/*
>>> + * x86 CPU topology data structures and functions
>>> + *
>>> + * Copyright (c) 2012 Red Hat Inc.
>>> + *
>>> + * Permission is hereby granted, free of charge, to any person obtaining a
>>> copy
>>> + * of this software and associated documentation files (the "Software"),
>>> to deal
>>> + * in the Software without restriction, including without limitation the
>>> rights
>>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or
>>> sell
>>> + * copies of the Software, and to permit persons to whom the Software is
>>> + * furnished to do so, subject to the following conditions:
>>> + *
>>> + * The above copyright notice and this permission notice shall be included
>>> in
>>> + * all copies or substantial portions of the Software.
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
>>> OR
>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>>> OTHER
>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>>> FROM,
>>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>>> IN
>>> + * THE SOFTWARE.
>>> + */
>>> +#ifndef TARGET_I386_TOPOLOGY_H
>>> +#define TARGET_I386_TOPOLOGY_H
>>> +
>>> +/* This file implements the APIC-ID-based CPU topology enumeration logic,
>>> + * documented at the following document:
>>> + * Intel® 64 Architecture Processor Topology Enumeration
>>> + *
>>> http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
>>> + *
>>> + * This code should be compatible with AMD's "Extended Method" described
>>> at:
>>> + * AMD CPUID Specification (Publication #25481)
>>> + * Section 3: Multiple Core Calcuation
>>> + * as long as:
>>> + * nr_threads is set to 1;
>>> + * OFFSET_IDX is assumed to be 0;
>>> + * CPUID Fn8000_0008_ECX[ApicIdCoreIdSize[3:0]] is set to
>>> apicid_core_width().
>>> + */
>>> +
>>> +#include <stdint.h>
>>> +#include <string.h>
>>> +
>>> +#include "qemu/bitops.h"
>>> +
>>> +/* APIC IDs can be 32-bit, but beware: APIC IDs > 255 require x2APIC
>>> support
>>> + */
>>> +typedef uint32_t apic_id_t;
>>
>> Is this file imported from somewhere?
>
> It's used by PATCH 12/12, when actually implementing the topology-aware
> APIC ID calculation in the CPU code.
I meant, is this file/code from Linux or some other project? :) Or did
you write it from scratch? The commit message is a bit brief.
I was thinking about whether an x86_... function prefix would be needed,
but since these are static inline I think not.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- [Qemu-devel] [PATCH for-1.4 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function, (continued)
[Qemu-devel] [PATCH for-1.4 08/12] cpus.h: Make constant smp_cores/smp_threads available on *-user, Eduardo Habkost, 2013/01/17
[Qemu-devel] [PATCH for-1.4 09/12] pc: Set fw_cfg data based on APIC ID calculation, Eduardo Habkost, 2013/01/17
[Qemu-devel] [PATCH for-1.4 11/12] target-i386: Topology & APIC ID utility functions, Eduardo Habkost, 2013/01/17
Re: [Qemu-devel] [PATCH for-1.4 00/12] target-i386: Fix APIC-ID-based topology (v4), li guang, 2013/01/18
Re: [Qemu-devel] [PATCH for-1.4 00/12] target-i386: Fix APIC-ID-based topology (v4), Eduardo Habkost, 2013/01/18
Re: [Qemu-devel] [PATCH for-1.4 00/12] target-i386: Fix APIC-ID-based topology (v4), Andreas Färber, 2013/01/21