diff options
author | David S. Miller <davem@davemloft.net> | 2008-03-19 07:52:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-24 02:32:16 -0400 |
commit | c1b1a5f1f1b2612b69b67381b223bce9f8ec4da5 (patch) | |
tree | e95abb7a3dbd0ca6c341c44f2b69dd174fd03bec /arch/sparc64/kernel/pci_sun4v.c | |
parent | 0c49a573ea93f777fd27f26b7853e7bf5a20e1a3 (diff) |
[SPARC64]: NUMA device infrastructure.
Record and propagate NUMA information for devices.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/pci_sun4v.c')
-rw-r--r-- | arch/sparc64/kernel/pci_sun4v.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 01839706bd52..e2bb9790039c 100644 --- a/arch/sparc64/kernel/pci_sun4v.c +++ b/arch/sparc64/kernel/pci_sun4v.c | |||
@@ -127,10 +127,12 @@ static inline long iommu_batch_end(void) | |||
127 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | 127 | static void *dma_4v_alloc_coherent(struct device *dev, size_t size, |
128 | dma_addr_t *dma_addrp, gfp_t gfp) | 128 | dma_addr_t *dma_addrp, gfp_t gfp) |
129 | { | 129 | { |
130 | struct iommu *iommu; | ||
131 | unsigned long flags, order, first_page, npages, n; | 130 | unsigned long flags, order, first_page, npages, n; |
131 | struct iommu *iommu; | ||
132 | struct page *page; | ||
132 | void *ret; | 133 | void *ret; |
133 | long entry; | 134 | long entry; |
135 | int nid; | ||
134 | 136 | ||
135 | size = IO_PAGE_ALIGN(size); | 137 | size = IO_PAGE_ALIGN(size); |
136 | order = get_order(size); | 138 | order = get_order(size); |
@@ -139,10 +141,12 @@ static void *dma_4v_alloc_coherent(struct device *dev, size_t size, | |||
139 | 141 | ||
140 | npages = size >> IO_PAGE_SHIFT; | 142 | npages = size >> IO_PAGE_SHIFT; |
141 | 143 | ||
142 | first_page = __get_free_pages(gfp, order); | 144 | nid = dev->archdata.numa_node; |
143 | if (unlikely(first_page == 0UL)) | 145 | page = alloc_pages_node(nid, gfp, order); |
146 | if (unlikely(!page)) | ||
144 | return NULL; | 147 | return NULL; |
145 | 148 | ||
149 | first_page = (unsigned long) page_address(page); | ||
146 | memset((char *)first_page, 0, PAGE_SIZE << order); | 150 | memset((char *)first_page, 0, PAGE_SIZE << order); |
147 | 151 | ||
148 | iommu = dev->archdata.iommu; | 152 | iommu = dev->archdata.iommu; |
@@ -899,6 +903,8 @@ static void __init pci_sun4v_pbm_init(struct pci_controller_info *p, | |||
899 | pbm->next = pci_pbm_root; | 903 | pbm->next = pci_pbm_root; |
900 | pci_pbm_root = pbm; | 904 | pci_pbm_root = pbm; |
901 | 905 | ||
906 | pbm->numa_node = of_node_to_nid(dp); | ||
907 | |||
902 | pbm->scan_bus = pci_sun4v_scan_bus; | 908 | pbm->scan_bus = pci_sun4v_scan_bus; |
903 | pbm->pci_ops = &sun4v_pci_ops; | 909 | pbm->pci_ops = &sun4v_pci_ops; |
904 | pbm->config_space_reg_bits = 12; | 910 | pbm->config_space_reg_bits = 12; |
@@ -913,6 +919,7 @@ static void __init pci_sun4v_pbm_init(struct pci_controller_info *p, | |||
913 | pbm->name = dp->full_name; | 919 | pbm->name = dp->full_name; |
914 | 920 | ||
915 | printk("%s: SUN4V PCI Bus Module\n", pbm->name); | 921 | printk("%s: SUN4V PCI Bus Module\n", pbm->name); |
922 | printk("%s: On NUMA node %d\n", pbm->name, pbm->numa_node); | ||
916 | 923 | ||
917 | pci_determine_mem_io_space(pbm); | 924 | pci_determine_mem_io_space(pbm); |
918 | 925 | ||