This commit is contained in:
cl349@firebug.cl.cam.ac.uk committed 2005-09-06 18:29:53 +00:00
commit d3733b34b5
18 files changed
+98 -60

No files matched your search

@@ -359,7 +359,7 @@ static void __init probe_roms(void)
shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
EXPORT_SYMBOL(HYPERVISOR_shared_info);
unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
EXPORT_SYMBOL(phys_to_machine_mapping);
/* Raw start-of-day parameters from the hypervisor. */
@@ -1206,7 +1206,7 @@ void __init setup_bootmem_allocator(void)
}
#endif
phys_to_machine_mapping = (unsigned int *)xen_start_info->mfn_list;
phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list;
}
/*
@@ -1638,15 +1638,15 @@ void __init setup_arch(char **cmdline_p)
/* Make sure we have a correctly sized P->M table. */
if (max_pfn != xen_start_info->nr_pages) {
phys_to_machine_mapping = alloc_bootmem_low_pages(
max_pfn * sizeof(unsigned int));
max_pfn * sizeof(unsigned long));
if (max_pfn > xen_start_info->nr_pages) {
/* set to INVALID_P2M_ENTRY */
memset(phys_to_machine_mapping, ~0,
max_pfn * sizeof(unsigned int));
max_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
(unsigned int *)xen_start_info->mfn_list,
xen_start_info->nr_pages * sizeof(unsigned int));
(unsigned long *)xen_start_info->mfn_list,
xen_start_info->nr_pages * sizeof(unsigned long));
} else {
struct xen_memory_reservation reservation = {
.extent_start = (unsigned long *)xen_start_info->mfn_list + max_pfn,
@@ -1656,9 +1656,8 @@ void __init setup_arch(char **cmdline_p)
};
memcpy(phys_to_machine_mapping,
(unsigned int *)xen_start_info->mfn_list,
max_pfn * sizeof(unsigned int));
/* N.B. below relies on sizeof(int) == sizeof(long). */
(unsigned long *)xen_start_info->mfn_list,
max_pfn * sizeof(unsigned long));
BUG_ON(HYPERVISOR_memory_op(
XENMEM_decrease_reservation,
&reservation) !=
@@ -1667,11 +1666,11 @@ void __init setup_arch(char **cmdline_p)
free_bootmem(
__pa(xen_start_info->mfn_list),
PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
sizeof(unsigned int))));
sizeof(unsigned long))));
}
pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned int)), j++ )
for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
{
pfn_to_mfn_frame_list[j] =
virt_to_mfn(&phys_to_machine_mapping[i]);
@@ -51,7 +51,7 @@ static unsigned long iotlb_nslabs;
* swiotlb_sync_single_*, to see if the memory was in fact allocated by this
* API.
*/
static dma_addr_t iotlb_bus_start, iotlb_bus_mask;
static dma_addr_t iotlb_bus_start, iotlb_bus_end, iotlb_bus_mask;
/* Does the given dma address reside within the swiotlb aperture? */
#define in_swiotlb_aperture(a) (!(((a) ^ iotlb_bus_start) & iotlb_bus_mask))
@@ -157,6 +157,7 @@ swiotlb_init_with_default_size (size_t default_size)
io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
iotlb_bus_start = virt_to_bus(iotlb_virt_start);
iotlb_bus_end = iotlb_bus_start + bytes;
iotlb_bus_mask = ~(dma_addr_t)(bytes - 1);
printk(KERN_INFO "Software IO TLB enabled: \n"
@@ -165,7 +166,7 @@ swiotlb_init_with_default_size (size_t default_size)
" Kernel range: 0x%016lx - 0x%016lx\n",
bytes >> 20,
(unsigned long)iotlb_bus_start,
(unsigned long)iotlb_bus_start + bytes,
(unsigned long)iotlb_bus_end,
(unsigned long)iotlb_virt_start,
(unsigned long)iotlb_virt_start + bytes);
}
@@ -191,6 +192,8 @@ swiotlb_init(void)
if (swiotlb)
swiotlb_init_with_default_size(64 * (1<<20));
else
printk(KERN_INFO "Software IO TLB disabled\n");
}
static void
@@ -424,13 +427,6 @@ swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
}
dev_addr = virt_to_bus(map);
/*
* Ensure that the address returned is DMA'ble
*/
if (address_needs_mapping(hwdev, dev_addr))
panic("map_single: bounce buffer is not DMA'ble");
return dev_addr;
}
@@ -632,7 +628,7 @@ swiotlb_dma_mapping_error(dma_addr_t dma_addr)
int
swiotlb_dma_supported (struct device *hwdev, u64 mask)
{
return (mask >= 0xffffffffUL);
return (mask >= (iotlb_bus_end - 1));
}
EXPORT_SYMBOL(swiotlb_init);
@@ -81,7 +81,7 @@ static int __do_suspend(void *ignore)
extern void time_suspend(void);
extern void time_resume(void);
extern unsigned long max_pfn;
extern unsigned int *pfn_to_mfn_frame_list;
extern unsigned long *pfn_to_mfn_frame_list;
#ifdef CONFIG_SMP
extern void smp_suspend(void);
@@ -90,7 +90,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
{
int i;
phys_to_machine_mapping = (u32 *)xen_start_info->mfn_list;
phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list;
start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) +
xen_start_info->nr_pt_frames;
@@ -76,7 +76,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
/* Allows setting of maximum possible memory size */
unsigned long xen_override_max_pfn;
u32 *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
EXPORT_SYMBOL(phys_to_machine_mapping);
@@ -734,22 +734,22 @@ void __init setup_arch(char **cmdline_p)
/* Make sure we have a large enough P->M table. */
if (end_pfn > xen_start_info->nr_pages) {
phys_to_machine_mapping = alloc_bootmem(
end_pfn * sizeof(u32));
end_pfn * sizeof(unsigned long));
memset(phys_to_machine_mapping, ~0,
end_pfn * sizeof(u32));
end_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
(u32 *)xen_start_info->mfn_list,
xen_start_info->nr_pages * sizeof(u32));
(unsigned long *)xen_start_info->mfn_list,
xen_start_info->nr_pages * sizeof(unsigned long));
free_bootmem(
__pa(xen_start_info->mfn_list),
PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
sizeof(u32))));
sizeof(unsigned long))));
}
pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE);
for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(u32)), j++ )
pfn_to_mfn_frame_list[j] =
for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
pfn_to_mfn_frame_list[j] =
virt_to_mfn(&phys_to_machine_mapping[i]);
}
#endif
@@ -60,14 +60,14 @@
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
#define INVALID_P2M_ENTRY (~0U)
#define FOREIGN_FRAME(m) ((m) | 0x80000000U)
extern unsigned int *phys_to_machine_mapping;
#define INVALID_P2M_ENTRY (~0UL)
#define FOREIGN_FRAME(m) ((m) | (1UL<<31))
extern unsigned long *phys_to_machine_mapping;
#define pfn_to_mfn(pfn) \
((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL<<31))
static inline unsigned long mfn_to_pfn(unsigned long mfn)
{
unsigned int pfn;
unsigned long pfn;
/*
* The array access can fail (e.g., device space beyond end of RAM).
@@ -83,7 +83,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
".previous"
: "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
return (unsigned long)pfn;
return pfn;
}
/* Definitions for machine and pseudophysical addresses. */
@@ -43,9 +43,33 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
struct pci_dev;
#ifdef CONFIG_SWIOTLB
/* On Xen we use SWIOTLB instead of blk-specific bounce buffers. */
#define PCI_DMA_BUS_IS_PHYS (0)
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
dma_addr_t ADDR_NAME;
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
__u32 LEN_NAME;
#define pci_unmap_addr(PTR, ADDR_NAME) \
((PTR)->ADDR_NAME)
#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
(((PTR)->ADDR_NAME) = (VAL))
#define pci_unmap_len(PTR, LEN_NAME) \
((PTR)->LEN_NAME)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
(((PTR)->LEN_NAME) = (VAL))
#else
/* The PCI address space does equal the physical memory
* address space. The networking and block device layers use
* this boolean for bounce buffer decisions.
*/
#define PCI_DMA_BUS_IS_PHYS (1)
/* pci_unmap_{page,single} is a nop so... */
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
@@ -54,6 +78,8 @@ struct pci_dev;
#define pci_unmap_len(PTR, LEN_NAME) (0)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
#endif
/* This is always fine. */
#define pci_dac_dma_supported(pci_dev, mask) (1)
@@ -62,14 +62,14 @@ void copy_page(void *, void *);
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
#define INVALID_P2M_ENTRY (~0U)
#define FOREIGN_FRAME(m) ((m) | 0x80000000U)
extern u32 *phys_to_machine_mapping;
#define INVALID_P2M_ENTRY (~0UL)
#define FOREIGN_FRAME(m) ((m) | (1UL<<63))
extern unsigned long *phys_to_machine_mapping;
#define pfn_to_mfn(pfn) \
((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL << 63))
static inline unsigned long mfn_to_pfn(unsigned long mfn)
{
unsigned int pfn;
unsigned long pfn;
/*
* The array access can fail (e.g., device space beyond end of RAM).
@@ -77,7 +77,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
* but we must handle the fault without crashing!
*/
asm (
"1: movl %1,%k0\n"
"1: movq %1,%0\n"
"2:\n"
".section __ex_table,\"a\"\n"
" .align 8\n"
@@ -85,7 +85,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
".previous"
: "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) );
return (unsigned long)pfn;
return pfn;
}
/* Definitions for machine and pseudophysical addresses. */
@@ -63,6 +63,25 @@ extern int iommu_setup(char *opt);
extern int iommu_sac_force;
#define pci_dac_dma_supported(pci_dev, mask) (!iommu_sac_force)
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
dma_addr_t ADDR_NAME;
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
__u32 LEN_NAME;
#define pci_unmap_addr(PTR, ADDR_NAME) \
((PTR)->ADDR_NAME)
#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
(((PTR)->ADDR_NAME) = (VAL))
#define pci_unmap_len(PTR, LEN_NAME) \
((PTR)->LEN_NAME)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
(((PTR)->LEN_NAME) = (VAL))
#elif defined(CONFIG_SWIOTLB)
#define PCI_DMA_BUS_IS_PHYS 0
#define pci_dac_dma_supported(pci_dev, mask) 1
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
dma_addr_t ADDR_NAME;
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
@@ -79,9 +98,7 @@ extern int iommu_sac_force;
#else
/* No IOMMU */
/* On Xen we use SWIOTLB instead of blk-specific bounce buffers. */
#define PCI_DMA_BUS_IS_PHYS (0)
#define PCI_DMA_BUS_IS_PHYS 1
#define pci_dac_dma_supported(pci_dev, mask) 1
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
@@ -307,7 +307,7 @@ inline static void set_pte_at(struct mm_struct *mm, unsigned long addr,
#define pte_pfn(_pte) \
({ \
unsigned long mfn = pte_mfn(_pte); \
unsigned pfn = mfn_to_pfn(mfn); \
unsigned long pfn = mfn_to_pfn(mfn); \
if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
pfn = max_mapnr; /* special: force !pfn_valid() */ \
pfn; \
+1 -1
View File
@@ -348,7 +348,7 @@ static int setup_guest(int xc_handle,
unsigned long nr_pt_pages;
unsigned long physmap_pfn;
u32 *physmap, *physmap_e;
unsigned long *physmap, *physmap_e;
struct load_funcs load_funcs;
struct domain_setup_info dsi;
+3 -3
View File
@@ -218,7 +218,7 @@ int construct_dom0(struct domain *d,
vinitrd_start = round_pgup(dsi.v_end);
vinitrd_end = vinitrd_start + initrd_len;
vphysmap_start = round_pgup(vinitrd_end);
vphysmap_end = vphysmap_start + (nr_pages * sizeof(u32));
vphysmap_end = vphysmap_start + (nr_pages * sizeof(unsigned long));
vstartinfo_start = round_pgup(vphysmap_end);
vstartinfo_end = vstartinfo_start + PAGE_SIZE;
vpt_start = vstartinfo_end;
@@ -613,7 +613,7 @@ int construct_dom0(struct domain *d,
if ( !opt_dom0_translate && (pfn > REVERSE_START) )
mfn = alloc_epfn - (pfn - REVERSE_START);
#endif
((u32 *)vphysmap_start)[pfn] = mfn;
((unsigned long *)vphysmap_start)[pfn] = mfn;
set_pfn_from_mfn(mfn, pfn);
}
while ( pfn < nr_pages )
@@ -626,7 +626,7 @@ int construct_dom0(struct domain *d,
#ifndef NDEBUG
#define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
#endif
((u32 *)vphysmap_start)[pfn] = mfn;
((unsigned long *)vphysmap_start)[pfn] = mfn;
set_pfn_from_mfn(mfn, pfn);
#undef pfn
page++; pfn++;
+1 -1
View File
@@ -1450,7 +1450,7 @@ int get_page_type(struct pfn_info *page, unsigned long type)
((type & PGT_type_mask) != PGT_l1_page_table) )
MEM_LOG("Bad type (saw %" PRtype_info
"!= exp %" PRtype_info ") "
"for mfn %lx (pfn %x)",
"for mfn %lx (pfn %lx)",
x, type, page_to_pfn(page),
get_pfn_from_mfn(page_to_pfn(page)));
return 0;
+1 -1
View File
@@ -95,7 +95,7 @@ void __init paging_init(void)
* Allocate and map the machine-to-phys table and create read-only mapping
* of MPT for guest-OS use.
*/
mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
mpt_size = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1;
mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
{
+1 -1
View File
@@ -98,7 +98,7 @@ void __init paging_init(void)
* Allocate and map the machine-to-phys table.
* This also ensures L3 is present for fixmaps.
*/
mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
mpt_size = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1;
mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
{
+3 -3
View File
@@ -255,9 +255,9 @@ int check_descriptor(struct desc_struct *d);
* contiguous (or near contiguous) physical memory.
*/
#undef machine_to_phys_mapping
#define machine_to_phys_mapping ((u32 *)RDWR_MPT_VIRT_START)
#define INVALID_M2P_ENTRY (~0U)
#define VALID_M2P(_e) (!((_e) & (1U<<31)))
#define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START)
#define INVALID_M2P_ENTRY (~0UL)
#define VALID_M2P(_e) (!((_e) & (1UL<<(BITS_PER_LONG-1))))
#define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
+1 -1
View File
@@ -55,7 +55,7 @@
# define HYPERVISOR_VIRT_START (0xFC000000UL)
#endif
#ifndef machine_to_phys_mapping
#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START)
#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
#endif
/* Maximum number of virtual CPUs in multi-processor guests. */
+1 -1
View File
@@ -71,7 +71,7 @@
/* The machine->physical mapping table starts at this address, read-only. */
#ifndef machine_to_phys_mapping
#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START)
#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
#endif
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.