diff mbox

tools/libacpi: set FADT boot flag to notify lack of VGA for PVHv2 guests

Message ID 20161201124001.48565-1-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monne Dec. 1, 2016, 12:40 p.m. UTC
PVHv2 guests don't have any VGA card, and as so it must be notified in the FADT.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: boris.ostrovsky@oracle.com
Cc: konrad.wilk@oracle.com
---
 tools/firmware/hvmloader/util.c | 3 ++-
 tools/libacpi/acpi2_0.h         | 1 +
 tools/libacpi/build.c           | 2 ++
 tools/libacpi/libacpi.h         | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

Comments

Jan Beulich Dec. 1, 2016, 1:09 p.m. UTC | #1
>>> On 01.12.16 at 13:40, <roger.pau@citrix.com> wrote:
> PVHv2 guests don't have any VGA card, and as so it must be notified in the 
> FADT.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Looking at this ...

> --- a/tools/libacpi/acpi2_0.h
> +++ b/tools/libacpi/acpi2_0.h
> @@ -229,6 +229,7 @@ struct acpi_20_fadt {
>   */
>  #define ACPI_LEGACY_DEVICES (1 << 0)
>  #define ACPI_8042           (1 << 1)
> +#define ACPI_FADT_NO_VGA    (1 << 2)

... though makes me wonder: Don't we need a similar patch then
for ACPI_FADT_NO_CMOS_RTC, the setting of which then would
need to be in sync with XEN_X86_EMU_RTC?

Jan
Roger Pau Monne Dec. 1, 2016, 1:29 p.m. UTC | #2
On Thu, Dec 01, 2016 at 06:09:09AM -0700, Jan Beulich wrote:
> >>> On 01.12.16 at 13:40, <roger.pau@citrix.com> wrote:
> > PVHv2 guests don't have any VGA card, and as so it must be notified in the 
> > FADT.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> Looking at this ...
> 
> > --- a/tools/libacpi/acpi2_0.h
> > +++ b/tools/libacpi/acpi2_0.h
> > @@ -229,6 +229,7 @@ struct acpi_20_fadt {
> >   */
> >  #define ACPI_LEGACY_DEVICES (1 << 0)
> >  #define ACPI_8042           (1 << 1)
> > +#define ACPI_FADT_NO_VGA    (1 << 2)
> 
> ... though makes me wonder: Don't we need a similar patch then
> for ACPI_FADT_NO_CMOS_RTC, the setting of which then would
> need to be in sync with XEN_X86_EMU_RTC?

Right... and we also need to remove ACPI_8042, which is set by default. Will 
prepare two more patches to fix this.

Roger.
Boris Ostrovsky Dec. 1, 2016, 1:46 p.m. UTC | #3
On 12/01/2016 08:29 AM, Roger Pau Monne wrote:
> On Thu, Dec 01, 2016 at 06:09:09AM -0700, Jan Beulich wrote:
>>>>> On 01.12.16 at 13:40, <roger.pau@citrix.com> wrote:
>>> PVHv2 guests don't have any VGA card, and as so it must be notified in the
>>> FADT.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>>
>> Looking at this ...
>>
>>> --- a/tools/libacpi/acpi2_0.h
>>> +++ b/tools/libacpi/acpi2_0.h
>>> @@ -229,6 +229,7 @@ struct acpi_20_fadt {
>>>   */
>>>  #define ACPI_LEGACY_DEVICES (1 << 0)
>>>  #define ACPI_8042           (1 << 1)
>>> +#define ACPI_FADT_NO_VGA    (1 << 2)
>>
>> ... though makes me wonder: Don't we need a similar patch then
>> for ACPI_FADT_NO_CMOS_RTC, the setting of which then would
>> need to be in sync with XEN_X86_EMU_RTC?


This will also eliminate the need in Linux to explicitly disable RTC for 
PVH guests. With ACPI_FADT_NO_CMOS_RTC this will be taken care of by 
generic ACPI boot code.

-boris


>
> Right... and we also need to remove ACPI_8042, which is set by default. Will
> prepare two more patches to fix this.
>
> Roger.
>
Roger Pau Monne Dec. 1, 2016, 3:08 p.m. UTC | #4
On Thu, Dec 01, 2016 at 12:40:01PM +0000, Roger Pau Monne wrote:
> --- a/tools/libacpi/acpi2_0.h
> +++ b/tools/libacpi/acpi2_0.h
> @@ -229,6 +229,7 @@ struct acpi_20_fadt {
>   */
>  #define ACPI_LEGACY_DEVICES (1 << 0)
>  #define ACPI_8042           (1 << 1)
> +#define ACPI_FADT_NO_VGA    (1 << 2)

Hm, I'm wondering whether I should drop the "_FADT_" here, other flags don't 
have it already.

Roger.
Jan Beulich Dec. 1, 2016, 3:26 p.m. UTC | #5
>>> On 01.12.16 at 16:08, <roger.pau@citrix.com> wrote:
> On Thu, Dec 01, 2016 at 12:40:01PM +0000, Roger Pau Monne wrote:
>> --- a/tools/libacpi/acpi2_0.h
>> +++ b/tools/libacpi/acpi2_0.h
>> @@ -229,6 +229,7 @@ struct acpi_20_fadt {
>>   */
>>  #define ACPI_LEGACY_DEVICES (1 << 0)
>>  #define ACPI_8042           (1 << 1)
>> +#define ACPI_FADT_NO_VGA    (1 << 2)
> 
> Hm, I'm wondering whether I should drop the "_FADT_" here, other flags don't 
> have it already.

No, the other two should gain _FADT (see actbl.h).

Jan
diff mbox

Patch

diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 6e0cfe7..3e192bf 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -948,7 +948,8 @@  void hvmloader_acpi_build_tables(struct acpi_config *config,
     if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1)  )
         config->table_flags |= ACPI_HAS_SSDT_S4;
 
-    config->table_flags |= (ACPI_HAS_TCPA | ACPI_HAS_IOAPIC | ACPI_HAS_WAET);
+    config->table_flags |= (ACPI_HAS_TCPA | ACPI_HAS_IOAPIC | ACPI_HAS_WAET |
+                            ACPI_HAS_VGA);
 
     config->tis_hdr = (uint16_t *)ACPI_TIS_HDR_ADDRESS;
 
diff --git a/tools/libacpi/acpi2_0.h b/tools/libacpi/acpi2_0.h
index 775eb7a..aeb95a7 100644
--- a/tools/libacpi/acpi2_0.h
+++ b/tools/libacpi/acpi2_0.h
@@ -229,6 +229,7 @@  struct acpi_20_fadt {
  */
 #define ACPI_LEGACY_DEVICES (1 << 0)
 #define ACPI_8042           (1 << 1)
+#define ACPI_FADT_NO_VGA    (1 << 2)
 
 /*
  * FADT Fixed Feature Flags.
diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index 47dae01..8799e2c 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -579,6 +579,8 @@  int acpi_build_tables(struct acpi_ctxt *ctxt, struct acpi_config *config)
     fadt->x_dsdt = ctxt->mem_ops.v2p(ctxt, dsdt);
     fadt->firmware_ctrl   = ctxt->mem_ops.v2p(ctxt, facs);
     fadt->x_firmware_ctrl = ctxt->mem_ops.v2p(ctxt, facs);
+    if ( !(config->table_flags & ACPI_HAS_VGA) )
+        fadt->iapc_boot_arch |= ACPI_FADT_NO_VGA;
     set_checksum(fadt,
                  offsetof(struct acpi_header, checksum),
                  sizeof(struct acpi_20_fadt));
diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h
index 1d388f9..d7ea6e1 100644
--- a/tools/libacpi/libacpi.h
+++ b/tools/libacpi/libacpi.h
@@ -30,6 +30,7 @@ 
 #define ACPI_HAS_TCPA        (1<<7)
 #define ACPI_HAS_IOAPIC      (1<<8)
 #define ACPI_HAS_WAET        (1<<9)
+#define ACPI_HAS_VGA         (1<<10)
 
 struct xen_vmemrange;
 struct acpi_numa {