* [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together
@ 2009-10-08 15:59 Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 01/21] Add support for passing additional acpi tables from qemu Gleb Natapov
` (20 more replies)
0 siblings, 21 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
That is for now.
Gleb Natapov (21):
Add support for passing additional acpi tables from qemu.
Load SMBIOS entries and files from qemu
Always create PCI interrupt override acpi tables.
Correct default pci irq links
irq0override provided by qemu.
Check at runtime if VM is KVM.
Remove CONFIG_KVM compile option.
Add rule to compile DSDT to make file.
Use preprocessor for pci link routing.
Advertise pci irqs as active high in DSDT
Restrict pci interrupts to irq 5/9/10/11
Use extended interrupt descriptor for pci irqs.
Remove irq 9 from the pci interrupt link resources.
Provide gpe _L0x methods.
Pci hotplug support.
HPET support.
Add 26 pci slots, bringing the total to 32.
Add SRAT ACPI table support.
Read max number of cpus from VM.
Move qemu cfg init before smp init.
Use MaxCountCPUs during building of per cpu tables.
Makefile | 7 ++
src/acpi-dsdt.dsl | 311 +++++++++++++++++++++++++++++++++++++++++------------
src/acpi.c | 245 ++++++++++++++++++++++++++++++++++++++----
src/config.h | 6 +-
src/mptable.c | 27 ++---
src/paravirt.c | 221 +++++++++++++++++++++++++++++++++++++
src/paravirt.h | 12 ++
src/pciinit.c | 4 -
src/post.c | 6 +-
src/smbios.c | 188 +++++++++++++++++++-------------
src/smp.c | 9 ++-
src/util.h | 4 +-
12 files changed, 846 insertions(+), 194 deletions(-)
^ permalink raw reply [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH v2 01/21] Add support for passing additional acpi tables from qemu.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 02/21] Load SMBIOS entries and files " Gleb Natapov
` (19 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
v1->v2
- drop CONFIG_KVM change. That was unintentional
src/acpi.c | 18 +++++++++++++++++-
src/paravirt.c | 27 +++++++++++++++++++++++++++
src/paravirt.h | 3 +++
3 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index b9d449f..dafd8c8 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -11,7 +11,7 @@
#include "biosvar.h" // GET_EBDA
#include "pci_ids.h" // PCI_VENDOR_ID_INTEL
#include "pci_regs.h" // PCI_INTERRUPT_LINE
-
+#include "paravirt.h"
/****************************************************/
/* ACPI tables init */
@@ -444,6 +444,22 @@ acpi_bios_init(void)
ACPI_INIT_TABLE(build_ssdt());
ACPI_INIT_TABLE(build_madt());
+ u16 i, external_tables = qemu_cfg_acpi_additional_tables();
+
+ for(i = 0; i < external_tables; i++) {
+ u16 len = qemu_cfg_next_acpi_table_len();
+ void *addr = malloc_high(len);
+ if (!addr) {
+ dprintf(1, "Not enogh memory of ext acpi table of size %d!\n", len);
+ continue;
+ }
+ ACPI_INIT_TABLE(qemu_cfg_next_acpi_table_load(addr, len));
+ if (tbl_idx == MAX_ACPI_TABLES) {
+ dprintf(1, "To many external table!\n");
+ break;
+ }
+ }
+
struct rsdt_descriptor_rev1 *rsdt;
size_t rsdt_len = sizeof(*rsdt) + sizeof(u32) * tbl_idx;
rsdt = malloc_high(rsdt_len);
diff --git a/src/paravirt.c b/src/paravirt.c
index 56d8421..cd1f263 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -72,3 +72,30 @@ int qemu_cfg_show_boot_menu(void)
return v;
}
+u16 qemu_cfg_acpi_additional_tables(void)
+{
+ u16 cnt;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_ACPI_TABLES, sizeof(cnt));
+
+ return cnt;
+}
+
+u16 qemu_cfg_next_acpi_table_len(void)
+{
+ u16 len;
+
+ qemu_cfg_read((u8*)&len, sizeof(len));
+
+ return len;
+}
+
+void* qemu_cfg_next_acpi_table_load(void *addr, u16 len)
+{
+ qemu_cfg_read(addr, len);
+ return addr;
+}
+
diff --git a/src/paravirt.h b/src/paravirt.h
index 6997cff..c2bab71 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -40,5 +40,8 @@ extern int qemu_cfg_present;
void qemu_cfg_port_probe(void);
int qemu_cfg_show_boot_menu(void);
void qemu_cfg_get_uuid(u8 *uuid);
+u16 qemu_cfg_acpi_additional_tables(void);
+u16 qemu_cfg_next_acpi_table_len(void);
+void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
#endif
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH v2 02/21] Load SMBIOS entries and files from qemu
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 01/21] Add support for passing additional acpi tables from qemu Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 03/21] Always create PCI interrupt override acpi tables Gleb Natapov
` (18 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Allow SMBIOS fields to be overridden and entries replaced by those
read from qemu.
This is port of commit f4a09e759469be74e2598758bfae623b555c4cae
from qemu pc-bios tree.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
v1->v2:
check that additional tables do not overflow allocated memory.
src/paravirt.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++
src/paravirt.h | 4 +
src/smbios.c | 182 ++++++++++++++++++++++++++++++++++----------------------
3 files changed, 269 insertions(+), 71 deletions(-)
diff --git a/src/paravirt.c b/src/paravirt.c
index cd1f263..9637f87 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -27,6 +27,13 @@ qemu_cfg_read(u8 *buf, int len)
}
static void
+qemu_cfg_skip(int len)
+{
+ while (len--)
+ inb(PORT_QEMU_CFG_DATA);
+}
+
+static void
qemu_cfg_read_entry(void *buf, int e, int len)
{
qemu_cfg_select(e);
@@ -99,3 +106,150 @@ void* qemu_cfg_next_acpi_table_load(void *addr, u16 len)
return addr;
}
+u16 qemu_cfg_smbios_entries(void)
+{
+ u16 cnt;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_SMBIOS_ENTRIES, sizeof(cnt));
+
+ return cnt;
+}
+
+struct smbios_header {
+ u16 length;
+ u8 type;
+} PACKED;
+
+struct smbios_field {
+ struct smbios_header header;
+ u8 type;
+ u16 offset;
+ u8 data[];
+} PACKED;
+
+struct smbios_table {
+ struct smbios_header header;
+ u8 data[];
+} PACKED;
+
+#define SMBIOS_FIELD_ENTRY 0
+#define SMBIOS_TABLE_ENTRY 1
+
+size_t qemu_cfg_smbios_load_field(int type, size_t offset, void *addr)
+{
+ int i;
+
+ for (i = qemu_cfg_smbios_entries(); i > 0; i--) {
+ struct smbios_field field;
+
+ qemu_cfg_read((u8 *)&field, sizeof(struct smbios_header));
+ field.header.length -= sizeof(struct smbios_header);
+
+ if (field.header.type != SMBIOS_FIELD_ENTRY) {
+ qemu_cfg_skip(field.header.length);
+ continue;
+ }
+
+ qemu_cfg_read((u8 *)&field.type,
+ sizeof(field) - sizeof(struct smbios_header));
+ field.header.length -= sizeof(field) - sizeof(struct smbios_header);
+
+ if (field.type != type || field.offset != offset) {
+ qemu_cfg_skip(field.header.length);
+ continue;
+ }
+
+ qemu_cfg_read(addr, field.header.length);
+ return (size_t)field.header.length;
+ }
+ return 0;
+}
+
+/* This goes at the beginning of every SMBIOS structure. */
+struct smbios_structure_header {
+ u8 type;
+ u8 length;
+ u16 handle;
+} PACKED;
+
+int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
+ unsigned *max_struct_size, char *end)
+{
+ static u64 used_bitmap[4] = { 0 };
+ char *start = *p;
+ int i;
+
+ /* Check if we've already reported these tables */
+ if (used_bitmap[(type >> 6) & 0x3] & (1ULL << (type & 0x3f)))
+ return 1;
+
+ /* Don't introduce spurious end markers */
+ if (type == 127)
+ return 0;
+
+ for (i = qemu_cfg_smbios_entries(); i > 0; i--) {
+ struct smbios_table table;
+ struct smbios_structure_header *header = (void *)*p;
+ int string;
+
+ qemu_cfg_read((u8 *)&table, sizeof(struct smbios_header));
+ table.header.length -= sizeof(struct smbios_header);
+
+ if (table.header.type != SMBIOS_TABLE_ENTRY) {
+ qemu_cfg_skip(table.header.length);
+ continue;
+ }
+
+ if (end - *p < sizeof(struct smbios_structure_header)) {
+ dprintf(1, "No more memory for additional smbios tables\n");
+ break;
+ }
+
+ qemu_cfg_read((u8 *)*p, sizeof(struct smbios_structure_header));
+ table.header.length -= sizeof(struct smbios_structure_header);
+
+ if (header->type != type) {
+ qemu_cfg_skip(table.header.length);
+ continue;
+ }
+
+ *p += sizeof(struct smbios_structure_header);
+
+ /* Entries end with a double NULL char, if there's a string at
+ * the end (length is greater than formatted length), the string
+ * terminator provides the first NULL. */
+ string = header->length < table.header.length +
+ sizeof(struct smbios_structure_header);
+
+ /* Read the rest and terminate the entry */
+ if (end - *p < table.header.length) {
+ dprintf(1, "No memory for smbios table %d\n", header->type);
+ *p -= sizeof(struct smbios_structure_header);
+ continue;
+ }
+ qemu_cfg_read((u8 *)*p, table.header.length);
+ *p += table.header.length;
+ *((u8*)*p) = 0;
+ (*p)++;
+ if (!string) {
+ *((u8*)*p) = 0;
+ (*p)++;
+ }
+
+ (*nr_structs)++;
+ if (*p - (char *)header > *max_struct_size)
+ *max_struct_size = *p - (char *)header;
+ }
+
+ if (start != *p) {
+ /* Mark that we've reported on this type */
+ used_bitmap[(type >> 6) & 0x3] |= (1ULL << (type & 0x3f));
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/src/paravirt.h b/src/paravirt.h
index c2bab71..da01c0c 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -43,5 +43,9 @@ void qemu_cfg_get_uuid(u8 *uuid);
u16 qemu_cfg_acpi_additional_tables(void);
u16 qemu_cfg_next_acpi_table_len(void);
void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
+u16 qemu_cfg_smbios_entries(void);
+size_t qemu_cfg_smbios_load_field(int type, size_t offset, void *addr);
+int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
+ unsigned *max_struct_size, char *end);
#endif
diff --git a/src/smbios.c b/src/smbios.c
index 30dc853..a77c197 100644
--- a/src/smbios.c
+++ b/src/smbios.c
@@ -10,25 +10,6 @@
#include "paravirt.h"
/****************************************************************
- * UUID probe
- ****************************************************************/
-
-static void
-uuid_probe(u8 *bios_uuid)
-{
- // Default to UUID not set
- memset(bios_uuid, 0, 16);
-
- if (! CONFIG_UUID_BACKDOOR)
- return;
- if (CONFIG_COREBOOT)
- return;
-
- qemu_cfg_get_uuid(bios_uuid);
-}
-
-
-/****************************************************************
* smbios tables
****************************************************************/
@@ -229,72 +210,121 @@ smbios_entry_point_init(u16 max_structure_size,
dprintf(1, "SMBIOS ptr=%p table=%p\n", ep, structure_table_address);
}
+#define load_str_field_with_default(type, field, def) \
+ do { \
+ size = qemu_cfg_smbios_load_field(type, \
+ offsetof(struct smbios_type_##type, \
+ field), end); \
+ if (size > 0) { \
+ end += size; \
+ } else { \
+ memcpy(end, def, sizeof(def)); \
+ end += sizeof(def); \
+ } \
+ p->field = ++str_index; \
+ } while (0)
+
+#define load_str_field_or_skip(type, field) \
+ do { \
+ size = qemu_cfg_smbios_load_field(type, \
+ offsetof(struct smbios_type_##type, \
+ field), end); \
+ if (size > 0) { \
+ end += size; \
+ p->field = ++str_index; \
+ } else { \
+ p->field = 0; \
+ } \
+ } while (0)
+
/* Type 0 -- BIOS Information */
#define RELEASE_DATE_STR "01/01/2007"
static void *
-smbios_type_0_init(void *start)
+smbios_init_type_0(void *start)
{
struct smbios_type_0 *p = (struct smbios_type_0 *)start;
+ char *end = (char *)start + sizeof(struct smbios_type_0);
+ size_t size;
+ int str_index = 0;
p->header.type = 0;
p->header.length = sizeof(struct smbios_type_0);
p->header.handle = 0;
- p->vendor_str = 1;
- p->bios_version_str = 1;
+ load_str_field_with_default(0, vendor_str, CONFIG_APPNAME);
+ load_str_field_with_default(0, bios_version_str, CONFIG_APPNAME);
+
p->bios_starting_address_segment = 0xe800;
- p->bios_release_date_str = 2;
+
+ load_str_field_with_default(0, bios_release_date_str, RELEASE_DATE_STR);
+
p->bios_rom_size = 0; /* FIXME */
- memset(p->bios_characteristics, 0, sizeof(p->bios_characteristics));
+ memset(p->bios_characteristics, 0, 8);
p->bios_characteristics[0] = 0x08; /* BIOS characteristics not supported */
p->bios_characteristics_extension_bytes[0] = 0;
p->bios_characteristics_extension_bytes[1] = 0;
- p->system_bios_major_release = 1;
- p->system_bios_minor_release = 0;
+ if (!qemu_cfg_smbios_load_field(0, offsetof(struct smbios_type_0,
+ system_bios_major_release),
+ &p->system_bios_major_release))
+ p->system_bios_major_release = 1;
+
+ if (!qemu_cfg_smbios_load_field(0, offsetof(struct smbios_type_0,
+ system_bios_minor_release),
+ &p->system_bios_minor_release))
+ p->system_bios_minor_release = 0;
+
p->embedded_controller_major_release = 0xff;
p->embedded_controller_minor_release = 0xff;
- start += sizeof(struct smbios_type_0);
- memcpy((char *)start, CONFIG_APPNAME, sizeof(CONFIG_APPNAME));
- start += sizeof(CONFIG_APPNAME);
- memcpy((char *)start, RELEASE_DATE_STR, sizeof(RELEASE_DATE_STR));
- start += sizeof(RELEASE_DATE_STR);
- *((u8 *)start) = 0;
+ *end = 0;
+ end++;
- return start+1;
+ return end;
}
/* Type 1 -- System Information */
static void *
-smbios_type_1_init(void *start)
+smbios_init_type_1(void *start)
{
struct smbios_type_1 *p = (struct smbios_type_1 *)start;
+ char *end = (char *)start + sizeof(struct smbios_type_1);
+ size_t size;
+ int str_index = 0;
+
p->header.type = 1;
p->header.length = sizeof(struct smbios_type_1);
p->header.handle = 0x100;
- p->manufacturer_str = 0;
- p->product_name_str = 0;
- p->version_str = 0;
- p->serial_number_str = 0;
+ load_str_field_or_skip(1, manufacturer_str);
+ load_str_field_or_skip(1, product_name_str);
+ load_str_field_or_skip(1, version_str);
+ load_str_field_or_skip(1, serial_number_str);
- uuid_probe(p->uuid);
+ size = qemu_cfg_smbios_load_field(1, offsetof(struct smbios_type_1,
+ uuid), &p->uuid);
+ if (size == 0)
+ memset(p->uuid, 0, 16);
p->wake_up_type = 0x06; /* power switch */
- p->sku_number_str = 0;
- p->family_str = 0;
- start += sizeof(struct smbios_type_1);
- *((u16 *)start) = 0;
+ load_str_field_or_skip(1, sku_number_str);
+ load_str_field_or_skip(1, family_str);
- return start+2;
+ *end = 0;
+ end++;
+ if (!str_index) {
+ *end = 0;
+ end++;
+ }
+
+ return end;
}
/* Type 3 -- System Enclosure */
static void *
-smbios_type_3_init(void *start)
+smbios_init_type_3(void *start)
{
struct smbios_type_3 *p = (struct smbios_type_3 *)start;
@@ -324,7 +354,7 @@ smbios_type_3_init(void *start)
/* Type 4 -- Processor Information */
static void *
-smbios_type_4_init(void *start, unsigned int cpu_number)
+smbios_init_type_4(void *start, unsigned int cpu_number)
{
struct smbios_type_4 *p = (struct smbios_type_4 *)start;
@@ -366,7 +396,7 @@ smbios_type_4_init(void *start, unsigned int cpu_number)
/* Type 16 -- Physical Memory Array */
static void *
-smbios_type_16_init(void *start, u32 memory_size_mb, int nr_mem_devs)
+smbios_init_type_16(void *start, u32 memory_size_mb, int nr_mem_devs)
{
struct smbios_type_16 *p = (struct smbios_type_16*)start;
@@ -389,7 +419,7 @@ smbios_type_16_init(void *start, u32 memory_size_mb, int nr_mem_devs)
/* Type 17 -- Memory Device */
static void *
-smbios_type_17_init(void *start, u32 memory_size_mb, int instance)
+smbios_init_type_17(void *start, u32 memory_size_mb, int instance)
{
struct smbios_type_17 *p = (struct smbios_type_17 *)start;
@@ -420,7 +450,7 @@ smbios_type_17_init(void *start, u32 memory_size_mb, int instance)
/* Type 19 -- Memory Array Mapped Address */
static void *
-smbios_type_19_init(void *start, u32 memory_size_mb, int instance)
+smbios_init_type_19(void *start, u32 memory_size_mb, int instance)
{
struct smbios_type_19 *p = (struct smbios_type_19 *)start;
@@ -441,7 +471,7 @@ smbios_type_19_init(void *start, u32 memory_size_mb, int instance)
/* Type 20 -- Memory Device Mapped Address */
static void *
-smbios_type_20_init(void *start, u32 memory_size_mb, int instance)
+smbios_init_type_20(void *start, u32 memory_size_mb, int instance)
{
struct smbios_type_20 *p = (struct smbios_type_20 *)start;
@@ -465,7 +495,7 @@ smbios_type_20_init(void *start, u32 memory_size_mb, int instance)
/* Type 32 -- System Boot Information */
static void *
-smbios_type_32_init(void *start)
+smbios_init_type_32(void *start)
{
struct smbios_type_32 *p = (struct smbios_type_32 *)start;
@@ -483,7 +513,7 @@ smbios_type_32_init(void *start)
/* Type 127 -- End of Table */
static void *
-smbios_type_127_init(void *start)
+smbios_init_type_127(void *start)
{
struct smbios_type_127 *p = (struct smbios_type_127 *)start;
@@ -512,22 +542,27 @@ smbios_init(void)
}
u32 nr_structs = 0, max_struct_size = 0;
- char *q, *p = start;
-
-#define add_struct(fn) { \
- q = (fn); \
- nr_structs++; \
- if ((q - p) > max_struct_size) \
- max_struct_size = q - p; \
- p = q; \
-}
+ char *q, *p = start, *end = start + 2048 - sizeof(struct smbios_type_127);
+
+#define add_struct(type, args...) \
+ do { \
+ if (!qemu_cfg_smbios_load_external(type, &p, &nr_structs, \
+ &max_struct_size, end)) { \
+ q = smbios_init_type_##type(args); \
+ nr_structs++; \
+ if ((q - p) > max_struct_size) \
+ max_struct_size = q - p; \
+ p = q; \
+ } \
+ } while (0)
+
+ add_struct(0, p);
+ add_struct(1, p);
+ add_struct(3, p);
- add_struct(smbios_type_0_init(p));
- add_struct(smbios_type_1_init(p));
- add_struct(smbios_type_3_init(p));
int cpu_num, smp_cpus = CountCPUs;
for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++)
- add_struct(smbios_type_4_init(p, cpu_num));
+ add_struct(4, p, cpu_num);
u64 memsize = RamSizeOver4G;
if (memsize)
memsize += 0x100000000ull;
@@ -535,17 +570,22 @@ smbios_init(void)
memsize = RamSize;
memsize = memsize / (1024 * 1024);
int nr_mem_devs = (memsize + 0x3fff) >> 14;
- add_struct(smbios_type_16_init(p, memsize, nr_mem_devs));
+ add_struct(16, p, memsize, nr_mem_devs);
int i;
for (i = 0; i < nr_mem_devs; i++) {
u32 dev_memsize = ((i == (nr_mem_devs - 1))
? (((memsize-1) & 0x3fff)+1) : 0x4000);
- add_struct(smbios_type_17_init(p, dev_memsize, i));
- add_struct(smbios_type_19_init(p, dev_memsize, i));
- add_struct(smbios_type_20_init(p, dev_memsize, i));
+ add_struct(17, p, dev_memsize, i);
+ add_struct(19, p, dev_memsize, i);
+ add_struct(20, p, dev_memsize, i);
}
- add_struct(smbios_type_32_init(p));
- add_struct(smbios_type_127_init(p));
+
+ add_struct(32, p);
+ /* Add any remaining provided entries before the end marker */
+ for (i = 0; i < 256; i++)
+ qemu_cfg_smbios_load_external(i, &p, &nr_structs, &max_struct_size,
+ end);
+ add_struct(127, p);
#undef add_struct
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 03/21] Always create PCI interrupt override acpi tables.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 01/21] Add support for passing additional acpi tables from qemu Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 02/21] Load SMBIOS entries and files " Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 04/21] Correct default pci irq links Gleb Natapov
` (17 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
This is what qemu pcbios does since commit
da5ff65dc9473e3f069736d38b9a189ea14a67eb.
Qemu implements PCI interrupts as active high, but OSes assume
that they are active low as per PCI spec. Qemu works without override
only because ioapic there doesn't implement polarity bit.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index dafd8c8..1b4f4c5 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -196,12 +196,7 @@ struct madt_io_apic
* lines start */
} PACKED;
-#if CONFIG_KVM
-/* IRQs 5,9,10,11 */
#define PCI_ISA_IRQ_MASK 0x0e20
-#else
-#define PCI_ISA_IRQ_MASK 0x0000
-#endif
struct madt_intsrcovr {
APIC_HEADER_DEF
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 04/21] Correct default pci irq links
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (2 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 03/21] Always create PCI interrupt override acpi tables Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 05/21] irq0override provided by qemu Gleb Natapov
` (16 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
The hardware uses irqs 10 and 11, so change the bios to reflect that.
Qemu pcbios commit b0a155cfddc57e93b641a24fb198fdd8d738f143
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/pciinit.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c
index fffbd1e..8db1fea 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -19,11 +19,7 @@ static u32 pci_bios_mem_addr;
static u32 pci_bios_bigmem_addr;
/* host irqs corresponding to PCI irqs A-D */
static u8 pci_irqs[4] = {
-#if CONFIG_KVM
10, 10, 11, 11
-#else
- 11, 9, 11, 9
-#endif
};
static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 05/21] irq0override provided by qemu.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (3 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 04/21] Correct default pci irq links Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 06/21] Check at runtime if VM is KVM Gleb Natapov
` (15 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Read it instead of relying on compile time flag.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi.c | 2 +-
src/mptable.c | 9 ++-------
src/paravirt.c | 12 ++++++++++++
src/paravirt.h | 2 ++
src/util.h | 3 ---
5 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index 1b4f4c5..fb57860 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -314,7 +314,7 @@ build_madt(void)
io_apic->interrupt = cpu_to_le32(0);
struct madt_intsrcovr *intsrcovr = (void*)&io_apic[1];
- if (irq0override) {
+ if (qemu_cfg_irq0_override()) {
memset(intsrcovr, 0, sizeof(*intsrcovr));
intsrcovr->type = APIC_XRUPT_OVERRIDE;
intsrcovr->length = sizeof(*intsrcovr);
diff --git a/src/mptable.c b/src/mptable.c
index aeb1f94..4aaff1e 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -8,12 +8,7 @@
#include "util.h" // dprintf
#include "config.h" // CONFIG_*
#include "mptable.h" // MPTABLE_SIGNATURE
-
-#if CONFIG_KVM
-int irq0override = 1;
-#else
-int irq0override = 0;
-#endif
+#include "paravirt.h"
void
mptable_init(void)
@@ -103,7 +98,7 @@ mptable_init(void)
intsrc->srcbusirq = i;
intsrc->dstapic = ioapic_id;
intsrc->dstirq = i;
- if (irq0override) {
+ if (qemu_cfg_irq0_override()) {
/* Destination 2 is covered by irq0->inti2 override (i ==
0). Source IRQ 2 is unused */
if (i == 0)
diff --git a/src/paravirt.c b/src/paravirt.c
index 9637f87..8c08ce7 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -79,6 +79,18 @@ int qemu_cfg_show_boot_menu(void)
return v;
}
+int qemu_cfg_irq0_override(void)
+{
+ u8 v;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&v, QEMU_CFG_IRQ0_OVERRIDE, sizeof(v));
+
+ return v;
+}
+
u16 qemu_cfg_acpi_additional_tables(void)
{
u16 cnt;
diff --git a/src/paravirt.h b/src/paravirt.h
index da01c0c..2b2f314 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -34,12 +34,14 @@ static inline int kvm_para_available(void)
#define QEMU_CFG_ARCH_LOCAL 0x8000
#define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
#define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
+#define QEMU_CFG_IRQ0_OVERRIDE (QEMU_CFG_ARCH_LOCAL + 1)
extern int qemu_cfg_present;
void qemu_cfg_port_probe(void);
int qemu_cfg_show_boot_menu(void);
void qemu_cfg_get_uuid(u8 *uuid);
+int qemu_cfg_irq0_override(void);
u16 qemu_cfg_acpi_additional_tables(void);
u16 qemu_cfg_next_acpi_table_len(void);
void *qemu_cfg_next_acpi_table_load(void *addr, u16 len);
diff --git a/src/util.h b/src/util.h
index dd8619b..ca16ac7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -302,9 +302,6 @@ void reset_vector() __attribute__ ((noreturn));
// misc.c
extern u8 BiosChecksum;
-// mptable.c
-extern int irq0override;
-
// version (auto generated file out/version.c)
extern const char VERSION[];
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 06/21] Check at runtime if VM is KVM.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (4 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 05/21] irq0override provided by qemu Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 07/21] Remove CONFIG_KVM compile option Gleb Natapov
` (14 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/post.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/post.c b/src/post.c
index e5764c7..e6f9c39 100644
--- a/src/post.c
+++ b/src/post.c
@@ -129,7 +129,7 @@ ram_probe(void)
, E820_RESERVED);
add_e820(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED);
- if (CONFIG_KVM)
+ if (kvm_para_available())
// 4 pages before the bios, 3 pages for vmx tss pages, the
// other page for EPT real mode pagetable
add_e820(0xfffbc000, 4*4096, E820_RESERVED);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 07/21] Remove CONFIG_KVM compile option.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (5 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 06/21] Check at runtime if VM is KVM Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 08/21] Add rule to compile DSDT to make file Gleb Natapov
` (13 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Qemu and KVM should use the same bios build. All differences should be
handled in runtime.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/config.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/config.h b/src/config.h
index e93b080..fa0dd1d 100644
--- a/src/config.h
+++ b/src/config.h
@@ -12,8 +12,6 @@
#define CONFIG_APPNAME6 "BOCHS "
#define CONFIG_APPNAME4 "BXPC"
-// Configure for use with KVM.
-#define CONFIG_KVM 0
// Configure as a coreboot payload.
#define CONFIG_COREBOOT 0
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 08/21] Add rule to compile DSDT to make file.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (6 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 07/21] Remove CONFIG_KVM compile option Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 09/21] Use preprocessor for pci link routing Gleb Natapov
` (12 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
Makefile | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index dd5bc69..50e7da2 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,13 @@ $(OUT)vgabios.bin: $(OUT)vgabios.bin.raw tools/buildrom.py
@echo " Finalizing rom $@"
$(Q)./tools/buildrom.py $< $@
+####### dsdt buld rules
+src/acpi-dsdt.hex: src/acpi-dsdt.dsl
+ @echo "Compiling DSDT"
+ $(Q)cpp -P $< > $(OUT)acpi-dsdt.dsl.i
+ $(Q)iasl -tc -p $@ $(OUT)acpi-dsdt.dsl.i
+ $(Q)rm $(OUT)acpi-dsdt.dsl.i
+
####### Generic rules
clean:
$(Q)rm -rf $(OUT)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 09/21] Use preprocessor for pci link routing.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (7 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 08/21] Add rule to compile DSDT to make file Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT Gleb Natapov
` (11 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Qemu pcbios commit 297a5cd68d2883215571634b2f8c627364c87f2c
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 50 +++++++++++++++-----------------------------------
1 files changed, 15 insertions(+), 35 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 5fc3636..490c017 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -47,42 +47,22 @@ DefinitionBlock (
section 6.2.8.1 */
/* Note: we provide the same info as the PCI routing
table of the Bochs BIOS */
+#define prt_slot(nr, lnk0, lnk1, lnk2, lnk3) \
+ Package() { nr##ffff, 0, lnk0, 0 }, \
+ Package() { nr##ffff, 1, lnk1, 0 }, \
+ Package() { nr##ffff, 2, lnk2, 0 }, \
+ Package() { nr##ffff, 3, lnk3, 0 }
- // PCI Slot 0
- Package() {0x0000ffff, 0, LNKD, 0},
- Package() {0x0000ffff, 1, LNKA, 0},
- Package() {0x0000ffff, 2, LNKB, 0},
- Package() {0x0000ffff, 3, LNKC, 0},
-
- // PCI Slot 1
- Package() {0x0001ffff, 0, LNKA, 0},
- Package() {0x0001ffff, 1, LNKB, 0},
- Package() {0x0001ffff, 2, LNKC, 0},
- Package() {0x0001ffff, 3, LNKD, 0},
-
- // PCI Slot 2
- Package() {0x0002ffff, 0, LNKB, 0},
- Package() {0x0002ffff, 1, LNKC, 0},
- Package() {0x0002ffff, 2, LNKD, 0},
- Package() {0x0002ffff, 3, LNKA, 0},
-
- // PCI Slot 3
- Package() {0x0003ffff, 0, LNKC, 0},
- Package() {0x0003ffff, 1, LNKD, 0},
- Package() {0x0003ffff, 2, LNKA, 0},
- Package() {0x0003ffff, 3, LNKB, 0},
-
- // PCI Slot 4
- Package() {0x0004ffff, 0, LNKD, 0},
- Package() {0x0004ffff, 1, LNKA, 0},
- Package() {0x0004ffff, 2, LNKB, 0},
- Package() {0x0004ffff, 3, LNKC, 0},
-
- // PCI Slot 5
- Package() {0x0005ffff, 0, LNKA, 0},
- Package() {0x0005ffff, 1, LNKB, 0},
- Package() {0x0005ffff, 2, LNKC, 0},
- Package() {0x0005ffff, 3, LNKD, 0},
+#define prt_slot0(nr) prt_slot(nr, LNKD, LNKA, LNKB, LNKC)
+#define prt_slot1(nr) prt_slot(nr, LNKA, LNKB, LNKC, LNKD)
+#define prt_slot2(nr) prt_slot(nr, LNKB, LNKC, LNKD, LNKA)
+#define prt_slot3(nr) prt_slot(nr, LNKC, LNKD, LNKA, LNKB)
+ prt_slot0(0x0000),
+ prt_slot1(0x0001),
+ prt_slot2(0x0002),
+ prt_slot3(0x0003),
+ prt_slot0(0x0004),
+ prt_slot1(0x0005),
})
Name (_CRS, ResourceTemplate ()
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (8 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 09/21] Use preprocessor for pci link routing Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-09 10:56 ` Jamie Lokier
2009-10-08 15:59 ` [Qemu-devel] [PATCH 11/21] Restrict pci interrupts to irq 5/9/10/11 Gleb Natapov
` (10 subsequent siblings)
20 siblings, 1 reply; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Now that kvm emulates the ioapic polarity correctly, we must describe
the polarity correctly in the acpi tables. Otherwise pci interrupts won't
be delivered correctly.
Qemu pcbios commit 0c8d4b40a1eec2369c016b9be1c9175607e64a4b
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 490c017..9d6aba9 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -340,7 +340,7 @@ DefinitionBlock (
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 1)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
@@ -360,7 +360,7 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
@@ -387,7 +387,7 @@ DefinitionBlock (
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 2)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
@@ -407,7 +407,7 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
@@ -434,7 +434,7 @@ DefinitionBlock (
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 3)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
@@ -454,7 +454,7 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
@@ -481,7 +481,7 @@ DefinitionBlock (
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 4)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{3,4,5,6,7,9,10,11,12}
})
Method (_STA, 0, NotSerialized)
@@ -501,7 +501,7 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveLow, Shared)
+ IRQ (Level, ActiveHigh, Shared)
{1}
})
CreateWordField (PRR0, 0x01, TMP)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 11/21] Restrict pci interrupts to irq 5/9/10/11
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (9 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 12/21] Use extended interrupt descriptor for pci irqs Gleb Natapov
` (9 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
we need to specify the pci interrupts as active high; this reduces
the number of override entries we have to add.
Qemu pcbios commit 0f79abf26ff3e61dab712dbccdbc08a04619e7c0
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 9d6aba9..905d58b 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -341,7 +341,7 @@ DefinitionBlock (
Name(_UID, 1)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveHigh, Shared)
- {3,4,5,6,7,9,10,11,12}
+ { 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -388,7 +388,7 @@ DefinitionBlock (
Name(_UID, 2)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveHigh, Shared)
- {3,4,5,6,7,9,10,11,12}
+ { 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -435,7 +435,7 @@ DefinitionBlock (
Name(_UID, 3)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveHigh, Shared)
- {3,4,5,6,7,9,10,11,12}
+ { 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -482,7 +482,7 @@ DefinitionBlock (
Name(_UID, 4)
Name(_PRS, ResourceTemplate(){
IRQ (Level, ActiveHigh, Shared)
- {3,4,5,6,7,9,10,11,12}
+ { 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 12/21] Use extended interrupt descriptor for pci irqs.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (10 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 11/21] Restrict pci interrupts to irq 5/9/10/11 Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 13/21] Remove irq 9 from the pci interrupt link resources Gleb Natapov
` (8 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
This is necessary to allow freebsd to boot; freebsd chokes if a regular
interrupt descriptor specifies an active high pic irq.
Qemu pcbios commit aaff1cc0ce8de3c45eec49b9b0e7624576058eda
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 56 ++++++++++++++++++++++------------------------------
1 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 905d58b..b7ac9f6 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -340,7 +340,7 @@ DefinitionBlock (
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 1)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{ 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
@@ -360,14 +360,14 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{1}
})
- CreateWordField (PRR0, 0x01, TMP)
+ CreateDWordField (PRR0, 0x05, TMP)
Store (PRQ0, Local0)
If (LLess (Local0, 0x80))
{
- ShiftLeft (One, Local0, TMP)
+ Store (Local0, TMP)
}
Else
{
@@ -377,17 +377,15 @@ DefinitionBlock (
}
Method (_SRS, 1, NotSerialized)
{
- CreateWordField (Arg0, 0x01, TMP)
- FindSetRightBit (TMP, Local0)
- Decrement (Local0)
- Store (Local0, PRQ0)
+ CreateDWordField (Arg0, 0x05, TMP)
+ Store (TMP, PRQ0)
}
}
Device(LNKB){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 2)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{ 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
@@ -407,14 +405,14 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{1}
})
- CreateWordField (PRR0, 0x01, TMP)
+ CreateDWordField (PRR0, 0x05, TMP)
Store (PRQ1, Local0)
If (LLess (Local0, 0x80))
{
- ShiftLeft (One, Local0, TMP)
+ Store (Local0, TMP)
}
Else
{
@@ -424,17 +422,15 @@ DefinitionBlock (
}
Method (_SRS, 1, NotSerialized)
{
- CreateWordField (Arg0, 0x01, TMP)
- FindSetRightBit (TMP, Local0)
- Decrement (Local0)
- Store (Local0, PRQ1)
+ CreateDWordField (Arg0, 0x05, TMP)
+ Store (TMP, PRQ1)
}
}
Device(LNKC){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 3)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{ 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
@@ -454,14 +450,14 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{1}
})
- CreateWordField (PRR0, 0x01, TMP)
+ CreateDWordField (PRR0, 0x05, TMP)
Store (PRQ2, Local0)
If (LLess (Local0, 0x80))
{
- ShiftLeft (One, Local0, TMP)
+ Store (Local0, TMP)
}
Else
{
@@ -471,17 +467,15 @@ DefinitionBlock (
}
Method (_SRS, 1, NotSerialized)
{
- CreateWordField (Arg0, 0x01, TMP)
- FindSetRightBit (TMP, Local0)
- Decrement (Local0)
- Store (Local0, PRQ2)
+ CreateDWordField (Arg0, 0x05, TMP)
+ Store (TMP, PRQ2)
}
}
Device(LNKD){
Name(_HID, EISAID("PNP0C0F")) // PCI interrupt link
Name(_UID, 4)
Name(_PRS, ResourceTemplate(){
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{ 5, 9, 10, 11 }
})
Method (_STA, 0, NotSerialized)
@@ -501,14 +495,14 @@ DefinitionBlock (
{
Name (PRR0, ResourceTemplate ()
{
- IRQ (Level, ActiveHigh, Shared)
+ Interrupt (, Level, ActiveHigh, Shared)
{1}
})
- CreateWordField (PRR0, 0x01, TMP)
+ CreateDWordField (PRR0, 0x05, TMP)
Store (PRQ3, Local0)
If (LLess (Local0, 0x80))
{
- ShiftLeft (One, Local0, TMP)
+ Store (Local0, TMP)
}
Else
{
@@ -518,10 +512,8 @@ DefinitionBlock (
}
Method (_SRS, 1, NotSerialized)
{
- CreateWordField (Arg0, 0x01, TMP)
- FindSetRightBit (TMP, Local0)
- Decrement (Local0)
- Store (Local0, PRQ3)
+ CreateDWordField (Arg0, 0x05, TMP)
+ Store (TMP, PRQ3)
}
}
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 13/21] Remove irq 9 from the pci interrupt link resources.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (11 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 12/21] Use extended interrupt descriptor for pci irqs Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 14/21] Provide gpe _L0x methods Gleb Natapov
` (7 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
qemu can't share isa irqs (which is how the acpi sci interrupt is implemente
with the pci irqs, so remove the sci interrupt from the pci link interrupt
candidate list.
Qemu pcbios commit 713939c93b9caa1a31c49211fe83525bcbee5948
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index b7ac9f6..88d3b57 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -341,7 +341,7 @@ DefinitionBlock (
Name(_UID, 1)
Name(_PRS, ResourceTemplate(){
Interrupt (, Level, ActiveHigh, Shared)
- { 5, 9, 10, 11 }
+ { 5, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -386,7 +386,7 @@ DefinitionBlock (
Name(_UID, 2)
Name(_PRS, ResourceTemplate(){
Interrupt (, Level, ActiveHigh, Shared)
- { 5, 9, 10, 11 }
+ { 5, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -431,7 +431,7 @@ DefinitionBlock (
Name(_UID, 3)
Name(_PRS, ResourceTemplate(){
Interrupt (, Level, ActiveHigh, Shared)
- { 5, 9, 10, 11 }
+ { 5, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
@@ -476,7 +476,7 @@ DefinitionBlock (
Name(_UID, 4)
Name(_PRS, ResourceTemplate(){
Interrupt (, Level, ActiveHigh, Shared)
- { 5, 9, 10, 11 }
+ { 5, 10, 11 }
})
Method (_STA, 0, NotSerialized)
{
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 14/21] Provide gpe _L0x methods.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (12 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 13/21] Remove irq 9 from the pci interrupt link resources Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 15/21] Pci hotplug support Gleb Natapov
` (6 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Provide methods for gpe blk 0, even though they do nothing atm.
Qemu pcbios commit 37c3845e38cb8ee4a98960bf1fc31563d071838d
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/acpi.c | 2 +
2 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 88d3b57..0c01624 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -543,4 +543,59 @@ DefinitionBlock (
Zero, /* reserved */
Zero /* reserved */
})
+
+ Scope (\_GPE)
+ {
+ Name(_HID, "ACPI0006")
+
+ Method(_L00) {
+ Return(0x01)
+ }
+ Method(_L01) {
+ Return(0x01)
+ }
+ Method(_L02) {
+ Return(0x01)
+ }
+ Method(_L03) {
+ Return(0x01)
+ }
+ Method(_L04) {
+ Return(0x01)
+ }
+ Method(_L05) {
+ Return(0x01)
+ }
+ Method(_L06) {
+ Return(0x01)
+ }
+ Method(_L07) {
+ Return(0x01)
+ }
+ Method(_L08) {
+ Return(0x01)
+ }
+ Method(_L09) {
+ Return(0x01)
+ }
+ Method(_L0A) {
+ Return(0x01)
+ }
+ Method(_L0B) {
+ Return(0x01)
+ }
+ Method(_L0C) {
+ Return(0x01)
+ }
+ Method(_L0D) {
+ Return(0x01)
+ }
+ Method(_L0E) {
+ Return(0x01)
+ }
+ Method(_L0F) {
+ Return(0x01)
+ }
+ }
+
}
diff --git a/src/acpi.c b/src/acpi.c
index fb57860..7c96427 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -272,6 +272,8 @@ build_fadt(int bdf)
fadt->pm_tmr_len = 4;
fadt->plvl2_lat = cpu_to_le16(0xfff); // C2 state not supported
fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported
+ fadt->gpe0_blk = cpu_to_le32(0xafe0);
+ fadt->gpe0_blk_len = 4;
/* WBINVD + PROC_C1 + PWR_BUTTON + SLP_BUTTON + FIX_RTC */
fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 4) | (1 << 5) | (1 << 6));
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 15/21] Pci hotplug support.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (13 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 14/21] Provide gpe _L0x methods Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 16/21] HPET support Gleb Natapov
` (5 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Qemy pcbios commit e88ec0d97b464915281d27d5714784d2215cbdef
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 98 insertions(+), 1 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 0c01624..4cd6f6a 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -65,6 +65,61 @@ DefinitionBlock (
prt_slot1(0x0005),
})
+ OperationRegion(PCST, SystemIO, 0xae00, 0x08)
+ Field (PCST, DWordAcc, NoLock, WriteAsZeros)
+ {
+ PCIU, 32,
+ PCID, 32,
+ }
+
+ OperationRegion(SEJ, SystemIO, 0xae08, 0x04)
+ Field (SEJ, DWordAcc, NoLock, WriteAsZeros)
+ {
+ B0EJ, 32,
+ }
+
+#define hotplug_slot(name, nr) \
+ Device (S##name) { \
+ Name (_ADR, nr##0000) \
+ Method (_EJ0,1) { \
+ Store(ShiftLeft(1, nr), B0EJ) \
+ Return (0x0) \
+ } \
+ Name (_SUN, name) \
+ }
+
+ hotplug_slot(1, 0x0001)
+ hotplug_slot(2, 0x0002)
+ hotplug_slot(3, 0x0003)
+ hotplug_slot(4, 0x0004)
+ hotplug_slot(5, 0x0005)
+ hotplug_slot(6, 0x0006)
+ hotplug_slot(7, 0x0007)
+ hotplug_slot(8, 0x0008)
+ hotplug_slot(9, 0x0009)
+ hotplug_slot(10, 0x000a)
+ hotplug_slot(11, 0x000b)
+ hotplug_slot(12, 0x000c)
+ hotplug_slot(13, 0x000d)
+ hotplug_slot(14, 0x000e)
+ hotplug_slot(15, 0x000f)
+ hotplug_slot(16, 0x0010)
+ hotplug_slot(17, 0x0011)
+ hotplug_slot(18, 0x0012)
+ hotplug_slot(19, 0x0013)
+ hotplug_slot(20, 0x0014)
+ hotplug_slot(21, 0x0015)
+ hotplug_slot(22, 0x0016)
+ hotplug_slot(23, 0x0017)
+ hotplug_slot(24, 0x0018)
+ hotplug_slot(25, 0x0019)
+ hotplug_slot(26, 0x001a)
+ hotplug_slot(27, 0x001b)
+ hotplug_slot(28, 0x001c)
+ hotplug_slot(29, 0x001d)
+ hotplug_slot(30, 0x001e)
+ hotplug_slot(31, 0x001f)
+
Name (_CRS, ResourceTemplate ()
{
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
@@ -551,8 +606,50 @@ DefinitionBlock (
Method(_L00) {
Return(0x01)
}
+
+#define gen_pci_hotplug(nr) \
+ If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \
+ Notify(\_SB.PCI0.S##nr, 1) \
+ } \
+ If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \
+ Notify(\_SB.PCI0.S##nr, 3) \
+ }
+
Method(_L01) {
- Return(0x01)
+ gen_pci_hotplug(1)
+ gen_pci_hotplug(2)
+ gen_pci_hotplug(3)
+ gen_pci_hotplug(4)
+ gen_pci_hotplug(5)
+ gen_pci_hotplug(6)
+ gen_pci_hotplug(7)
+ gen_pci_hotplug(8)
+ gen_pci_hotplug(9)
+ gen_pci_hotplug(10)
+ gen_pci_hotplug(11)
+ gen_pci_hotplug(12)
+ gen_pci_hotplug(13)
+ gen_pci_hotplug(14)
+ gen_pci_hotplug(15)
+ gen_pci_hotplug(16)
+ gen_pci_hotplug(17)
+ gen_pci_hotplug(18)
+ gen_pci_hotplug(19)
+ gen_pci_hotplug(20)
+ gen_pci_hotplug(21)
+ gen_pci_hotplug(22)
+ gen_pci_hotplug(23)
+ gen_pci_hotplug(24)
+ gen_pci_hotplug(25)
+ gen_pci_hotplug(26)
+ gen_pci_hotplug(27)
+ gen_pci_hotplug(28)
+ gen_pci_hotplug(29)
+ gen_pci_hotplug(30)
+ gen_pci_hotplug(31)
+
+ Return (0x01)
+
}
Method(_L02) {
Return(0x01)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 16/21] HPET support.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (14 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 15/21] Pci hotplug support Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 17/21] Add 26 pci slots, bringing the total to 32 Gleb Natapov
` (4 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Part of qemu pcbios commit e04da91178f0e11febbbd61d9795e49cc27e9ad4
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 19 +++++++++++++++++++
src/acpi.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index 4cd6f6a..c7e6547 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -165,6 +165,25 @@ DefinitionBlock (
,, , AddressRangeMemory, TypeStatic)
})
}
+
+ Device(HPET) {
+ Name(_HID, EISAID("PNP0103"))
+ Name(_UID, 0)
+ Method (_STA, 0, NotSerialized) {
+ Return(0x0F)
+ }
+ Name(_CRS, ResourceTemplate() {
+ DWordMemory(
+ ResourceConsumer, PosDecode, MinFixed, MaxFixed,
+ NonCacheable, ReadWrite,
+ 0x00000000,
+ 0xFED00000,
+ 0xFED003FF,
+ 0x00000000,
+ 0x00000400 /* 1K memory: FED00000 - FED003FF */
+ )
+ })
+ }
}
Scope(\_SB.PCI0) {
diff --git a/src/acpi.c b/src/acpi.c
index 7c96427..3e7efc8 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -206,6 +206,30 @@ struct madt_intsrcovr {
u16 flags;
} PACKED;
+/*
+ * ACPI 2.0 Generic Address Space definition.
+ */
+struct acpi_20_generic_address {
+ u8 address_space_id;
+ u8 register_bit_width;
+ u8 register_bit_offset;
+ u8 reserved;
+ u64 address;
+} PACKED;
+
+/*
+ * HPET Description Table
+ */
+struct acpi_20_hpet {
+ ACPI_TABLE_HEADER_DEF /* ACPI common table header */
+ u32 timer_block_id;
+ struct acpi_20_generic_address addr;
+ u8 hpet_number;
+ u16 min_tick;
+ u8 page_protect;
+} PACKED;
+#define ACPI_HPET_ADDRESS 0xFED00000UL
+
#include "acpi-dsdt.hex"
static inline u16 cpu_to_le16(u16 x)
@@ -402,6 +426,27 @@ build_ssdt(void)
return ssdt;
}
+#define HPET_SIGNATURE 0x54455048 //HPET
+static void*
+build_hpet(void)
+{
+ struct acpi_20_hpet *hpet = malloc_high(sizeof(*hpet));
+ if (!hpet) {
+ dprintf(1, "Not enough memory for hpet!\n");
+ return NULL;
+ }
+
+ memset(hpet, 0, sizeof(*hpet));
+ /* Note timer_block_id value must be kept in sync with value advertised by
+ * emulated hpet
+ */
+ hpet->timer_block_id = cpu_to_le32(0x8086a201);
+ hpet->addr.address = cpu_to_le32(ACPI_HPET_ADDRESS);
+ build_header((void*)hpet, HPET_SIGNATURE, sizeof(*hpet), 1);
+
+ return hpet;
+}
+
struct rsdp_descriptor *RsdpAddr;
#define MAX_ACPI_TABLES 20
@@ -440,6 +485,7 @@ acpi_bios_init(void)
ACPI_INIT_TABLE(build_fadt(bdf));
ACPI_INIT_TABLE(build_ssdt());
ACPI_INIT_TABLE(build_madt());
+ ACPI_INIT_TABLE(build_hpet());
u16 i, external_tables = qemu_cfg_acpi_additional_tables();
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 17/21] Add 26 pci slots, bringing the total to 32.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (15 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 16/21] HPET support Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 18/21] Add SRAT ACPI table support Gleb Natapov
` (3 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Lack of pci slots causes Windows to complain when installing too many
device.
Qemu pcbios commit 001fd46e3b551de05c62590ba5ed4cbf6cbe3510
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi-dsdt.dsl | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index c7e6547..cee038a 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -63,6 +63,32 @@ DefinitionBlock (
prt_slot3(0x0003),
prt_slot0(0x0004),
prt_slot1(0x0005),
+ prt_slot2(0x0006),
+ prt_slot3(0x0007),
+ prt_slot0(0x0008),
+ prt_slot1(0x0009),
+ prt_slot2(0x000a),
+ prt_slot3(0x000b),
+ prt_slot0(0x000c),
+ prt_slot1(0x000d),
+ prt_slot2(0x000e),
+ prt_slot3(0x000f),
+ prt_slot0(0x0010),
+ prt_slot1(0x0011),
+ prt_slot2(0x0012),
+ prt_slot3(0x0013),
+ prt_slot0(0x0014),
+ prt_slot1(0x0015),
+ prt_slot2(0x0016),
+ prt_slot3(0x0017),
+ prt_slot0(0x0018),
+ prt_slot1(0x0019),
+ prt_slot2(0x001a),
+ prt_slot3(0x001b),
+ prt_slot0(0x001c),
+ prt_slot1(0x001d),
+ prt_slot2(0x001e),
+ prt_slot3(0x001f),
})
OperationRegion(PCST, SystemIO, 0xae00, 0x08)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 18/21] Add SRAT ACPI table support.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (16 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 17/21] Add 26 pci slots, bringing the total to 32 Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 19/21] Read max number of cpus from VM Gleb Natapov
` (2 subsequent siblings)
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Take NUMA topology info from the QEMU firmware configuration interface
(number of nodes, node for each (V)CPU and amount of memory) and build
a SRAT table describing this topology for the guest OS. Handles more than
4 GB of RAM by including a hole for 32bit PCI memory mapping.
Qemu pcbios commit 444f1226c11082d374b7e1361c6f5696e479642a
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi.c | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
src/paravirt.c | 16 ++++++
src/paravirt.h | 2 +
3 files changed, 170 insertions(+), 5 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index 3e7efc8..41ad0cb 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -151,7 +151,7 @@ struct multiple_apic_table
} PACKED;
-/* Values for Type in APIC_HEADER_DEF */
+/* Values for Type in APIC sub-headers */
#define APIC_PROCESSOR 0
#define APIC_IO 1
@@ -167,7 +167,7 @@ struct multiple_apic_table
/*
* MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
*/
-#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
+#define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\
u8 type; \
u8 length;
@@ -175,7 +175,7 @@ struct multiple_apic_table
struct madt_processor_apic
{
- APIC_HEADER_DEF
+ ACPI_SUB_HEADER_DEF
u8 processor_id; /* ACPI processor id */
u8 local_apic_id; /* Processor's local APIC id */
#if 0
@@ -188,7 +188,7 @@ struct madt_processor_apic
struct madt_io_apic
{
- APIC_HEADER_DEF
+ ACPI_SUB_HEADER_DEF
u8 io_apic_id; /* I/O APIC ID */
u8 reserved; /* Reserved - must be zero */
u32 address; /* APIC physical address */
@@ -199,7 +199,7 @@ struct madt_io_apic
#define PCI_ISA_IRQ_MASK 0x0e20
struct madt_intsrcovr {
- APIC_HEADER_DEF
+ ACPI_SUB_HEADER_DEF
u8 bus;
u8 source;
u32 gsi;
@@ -230,6 +230,43 @@ struct acpi_20_hpet {
} PACKED;
#define ACPI_HPET_ADDRESS 0xFED00000UL
+/*
+ * SRAT (NUMA topology description) table
+ */
+
+#define SRAT_PROCESSOR 0
+#define SRAT_MEMORY 1
+
+struct system_resource_affinity_table
+{
+ ACPI_TABLE_HEADER_DEF
+ u32 reserved1;
+ u32 reserved2[2];
+} PACKED;
+
+struct srat_processor_affinity
+{
+ ACPI_SUB_HEADER_DEF
+ u8 proximity_lo;
+ u8 local_apic_id;
+ u32 flags;
+ u8 local_sapic_eid;
+ u8 proximity_hi[3];
+ u32 reserved;
+} PACKED;
+
+struct srat_memory_affinity
+{
+ ACPI_SUB_HEADER_DEF
+ u8 proximity[4];
+ u16 reserved1;
+ u32 base_addr_low,base_addr_high;
+ u32 length_low,length_high;
+ u32 reserved2;
+ u32 flags;
+ u32 reserved3[2];
+} PACKED;
+
#include "acpi-dsdt.hex"
static inline u16 cpu_to_le16(u16 x)
@@ -447,6 +484,115 @@ build_hpet(void)
return hpet;
}
+static void
+acpi_build_srat_memory(struct srat_memory_affinity *numamem,
+ u64 base, u64 len, int node, int enabled)
+{
+ numamem->type = SRAT_MEMORY;
+ numamem->length = sizeof(*numamem);
+ memset (numamem->proximity, 0 ,4);
+ numamem->proximity[0] = node;
+ numamem->flags = cpu_to_le32(!!enabled);
+ numamem->base_addr_low = base & 0xFFFFFFFF;
+ numamem->base_addr_high = base >> 32;
+ numamem->length_low = len & 0xFFFFFFFF;
+ numamem->length_high = len >> 32;
+}
+
+#define SRAT_SIGNATURE 0x54415253 //HPET
+static void *
+build_srat(void)
+{
+ int nb_numa_nodes = qemu_cfg_get_numa_nodes();
+
+ if (nb_numa_nodes == 0)
+ return NULL;
+
+ u64 *numadata = malloc_tmphigh(sizeof(u64) * (CountCPUs + nb_numa_nodes));
+ if (!numadata) {
+ dprintf(1, "Not enough memory for read numa data from VM!\n");
+ return NULL;
+ }
+
+ qemu_cfg_get_numa_data(numadata, CountCPUs + nb_numa_nodes);
+
+ struct system_resource_affinity_table *srat;
+ int srat_size = sizeof(*srat) +
+ sizeof(struct srat_processor_affinity) * CountCPUs +
+ sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 2);
+
+ srat = malloc_high(srat_size);
+ if (!srat) {
+ dprintf(1, "Not enough memory for srat table!\n");
+ return NULL;
+ }
+
+ memset(srat, 0, srat_size);
+ srat->reserved1=1;
+ struct srat_processor_affinity *core = (void*)(srat + 1);
+ int i;
+ u64 curnode;
+
+ for (i = 0; i < CountCPUs; ++i) {
+ core->type = SRAT_PROCESSOR;
+ core->length = sizeof(*core);
+ core->local_apic_id = i;
+ curnode = *numadata++;
+ core->proximity_lo = curnode;
+ memset(core->proximity_hi, 0, 3);
+ core->local_sapic_eid = 0;
+ if (i < CountCPUs)
+ core->flags = cpu_to_le32(1);
+ else
+ core->flags = 0;
+ core++;
+ }
+
+
+ /* the memory map is a bit tricky, it contains at least one hole
+ * from 640k-1M and possibly another one from 3.5G-4G.
+ */
+ struct srat_memory_affinity *numamem = (void*)core;
+ int slots = 0;
+ u64 mem_len, mem_base, next_base = 0;
+
+ acpi_build_srat_memory(numamem, 0, 640*1024, 0, 1);
+ next_base = 1024 * 1024;
+ numamem++;
+ slots++;
+ for (i = 1; i < nb_numa_nodes + 1; ++i) {
+ mem_base = next_base;
+ mem_len = *numadata++;
+ if (i == 1)
+ mem_len -= 1024 * 1024;
+ next_base = mem_base + mem_len;
+
+ /* Cut out the PCI hole */
+ if (mem_base <= RamSize && next_base > RamSize) {
+ mem_len -= next_base - RamSize;
+ if (mem_len > 0) {
+ acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
+ numamem++;
+ slots++;
+ }
+ mem_base = 1ULL << 32;
+ mem_len = next_base - RamSize;
+ next_base += (1ULL << 32) - RamSize;
+ }
+ acpi_build_srat_memory(numamem, mem_base, mem_len, i-1, 1);
+ numamem++;
+ slots++;
+ }
+ for (; slots < nb_numa_nodes + 2; slots++) {
+ acpi_build_srat_memory(numamem, 0, 0, 0, 0);
+ numamem++;
+ }
+
+ build_header((void*)srat, SRAT_SIGNATURE, srat_size, 1);
+
+ return srat;
+}
+
struct rsdp_descriptor *RsdpAddr;
#define MAX_ACPI_TABLES 20
@@ -486,6 +632,7 @@ acpi_bios_init(void)
ACPI_INIT_TABLE(build_ssdt());
ACPI_INIT_TABLE(build_madt());
ACPI_INIT_TABLE(build_hpet());
+ ACPI_INIT_TABLE(build_srat());
u16 i, external_tables = qemu_cfg_acpi_additional_tables();
diff --git a/src/paravirt.c b/src/paravirt.c
index 8c08ce7..8fbeb9c 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -265,3 +265,19 @@ int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
return 0;
}
+int qemu_cfg_get_numa_nodes(void)
+{
+ u64 cnt;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_NUMA, sizeof(cnt));
+
+ return (int)cnt;
+}
+
+void qemu_cfg_get_numa_data(u64 *data, int n)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ qemu_cfg_read((u8*)(data + i), sizeof(u64));
+}
diff --git a/src/paravirt.h b/src/paravirt.h
index 2b2f314..04a6907 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -49,5 +49,7 @@ u16 qemu_cfg_smbios_entries(void);
size_t qemu_cfg_smbios_load_field(int type, size_t offset, void *addr);
int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
unsigned *max_struct_size, char *end);
+int qemu_cfg_get_numa_nodes(void);
+void qemu_cfg_get_numa_data(u64 *data, int n);
#endif
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 19/21] Read max number of cpus from VM.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (17 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 18/21] Add SRAT ACPI table support Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 20/21] Move qemu cfg init before smp init Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables Gleb Natapov
20 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/paravirt.c | 12 ++++++++++++
src/paravirt.h | 1 +
src/smp.c | 9 ++++++++-
src/util.h | 1 +
4 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/src/paravirt.c b/src/paravirt.c
index 8fbeb9c..da5923b 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -281,3 +281,15 @@ void qemu_cfg_get_numa_data(u64 *data, int n)
for (i = 0; i < n; i++)
qemu_cfg_read((u8*)(data + i), sizeof(u64));
}
+
+u16 qemu_cfg_get_max_cpus(void)
+{
+ u16 cnt;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_MAX_CPUS, sizeof(cnt));
+
+ return cnt;
+}
diff --git a/src/paravirt.h b/src/paravirt.h
index 04a6907..a3f9be4 100644
--- a/src/paravirt.h
+++ b/src/paravirt.h
@@ -51,5 +51,6 @@ int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
unsigned *max_struct_size, char *end);
int qemu_cfg_get_numa_nodes(void);
void qemu_cfg_get_numa_data(u64 *data, int n);
+u16 qemu_cfg_get_max_cpus(void);
#endif
diff --git a/src/smp.c b/src/smp.c
index 44a7929..6879472 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -9,6 +9,7 @@
#include "config.h" // CONFIG_*
#include "cmos.h" // CMOS_BIOS_SMP_COUNT
#include "farptr.h" // ASSERT32
+#include "paravirt.h"
#define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
#define APIC_SVR ((u8*)BUILD_APIC_ADDR + 0x0F0)
@@ -61,6 +62,7 @@ wrmsr_smp(u32 index, u64 val)
}
u32 CountCPUs VAR16VISIBLE;
+u32 MaxCountCPUs VAR16VISIBLE;
extern void smp_ap_boot_code();
ASM16(
" .global smp_ap_boot_code\n"
@@ -134,7 +136,12 @@ smp_probe(void)
// Restore memory.
*(u64*)BUILD_AP_BOOT_ADDR = old;
- dprintf(1, "Found %d cpu(s)\n", readl(&CountCPUs));
+ MaxCountCPUs = qemu_cfg_get_max_cpus();
+ if (!MaxCountCPUs || MaxCountCPUs < CountCPUs)
+ MaxCountCPUs = CountCPUs;
+
+ dprintf(1, "Found %d cpu(s) max supported %d cpu(s)\n", readl(&CountCPUs),
+ MaxCountCPUs);
}
// Reset variables to zero
diff --git a/src/util.h b/src/util.h
index ca16ac7..401e6ea 100644
--- a/src/util.h
+++ b/src/util.h
@@ -221,6 +221,7 @@ void smm_init();
// smp.c
extern u32 CountCPUs;
+extern u32 MaxCountCPUs;
void wrmsr_smp(u32 index, u64 val);
void smp_probe(void);
void smp_probe_setup(void);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 20/21] Move qemu cfg init before smp init.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (18 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 19/21] Read max number of cpus from VM Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-09 2:18 ` [Qemu-devel] " Kevin O'Connor
2009-10-08 15:59 ` [Qemu-devel] [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables Gleb Natapov
20 siblings, 1 reply; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
We will need to read qemu config during smp init.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/post.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/post.c b/src/post.c
index e6f9c39..674f402 100644
--- a/src/post.c
+++ b/src/post.c
@@ -161,6 +161,8 @@ post()
init_ivt();
init_bda();
+ qemu_cfg_port_probe();
+
pic_setup();
timer_setup();
mathcp_setup();
@@ -185,8 +187,6 @@ post()
serial_setup();
mouse_setup();
- qemu_cfg_port_probe();
-
init_bios_tables();
boot_setup();
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables.
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
` (19 preceding siblings ...)
2009-10-08 15:59 ` [Qemu-devel] [PATCH 20/21] Move qemu cfg init before smp init Gleb Natapov
@ 2009-10-08 15:59 ` Gleb Natapov
2009-10-09 2:22 ` [Qemu-devel] " Kevin O'Connor
20 siblings, 1 reply; 28+ messages in thread
From: Gleb Natapov @ 2009-10-08 15:59 UTC (permalink / raw)
To: kevin; +Cc: qemu-devel
Preparation for hot pluggable CPUs.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
src/acpi.c | 23 ++++++++++++-----------
src/config.h | 4 ++--
src/mptable.c | 18 ++++++++++--------
src/smbios.c | 4 ++--
4 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/src/acpi.c b/src/acpi.c
index 41ad0cb..7c0e01d 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -346,9 +346,8 @@ build_fadt(int bdf)
static void*
build_madt(void)
{
- int smp_cpus = CountCPUs;
int madt_size = (sizeof(struct multiple_apic_table)
- + sizeof(struct madt_processor_apic) * smp_cpus
+ + sizeof(struct madt_processor_apic) * MaxCountCPUs
+ sizeof(struct madt_io_apic)
+ sizeof(struct madt_intsrcovr) * 16);
struct multiple_apic_table *madt = malloc_high(madt_size);
@@ -361,18 +360,21 @@ build_madt(void)
madt->flags = cpu_to_le32(1);
struct madt_processor_apic *apic = (void*)&madt[1];
int i;
- for (i=0; i<smp_cpus; i++) {
+ for (i=0; i<MaxCountCPUs; i++) {
apic->type = APIC_PROCESSOR;
apic->length = sizeof(*apic);
apic->processor_id = i;
apic->local_apic_id = i;
- apic->flags = cpu_to_le32(1);
+ if (i < CountCPUs)
+ apic->flags = cpu_to_le32(1);
+ else
+ apic->flags = cpu_to_le32(0);
apic++;
}
struct madt_io_apic *io_apic = (void*)apic;
io_apic->type = APIC_IO;
io_apic->length = sizeof(*io_apic);
- io_apic->io_apic_id = smp_cpus;
+ io_apic->io_apic_id = CountCPUs;
io_apic->address = cpu_to_le32(BUILD_IOAPIC_ADDR);
io_apic->interrupt = cpu_to_le32(0);
@@ -407,8 +409,7 @@ build_madt(void)
static void*
build_ssdt(void)
{
- int smp_cpus = CountCPUs;
- int acpi_cpus = smp_cpus > 0xff ? 0xff : smp_cpus;
+ int acpi_cpus = MaxCountCPUs > 0xff ? 0xff : MaxCountCPUs;
// calculate the length of processor block and scope block
// excluding PkgLength
int cpu_length = 13 * acpi_cpus + 4;
@@ -508,17 +509,17 @@ build_srat(void)
if (nb_numa_nodes == 0)
return NULL;
- u64 *numadata = malloc_tmphigh(sizeof(u64) * (CountCPUs + nb_numa_nodes));
+ u64 *numadata = malloc_tmphigh(sizeof(u64) * (MaxCountCPUs + nb_numa_nodes));
if (!numadata) {
dprintf(1, "Not enough memory for read numa data from VM!\n");
return NULL;
}
- qemu_cfg_get_numa_data(numadata, CountCPUs + nb_numa_nodes);
+ qemu_cfg_get_numa_data(numadata, MaxCountCPUs + nb_numa_nodes);
struct system_resource_affinity_table *srat;
int srat_size = sizeof(*srat) +
- sizeof(struct srat_processor_affinity) * CountCPUs +
+ sizeof(struct srat_processor_affinity) * MaxCountCPUs +
sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 2);
srat = malloc_high(srat_size);
@@ -533,7 +534,7 @@ build_srat(void)
int i;
u64 curnode;
- for (i = 0; i < CountCPUs; ++i) {
+ for (i = 0; i < MaxCountCPUs; ++i) {
core->type = SRAT_PROCESSOR;
core->length = sizeof(*core);
core->local_apic_id = i;
diff --git a/src/config.h b/src/config.h
index fa0dd1d..4ab9fbe 100644
--- a/src/config.h
+++ b/src/config.h
@@ -16,9 +16,9 @@
#define CONFIG_COREBOOT 0
// Control how verbose debug output is.
-#define CONFIG_DEBUG_LEVEL 1
+#define CONFIG_DEBUG_LEVEL 2
// Send debugging information to serial port
-#define CONFIG_DEBUG_SERIAL 0
+#define CONFIG_DEBUG_SERIAL 1
// Screen writes are also sent to debug ports.
#define CONFIG_SCREEN_AND_DEBUG 1
diff --git a/src/mptable.c b/src/mptable.c
index 4aaff1e..793968c 100644
--- a/src/mptable.c
+++ b/src/mptable.c
@@ -18,13 +18,12 @@ mptable_init(void)
dprintf(3, "init MPTable\n");
- int smp_cpus = CountCPUs;
- if (smp_cpus <= 1)
+ if (MaxCountCPUs <= 1)
// Building an mptable on uniprocessor machines confuses some OSes.
return;
int length = (sizeof(struct mptable_config_s)
- + sizeof(struct mpt_cpu) * smp_cpus
+ + sizeof(struct mpt_cpu) * MaxCountCPUs
+ sizeof(struct mpt_bus)
+ sizeof(struct mpt_ioapic)
+ sizeof(struct mpt_intsrc) * 16);
@@ -49,7 +48,7 @@ mptable_init(void)
config->spec = 4;
memcpy(config->oemid, CONFIG_CPUNAME8, sizeof(config->oemid));
memcpy(config->productid, "0.1 ", sizeof(config->productid));
- config->entrycount = smp_cpus + 2 + 16;
+ config->entrycount = MaxCountCPUs + 2 + 16;
config->lapic = BUILD_APIC_ADDR;
// CPU definitions.
@@ -57,14 +56,17 @@ mptable_init(void)
cpuid(1, &cpuid_signature, &ebx, &ecx, &cpuid_features);
struct mpt_cpu *cpus = (void*)&config[1];
int i;
- for (i = 0; i < smp_cpus; i++) {
+ for (i = 0; i < MaxCountCPUs; i++) {
struct mpt_cpu *cpu = &cpus[i];
memset(cpu, 0, sizeof(*cpu));
cpu->type = MPT_TYPE_CPU;
cpu->apicid = i;
cpu->apicver = 0x11;
/* cpu flags: enabled, bootstrap cpu */
- cpu->cpuflag = (i == 0 ? 3 : 1);
+ if (i < CountCPUs)
+ cpu->cpuflag = 1 | (i == 0) ? 2 : 0;
+ else
+ cpu->cpuflag = 0;
if (cpuid_signature) {
cpu->cpusignature = cpuid_signature;
cpu->featureflag = cpuid_features;
@@ -75,13 +77,13 @@ mptable_init(void)
}
/* isa bus */
- struct mpt_bus *bus = (void*)&cpus[smp_cpus];
+ struct mpt_bus *bus = (void*)&cpus[MaxCountCPUs];
memset(bus, 0, sizeof(*bus));
bus->type = MPT_TYPE_BUS;
memcpy(bus->bustype, "ISA ", sizeof(bus->bustype));
/* ioapic */
- u8 ioapic_id = smp_cpus;
+ u8 ioapic_id = CountCPUs;
struct mpt_ioapic *ioapic = (void*)&bus[1];
memset(ioapic, 0, sizeof(*ioapic));
ioapic->type = MPT_TYPE_IOAPIC;
diff --git a/src/smbios.c b/src/smbios.c
index a77c197..ad0d0c4 100644
--- a/src/smbios.c
+++ b/src/smbios.c
@@ -560,8 +560,8 @@ smbios_init(void)
add_struct(1, p);
add_struct(3, p);
- int cpu_num, smp_cpus = CountCPUs;
- for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++)
+ int cpu_num;
+ for (cpu_num = 1; cpu_num <= MaxCountCPUs; cpu_num++)
add_struct(4, p, cpu_num);
u64 memsize = RamSizeOver4G;
if (memsize)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [Qemu-devel] Re: [PATCH 20/21] Move qemu cfg init before smp init.
2009-10-08 15:59 ` [Qemu-devel] [PATCH 20/21] Move qemu cfg init before smp init Gleb Natapov
@ 2009-10-09 2:18 ` Kevin O'Connor
0 siblings, 0 replies; 28+ messages in thread
From: Kevin O'Connor @ 2009-10-09 2:18 UTC (permalink / raw)
To: Gleb Natapov; +Cc: qemu-devel
On Thu, Oct 08, 2009 at 05:59:25PM +0200, Gleb Natapov wrote:
> We will need to read qemu config during smp init.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Thanks! I applied patches 1 - 20.
-Kevin
^ permalink raw reply [flat|nested] 28+ messages in thread
* [Qemu-devel] Re: [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables.
2009-10-08 15:59 ` [Qemu-devel] [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables Gleb Natapov
@ 2009-10-09 2:22 ` Kevin O'Connor
2009-10-09 6:37 ` Gleb Natapov
0 siblings, 1 reply; 28+ messages in thread
From: Kevin O'Connor @ 2009-10-09 2:22 UTC (permalink / raw)
To: Gleb Natapov; +Cc: qemu-devel
On Thu, Oct 08, 2009 at 05:59:26PM +0200, Gleb Natapov wrote:
> Preparation for hot pluggable CPUs.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Thanks - this patch looks like it is pulling in unrelated changes to
config.h:
> --- a/src/config.h
> +++ b/src/config.h
> @@ -16,9 +16,9 @@
> #define CONFIG_COREBOOT 0
>
> // Control how verbose debug output is.
> -#define CONFIG_DEBUG_LEVEL 1
> +#define CONFIG_DEBUG_LEVEL 2
> // Send debugging information to serial port
> -#define CONFIG_DEBUG_SERIAL 0
> +#define CONFIG_DEBUG_SERIAL 1
> // Screen writes are also sent to debug ports.
> #define CONFIG_SCREEN_AND_DEBUG 1
>
Otherwise, it looks okay to me.
-Kevin
^ permalink raw reply [flat|nested] 28+ messages in thread
* [Qemu-devel] Re: [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables.
2009-10-09 2:22 ` [Qemu-devel] " Kevin O'Connor
@ 2009-10-09 6:37 ` Gleb Natapov
2009-10-09 13:44 ` Kevin O'Connor
0 siblings, 1 reply; 28+ messages in thread
From: Gleb Natapov @ 2009-10-09 6:37 UTC (permalink / raw)
To: Kevin O'Connor; +Cc: qemu-devel
On Thu, Oct 08, 2009 at 10:22:50PM -0400, Kevin O'Connor wrote:
> On Thu, Oct 08, 2009 at 05:59:26PM +0200, Gleb Natapov wrote:
> > Preparation for hot pluggable CPUs.
> >
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
>
> Thanks - this patch looks like it is pulling in unrelated changes to
> config.h:
>
> > --- a/src/config.h
> > +++ b/src/config.h
> > @@ -16,9 +16,9 @@
> > #define CONFIG_COREBOOT 0
> >
> > // Control how verbose debug output is.
> > -#define CONFIG_DEBUG_LEVEL 1
> > +#define CONFIG_DEBUG_LEVEL 2
> > // Send debugging information to serial port
> > -#define CONFIG_DEBUG_SERIAL 0
> > +#define CONFIG_DEBUG_SERIAL 1
> > // Screen writes are also sent to debug ports.
> > #define CONFIG_SCREEN_AND_DEBUG 1
> >
>
> Otherwise, it looks okay to me.
>
This is once more by accident. Can you drop them and apply please.
> -Kevin
--
Gleb.
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT
2009-10-08 15:59 ` [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT Gleb Natapov
@ 2009-10-09 10:56 ` Jamie Lokier
2009-10-09 11:37 ` Gleb Natapov
0 siblings, 1 reply; 28+ messages in thread
From: Jamie Lokier @ 2009-10-09 10:56 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kevin, qemu-devel
Gleb Natapov wrote:
> Now that kvm emulates the ioapic polarity correctly, we must describe
> the polarity correctly in the acpi tables. Otherwise pci interrupts won't
> be delivered correctly.
In another thread recently, wasn't it mentioned that the in-kernel
ioapic handles polarity correctly but the out-of-kernel ioapic does
not yet?
-- Jamie
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT
2009-10-09 10:56 ` Jamie Lokier
@ 2009-10-09 11:37 ` Gleb Natapov
0 siblings, 0 replies; 28+ messages in thread
From: Gleb Natapov @ 2009-10-09 11:37 UTC (permalink / raw)
To: Jamie Lokier; +Cc: kevin, qemu-devel
On Fri, Oct 09, 2009 at 11:56:14AM +0100, Jamie Lokier wrote:
> Gleb Natapov wrote:
> > Now that kvm emulates the ioapic polarity correctly, we must describe
> > the polarity correctly in the acpi tables. Otherwise pci interrupts won't
> > be delivered correctly.
>
> In another thread recently, wasn't it mentioned that the in-kernel
> ioapic handles polarity correctly but the out-of-kernel ioapic does
> not yet?
>
Correct and that is why out-of-kernel doesn't care about polarity. It
just ignores the bit. So for in-kernel ioapic to work you need this
change and it is nop for out-of-kernel one
--
Gleb.
^ permalink raw reply [flat|nested] 28+ messages in thread
* [Qemu-devel] Re: [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables.
2009-10-09 6:37 ` Gleb Natapov
@ 2009-10-09 13:44 ` Kevin O'Connor
0 siblings, 0 replies; 28+ messages in thread
From: Kevin O'Connor @ 2009-10-09 13:44 UTC (permalink / raw)
To: Gleb Natapov; +Cc: qemu-devel
On Fri, Oct 09, 2009 at 08:37:57AM +0200, Gleb Natapov wrote:
> On Thu, Oct 08, 2009 at 10:22:50PM -0400, Kevin O'Connor wrote:
> > On Thu, Oct 08, 2009 at 05:59:26PM +0200, Gleb Natapov wrote:
> > > Preparation for hot pluggable CPUs.
> > >
> > > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> >
> > Thanks - this patch looks like it is pulling in unrelated changes to
> > config.h:
> This is once more by accident. Can you drop them and apply please.
Okay - it's commit a26df9bd7c8dc3a901994be17ec067abb87c2f1a
Thanks,
-Kevin
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2009-10-09 13:44 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-08 15:59 [Qemu-devel] [PATCH 00/21] Bring seabios and qemu pcbios closer together Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 01/21] Add support for passing additional acpi tables from qemu Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH v2 02/21] Load SMBIOS entries and files " Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 03/21] Always create PCI interrupt override acpi tables Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 04/21] Correct default pci irq links Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 05/21] irq0override provided by qemu Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 06/21] Check at runtime if VM is KVM Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 07/21] Remove CONFIG_KVM compile option Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 08/21] Add rule to compile DSDT to make file Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 09/21] Use preprocessor for pci link routing Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 10/21] Advertise pci irqs as active high in DSDT Gleb Natapov
2009-10-09 10:56 ` Jamie Lokier
2009-10-09 11:37 ` Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 11/21] Restrict pci interrupts to irq 5/9/10/11 Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 12/21] Use extended interrupt descriptor for pci irqs Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 13/21] Remove irq 9 from the pci interrupt link resources Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 14/21] Provide gpe _L0x methods Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 15/21] Pci hotplug support Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 16/21] HPET support Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 17/21] Add 26 pci slots, bringing the total to 32 Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 18/21] Add SRAT ACPI table support Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 19/21] Read max number of cpus from VM Gleb Natapov
2009-10-08 15:59 ` [Qemu-devel] [PATCH 20/21] Move qemu cfg init before smp init Gleb Natapov
2009-10-09 2:18 ` [Qemu-devel] " Kevin O'Connor
2009-10-08 15:59 ` [Qemu-devel] [PATCH 21/21] Use MaxCountCPUs during building of per cpu tables Gleb Natapov
2009-10-09 2:22 ` [Qemu-devel] " Kevin O'Connor
2009-10-09 6:37 ` Gleb Natapov
2009-10-09 13:44 ` Kevin O'Connor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).