* [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model
@ 2017-08-17 14:57 Igor Druzhinin
2017-08-17 18:33 ` Andrew Cooper
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Igor Druzhinin @ 2017-08-17 14:57 UTC (permalink / raw)
To: xen-devel; +Cc: Igor Druzhinin, ian.jackson, wei.liu2, jbeulich, andrew.cooper3
We need to choose ACPI tables and ACPI IO port location
properly depending on the device model version we are running.
Previously, this decision was made by BIOS type specific
code in hvmloader, e.g. always load QEMU traditional specific
tables if it's ROMBIOS and always load QEMU Xen specific
tables if it's SeaBIOS.
This change saves this behavior (for compatibility) but adds
an additional way (xenstore key) to specify the correct
device model if we happen to run a non-default one. Toolstack
bit makes use of it.
The enforcement of BIOS type depending on QEMU version will
be lifted later when the rest of ROMBIOS compatibility fixes
are in place.
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
---
Changes in v3:
* move ACPI table externs into util.h
Changes in v2:
* fix insufficient allocation size of localent
---
tools/firmware/hvmloader/hvmloader.c | 2 --
tools/firmware/hvmloader/ovmf.c | 5 ++---
tools/firmware/hvmloader/rombios.c | 5 ++---
tools/firmware/hvmloader/seabios.c | 6 +++---
tools/firmware/hvmloader/util.c | 21 +++++++++++++++++++++
tools/firmware/hvmloader/util.h | 3 +++
tools/libxl/libxl_create.c | 4 +++-
7 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
index f603f68..db11ab1 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -405,8 +405,6 @@ int main(void)
}
acpi_enable_sci();
-
- hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
}
init_vm86_tss();
diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c
index 4ff7f1d..17bd0fe 100644
--- a/tools/firmware/hvmloader/ovmf.c
+++ b/tools/firmware/hvmloader/ovmf.c
@@ -41,9 +41,6 @@
#define LOWCHUNK_MAXOFFSET 0x0000FFFF
#define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000
-extern unsigned char dsdt_anycpu_qemu_xen[];
-extern int dsdt_anycpu_qemu_xen_len;
-
#define OVMF_INFO_MAX_TABLES 4
struct ovmf_info {
char signature[14]; /* XenHVMOVMF\0\0\0\0 */
@@ -127,6 +124,8 @@ static void ovmf_acpi_build_tables(void)
.dsdt_15cpu_len = 0
};
+ hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
+
hvmloader_acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
}
diff --git a/tools/firmware/hvmloader/rombios.c b/tools/firmware/hvmloader/rombios.c
index 56b39b7..b14d1f2 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -42,9 +42,6 @@
#define ROMBIOS_MAXOFFSET 0x0000FFFF
#define ROMBIOS_END (ROMBIOS_BEGIN + ROMBIOS_SIZE)
-extern unsigned char dsdt_anycpu[], dsdt_15cpu[];
-extern int dsdt_anycpu_len, dsdt_15cpu_len;
-
static void rombios_setup_e820(void)
{
/*
@@ -181,6 +178,8 @@ static void rombios_acpi_build_tables(void)
.dsdt_15cpu_len = dsdt_15cpu_len,
};
+ hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 0);
+
hvmloader_acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
}
diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c
index 870576a..c8792cd 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -28,9 +28,7 @@
#include <acpi2_0.h>
#include <libacpi.h>
-
-extern unsigned char dsdt_anycpu_qemu_xen[];
-extern int dsdt_anycpu_qemu_xen_len;
+#include <xen/hvm/params.h>
struct seabios_info {
char signature[14]; /* XenHVMSeaBIOS\0 */
@@ -99,6 +97,8 @@ static void seabios_acpi_build_tables(void)
.dsdt_15cpu_len = 0,
};
+ hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
+
hvmloader_acpi_build_tables(&config, rsdp);
add_table(rsdp);
}
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index db5f240..934b566 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -897,6 +897,27 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
/* Allocate and initialise the acpi info area. */
mem_hole_populate_ram(ACPI_INFO_PHYSICAL_ADDRESS >> PAGE_SHIFT, 1);
+ /* If the device model is specified switch to the corresponding tables */
+ s = xenstore_read("platform/device-model", "");
+ if ( !strncmp(s, "qemu_xen_traditional", 21) )
+ {
+ config->dsdt_anycpu = dsdt_anycpu;
+ config->dsdt_anycpu_len = dsdt_anycpu_len;
+ config->dsdt_15cpu = dsdt_15cpu;
+ config->dsdt_15cpu_len = dsdt_15cpu_len;
+
+ hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 0);
+ }
+ else if ( !strncmp(s, "qemu_xen", 9) )
+ {
+ config->dsdt_anycpu = dsdt_anycpu_qemu_xen;
+ config->dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len;
+ config->dsdt_15cpu = NULL;
+ config->dsdt_15cpu_len = 0;
+
+ hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
+ }
+
config->lapic_base_address = LAPIC_BASE_ADDRESS;
config->lapic_id = acpi_lapic_id;
config->ioapic_base_address = ioapic_base_address;
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 6062f0b..874916c 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -276,6 +276,9 @@ extern struct e820map memory_map;
bool check_overlap(uint64_t start, uint64_t size,
uint64_t reserved_start, uint64_t reserved_size);
+extern unsigned char dsdt_anycpu_qemu_xen[], dsdt_anycpu[], dsdt_15cpu[];
+extern int dsdt_anycpu_qemu_xen_len, dsdt_anycpu_len, dsdt_15cpu_len;
+
struct acpi_config;
void hvmloader_acpi_build_tables(struct acpi_config *config,
unsigned int physical);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 1158303..1d24209 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -451,7 +451,7 @@ int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time";
vments[5] = GCSPRINTF("%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
- localents = libxl__calloc(gc, 11, sizeof(char *));
+ localents = libxl__calloc(gc, 13, sizeof(char *));
i = 0;
localents[i++] = "platform/acpi";
localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0";
@@ -472,6 +472,8 @@ int libxl__domain_build(libxl__gc *gc,
info->u.hvm.mmio_hole_memkb << 10);
}
}
+ localents[i++] = "platform/device-model";
+ localents[i++] = (char *) libxl_device_model_version_to_string(info->device_model_version);
break;
case LIBXL_DOMAIN_TYPE_PV:
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model
2017-08-17 14:57 [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model Igor Druzhinin
@ 2017-08-17 18:33 ` Andrew Cooper
2017-08-22 14:20 ` Wei Liu
2017-08-25 18:02 ` Roger Pau Monné
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2017-08-17 18:33 UTC (permalink / raw)
To: Igor Druzhinin, xen-devel; +Cc: wei.liu2, ian.jackson, jbeulich
On 17/08/17 15:57, Igor Druzhinin wrote:
> We need to choose ACPI tables and ACPI IO port location
> properly depending on the device model version we are running.
> Previously, this decision was made by BIOS type specific
> code in hvmloader, e.g. always load QEMU traditional specific
> tables if it's ROMBIOS and always load QEMU Xen specific
> tables if it's SeaBIOS.
>
> This change saves this behavior (for compatibility) but adds
> an additional way (xenstore key) to specify the correct
> device model if we happen to run a non-default one. Toolstack
> bit makes use of it.
>
> The enforcement of BIOS type depending on QEMU version will
> be lifted later when the rest of ROMBIOS compatibility fixes
> are in place.
>
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
HVMLoader bits Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model
2017-08-17 14:57 [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model Igor Druzhinin
2017-08-17 18:33 ` Andrew Cooper
@ 2017-08-22 14:20 ` Wei Liu
2017-08-25 18:02 ` Roger Pau Monné
2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2017-08-22 14:20 UTC (permalink / raw)
To: Igor Druzhinin; +Cc: andrew.cooper3, ian.jackson, wei.liu2, jbeulich, xen-devel
On Thu, Aug 17, 2017 at 03:57:13PM +0100, Igor Druzhinin wrote:
> We need to choose ACPI tables and ACPI IO port location
> properly depending on the device model version we are running.
> Previously, this decision was made by BIOS type specific
> code in hvmloader, e.g. always load QEMU traditional specific
> tables if it's ROMBIOS and always load QEMU Xen specific
> tables if it's SeaBIOS.
>
> This change saves this behavior (for compatibility) but adds
> an additional way (xenstore key) to specify the correct
> device model if we happen to run a non-default one. Toolstack
> bit makes use of it.
>
> The enforcement of BIOS type depending on QEMU version will
> be lifted later when the rest of ROMBIOS compatibility fixes
> are in place.
>
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model
2017-08-17 14:57 [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model Igor Druzhinin
2017-08-17 18:33 ` Andrew Cooper
2017-08-22 14:20 ` Wei Liu
@ 2017-08-25 18:02 ` Roger Pau Monné
2 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2017-08-25 18:02 UTC (permalink / raw)
To: Igor Druzhinin; +Cc: wei.liu2, andrew.cooper3, ian.jackson, jbeulich, xen-devel
On Thu, Aug 17, 2017 at 03:57:13PM +0100, Igor Druzhinin wrote:
> We need to choose ACPI tables and ACPI IO port location
> properly depending on the device model version we are running.
> Previously, this decision was made by BIOS type specific
> code in hvmloader, e.g. always load QEMU traditional specific
> tables if it's ROMBIOS and always load QEMU Xen specific
> tables if it's SeaBIOS.
>
> This change saves this behavior (for compatibility) but adds
> an additional way (xenstore key) to specify the correct
> device model if we happen to run a non-default one. Toolstack
> bit makes use of it.
>
> The enforcement of BIOS type depending on QEMU version will
> be lifted later when the rest of ROMBIOS compatibility fixes
> are in place.
>
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> Changes in v3:
> * move ACPI table externs into util.h
>
> Changes in v2:
> * fix insufficient allocation size of localent
> ---
> tools/firmware/hvmloader/hvmloader.c | 2 --
> tools/firmware/hvmloader/ovmf.c | 5 ++---
> tools/firmware/hvmloader/rombios.c | 5 ++---
> tools/firmware/hvmloader/seabios.c | 6 +++---
> tools/firmware/hvmloader/util.c | 21 +++++++++++++++++++++
> tools/firmware/hvmloader/util.h | 3 +++
> tools/libxl/libxl_create.c | 4 +++-
> 7 files changed, 34 insertions(+), 12 deletions(-)
>
> diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c
> index f603f68..db11ab1 100644
> --- a/tools/firmware/hvmloader/hvmloader.c
> +++ b/tools/firmware/hvmloader/hvmloader.c
> @@ -405,8 +405,6 @@ int main(void)
> }
>
> acpi_enable_sci();
> -
> - hvm_param_set(HVM_PARAM_ACPI_IOPORTS_LOCATION, 1);
AFAICT there's something very strange going on here. Setting
HVM_PARAM_ACPI_IOPORTS_LOCATION was done here unconditionally after
calling acpi_build_tables, which means that any selection done by the
BIOS was overwritten here.
Also the FADT has the control/event register V1 values set by default,
and they are not changed anywhere AFAICT. IMHO, hotplug for qemu-trad
has not worked in a long time I guess...
Roger.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-25 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 14:57 [PATCH v3] hvmloader, libxl: use the correct ACPI settings depending on device model Igor Druzhinin
2017-08-17 18:33 ` Andrew Cooper
2017-08-22 14:20 ` Wei Liu
2017-08-25 18:02 ` Roger Pau Monné
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).