* [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure
@ 2009-10-01 23:06 Suresh Siddha
2009-10-01 23:06 ` [patch 2/4] dmar: Allocate queued invalidation structure using numa locality info Suresh Siddha
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-01 23:06 UTC (permalink / raw)
To: dwmw2; +Cc: jbarnes, len.brown, linux-kernel, Suresh Siddha
[-- Attachment #1: parse_rhsa_struct.patch --]
[-- Type: text/plain, Size: 3733 bytes --]
Add support for parsing Remapping Hardware Static Affinity (RHSA) structure.
This enables identifying the association between remapping hardware units and
the corresponding proximity domain. This enables to allocate transalation
structures closer to the remapping hardware unit.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
drivers/pci/dmar.c | 32 ++++++++++++++++++++++++++++++++
include/acpi/actbl1.h | 12 +++++++++++-
include/linux/intel-iommu.h | 1 +
3 files changed, 44 insertions(+), 1 deletion(-)
Index: tip/drivers/pci/dmar.c
===================================================================
--- tip.orig/drivers/pci/dmar.c
+++ tip/drivers/pci/dmar.c
@@ -348,12 +348,33 @@ found:
}
#endif
+static int __init
+dmar_parse_one_rhsa(struct acpi_dmar_header *header)
+{
+ struct acpi_dmar_rhsa *rhsa;
+ struct dmar_drhd_unit *drhd;
+
+ rhsa = (struct acpi_dmar_rhsa *)header;
+ for_each_drhd_unit(drhd)
+ if (drhd->reg_base_addr == rhsa->base_address) {
+ int node = acpi_map_pxm_to_node(rhsa->pxm);
+
+ if (!node_online(node))
+ node = -1;
+ drhd->iommu->node = node;
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
static void __init
dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
{
struct acpi_dmar_hardware_unit *drhd;
struct acpi_dmar_reserved_memory *rmrr;
struct acpi_dmar_atsr *atsr;
+ struct acpi_dmar_rhsa *rhsa;
switch (header->type) {
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -375,6 +396,12 @@ dmar_table_print_dmar_entry(struct acpi_
atsr = container_of(header, struct acpi_dmar_atsr, header);
printk(KERN_INFO PREFIX "ATSR flags: %#x\n", atsr->flags);
break;
+ case ACPI_DMAR_TYPE_RHSA:
+ rhsa = container_of(header, struct acpi_dmar_rhsa, header);
+ printk(KERN_INFO PREFIX
+ "RHSA base: %#016Lx pxm: %#x\n",
+ rhsa->base_address, rhsa->pxm);
+ break;
}
}
@@ -459,6 +486,9 @@ parse_dmar_table(void)
ret = dmar_parse_one_atsr(entry_header);
#endif
break;
+ case ACPI_DMAR_TYPE_RHSA:
+ ret = dmar_parse_one_rhsa(entry_header);
+ break;
default:
printk(KERN_WARNING PREFIX
"Unknown DMAR structure type\n");
@@ -658,6 +688,8 @@ int alloc_iommu(struct dmar_drhd_unit *d
iommu->agaw = agaw;
iommu->msagaw = msagaw;
+ iommu->node = -1;
+
/* the registers might be more than one page */
map_size = max_t(int, ecap_max_iotlb_offset(iommu->ecap),
cap_max_fault_reg_offset(iommu->cap));
Index: tip/include/acpi/actbl1.h
===================================================================
--- tip.orig/include/acpi/actbl1.h
+++ tip/include/acpi/actbl1.h
@@ -328,7 +328,8 @@ enum acpi_dmar_type {
ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
ACPI_DMAR_TYPE_ATSR = 2,
- ACPI_DMAR_TYPE_RESERVED = 3 /* 3 and greater are reserved */
+ ACPI_DMAR_TYPE_RHSA = 3,
+ ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */
};
struct acpi_dmar_device_scope {
@@ -401,6 +402,15 @@ struct acpi_dmar_atsr {
#define ACPI_DMAR_ALL_PORTS (1)
+/* 3: Remapping Hardware Static Affinity Reporting Structure */
+
+struct acpi_dmar_rhsa {
+ struct acpi_dmar_header header;
+ u32 reserved;
+ u64 base_address;
+ u32 pxm;
+};
+
/*******************************************************************************
*
* ECDT - Embedded Controller Boot Resources Table
Index: tip/include/linux/intel-iommu.h
===================================================================
--- tip.orig/include/linux/intel-iommu.h
+++ tip/include/linux/intel-iommu.h
@@ -332,6 +332,7 @@ struct intel_iommu {
#ifdef CONFIG_INTR_REMAP
struct ir_table *ir_table; /* Interrupt remapping info */
#endif
+ int node;
};
static inline void __iommu_flush_cache(
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 2/4] dmar: Allocate queued invalidation structure using numa locality info
2009-10-01 23:06 [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure Suresh Siddha
@ 2009-10-01 23:06 ` Suresh Siddha
2009-10-01 23:06 ` [patch 3/4] intr_remap: Allocate intr-remapping table " Suresh Siddha
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-01 23:06 UTC (permalink / raw)
To: dwmw2; +Cc: jbarnes, len.brown, linux-kernel, Suresh Siddha
[-- Attachment #1: qi_use_affinity_info.patch --]
[-- Type: text/plain, Size: 1078 bytes --]
Allocate queued invalidation descriptor structures using numa locality info.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
drivers/pci/dmar.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: tip/drivers/pci/dmar.c
===================================================================
--- tip.orig/drivers/pci/dmar.c
+++ tip/drivers/pci/dmar.c
@@ -1028,6 +1028,7 @@ static void __dmar_enable_qi(struct inte
int dmar_enable_qi(struct intel_iommu *iommu)
{
struct q_inval *qi;
+ struct page *desc_page;
if (!ecap_qis(iommu->ecap))
return -ENOENT;
@@ -1044,13 +1045,16 @@ int dmar_enable_qi(struct intel_iommu *i
qi = iommu->qi;
- qi->desc = (void *)(get_zeroed_page(GFP_ATOMIC));
- if (!qi->desc) {
+
+ desc_page = alloc_pages_node(iommu->node, GFP_ATOMIC | __GFP_ZERO, 0);
+ if (!desc_page) {
kfree(qi);
iommu->qi = 0;
return -ENOMEM;
}
+ qi->desc = page_address(desc_page);
+
qi->desc_status = kmalloc(QI_LENGTH * sizeof(int), GFP_ATOMIC);
if (!qi->desc_status) {
free_page((unsigned long) qi->desc);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 3/4] intr_remap: Allocate intr-remapping table using numa locality info
2009-10-01 23:06 [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure Suresh Siddha
2009-10-01 23:06 ` [patch 2/4] dmar: Allocate queued invalidation structure using numa locality info Suresh Siddha
@ 2009-10-01 23:06 ` Suresh Siddha
2009-10-01 23:06 ` [patch 4/4] iommu: Allocate dma-remapping structures " Suresh Siddha
2009-10-02 5:39 ` [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure David Woodhouse
3 siblings, 0 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-01 23:06 UTC (permalink / raw)
To: dwmw2; +Cc: jbarnes, len.brown, linux-kernel, Suresh Siddha
[-- Attachment #1: intr_remap_use_affinity_info.patch --]
[-- Type: text/plain, Size: 895 bytes --]
Allocate intr-remapping table using numa locality info. On platforms
having remapping hardware units span different nodes, this enables
optimized intr-remapping table entry access by remapping hardware.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
drivers/pci/intr_remapping.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: tip/drivers/pci/intr_remapping.c
===================================================================
--- tip.orig/drivers/pci/intr_remapping.c
+++ tip/drivers/pci/intr_remapping.c
@@ -590,7 +590,8 @@ static int setup_intr_remapping(struct i
if (!iommu->ir_table)
return -ENOMEM;
- pages = alloc_pages(GFP_ATOMIC | __GFP_ZERO, INTR_REMAP_PAGE_ORDER);
+ pages = alloc_pages_node(iommu->node, GFP_ATOMIC | __GFP_ZERO,
+ INTR_REMAP_PAGE_ORDER);
if (!pages) {
printk(KERN_ERR "failed to allocate pages of order %d\n",
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 4/4] iommu: Allocate dma-remapping structures using numa locality info
2009-10-01 23:06 [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure Suresh Siddha
2009-10-01 23:06 ` [patch 2/4] dmar: Allocate queued invalidation structure using numa locality info Suresh Siddha
2009-10-01 23:06 ` [patch 3/4] intr_remap: Allocate intr-remapping table " Suresh Siddha
@ 2009-10-01 23:06 ` Suresh Siddha
2009-10-02 5:39 ` [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure David Woodhouse
3 siblings, 0 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-01 23:06 UTC (permalink / raw)
To: dwmw2; +Cc: jbarnes, len.brown, linux-kernel, Suresh Siddha
[-- Attachment #1: iommu_use_affinity_info.patch --]
[-- Type: text/plain, Size: 3901 bytes --]
Allocate dma-remapping structures using numa locality info. On platforms
having remapping hardware units span different nodes, this enables
optimized dma-remapping transalation structures access by remapping hardware.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
drivers/pci/intel-iommu.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
Index: tip/drivers/pci/intel-iommu.c
===================================================================
--- tip.orig/drivers/pci/intel-iommu.c
+++ tip/drivers/pci/intel-iommu.c
@@ -267,6 +267,7 @@ struct dmar_domain *si_domain;
struct dmar_domain {
int id; /* domain id */
+ int nid; /* node id */
unsigned long iommu_bmp; /* bitmap of iommus this domain uses*/
struct list_head devices; /* all devices' list */
@@ -390,15 +391,18 @@ static inline void *iommu_kmem_cache_all
}
-static inline void *alloc_pgtable_page(void)
+static inline void *alloc_pgtable_page(int node)
{
unsigned int flags;
- void *vaddr;
+ struct page *page;
+ void *vaddr = NULL;
/* trying to avoid low memory issues */
flags = current->flags & PF_MEMALLOC;
current->flags |= PF_MEMALLOC;
- vaddr = (void *)get_zeroed_page(GFP_ATOMIC);
+ page = alloc_pages_node(node, GFP_ATOMIC | __GFP_ZERO, 0);
+ if (page)
+ vaddr = page_address(page);
current->flags &= (~PF_MEMALLOC | flags);
return vaddr;
}
@@ -579,7 +583,8 @@ static struct context_entry * device_to_
root = &iommu->root_entry[bus];
context = get_context_addr_from_root(root);
if (!context) {
- context = (struct context_entry *)alloc_pgtable_page();
+ context = (struct context_entry *)
+ alloc_pgtable_page(iommu->node);
if (!context) {
spin_unlock_irqrestore(&iommu->lock, flags);
return NULL;
@@ -722,7 +727,7 @@ static struct dma_pte *pfn_to_dma_pte(st
if (!dma_pte_present(pte)) {
uint64_t pteval;
- tmp_page = alloc_pgtable_page();
+ tmp_page = alloc_pgtable_page(domain->nid);
if (!tmp_page)
return NULL;
@@ -855,7 +860,7 @@ static int iommu_alloc_root_entry(struct
struct root_entry *root;
unsigned long flags;
- root = (struct root_entry *)alloc_pgtable_page();
+ root = (struct root_entry *)alloc_pgtable_page(iommu->node);
if (!root)
return -ENOMEM;
@@ -1249,6 +1254,7 @@ static struct dmar_domain *alloc_domain(
if (!domain)
return NULL;
+ domain->nid = -1;
memset(&domain->iommu_bmp, 0, sizeof(unsigned long));
domain->flags = 0;
@@ -1409,9 +1415,10 @@ static int domain_init(struct dmar_domai
domain->iommu_snooping = 0;
domain->iommu_count = 1;
+ domain->nid = iommu->node;
/* always allocate the top pgd */
- domain->pgd = (struct dma_pte *)alloc_pgtable_page();
+ domain->pgd = (struct dma_pte *)alloc_pgtable_page(domain->nid);
if (!domain->pgd)
return -ENOMEM;
__iommu_flush_cache(iommu, domain->pgd, PAGE_SIZE);
@@ -1566,6 +1573,8 @@ static int domain_context_mapping_one(st
spin_lock_irqsave(&domain->iommu_lock, flags);
if (!test_and_set_bit(iommu->seq_id, &domain->iommu_bmp)) {
domain->iommu_count++;
+ if (domain->iommu_count == 1)
+ domain->nid = iommu->node;
domain_update_iommu_cap(domain);
}
spin_unlock_irqrestore(&domain->iommu_lock, flags);
@@ -3397,6 +3406,7 @@ static struct dmar_domain *iommu_alloc_v
return NULL;
domain->id = vm_domid++;
+ domain->nid = -1;
memset(&domain->iommu_bmp, 0, sizeof(unsigned long));
domain->flags = DOMAIN_FLAG_VIRTUAL_MACHINE;
@@ -3423,9 +3433,10 @@ static int md_domain_init(struct dmar_do
domain->iommu_coherency = 0;
domain->iommu_snooping = 0;
domain->max_addr = 0;
+ domain->nid = -1;
/* always allocate the top pgd */
- domain->pgd = (struct dma_pte *)alloc_pgtable_page();
+ domain->pgd = (struct dma_pte *)alloc_pgtable_page(domain->nid);
if (!domain->pgd)
return -ENOMEM;
domain_flush_cache(domain, domain->pgd, PAGE_SIZE);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure
2009-10-01 23:06 [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure Suresh Siddha
` (2 preceding siblings ...)
2009-10-01 23:06 ` [patch 4/4] iommu: Allocate dma-remapping structures " Suresh Siddha
@ 2009-10-02 5:39 ` David Woodhouse
2009-10-02 18:12 ` Suresh Siddha
3 siblings, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2009-10-02 5:39 UTC (permalink / raw)
To: Suresh Siddha; +Cc: jbarnes, len.brown, linux-kernel
On Thu, 2009-10-01 at 16:06 -0700, Suresh Siddha wrote:
> Add support for parsing Remapping Hardware Static Affinity (RHSA) structure.
> This enables identifying the association between remapping hardware units and
> the corresponding proximity domain. This enables to allocate transalation
> structures closer to the remapping hardware unit.
That's not going to apply on top of commit 17b6097753e, is it?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure
2009-10-02 5:39 ` [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure David Woodhouse
@ 2009-10-02 18:12 ` Suresh Siddha
0 siblings, 0 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-02 18:12 UTC (permalink / raw)
To: David Woodhouse; +Cc: jbarnes, Brown, Len, linux-kernel
On Thu, 2009-10-01 at 22:39 -0700, David Woodhouse wrote:
> On Thu, 2009-10-01 at 16:06 -0700, Suresh Siddha wrote:
> > Add support for parsing Remapping Hardware Static Affinity (RHSA) structure.
> > This enables identifying the association between remapping hardware units and
> > the corresponding proximity domain. This enables to allocate transalation
> > structures closer to the remapping hardware unit.
>
> That's not going to apply on top of commit 17b6097753e, is it?
Oops, didn't notice Roland's patch. Just posted the new set on top of
your tree.
thanks,
suresh
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure
@ 2009-10-02 18:01 Suresh Siddha
0 siblings, 0 replies; 7+ messages in thread
From: Suresh Siddha @ 2009-10-02 18:01 UTC (permalink / raw)
To: dwmw2; +Cc: jbarnes, len.brown, linux-kernel, rdreier, Suresh Siddha
[-- Attachment #1: parse_rhsa_struct.patch --]
[-- Type: text/plain, Size: 2162 bytes --]
Add support for parsing Remapping Hardware Static Affinity (RHSA) structure.
This enables identifying the association between remapping hardware units and
the corresponding proximity domain. This enables to allocate transalation
structures closer to the remapping hardware unit.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
drivers/pci/dmar.c | 24 +++++++++++++++++++++++-
include/linux/intel-iommu.h | 1 +
2 files changed, 24 insertions(+), 1 deletion(-)
Index: iommu-2.6/drivers/pci/dmar.c
===================================================================
--- iommu-2.6.orig/drivers/pci/dmar.c
+++ iommu-2.6/drivers/pci/dmar.c
@@ -348,6 +348,26 @@ found:
}
#endif
+static int __init
+dmar_parse_one_rhsa(struct acpi_dmar_header *header)
+{
+ struct acpi_dmar_rhsa *rhsa;
+ struct dmar_drhd_unit *drhd;
+
+ rhsa = (struct acpi_dmar_rhsa *)header;
+ for_each_drhd_unit(drhd)
+ if (drhd->reg_base_addr == rhsa->base_address) {
+ int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
+
+ if (!node_online(node))
+ node = -1;
+ drhd->iommu->node = node;
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
static void __init
dmar_table_print_dmar_entry(struct acpi_dmar_header *header)
{
@@ -467,7 +487,7 @@ parse_dmar_table(void)
#endif
break;
case ACPI_DMAR_HARDWARE_AFFINITY:
- /* We don't do anything with RHSA (yet?) */
+ ret = dmar_parse_one_rhsa(entry_header);
break;
default:
printk(KERN_WARNING PREFIX
@@ -677,6 +697,8 @@ int alloc_iommu(struct dmar_drhd_unit *d
iommu->agaw = agaw;
iommu->msagaw = msagaw;
+ iommu->node = -1;
+
/* the registers might be more than one page */
map_size = max_t(int, ecap_max_iotlb_offset(iommu->ecap),
cap_max_fault_reg_offset(iommu->cap));
Index: iommu-2.6/include/linux/intel-iommu.h
===================================================================
--- iommu-2.6.orig/include/linux/intel-iommu.h
+++ iommu-2.6/include/linux/intel-iommu.h
@@ -332,6 +332,7 @@ struct intel_iommu {
#ifdef CONFIG_INTR_REMAP
struct ir_table *ir_table; /* Interrupt remapping info */
#endif
+ int node;
};
static inline void __iommu_flush_cache(
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-10-02 18:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 23:06 [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure Suresh Siddha
2009-10-01 23:06 ` [patch 2/4] dmar: Allocate queued invalidation structure using numa locality info Suresh Siddha
2009-10-01 23:06 ` [patch 3/4] intr_remap: Allocate intr-remapping table " Suresh Siddha
2009-10-01 23:06 ` [patch 4/4] iommu: Allocate dma-remapping structures " Suresh Siddha
2009-10-02 5:39 ` [patch 1/4] dmar: support for parsing Remapping Hardware Static Affinity structure David Woodhouse
2009-10-02 18:12 ` Suresh Siddha
2009-10-02 18:01 Suresh Siddha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome