diff options
Diffstat (limited to 'arch/x86/platform/uv/tlb_uv.c')
| -rw-r--r-- | arch/x86/platform/uv/tlb_uv.c | 71 | 
1 files changed, 43 insertions, 28 deletions
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 0f92173a12b..dfe605ac1bc 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c @@ -433,15 +433,49 @@ static void reset_with_ipi(struct pnmask *distribution, struct bau_control *bcp)  	return;  } -static inline unsigned long cycles_2_us(unsigned long long cyc) +/* + * Not to be confused with cycles_2_ns() from tsc.c; this gives a relative + * number, not an absolute. It converts a duration in cycles to a duration in + * ns. + */ +static inline unsigned long long cycles_2_ns(unsigned long long cyc)  { +	struct cyc2ns_data *data = cyc2ns_read_begin();  	unsigned long long ns; -	unsigned long us; -	int cpu = smp_processor_id(); -	ns =  (cyc * per_cpu(cyc2ns, cpu)) >> CYC2NS_SCALE_FACTOR; -	us = ns / 1000; -	return us; +	ns = mul_u64_u32_shr(cyc, data->cyc2ns_mul, data->cyc2ns_shift); + +	cyc2ns_read_end(data); +	return ns; +} + +/* + * The reverse of the above; converts a duration in ns to a duration in cycles. + */  +static inline unsigned long long ns_2_cycles(unsigned long long ns) +{ +	struct cyc2ns_data *data = cyc2ns_read_begin(); +	unsigned long long cyc; + +	cyc = (ns << data->cyc2ns_shift) / data->cyc2ns_mul; + +	cyc2ns_read_end(data); +	return cyc; +} + +static inline unsigned long cycles_2_us(unsigned long long cyc) +{ +	return cycles_2_ns(cyc) / NSEC_PER_USEC; +} + +static inline cycles_t sec_2_cycles(unsigned long sec) +{ +	return ns_2_cycles(sec * NSEC_PER_SEC); +} + +static inline unsigned long long usec_2_cycles(unsigned long usec) +{ +	return ns_2_cycles(usec * NSEC_PER_USEC);  }  /* @@ -668,16 +702,6 @@ static int wait_completion(struct bau_desc *bau_desc,  								bcp, try);  } -static inline cycles_t sec_2_cycles(unsigned long sec) -{ -	unsigned long ns; -	cycles_t cyc; - -	ns = sec * 1000000000; -	cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); -	return cyc; -} -  /*   * Our retries are blocked by all destination sw ack resources being   * in use, and a timeout is pending. In that case hardware immediately @@ -1070,12 +1094,13 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,  	unsigned long status;  	bcp = &per_cpu(bau_control, cpu); -	stat = bcp->statp; -	stat->s_enters++;  	if (bcp->nobau)  		return cpumask; +	stat = bcp->statp; +	stat->s_enters++; +  	if (bcp->busy) {  		descriptor_status =  			read_lmmr(UVH_LB_BAU_SB_ACTIVATION_STATUS_0); @@ -1326,16 +1351,6 @@ static void ptc_seq_stop(struct seq_file *file, void *data)  {  } -static inline unsigned long long usec_2_cycles(unsigned long microsec) -{ -	unsigned long ns; -	unsigned long long cyc; - -	ns = microsec * 1000; -	cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); -	return cyc; -} -  /*   * Display the statistics thru /proc/sgi_uv/ptc_statistics   * 'data' points to the cpu number  | 
