Skip to contentSkip to conversation

Disable ACPI SRAT,SLIT on dom0

PATCH In review Akio Takebe 3 participants 6 messages Jul 26, 2007 – Jul 27, 2007

lore
Share & tools
lore
#0 lore raw

cover Disable ACPI SRAT,SLIT on dom0

Hi, Keir, Alex and all

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/2] is for common code, and [Patch 2/2] is for ia64.

[Patch 1/2] Export acpi a function and arguments
[Patch 2/2] Disable ACPI SRAT,SLIT on dom0

Best Regards,

Akio Takebe

#1 lore raw

PATCH 1/2 Export acpi a function and arguments

Hi,

This path export some symbols of acpi.

Best Regards,

Akio Takebe

xen/drivers/acpi/tables.c +5 -14
diff -r fcdd56b88acd xen/drivers/acpi/tables.c
@@ -36,8 +36,6 @@
 /*#include <xen/bootmem.h>*/
 
 #define PREFIX			"ACPI: "
-
-#define ACPI_MAX_TABLES		128
 
 static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
 	[ACPI_TABLE_UNKNOWN] = "????",
@@ -64,17 +62,10 @@ static char *mps_inti_flags_polarity[] =
 static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
 static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
 
-/* System Description Table (RSDT/XSDT) */
-struct acpi_table_sdt {
-	unsigned long pa;
-	enum acpi_table_id id;
-	unsigned long size;
-} __attribute__ ((packed));
-
-static unsigned long sdt_pa;	/* Physical Address */
-static unsigned long sdt_count;	/* Table count */
-
-static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;
+unsigned long sdt_pa;	/* Physical Address */
+unsigned long sdt_count;	/* Table count */
+
+struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES];
 
 void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr)
 {
@@ -226,7 +217,7 @@ void acpi_table_print_madt_entry(acpi_ta
 	}
 }
 
-static int
+int
 acpi_table_compute_checksum(void *table_pointer, unsigned long length)
 {
 	u8 *p = (u8 *) table_pointer;
xen/include/xen/acpi.h +14 -0
diff -r fcdd56b88acd 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);
+int acpi_table_compute_checksum(void *table_pointer, unsigned long length);
 
 /* the following four functions are architecture-dependent */
 void acpi_numa_slit_init (struct acpi_table_slit *slit);
@@ -409,6 +410,19 @@ extern u32 pci_mmcfg_base_addr;
 
 extern int sbf_port ;
 
+#define ACPI_MAX_TABLES                128
+/* System Description Table (RSDT/XSDT) */
+struct acpi_table_sdt {
+	unsigned long pa;
+	enum acpi_table_id id;
+	unsigned long size;
+} __attribute__ ((packed));
+
+extern unsigned long sdt_pa;	/* Physical Address */
+extern unsigned long sdt_count;	/* Table count */
+
+extern struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES];
+
 #else	/*!CONFIG_ACPI_BOOT*/
 
 #define acpi_mp_config	0

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

#2 lore raw

PATCH 2/2 Disable ACPI SRAT,SLIT on dom0

In reply to Akio Takebe

Hi,

This patch is to disable SRAT, SLIT on dom0.
This depends on the first patch.

Quoted 1 line

[Patch 1/2] Export acpi a function and arguments

Best Regards,

Akio Takebe

xen/arch/ia64/xen/dom_fw_dom0.c +184 -0
diff -r fcdd56b88acd xen/arch/ia64/xen/dom_fw_dom0.c
@@ -100,9 +100,181 @@ acpi_update_madt_checksum(unsigned long 
 	return 0;
 }
 
+static int
+__init __acpi_table_disable(struct acpi_table_rsdp *rsdp, int table_id)
+{
+	struct acpi_table_header *header = NULL;
+
+	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;
+		}
+
+		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 */
+
+	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;
+		}
+		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 {
+		printk(KERN_WARNING PREFIX
+		       "No System Description Table (RSDT/XSDT) specified in RSDP\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static int __init
+acpi_table_disable(enum acpi_table_id table_id)
+{
+	struct acpi_table_rsdp *rsdp = NULL;
+	unsigned long rsdp_phys = 0;
+	int result = 0;
+	int i, id = 0;
+
+	for (i = 0; i < sdt_count; i++) {
+		if (sdt_entry[i].id == table_id)
+			id = i;		
+	}
+
+	if (!id)
+		return -ENOENT;
+
+	rsdp_phys = acpi_find_rsdp();
+
+	if (!rsdp_phys){
+		printk(KERN_WARNING "%s: Unable to locate rsdp_phys\n", __func__);
+		return -ENODEV;
+	}
+
+	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
+		sizeof(struct acpi_table_rsdp));
+
+	if (!rsdp){
+		printk(KERN_WARNING "%s: cannot map rsdp\n", __func__);
+		return -ENODEV;
+	}
+
+
+	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 RSDP checksum\n");
+		return -ENODEV;
+	}
+
+	return __acpi_table_disable(rsdp, id);
+}
+
 /* 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 +282,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

#3 lore raw

Re: [Xen-ia64-devel] [Patch 0/2] Disable ACPI SRAT, SLIT on dom0

In reply to Akio Takebe
Quoted 11 lines · Akio Takebe

Hi, Keir, Alex and all

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.

Would it make more sense to create the acpi_table_disable() and
support functions in the common acpi code? The only ia64 specific parts of the implementation appear to be writing "XenIPF" for the OEM ID and calling generate_acpi_checksum(). The latter could easily be moved, or maybe we could make use of acpi_table_compute_checksum(). The new OEM ID could be passed into the function, but it might be just as useful to write the original table signature into the OEM ID field so we know what it was (ex. "xSRATx"). Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.
#4 lore raw

Re: [Xen-devel] Re: [Patch 0/2] Disable ACPI SRAT, SLIT on dom0

Hi, Alex and Keir

Quoted 8 lines

Would it make more sense to create the acpi_table_disable() and
support functions in the common acpi code? The only ia64 specific parts of the implementation appear to be writing "XenIPF" for the OEM ID and calling generate_acpi_checksum(). The latter could easily be moved, or maybe we could make use of acpi_table_compute_checksum(). The new OEM ID could be passed into the function, but it might be just as useful to write the original table signature into the OEM ID field so we know what it was (ex. "xSRATx"). Thanks,

Exactly, I want to move them to common code.
Keir, is this good?

BTW, we may rewrite also OEM Table ID.
How about the below?

signature = OEMx
OEM ID = xSRATx
OEM table ID = Xen

Best Regards,

Akio Takebe

#5 lore raw

Re: Re: [Xen-ia64-devel] [Patch 0/2] Disable ACPI SRAT, SLIT on dom0

Yes, if you want to generally screw around with ACPI info -- disabling tables, changing OEM IDs, etc -- then it makes sense to put the mechanism in common code, but call those new routines from arch code (so that different architectures have different policies about how they modify the tables).

-- Keir

Quoted 9 lines · Akio Takebe

Exactly, I want to move them to common code.
Keir, is this good?

BTW, we may rewrite also OEM Table ID.
How about the below?

signature = OEMx
OEM ID = xSRATx
OEM table ID = Xen