You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, irq: Allow 0xff for /proc/irq/[n]/smp_affinity on an 8-cpu system Makefile: Unexport LC_ALL instead of clearing it x86: Fix objdump version check in arch/x86/tools/chkobjdump.awk x86: Reenable TSC sync check at boot, even with NONSTOP_TSC x86: Don't use POSIX character classes in gen-insn-attr-x86.awk Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA x86: Fix checking of SRAT when node 0 ram is not from 0 x86, cpuid: Add "volatile" to asm in native_cpuid() x86, msr: msrs_alloc/free for CONFIG_SMP=n x86, amd: Get multi-node CPU info from NodeId MSR instead of PCI config space x86: Add IA32_TSC_AUX MSR and use it x86, msr/cpuid: Register enough minors for the MSR and CPUID drivers initramfs: add missing decompressor error check bzip2: Add missing checks for malloc returning NULL bzip2/lzma/gzip: pre-boot malloc doesn't return NULL on failure
This commit is contained in:
@@ -16,6 +16,13 @@ NAME = Man-Eating Seals of Antiquity
|
||||
# o print "Entering directory ...";
|
||||
MAKEFLAGS += -rR --no-print-directory
|
||||
|
||||
# Avoid funny character set dependencies
|
||||
unexport LC_ALL
|
||||
LC_CTYPE=C
|
||||
LC_COLLATE=C
|
||||
LC_NUMERIC=C
|
||||
export LC_CTYPE LC_COLLATE LC_NUMERIC
|
||||
|
||||
# We are using a recursive build, so we need to do a little thinking
|
||||
# to get the ordering right.
|
||||
#
|
||||
|
||||
@@ -153,6 +153,7 @@
|
||||
#define X86_FEATURE_SSE5 (6*32+11) /* SSE-5 */
|
||||
#define X86_FEATURE_SKINIT (6*32+12) /* SKINIT/STGI instructions */
|
||||
#define X86_FEATURE_WDT (6*32+13) /* Watchdog timer */
|
||||
#define X86_FEATURE_NODEID_MSR (6*32+19) /* NodeId MSR */
|
||||
|
||||
/*
|
||||
* Auxiliary flags: Linux defined - For features scattered in various
|
||||
|
||||
@@ -103,7 +103,8 @@ extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
|
||||
extern void send_cleanup_vector(struct irq_cfg *);
|
||||
|
||||
struct irq_desc;
|
||||
extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *);
|
||||
extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *,
|
||||
unsigned int *dest_id);
|
||||
extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr);
|
||||
extern void setup_ioapic_dest(void);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
|
||||
#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
|
||||
#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */
|
||||
#define MSR_TSC_AUX 0xc0000103 /* Auxiliary TSC */
|
||||
|
||||
/* EFER bits: */
|
||||
#define _EFER_SCE 0 /* SYSCALL/SYSRET */
|
||||
@@ -123,6 +124,7 @@
|
||||
#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2
|
||||
#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff
|
||||
#define FAM10H_MMIO_CONF_BASE_SHIFT 20
|
||||
#define MSR_FAM10H_NODE_ID 0xc001100c
|
||||
|
||||
/* K8 MSRs */
|
||||
#define MSR_K8_TOP_MEM1 0xc001001a
|
||||
|
||||
@@ -27,6 +27,18 @@ struct msr {
|
||||
};
|
||||
};
|
||||
|
||||
struct msr_info {
|
||||
u32 msr_no;
|
||||
struct msr reg;
|
||||
struct msr *msrs;
|
||||
int err;
|
||||
};
|
||||
|
||||
struct msr_regs_info {
|
||||
u32 *regs;
|
||||
int err;
|
||||
};
|
||||
|
||||
static inline unsigned long long native_read_tscp(unsigned int *aux)
|
||||
{
|
||||
unsigned long low, high;
|
||||
@@ -240,9 +252,9 @@ do { \
|
||||
#define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \
|
||||
(u32)((val) >> 32))
|
||||
|
||||
#define write_tsc(val1, val2) wrmsr(0x10, (val1), (val2))
|
||||
#define write_tsc(val1, val2) wrmsr(MSR_IA32_TSC, (val1), (val2))
|
||||
|
||||
#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
|
||||
#define write_rdtscp_aux(val) wrmsr(MSR_TSC_AUX, (val), 0)
|
||||
|
||||
struct msr *msrs_alloc(void);
|
||||
void msrs_free(struct msr *msrs);
|
||||
|
||||
@@ -181,7 +181,7 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
{
|
||||
/* ecx is often an input as well as an output. */
|
||||
asm("cpuid"
|
||||
asm volatile("cpuid"
|
||||
: "=a" (*eax),
|
||||
"=b" (*ebx),
|
||||
"=c" (*ecx),
|
||||
|
||||
@@ -306,10 +306,7 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
||||
if (cpumask_test_cpu(cpu, cpu_online_mask))
|
||||
break;
|
||||
}
|
||||
if (cpu < nr_cpu_ids)
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
|
||||
return BAD_APICID;
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
}
|
||||
|
||||
struct apic apic_physflat = {
|
||||
|
||||
@@ -131,10 +131,7 @@ static unsigned int bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
||||
if (cpumask_test_cpu(cpu, cpu_online_mask))
|
||||
break;
|
||||
}
|
||||
if (cpu < nr_cpu_ids)
|
||||
return bigsmp_cpu_to_logical_apicid(cpu);
|
||||
|
||||
return BAD_APICID;
|
||||
return bigsmp_cpu_to_logical_apicid(cpu);
|
||||
}
|
||||
|
||||
static int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb)
|
||||
|
||||
@@ -2276,26 +2276,28 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
|
||||
|
||||
/*
|
||||
* Either sets desc->affinity to a valid value, and returns
|
||||
* ->cpu_mask_to_apicid of that, or returns BAD_APICID and
|
||||
* ->cpu_mask_to_apicid of that in dest_id, or returns -1 and
|
||||
* leaves desc->affinity untouched.
|
||||
*/
|
||||
unsigned int
|
||||
set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask)
|
||||
set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask,
|
||||
unsigned int *dest_id)
|
||||
{
|
||||
struct irq_cfg *cfg;
|
||||
unsigned int irq;
|
||||
|
||||
if (!cpumask_intersects(mask, cpu_online_mask))
|
||||
return BAD_APICID;
|
||||
return -1;
|
||||
|
||||
irq = desc->irq;
|
||||
cfg = desc->chip_data;
|
||||
if (assign_irq_vector(irq, cfg, mask))
|
||||
return BAD_APICID;
|
||||
return -1;
|
||||
|
||||
cpumask_copy(desc->affinity, mask);
|
||||
|
||||
return apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain);
|
||||
*dest_id = apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2311,12 +2313,11 @@ set_ioapic_affinity_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
|
||||
cfg = desc->chip_data;
|
||||
|
||||
spin_lock_irqsave(&ioapic_lock, flags);
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest != BAD_APICID) {
|
||||
ret = set_desc_affinity(desc, mask, &dest);
|
||||
if (!ret) {
|
||||
/* Only the high 8 bits are valid. */
|
||||
dest = SET_APIC_LOGICAL_ID(dest);
|
||||
__target_IO_APIC_irq(irq, dest, cfg);
|
||||
ret = 0;
|
||||
}
|
||||
spin_unlock_irqrestore(&ioapic_lock, flags);
|
||||
|
||||
@@ -3351,8 +3352,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
struct msi_msg msg;
|
||||
unsigned int dest;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
cfg = desc->chip_data;
|
||||
@@ -3384,8 +3384,7 @@ ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
if (get_irte(irq, &irte))
|
||||
return -1;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
irte.vector = cfg->vector;
|
||||
@@ -3567,8 +3566,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
struct msi_msg msg;
|
||||
unsigned int dest;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
cfg = desc->chip_data;
|
||||
@@ -3623,8 +3621,7 @@ static int hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
struct msi_msg msg;
|
||||
unsigned int dest;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
cfg = desc->chip_data;
|
||||
@@ -3730,8 +3727,7 @@ static int set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
struct irq_cfg *cfg;
|
||||
unsigned int dest;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
cfg = desc->chip_data;
|
||||
|
||||
@@ -148,10 +148,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
||||
break;
|
||||
}
|
||||
|
||||
if (cpu < nr_cpu_ids)
|
||||
return per_cpu(x86_cpu_to_logical_apicid, cpu);
|
||||
|
||||
return BAD_APICID;
|
||||
return per_cpu(x86_cpu_to_logical_apicid, cpu);
|
||||
}
|
||||
|
||||
static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
|
||||
|
||||
@@ -146,10 +146,7 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
||||
break;
|
||||
}
|
||||
|
||||
if (cpu < nr_cpu_ids)
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
|
||||
return BAD_APICID;
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
}
|
||||
|
||||
static unsigned int x2apic_phys_get_apic_id(unsigned long x)
|
||||
|
||||
@@ -225,10 +225,7 @@ uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
|
||||
if (cpumask_test_cpu(cpu, cpu_online_mask))
|
||||
break;
|
||||
}
|
||||
if (cpu < nr_cpu_ids)
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
|
||||
return BAD_APICID;
|
||||
return per_cpu(x86_cpu_to_apicid, cpu);
|
||||
}
|
||||
|
||||
static unsigned int x2apic_get_apic_id(unsigned long x)
|
||||
|
||||
+15
-38
@@ -254,59 +254,36 @@ static int __cpuinit nearby_node(int apicid)
|
||||
|
||||
/*
|
||||
* Fixup core topology information for AMD multi-node processors.
|
||||
* Assumption 1: Number of cores in each internal node is the same.
|
||||
* Assumption 2: Mixed systems with both single-node and dual-node
|
||||
* processors are not supported.
|
||||
* Assumption: Number of cores in each internal node is the same.
|
||||
*/
|
||||
#ifdef CONFIG_X86_HT
|
||||
static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c)
|
||||
{
|
||||
#ifdef CONFIG_PCI
|
||||
u32 t, cpn;
|
||||
u8 n, n_id;
|
||||
unsigned long long value;
|
||||
u32 nodes, cores_per_node;
|
||||
int cpu = smp_processor_id();
|
||||
|
||||
if (!cpu_has(c, X86_FEATURE_NODEID_MSR))
|
||||
return;
|
||||
|
||||
/* fixup topology information only once for a core */
|
||||
if (cpu_has(c, X86_FEATURE_AMD_DCM))
|
||||
return;
|
||||
|
||||
/* check for multi-node processor on boot cpu */
|
||||
t = read_pci_config(0, 24, 3, 0xe8);
|
||||
if (!(t & (1 << 29)))
|
||||
rdmsrl(MSR_FAM10H_NODE_ID, value);
|
||||
|
||||
nodes = ((value >> 3) & 7) + 1;
|
||||
if (nodes == 1)
|
||||
return;
|
||||
|
||||
set_cpu_cap(c, X86_FEATURE_AMD_DCM);
|
||||
cores_per_node = c->x86_max_cores / nodes;
|
||||
|
||||
/* cores per node: each internal node has half the number of cores */
|
||||
cpn = c->x86_max_cores >> 1;
|
||||
/* store NodeID, use llc_shared_map to store sibling info */
|
||||
per_cpu(cpu_llc_id, cpu) = value & 7;
|
||||
|
||||
/* even-numbered NB_id of this dual-node processor */
|
||||
n = c->phys_proc_id << 1;
|
||||
|
||||
/*
|
||||
* determine internal node id and assign cores fifty-fifty to
|
||||
* each node of the dual-node processor
|
||||
*/
|
||||
t = read_pci_config(0, 24 + n, 3, 0xe8);
|
||||
n = (t>>30) & 0x3;
|
||||
if (n == 0) {
|
||||
if (c->cpu_core_id < cpn)
|
||||
n_id = 0;
|
||||
else
|
||||
n_id = 1;
|
||||
} else {
|
||||
if (c->cpu_core_id < cpn)
|
||||
n_id = 1;
|
||||
else
|
||||
n_id = 0;
|
||||
}
|
||||
|
||||
/* compute entire NodeID, use llc_shared_map to store sibling info */
|
||||
per_cpu(cpu_llc_id, cpu) = (c->phys_proc_id << 1) + n_id;
|
||||
|
||||
/* fixup core id to be in range from 0 to cpn */
|
||||
c->cpu_core_id = c->cpu_core_id % cpn;
|
||||
#endif
|
||||
/* fixup core id to be in range from 0 to (cores_per_node - 1) */
|
||||
c->cpu_core_id = c->cpu_core_id % cores_per_node;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
|
||||
if (c->x86_power & (1 << 8)) {
|
||||
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
|
||||
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
|
||||
set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
|
||||
sched_clock_stable = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ static int __init cpuid_init(void)
|
||||
int i, err = 0;
|
||||
i = 0;
|
||||
|
||||
if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) {
|
||||
if (__register_chrdev(CPUID_MAJOR, 0, NR_CPUS,
|
||||
"cpu/cpuid", &cpuid_fops)) {
|
||||
printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
|
||||
CPUID_MAJOR);
|
||||
err = -EBUSY;
|
||||
@@ -216,7 +217,7 @@ out_class:
|
||||
}
|
||||
class_destroy(cpuid_class);
|
||||
out_chrdev:
|
||||
unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
|
||||
__unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ core_initcall(e820_mark_nvs_memory);
|
||||
/*
|
||||
* Early reserved memory areas.
|
||||
*/
|
||||
#define MAX_EARLY_RES 20
|
||||
#define MAX_EARLY_RES 32
|
||||
|
||||
struct early_res {
|
||||
u64 start, end;
|
||||
|
||||
@@ -246,7 +246,7 @@ static int __init msr_init(void)
|
||||
int i, err = 0;
|
||||
i = 0;
|
||||
|
||||
if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
|
||||
if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) {
|
||||
printk(KERN_ERR "msr: unable to get major %d for msr\n",
|
||||
MSR_MAJOR);
|
||||
err = -EBUSY;
|
||||
@@ -274,7 +274,7 @@ out_class:
|
||||
msr_device_destroy(i);
|
||||
class_destroy(msr_class);
|
||||
out_chrdev:
|
||||
unregister_chrdev(MSR_MAJOR, "cpu/msr");
|
||||
__unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason)
|
||||
{
|
||||
if (!tsc_unstable) {
|
||||
tsc_unstable = 1;
|
||||
sched_clock_stable = 0;
|
||||
printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
|
||||
/* Change only the rating, when not registered */
|
||||
if (clocksource_tsc.mult)
|
||||
|
||||
@@ -215,8 +215,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||
unsigned long mmr_offset;
|
||||
unsigned mmr_pnode;
|
||||
|
||||
dest = set_desc_affinity(desc, mask);
|
||||
if (dest == BAD_APICID)
|
||||
if (set_desc_affinity(desc, mask, &dest))
|
||||
return -1;
|
||||
|
||||
mmr_value = 0;
|
||||
|
||||
@@ -14,7 +14,7 @@ $(obj)/inat.o: $(obj)/inat-tables.c
|
||||
|
||||
clean-files := inat-tables.c
|
||||
|
||||
obj-$(CONFIG_SMP) := msr.o
|
||||
obj-$(CONFIG_SMP) += msr-smp.o
|
||||
|
||||
lib-y := delay.o
|
||||
lib-y += thunk_$(BITS).o
|
||||
@@ -22,7 +22,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o
|
||||
lib-y += memcpy_$(BITS).o
|
||||
lib-$(CONFIG_KPROBES) += insn.o inat.o
|
||||
|
||||
obj-y += msr-reg.o msr-reg-export.o
|
||||
obj-y += msr.o msr-reg.o msr-reg-export.o
|
||||
|
||||
ifeq ($(CONFIG_X86_32),y)
|
||||
obj-y += atomic64_32.o
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user