Skip to contentSkip to conversation

Disable ACPI SRAT, SLIT on dom0 <take 2>

PATCH In review Akio Takebe 1 participant 7 messages Jul 29, 2007

lore
Share & tools
lore
#0 lore raw

cover Disable ACPI SRAT, SLIT on dom0 <take 2>

Hi, Keir, Alex and all

I updated my patches.

Summary:
On some ia64 NUMA machine, we cannot boot dom0.
This issue is caused by different infomation LSAPIC and SRAT. Xen-ia64 modify LSAPIC IDs of dom0, but it does not modify SRAT.

Currently, credit scheduler does not consider NUMA system. And Xen-ia64 pass raw ACPI SRAT, SLIT infomation to dom0. If xen pass NUMA infomation to dom0, dom0 cannot move properly because vcpus can migrate and memory mapping is virtualized. So we decide disabling SRAT, SLIT of dom0 as first step of NUMA work.

[Patch 1/3] Move generate_acpi_checksum() from ia64 code to common. [Patch 2/3] Only add acpi_table_disable() into xen/drivers/acpi/tables.c [Patch 3/3] Disable ACPI SRAT,SLIT on dom0

The previous discussions are;
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-07/msg00146.html
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-07/msg00220.html

Changelog:
- Move generate_acpi_checksum() from ia64 code to common
- Move add acpi_table_disable() from ia64 code to common

Best Regards,

Akio Takebe

#1 lore raw

PATCH 1/3 Move generate_acpi_checksum() from ia64 code to common

Hi,

This patch move generate_acpi_checksum() from ia64 code to common.

Best Regards,

Akio Takebe

# HG changeset patch
# User [email protected]
# Date 1185730199 -32400
# Node ID 098822652566820b1b81fa5fb5cca2ba292c63ad # Parent 4492a0285bae734ee18f6acbb6b3f9c80f153be7 Move generate_acpi_checksum() from ia64 code to common.

xen/arch/ia64/xen/dom_fw_common.c +0 -11
diff -r 4492a0285bae -r 098822652566 xen/arch/ia64/xen/dom_fw_common.c
@@ -207,17 +207,6 @@ print_md(efi_memory_desc_t *md)
 		printk("(%luKB)\n", size >> 10);
 }
 
-uint8_t
-generate_acpi_checksum(void *tbl, unsigned long len)
-{
-	uint8_t *ptr, sum = 0;
-
-	for (ptr = tbl; len > 0 ; len--, ptr++)
-		sum += *ptr;
-
-	return 0 - sum;
-}
-
 struct fake_acpi_tables {
 	struct acpi20_table_rsdp rsdp;
 	struct xsdt_descriptor_rev2 xsdt;
xen/drivers/acpi/tables.c +11 -0
diff -r 4492a0285bae -r 098822652566 xen/drivers/acpi/tables.c
@@ -227,6 +227,17 @@ void acpi_table_print_madt_entry(acpi_ta
 	}
 }
 
+uint8_t
+generate_acpi_checksum(void *tbl, unsigned long len)
+{
+	uint8_t *ptr, sum = 0;
+
+	for (ptr = tbl; len > 0 ; len--, ptr++)
+		sum += *ptr;
+
+	return 0 - sum;
+}
+
 static int
 acpi_table_compute_checksum(void *table_pointer, unsigned long length)
 {
xen/include/xen/acpi.h +1 -0
diff -r 4492a0285bae -r 098822652566 xen/include/xen/acpi.h
@@ -390,6 +390,7 @@ void acpi_table_print (struct acpi_table
 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
+uint8_t generate_acpi_checksum(void *tbl, unsigned long len);
 
 /* the following four functions are architecture-dependent */
 void acpi_numa_slit_init (struct acpi_table_slit *slit);

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#2 lore raw

Re: [Xen-devel] [Patch 1/3] Move generate_acpi_checksum() from ia64code to common

Hi,

I'm sorry. I sent the old patch.
Please ignore the previous one.

This patch is new one.

Best Regards,

Akio Takebe

Quoted 6 lines

Hi,

This patch move generate_acpi_checksum() from ia64 code to common.

Quoted 8 lines

Best Regards,

Akio Takebe -------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

# HG changeset patch
# User [email protected]
# Date 1185740495 -32400
# Node ID d6715eb4c6494663f6e6239a92e9779d1744abc7 # Parent 4492a0285bae734ee18f6acbb6b3f9c80f153be7 Move generate_acpi_checksum() from ia64 code to common.

xen/arch/ia64/xen/dom_fw_common.c +0 -11
diff -r 4492a0285bae -r d6715eb4c649 xen/arch/ia64/xen/dom_fw_common.c
@@ -207,17 +207,6 @@ print_md(efi_memory_desc_t *md)
 		printk("(%luKB)\n", size >> 10);
 }
 
-uint8_t
-generate_acpi_checksum(void *tbl, unsigned long len)
-{
-	uint8_t *ptr, sum = 0;
-
-	for (ptr = tbl; len > 0 ; len--, ptr++)
-		sum += *ptr;
-
-	return 0 - sum;
-}
-
 struct fake_acpi_tables {
 	struct acpi20_table_rsdp rsdp;
 	struct xsdt_descriptor_rev2 xsdt;
xen/drivers/acpi/tables.c +11 -0
diff -r 4492a0285bae -r d6715eb4c649 xen/drivers/acpi/tables.c
@@ -227,6 +227,17 @@ void acpi_table_print_madt_entry(acpi_ta
 	}
 }
 
+uint8_t
+generate_acpi_checksum(void *tbl, unsigned long len)
+{
+	uint8_t *ptr, sum = 0;
+
+	for (ptr = tbl; len > 0 ; len--, ptr++)
+		sum += *ptr;
+
+	return 0 - sum;
+}
+
 static int
 acpi_table_compute_checksum(void *table_pointer, unsigned long length)
 {
xen/include/asm-ia64/dom_fw_common.h +0 -1
diff -r 4492a0285bae -r d6715eb4c649 xen/include/asm-ia64/dom_fw_common.h
@@ -85,7 +85,6 @@ xen_ia64_efi_make_md(efi_memory_desc_t *
 xen_ia64_efi_make_md(efi_memory_desc_t *md,
                      uint32_t type, uint64_t attr, 
                      uint64_t start, uint64_t end);
-uint8_t generate_acpi_checksum(void *tbl, unsigned long len);
 struct fake_acpi_tables;
 void dom_fw_fake_acpi(domain_t *d, struct fake_acpi_tables *tables);
 int efi_mdt_cmp(const void *a, const void *b); 
xen/include/xen/acpi.h +1 -0
diff -r 4492a0285bae -r d6715eb4c649 xen/include/xen/acpi.h
@@ -390,6 +390,7 @@ void acpi_table_print (struct acpi_table
 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
+uint8_t generate_acpi_checksum(void *tbl, unsigned long len);
 
 /* the following four functions are architecture-dependent */
 void acpi_numa_slit_init (struct acpi_table_slit *slit);

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#3 lore raw

PATCH 2/3 Only add acpi_table_disable() into xen/drivers/acpi/tables.c

In reply to Akio Takebe

Hi,

Add acpi_table_disable() into xen/drivers/acpi/tables.c This function can disable a ACPI table by updating the table header.

Best Regards,

Akio Takebe

# HG changeset patch
# User [email protected]
# Date 1185731370 -32400
# Node ID cb95dd25b38fb9e9331a4b116c63cf13b17beb8e
# Parent 098822652566820b1b81fa5fb5cca2ba292c63ad
Add acpi_table_disable() into xen/drivers/acpi/tables.c This function can disable a ACPI table by updating the table header.

xen/drivers/acpi/tables.c +289 -122
diff -r 098822652566 -r cb95dd25b38f xen/drivers/acpi/tables.c
@@ -73,6 +73,7 @@ struct acpi_table_sdt {
 
 static unsigned long sdt_pa;	/* Physical Address */
 static unsigned long sdt_count;	/* Table count */
+static struct acpi_table_rsdp *rsdp;
 unsigned char acpi_rsdp_rev;
 
 static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;
@@ -389,34 +390,11 @@ acpi_table_parse_madt(enum acpi_madt_ent
 					    handler, max_entries);
 }
 
-int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
-{
-	int count = 0;
-	unsigned int i = 0;
-
-	if (!handler)
-		return -EINVAL;
-
-	for (i = 0; i < sdt_count; i++) {
-		if (sdt_entry[i].id != id)
-			continue;
-		count++;
-		if (count == 1)
-			handler(sdt_entry[i].pa, sdt_entry[i].size);
-
-		else
-			printk(KERN_WARNING PREFIX
-			       "%d duplicate %s table ignored.\n", count,
-			       acpi_table_signatures[id]);
-	}
-
-	return count;
-}
-
-static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
+
+static int __init
+__acpi_table_disable(struct acpi_table_rsdp *rsdp, int table_id)
 {
 	struct acpi_table_header *header = NULL;
-	unsigned int i, id = 0;
 
 	if (!rsdp)
 		return -EINVAL;
@@ -460,17 +438,19 @@ static int __init acpi_table_get_sdt(str
 			return -ENODEV;
 		}
 
-		sdt_count =
-		    (header->length - sizeof(struct acpi_table_header)) >> 3;
-		if (sdt_count > ACPI_MAX_TABLES) {
-			printk(KERN_WARNING PREFIX
-			       "Truncated %lu XSDT entries\n",
-			       (sdt_count - ACPI_MAX_TABLES));
-			sdt_count = ACPI_MAX_TABLES;
-		}
-
-		for (i = 0; i < sdt_count; i++)
-			sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
+		if (table_id < sdt_count){
+			header = (struct acpi_table_header *)
+			   __acpi_map_table(mapped_xsdt->entry[table_id], sizeof(struct acpi_table_header));
+			memcpy(header->signature, "OEMx", 4);
+			memcpy(header->oem_id, "XenIPF", 6);
+			header->checksum = 0;
+			header->checksum = generate_acpi_checksum(header, header->length);
+		} else {
+			printk(KERN_WARNING PREFIX
+			       "Unable to disable entry %d\n",
+			       table_id);
+			return -ENODEV;
+		}
 	}
 
 	/* Then check RSDT */
@@ -509,18 +489,18 @@ static int __init acpi_table_get_sdt(str
 			printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
 			return -ENODEV;
 		}
-
-		sdt_count =
-		    (header->length - sizeof(struct acpi_table_header)) >> 2;
-		if (sdt_count > ACPI_MAX_TABLES) {
-			printk(KERN_WARNING PREFIX
-			       "Truncated %lu RSDT entries\n",
-			       (sdt_count - ACPI_MAX_TABLES));
-			sdt_count = ACPI_MAX_TABLES;
-		}
-
-		for (i = 0; i < sdt_count; i++)
-			sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
+		if (table_id < sdt_count){
+			header = (struct acpi_table_header *)
+			   __acpi_map_table(mapped_rsdt->entry[table_id], sizeof(struct acpi_table_header));
+			memcpy(header->signature, "XXXX", 4);
+			header->checksum = 0;
+			header->checksum = generate_acpi_checksum(header, header->length);
+		} else {
+			printk(KERN_WARNING PREFIX
+			       "Unable to disable entry %d\n",
+			       table_id);
+			return -ENODEV;
+		}
 	}
 
 	else {
@@ -529,88 +509,20 @@ static int __init acpi_table_get_sdt(str
 		return -ENODEV;
 	}
 
-	acpi_table_print(header, sdt_pa);
-
-	for (i = 0; i < sdt_count; i++) {
-
-		/* map in just the header */
-		header = (struct acpi_table_header *)
-		    __acpi_map_table(sdt_entry[i].pa,
-				     sizeof(struct acpi_table_header));
-		if (!header)
-			continue;
-
-		/* remap in the entire table before processing */
-		header = (struct acpi_table_header *)
-		    __acpi_map_table(sdt_entry[i].pa, header->length);
-		if (!header)
-			continue;
-
-		acpi_table_print(header, sdt_entry[i].pa);
-
-		if (acpi_table_compute_checksum(header, header->length)) {
-			printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
-			continue;
-		}
-
-		sdt_entry[i].size = header->length;
-
-		for (id = 0; id < ACPI_TABLE_COUNT; id++) {
-			if (!strncmp((char *)&header->signature,
-				     acpi_table_signatures[id],
-				     sizeof(header->signature))) {
-				sdt_entry[i].id = id;
-			}
-		}
-	}
-
-	/* 
-	 * The DSDT is *not* in the RSDT (why not? no idea.) but we want
-	 * to print its info, because this is what people usually blacklist
-	 * against. Unfortunately, we don't know the phys_addr, so just
-	 * print 0. Maybe no one will notice.
-	 */
-	if (!acpi_get_table_header_early(ACPI_DSDT, &header))
-		acpi_table_print(header, 0);
-
 	return 0;
 }
 
-/*
- * acpi_table_init()
- *
- * find RSDP, find and checksum SDT/XSDT.
- * checksum all tables, print SDT/XSDT
- * 
- * result: sdt_entry[] is initialized
- */
-
-int __init acpi_table_init(void)
-{
-	struct acpi_table_rsdp *rsdp = NULL;
+int __init
+acpi_table_disable(enum acpi_table_id table_id)
+{
 	unsigned long rsdp_phys = 0;
 	int result = 0;
-
-	/* Locate and map the Root System Description Table (RSDP) */
-
-	rsdp_phys = acpi_find_rsdp();
-	if (!rsdp_phys) {
-		printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
-		return -ENODEV;
-	}
-
-	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
-		sizeof(struct acpi_table_rsdp));
+	int i, id = 0;
+
 	if (!rsdp) {
 		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
 		return -ENODEV;
 	}
-
-	printk(KERN_DEBUG PREFIX
-	       "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
-	       rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
-
-	acpi_rsdp_rev = rsdp->revision;
 
 	if (rsdp->revision < 2)
 		result =
@@ -623,6 +535,261 @@ int __init acpi_table_init(void)
 						 rsdp)->length);
 
 	if (result) {
+		printk(KERN_WARNING "  >>> ERROR: Invalid RSDP checksum\n");
+		return -ENODEV;
+	}
+
+
+	/* search entry id of table_id */
+	for (i = 0; i < sdt_count; i++) {
+		if (sdt_entry[i].id == table_id)
+			id = i;		
+	}
+
+	if (!id){
+		printk(KERN_WARNING PREFIX 
+		       "Unable to find the table(%d)\n", table_id);
+		return -ENOENT;
+	}
+
+	return __acpi_table_disable(rsdp, id);
+}
+
+ 
+int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
+{
+	int count = 0;
+	unsigned int i = 0;
+
+	if (!handler)
+		return -EINVAL;
+
+	for (i = 0; i < sdt_count; i++) {
+		if (sdt_entry[i].id != id)
+			continue;
+		count++;
+		if (count == 1)
+			handler(sdt_entry[i].pa, sdt_entry[i].size);
+
+		else
+			printk(KERN_WARNING PREFIX
+			       "%d duplicate %s table ignored.\n", count,
+			       acpi_table_signatures[id]);
+	}
+
+	return count;
+}
+
+static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
+{
+	struct acpi_table_header *header = NULL;
+	unsigned int i, id = 0;
+
+	if (!rsdp)
+		return -EINVAL;
+
+	/* First check XSDT (but only on ACPI 2.0-compatible systems) */
+
+	if ((rsdp->revision >= 2) &&
+	    (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
+
+		struct acpi_table_xsdt *mapped_xsdt = NULL;
+
+		sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+
+		if (!header) {
+			printk(KERN_WARNING PREFIX
+			       "Unable to map XSDT header\n");
+			return -ENODEV;
+		}
+
+		/* remap in the entire table before processing */
+		mapped_xsdt = (struct acpi_table_xsdt *)
+		    __acpi_map_table(sdt_pa, header->length);
+		if (!mapped_xsdt) {
+			printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
+			return -ENODEV;
+		}
+		header = &mapped_xsdt->header;
+
+		if (strncmp(header->signature, "XSDT", 4)) {
+			printk(KERN_WARNING PREFIX
+			       "XSDT signature incorrect\n");
+			return -ENODEV;
+		}
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
+			return -ENODEV;
+		}
+
+		sdt_count =
+		    (header->length - sizeof(struct acpi_table_header)) >> 3;
+		if (sdt_count > ACPI_MAX_TABLES) {
+			printk(KERN_WARNING PREFIX
+			       "Truncated %lu XSDT entries\n",
+			       (sdt_count - ACPI_MAX_TABLES));
+			sdt_count = ACPI_MAX_TABLES;
+		}
+
+		for (i = 0; i < sdt_count; i++)
+			sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
+	}
+
+	/* Then check RSDT */
+
+	else if (rsdp->rsdt_address) {
+
+		struct acpi_table_rsdt *mapped_rsdt = NULL;
+
+		sdt_pa = rsdp->rsdt_address;
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+		if (!header) {
+			printk(KERN_WARNING PREFIX
+			       "Unable to map RSDT header\n");
+			return -ENODEV;
+		}
+
+		/* remap in the entire table before processing */
+		mapped_rsdt = (struct acpi_table_rsdt *)
+		    __acpi_map_table(sdt_pa, header->length);
+		if (!mapped_rsdt) {
+			printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
+			return -ENODEV;
+		}
+		header = &mapped_rsdt->header;
+
+		if (strncmp(header->signature, "RSDT", 4)) {
+			printk(KERN_WARNING PREFIX
+			       "RSDT signature incorrect\n");
+			return -ENODEV;
+		}
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
+			return -ENODEV;
+		}
+
+		sdt_count =
+		    (header->length - sizeof(struct acpi_table_header)) >> 2;
+		if (sdt_count > ACPI_MAX_TABLES) {
+			printk(KERN_WARNING PREFIX
+			       "Truncated %lu RSDT entries\n",
+			       (sdt_count - ACPI_MAX_TABLES));
+			sdt_count = ACPI_MAX_TABLES;
+		}
+
+		for (i = 0; i < sdt_count; i++)
+			sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
+	}
+
+	else {
+		printk(KERN_WARNING PREFIX
+		       "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+		return -ENODEV;
+	}
+
+	acpi_table_print(header, sdt_pa);
+
+	for (i = 0; i < sdt_count; i++) {
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_entry[i].pa,
+				     sizeof(struct acpi_table_header));
+		if (!header)
+			continue;
+
+		/* remap in the entire table before processing */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_entry[i].pa, header->length);
+		if (!header)
+			continue;
+
+		acpi_table_print(header, sdt_entry[i].pa);
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+			continue;
+		}
+
+		sdt_entry[i].size = header->length;
+
+		for (id = 0; id < ACPI_TABLE_COUNT; id++) {
+			if (!strncmp((char *)&header->signature,
+				     acpi_table_signatures[id],
+				     sizeof(header->signature))) {
+				sdt_entry[i].id = id;
+			}
+		}
+	}
+
+	/* 
+	 * The DSDT is *not* in the RSDT (why not? no idea.) but we want
+	 * to print its info, because this is what people usually blacklist
+	 * against. Unfortunately, we don't know the phys_addr, so just
+	 * print 0. Maybe no one will notice.
+	 */
+	if (!acpi_get_table_header_early(ACPI_DSDT, &header))
+		acpi_table_print(header, 0);
+
+	return 0;
+}
+
+/*
+ * acpi_table_init()
+ *
+ * find RSDP, find and checksum SDT/XSDT.
+ * checksum all tables, print SDT/XSDT
+ * 
+ * result: sdt_entry[] is initialized
+ */
+
+int __init acpi_table_init(void)
+{
+	unsigned long rsdp_phys = 0;
+	int result = 0;
+	rsdp = NULL;
+
+	/* Locate and map the Root System Description Table (RSDP) */
+
+	rsdp_phys = acpi_find_rsdp();
+	if (!rsdp_phys) {
+		printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
+		return -ENODEV;
+	}
+
+	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
+		sizeof(struct acpi_table_rsdp));
+	if (!rsdp) {
+		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
+		return -ENODEV;
+	}
+
+	printk(KERN_DEBUG PREFIX
+	       "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
+	       rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
+
+	acpi_rsdp_rev = rsdp->revision;
+
+	if (rsdp->revision < 2)
+		result =
+		    acpi_table_compute_checksum(rsdp,
+						sizeof(struct acpi_table_rsdp));
+	else
+		result =
+		    acpi_table_compute_checksum(rsdp,
+						((struct acpi20_table_rsdp *)
+						 rsdp)->length);
+
+	if (result) {
 		printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
 		return -ENODEV;
 	}
xen/include/xen/acpi.h +1 -0
diff -r 098822652566 -r cb95dd25b38f xen/include/xen/acpi.h
@@ -383,6 +383,7 @@ int acpi_numa_init (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
+int acpi_table_disable(enum acpi_table_id table_id);
 int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
 int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
 int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#4 lore raw

Re: [Xen-devel] [Patch 2/3] Only add acpi_table_disable() intoxen/drivers/acpi/tables.c

Hi,

I'm sorry. I sent the old patch.
Please ignore the previous one.

This patch is new one.

Best Regards,

Akio Takebe

Quoted 9 lines

Hi,

Add acpi_table_disable() into xen/drivers/acpi/tables.c This function can disable a ACPI table by updating the table header.

Best Regards,

Quoted 7 lines

Akio Takebe

-------------------------------text/plain-------------------------------
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

# HG changeset patch
# User [email protected]
# Date 1185740530 -32400
# Node ID e71d320ae99d957a26f3e4bd0ec9ef92b306a6fc
# Parent d6715eb4c6494663f6e6239a92e9779d1744abc7
Add acpi_table_disable() into xen/drivers/acpi/tables.c This function can disable a ACPI table by updating the table header.

xen/drivers/acpi/tables.c +292 -125
diff -r d6715eb4c649 -r e71d320ae99d xen/drivers/acpi/tables.c
@@ -73,6 +73,7 @@ struct acpi_table_sdt {
 
 static unsigned long sdt_pa;	/* Physical Address */
 static unsigned long sdt_count;	/* Table count */
+static struct acpi_table_rsdp *rsdp;
 unsigned char acpi_rsdp_rev;
 
 static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;
@@ -389,34 +390,11 @@ acpi_table_parse_madt(enum acpi_madt_ent
 					    handler, max_entries);
 }
 
-int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
-{
-	int count = 0;
-	unsigned int i = 0;
-
-	if (!handler)
-		return -EINVAL;
-
-	for (i = 0; i < sdt_count; i++) {
-		if (sdt_entry[i].id != id)
-			continue;
-		count++;
-		if (count == 1)
-			handler(sdt_entry[i].pa, sdt_entry[i].size);
-
-		else
-			printk(KERN_WARNING PREFIX
-			       "%d duplicate %s table ignored.\n", count,
-			       acpi_table_signatures[id]);
-	}
-
-	return count;
-}
-
-static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
+
+static int __init
+__acpi_table_disable(struct acpi_table_rsdp *rsdp, int table_id, char *table_name)
 {
 	struct acpi_table_header *header = NULL;
-	unsigned int i, id = 0;
 
 	if (!rsdp)
 		return -EINVAL;
@@ -460,17 +438,15 @@ static int __init acpi_table_get_sdt(str
 			return -ENODEV;
 		}
 
-		sdt_count =
-		    (header->length - sizeof(struct acpi_table_header)) >> 3;
-		if (sdt_count > ACPI_MAX_TABLES) {
-			printk(KERN_WARNING PREFIX
-			       "Truncated %lu XSDT entries\n",
-			       (sdt_count - ACPI_MAX_TABLES));
-			sdt_count = ACPI_MAX_TABLES;
-		}
-
-		for (i = 0; i < sdt_count; i++)
-			sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
+		if (table_id < sdt_count){
+			header = (struct acpi_table_header *)
+			   __acpi_map_table(mapped_xsdt->entry[table_id], sizeof(struct acpi_table_header));
+		} else {
+			printk(KERN_WARNING PREFIX
+			       "Unable to disable entry %d\n",
+			       table_id);
+			return -ENODEV;
+		}
 	}
 
 	/* Then check RSDT */
@@ -509,18 +485,15 @@ static int __init acpi_table_get_sdt(str
 			printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
 			return -ENODEV;
 		}
-
-		sdt_count =
-		    (header->length - sizeof(struct acpi_table_header)) >> 2;
-		if (sdt_count > ACPI_MAX_TABLES) {
-			printk(KERN_WARNING PREFIX
-			       "Truncated %lu RSDT entries\n",
-			       (sdt_count - ACPI_MAX_TABLES));
-			sdt_count = ACPI_MAX_TABLES;
-		}
-
-		for (i = 0; i < sdt_count; i++)
-			sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
+		if (table_id < sdt_count){
+			header = (struct acpi_table_header *)
+			   __acpi_map_table(mapped_rsdt->entry[table_id], sizeof(struct acpi_table_header));
+		} else {
+			printk(KERN_WARNING PREFIX
+			       "Unable to disable entry %d\n",
+			       table_id);
+			return -ENODEV;
+		}
 	}
 
 	else {
@@ -529,88 +502,26 @@ static int __init acpi_table_get_sdt(str
 		return -ENODEV;
 	}
 
-	acpi_table_print(header, sdt_pa);
-
-	for (i = 0; i < sdt_count; i++) {
-
-		/* map in just the header */
-		header = (struct acpi_table_header *)
-		    __acpi_map_table(sdt_entry[i].pa,
-				     sizeof(struct acpi_table_header));
-		if (!header)
-			continue;
-
-		/* remap in the entire table before processing */
-		header = (struct acpi_table_header *)
-		    __acpi_map_table(sdt_entry[i].pa, header->length);
-		if (!header)
-			continue;
-
-		acpi_table_print(header, sdt_entry[i].pa);
-
-		if (acpi_table_compute_checksum(header, header->length)) {
-			printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
-			continue;
-		}
-
-		sdt_entry[i].size = header->length;
-
-		for (id = 0; id < ACPI_TABLE_COUNT; id++) {
-			if (!strncmp((char *)&header->signature,
-				     acpi_table_signatures[id],
-				     sizeof(header->signature))) {
-				sdt_entry[i].id = id;
-			}
-		}
-	}
-
-	/* 
-	 * The DSDT is *not* in the RSDT (why not? no idea.) but we want
-	 * to print its info, because this is what people usually blacklist
-	 * against. Unfortunately, we don't know the phys_addr, so just
-	 * print 0. Maybe no one will notice.
-	 */
-	if (!acpi_get_table_header_early(ACPI_DSDT, &header))
-		acpi_table_print(header, 0);
+	memcpy(header->signature, "OEMx", 4);
+	memcpy(header->oem_id, "xxxxxx", 6);
+	memcpy(header->oem_id+1, table_name, 4);
+	memcpy(header->oem_table_id, "Xen     ", 8);
+	header->checksum = 0;
+	header->checksum = generate_acpi_checksum(header, header->length);
 
 	return 0;
 }
 
-/*
- * acpi_table_init()
- *
- * find RSDP, find and checksum SDT/XSDT.
- * checksum all tables, print SDT/XSDT
- * 
- * result: sdt_entry[] is initialized
- */
-
-int __init acpi_table_init(void)
-{
-	struct acpi_table_rsdp *rsdp = NULL;
-	unsigned long rsdp_phys = 0;
+int __init
+acpi_table_disable(enum acpi_table_id table_id)
+{
 	int result = 0;
-
-	/* Locate and map the Root System Description Table (RSDP) */
-
-	rsdp_phys = acpi_find_rsdp();
-	if (!rsdp_phys) {
-		printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
-		return -ENODEV;
-	}
-
-	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
-		sizeof(struct acpi_table_rsdp));
+	int i, id = 0;
+
 	if (!rsdp) {
-		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
-		return -ENODEV;
-	}
-
-	printk(KERN_DEBUG PREFIX
-	       "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
-	       rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
-
-	acpi_rsdp_rev = rsdp->revision;
+		printk(KERN_WARNING PREFIX "%s: Unable to map RSDP\n", __func__);
+		return -ENODEV;
+	}
 
 	if (rsdp->revision < 2)
 		result =
@@ -623,6 +534,262 @@ int __init acpi_table_init(void)
 						 rsdp)->length);
 
 	if (result) {
+		printk(KERN_WARNING "%s: ERROR: Invalid RSDP checksum\n", __func__);
+		return -ENODEV;
+	}
+
+
+	/* search entry id of table_id */
+	for (i = 0; i < sdt_count; i++) {
+		if (sdt_entry[i].id == table_id)
+			id = i;		
+	}
+
+	if (!id){
+		printk(KERN_WARNING PREFIX 
+		       "%s: Unable to find the table(%s)\n",
+		       __func__, acpi_table_signatures[table_id]);
+		return -ENOENT;
+	}
+
+	return __acpi_table_disable(rsdp, id, acpi_table_signatures[table_id]);
+}
+
+ 
+int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
+{
+	int count = 0;
+	unsigned int i = 0;
+
+	if (!handler)
+		return -EINVAL;
+
+	for (i = 0; i < sdt_count; i++) {
+		if (sdt_entry[i].id != id)
+			continue;
+		count++;
+		if (count == 1)
+			handler(sdt_entry[i].pa, sdt_entry[i].size);
+
+		else
+			printk(KERN_WARNING PREFIX
+			       "%d duplicate %s table ignored.\n", count,
+			       acpi_table_signatures[id]);
+	}
+
+	return count;
+}
+
+static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
+{
+	struct acpi_table_header *header = NULL;
+	unsigned int i, id = 0;
+
+	if (!rsdp)
+		return -EINVAL;
+
+	/* First check XSDT (but only on ACPI 2.0-compatible systems) */
+
+	if ((rsdp->revision >= 2) &&
+	    (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
+
+		struct acpi_table_xsdt *mapped_xsdt = NULL;
+
+		sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+
+		if (!header) {
+			printk(KERN_WARNING PREFIX
+			       "Unable to map XSDT header\n");
+			return -ENODEV;
+		}
+
+		/* remap in the entire table before processing */
+		mapped_xsdt = (struct acpi_table_xsdt *)
+		    __acpi_map_table(sdt_pa, header->length);
+		if (!mapped_xsdt) {
+			printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
+			return -ENODEV;
+		}
+		header = &mapped_xsdt->header;
+
+		if (strncmp(header->signature, "XSDT", 4)) {
+			printk(KERN_WARNING PREFIX
+			       "XSDT signature incorrect\n");
+			return -ENODEV;
+		}
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING PREFIX "Invalid XSDT checksum\n");
+			return -ENODEV;
+		}
+
+		sdt_count =
+		    (header->length - sizeof(struct acpi_table_header)) >> 3;
+		if (sdt_count > ACPI_MAX_TABLES) {
+			printk(KERN_WARNING PREFIX
+			       "Truncated %lu XSDT entries\n",
+			       (sdt_count - ACPI_MAX_TABLES));
+			sdt_count = ACPI_MAX_TABLES;
+		}
+
+		for (i = 0; i < sdt_count; i++)
+			sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
+	}
+
+	/* Then check RSDT */
+
+	else if (rsdp->rsdt_address) {
+
+		struct acpi_table_rsdt *mapped_rsdt = NULL;
+
+		sdt_pa = rsdp->rsdt_address;
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
+		if (!header) {
+			printk(KERN_WARNING PREFIX
+			       "Unable to map RSDT header\n");
+			return -ENODEV;
+		}
+
+		/* remap in the entire table before processing */
+		mapped_rsdt = (struct acpi_table_rsdt *)
+		    __acpi_map_table(sdt_pa, header->length);
+		if (!mapped_rsdt) {
+			printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
+			return -ENODEV;
+		}
+		header = &mapped_rsdt->header;
+
+		if (strncmp(header->signature, "RSDT", 4)) {
+			printk(KERN_WARNING PREFIX
+			       "RSDT signature incorrect\n");
+			return -ENODEV;
+		}
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING PREFIX "Invalid RSDT checksum\n");
+			return -ENODEV;
+		}
+
+		sdt_count =
+		    (header->length - sizeof(struct acpi_table_header)) >> 2;
+		if (sdt_count > ACPI_MAX_TABLES) {
+			printk(KERN_WARNING PREFIX
+			       "Truncated %lu RSDT entries\n",
+			       (sdt_count - ACPI_MAX_TABLES));
+			sdt_count = ACPI_MAX_TABLES;
+		}
+
+		for (i = 0; i < sdt_count; i++)
+			sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
+	}
+
+	else {
+		printk(KERN_WARNING PREFIX
+		       "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+		return -ENODEV;
+	}
+
+	acpi_table_print(header, sdt_pa);
+
+	for (i = 0; i < sdt_count; i++) {
+
+		/* map in just the header */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_entry[i].pa,
+				     sizeof(struct acpi_table_header));
+		if (!header)
+			continue;
+
+		/* remap in the entire table before processing */
+		header = (struct acpi_table_header *)
+		    __acpi_map_table(sdt_entry[i].pa, header->length);
+		if (!header)
+			continue;
+
+		acpi_table_print(header, sdt_entry[i].pa);
+
+		if (acpi_table_compute_checksum(header, header->length)) {
+			printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
+			continue;
+		}
+
+		sdt_entry[i].size = header->length;
+
+		for (id = 0; id < ACPI_TABLE_COUNT; id++) {
+			if (!strncmp((char *)&header->signature,
+				     acpi_table_signatures[id],
+				     sizeof(header->signature))) {
+				sdt_entry[i].id = id;
+			}
+		}
+	}
+
+	/* 
+	 * The DSDT is *not* in the RSDT (why not? no idea.) but we want
+	 * to print its info, because this is what people usually blacklist
+	 * against. Unfortunately, we don't know the phys_addr, so just
+	 * print 0. Maybe no one will notice.
+	 */
+	if (!acpi_get_table_header_early(ACPI_DSDT, &header))
+		acpi_table_print(header, 0);
+
+	return 0;
+}
+
+/*
+ * acpi_table_init()
+ *
+ * find RSDP, find and checksum SDT/XSDT.
+ * checksum all tables, print SDT/XSDT
+ * 
+ * result: sdt_entry[] is initialized
+ */
+
+int __init acpi_table_init(void)
+{
+	unsigned long rsdp_phys = 0;
+	int result = 0;
+	rsdp = NULL;
+
+	/* Locate and map the Root System Description Table (RSDP) */
+
+	rsdp_phys = acpi_find_rsdp();
+	if (!rsdp_phys) {
+		printk(KERN_ERR PREFIX "Unable to locate RSDP\n");
+		return -ENODEV;
+	}
+
+	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
+		sizeof(struct acpi_table_rsdp));
+	if (!rsdp) {
+		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
+		return -ENODEV;
+	}
+
+	printk(KERN_DEBUG PREFIX
+	       "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
+	       rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
+
+	acpi_rsdp_rev = rsdp->revision;
+
+	if (rsdp->revision < 2)
+		result =
+		    acpi_table_compute_checksum(rsdp,
+						sizeof(struct acpi_table_rsdp));
+	else
+		result =
+		    acpi_table_compute_checksum(rsdp,
+						((struct acpi20_table_rsdp *)
+						 rsdp)->length);
+
+	if (result) {
 		printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
 		return -ENODEV;
 	}
xen/include/xen/acpi.h +1 -0
diff -r d6715eb4c649 -r e71d320ae99d xen/include/xen/acpi.h
@@ -383,6 +383,7 @@ int acpi_numa_init (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
+int acpi_table_disable(enum acpi_table_id table_id);
 int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
 int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
 int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#5 lore raw

PATCH 3/3 Disable ACPI SRAT,SLIT on dom0

In reply to Akio Takebe

Hi,

This patch is for ia64.

On some ia64 NUMA machine, we cannot boot dom0.
This issue is caused by different infomation LSAPIC and SRAT. Xen-ia64 modify LSAPIC IDs of dom0, but it does not modify SRAT. So we decide disabling SRAT, SLIT of dom0 as first step of NUMA work.

Best Regards,

Akio Takebe

# HG changeset patch
# User [email protected]
# Date 1185731581 -32400
# Node ID 9a01e96c4e1790b1909f320d390002cb91675938 # Parent cb95dd25b38fb9e9331a4b116c63cf13b17beb8e Disable ACPI SRAT,SLIT table of dom0.

On some ia64 NUMA machine, we cannot boot dom0.
This issue is caused by different infomation LSAPIC and SRAT. Xen-ia64 modify LSAPIC IDs of dom0, but it does not modify SRAT. So we decide disabling SRAT, SLIT of dom0 as first step of NUMA work.

xen/arch/ia64/xen/dom_fw_dom0.c +13 -0
diff -r cb95dd25b38f -r 9a01e96c4e17 xen/arch/ia64/xen/dom_fw_dom0.c
@@ -103,6 +103,7 @@ acpi_update_madt_checksum(unsigned long 
 /* base is physical address of acpi table */
 static void __init touch_acpi_table(void)
 {
+	int result;
 	lsapic_nbr = 0;
 
 	if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_update_lsapic, 0) < 0)
@@ -110,6 +111,18 @@ static void __init touch_acpi_table(void
 	if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC,
 				  acpi_patch_plat_int_src, 0) < 0)
 		printk("Error parsing MADT - no PLAT_INT_SRC entries\n");
+
+	result = acpi_table_disable(ACPI_SRAT);
+	if ( result == 0 )
+		printk("Success Disabling SRAT\n");
+	else if ( result != -ENOENT )
+		printk("ERROR: Failed Disabling SRAT\n");
+
+	result = acpi_table_disable(ACPI_SLIT);
+	if ( result == 0 )
+		printk("Success Disabling SLIT\n");
+	else if ( result != -ENOENT )
+		printk("ERROR: Failed Disabling SLIT\n");
 
 	acpi_table_parse(ACPI_APIC, acpi_update_madt_checksum);
 

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#6 lore raw
In reply to Akio Takebe

Hi, Keir, Alex and all

I'm sorry very much.
Please ignore these patches. generate_acpi_checksum() is needed by libxc on ia64. So these patch is not complete...

Best Regards,

Akio Takebe

Quoted 36 lines

Hi, Keir, Alex and all

I updated my patches.

Summary:
On some ia64 NUMA machine, we cannot boot dom0.
This issue is caused by different infomation LSAPIC and SRAT. Xen-ia64 modify LSAPIC IDs of dom0, but it does not modify SRAT.

Currently, credit scheduler does not consider NUMA system. And Xen-ia64 pass raw ACPI SRAT, SLIT infomation to dom0. If xen pass NUMA infomation to dom0, dom0 cannot move properly because vcpus can migrate and memory mapping is virtualized. So we decide disabling SRAT, SLIT of dom0 as first step of NUMA work.

[Patch 1/3] Move generate_acpi_checksum() from ia64 code to common. [Patch 2/3] Only add acpi_table_disable() into xen/drivers/acpi/tables.c [Patch 3/3] Disable ACPI SRAT,SLIT on dom0

The previous discussions are;
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-07/msg00146.html
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-07/msg00220.html

Changelog:
- Move generate_acpi_checksum() from ia64 code to common
- Move add acpi_table_disable() from ia64 code to common

Best Regards,

Akio Takebe

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel