Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121032
b: refs/heads/master
c: 1fcccb0
h: refs/heads/master
v: v3
  • Loading branch information
Jaswinder Singh authored and Ingo Molnar committed Dec 25, 2008
1 parent 7b927b5 commit 898ad89
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 410 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c1c15b65ec30275575dac9322aae607075769fbc
refs/heads/master: 1fcccb008be12ea823aaa392758e1e41fb82de9a
24 changes: 0 additions & 24 deletions trunk/Documentation/x86/pat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,6 @@ pci proc | -- | -- | WC |
| | | |
-------------------------------------------------------------------

Advanced APIs for drivers
-------------------------
A. Exporting pages to users with remap_pfn_range, io_remap_pfn_range,
vm_insert_pfn

Drivers wanting to export some pages to userspace do it by using mmap
interface and a combination of
1) pgprot_noncached()
2) io_remap_pfn_range() or remap_pfn_range() or vm_insert_pfn()

With PAT support, a new API pgprot_writecombine is being added. So, drivers can
continue to use the above sequence, with either pgprot_noncached() or
pgprot_writecombine() in step 1, followed by step 2.

In addition, step 2 internally tracks the region as UC or WC in memtype
list in order to ensure no conflicting mapping.

Note that this set of APIs only works with IO (non RAM) regions. If driver
wants to export a RAM region, it has to do set_memory_uc() or set_memory_wc()
as step 0 above and also track the usage of those pages and use set_memory_wb()
before the page is freed to free pool.



Notes:

-- in the above table mean "Not suggested usage for the API". Some of the --'s
Expand Down
14 changes: 0 additions & 14 deletions trunk/arch/x86/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,8 @@
#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
#endif

/*
* Macro to mark a page protection value as UC-
*/
#define pgprot_noncached(prot) \
((boot_cpu_data.x86 > 3) \
? (__pgprot(pgprot_val(prot) | _PAGE_CACHE_UC_MINUS)) \
: (prot))

#ifndef __ASSEMBLY__

#define pgprot_writecombine pgprot_writecombine
extern pgprot_t pgprot_writecombine(pgprot_t prot);

/*
* ZERO_PAGE is a global shared page that is always zero: used
* for zero-mapped memory areas etc..
Expand Down Expand Up @@ -340,9 +329,6 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)

#ifndef __ASSEMBLY__
/* Indicate that x86 has its own track and untrack pfn vma functions */
#define __HAVE_PFNMAP_TRACKING

#define __HAVE_PHYS_MEM_ACCESS_PROT
struct file;
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
Expand Down
9 changes: 9 additions & 0 deletions trunk/arch/x86/include/asm/pgtable_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ extern unsigned long pg0[];
# include <asm/pgtable-2level.h>
#endif

/*
* Macro to mark a page protection value as "uncacheable".
* On processors which do not support it, this is a no-op.
*/
#define pgprot_noncached(prot) \
((boot_cpu_data.x86 > 3) \
? (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) \
: (prot))

/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/x86/include/asm/pgtable_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ static inline int pmd_bad(pmd_t pmd)

#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */

/*
* Macro to mark a page protection value as "uncacheable".
*/
#define pgprot_noncached(prot) \
(__pgprot(pgprot_val((prot)) | _PAGE_PCD | _PAGE_PWT))

/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
Expand Down
32 changes: 14 additions & 18 deletions trunk/arch/x86/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ void math_error(void __user *ip)
{
struct task_struct *task;
siginfo_t info;
unsigned short cwd, swd;
unsigned short cwd, swd, err;

/*
* Save the info for the exception handler and clear the error.
Expand All @@ -675,7 +675,6 @@ void math_error(void __user *ip)
task->thread.error_code = 0;
info.si_signo = SIGFPE;
info.si_errno = 0;
info.si_code = __SI_FAULT;
info.si_addr = ip;
/*
* (~cwd & swd) will mask out exceptions that are not set to unmasked
Expand All @@ -689,34 +688,31 @@ void math_error(void __user *ip)
*/
cwd = get_fpu_cwd(task);
swd = get_fpu_swd(task);
switch (swd & ~cwd & 0x3f) {
case 0x000: /* No unmasked exception */

err = swd & ~cwd & 0x3f;

#ifdef CONFIG_X86_32
if (!err)
return;
#endif
default: /* Multiple exceptions */
break;
case 0x001: /* Invalid Op */

if (err & 0x001) { /* Invalid op */
/*
* swd & 0x240 == 0x040: Stack Underflow
* swd & 0x240 == 0x240: Stack Overflow
* User must clear the SF bit (0x40) if set
*/
info.si_code = FPE_FLTINV;
break;
case 0x002: /* Denormalize */
case 0x010: /* Underflow */
info.si_code = FPE_FLTUND;
break;
case 0x004: /* Zero Divide */
} else if (err & 0x004) { /* Divide by Zero */
info.si_code = FPE_FLTDIV;
break;
case 0x008: /* Overflow */
} else if (err & 0x008) { /* Overflow */
info.si_code = FPE_FLTOVF;
break;
case 0x020: /* Precision */
} else if (err & 0x012) { /* Denormal, Underflow */
info.si_code = FPE_FLTUND;
} else if (err & 0x020) { /* Precision */
info.si_code = FPE_FLTRES;
break;
} else {
info.si_code = __SI_FAULT|SI_KERNEL; /* WTF? */
}
force_sig_info(SIGFPE, &info, task);
}
Expand Down
Loading

0 comments on commit 898ad89

Please sign in to comment.