qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] acpi: add reset register to fadt
@ 2015-03-28 14:46 Reza Jelveh
  2015-03-29 17:38 ` Marcel Apfelbaum
  2015-03-30 12:36 ` Igor Mammedov
  0 siblings, 2 replies; 7+ messages in thread
From: Reza Jelveh @ 2015-03-28 14:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Reza Jelveh

Some operating systems such as FreeBSD and Mac OSX need the reset_register
section of the FADT filled to know which port to write to for a system reset.

What is the right way to set the reset_val and the reset addr in this case?
---
 hw/i386/acpi-build.c | 5 +++++
 hw/i386/acpi-defs.h  | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index d0a5c85..21c1453 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -361,6 +361,11 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
                               (1 << ACPI_FADT_F_SLP_BUTTON) |
                               (1 << ACPI_FADT_F_RTC_S4));
     fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
+    fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
+    fadt->reset_val = 0xf;
+    fadt->reset_reg.address_space_id   = aml_system_io;
+    fadt->reset_reg.register_bit_width = 8;
+    fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;
     /* APIC destination mode ("Flat Logical") has an upper limit of 8 CPUs
      * For more than 8 CPUs, "Clustered Logical" mode has to be used
      */
diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h
index c4468f8..960c833 100644
--- a/hw/i386/acpi-defs.h
+++ b/hw/i386/acpi-defs.h
@@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
     uint8_t  reserved4a;             /* Reserved */
     uint8_t  reserved4b;             /* Reserved */
     uint32_t flags;
+    Acpi20GenericAddress reset_reg;
+    uint8_t reset_val;
 } QEMU_PACKED;
 typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
 
-- 
2.3.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-28 14:46 [Qemu-devel] [RFC] acpi: add reset register to fadt Reza Jelveh
@ 2015-03-29 17:38 ` Marcel Apfelbaum
  2015-03-30 13:56   ` Paolo Bonzini
  2015-03-30 12:36 ` Igor Mammedov
  1 sibling, 1 reply; 7+ messages in thread
From: Marcel Apfelbaum @ 2015-03-29 17:38 UTC (permalink / raw)
  To: Reza Jelveh, qemu-devel

On 03/28/2015 05:46 PM, Reza Jelveh wrote:
> Some operating systems such as FreeBSD and Mac OSX need the reset_register
> section of the FADT filled to know which port to write to for a system reset.
>
> What is the right way to set the reset_val and the reset addr in this case?
> ---
>   hw/i386/acpi-build.c | 5 +++++
>   hw/i386/acpi-defs.h  | 2 ++
>   2 files changed, 7 insertions(+)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index d0a5c85..21c1453 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -361,6 +361,11 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
>                                 (1 << ACPI_FADT_F_SLP_BUTTON) |
>                                 (1 << ACPI_FADT_F_RTC_S4));
>       fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
> +    fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
> +    fadt->reset_val = 0xf;
> +    fadt->reset_reg.address_space_id   = aml_system_io;
> +    fadt->reset_reg.register_bit_width = 8;
> +    fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;
Hi,

Is this for both PC and Q35? Because I don't think PC has ICH9_RST_CNT_IOPORT.

Thanks,
Marcel

>       /* APIC destination mode ("Flat Logical") has an upper limit of 8 CPUs
>        * For more than 8 CPUs, "Clustered Logical" mode has to be used
>        */
> diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h
> index c4468f8..960c833 100644
> --- a/hw/i386/acpi-defs.h
> +++ b/hw/i386/acpi-defs.h
> @@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
>       uint8_t  reserved4a;             /* Reserved */
>       uint8_t  reserved4b;             /* Reserved */
>       uint32_t flags;
> +    Acpi20GenericAddress reset_reg;
> +    uint8_t reset_val;
>   } QEMU_PACKED;
>   typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-28 14:46 [Qemu-devel] [RFC] acpi: add reset register to fadt Reza Jelveh
  2015-03-29 17:38 ` Marcel Apfelbaum
@ 2015-03-30 12:36 ` Igor Mammedov
  2015-03-30 13:27   ` Reza Jelveh
  1 sibling, 1 reply; 7+ messages in thread
From: Igor Mammedov @ 2015-03-30 12:36 UTC (permalink / raw)
  To: Reza Jelveh; +Cc: qemu-devel

On Sat, 28 Mar 2015 15:46:53 +0100
Reza Jelveh <fishman@saucelabs.com> wrote:

> Some operating systems such as FreeBSD and Mac OSX need the reset_register
> section of the FADT filled to know which port to write to for a system reset.
> 
> What is the right way to set the reset_val and the reset addr in this case?
> ---
>  hw/i386/acpi-build.c | 5 +++++
>  hw/i386/acpi-defs.h  | 2 ++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index d0a5c85..21c1453 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -361,6 +361,11 @@ static void fadt_setup(AcpiFadtDescriptorRev1 *fadt, AcpiPmInfo *pm)
>                                (1 << ACPI_FADT_F_SLP_BUTTON) |
>                                (1 << ACPI_FADT_F_RTC_S4));
>      fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
> +    fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
> +    fadt->reset_val = 0xf;
> +    fadt->reset_reg.address_space_id   = aml_system_io;
> +    fadt->reset_reg.register_bit_width = 8;
> +    fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;
>      /* APIC destination mode ("Flat Logical") has an upper limit of 8 CPUs
>       * For more than 8 CPUs, "Clustered Logical" mode has to be used
>       */
> diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h
> index c4468f8..960c833 100644
> --- a/hw/i386/acpi-defs.h
> +++ b/hw/i386/acpi-defs.h
> @@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
>      uint8_t  reserved4a;             /* Reserved */
>      uint8_t  reserved4b;             /* Reserved */
>      uint32_t flags;
> +    Acpi20GenericAddress reset_reg;
> +    uint8_t reset_val;
you are extending structure beyond of what specified by ACPI 1.0b spec,
that might break guests.
We probably can't change revision since Windows ACPI implementation
is mostly 1.0b based so we are stuck with it.
Patch needs to be tested with Windows guests starting with XP.

related issue,
adding fields without changing major version to a corresponding
one doesn't look correct.

>  } QEMU_PACKED;
>  typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-30 12:36 ` Igor Mammedov
@ 2015-03-30 13:27   ` Reza Jelveh
  2015-03-30 13:49     ` Igor Mammedov
  2015-03-30 13:59     ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Reza Jelveh @ 2015-03-30 13:27 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

On Mon, Mar 30, 2015 at 2:36 PM, Igor Mammedov <imammedo@redhat.com> wrote:

> you are extending structure beyond of what specified by ACPI 1.0b spec,
> that might break guests.
> We probably can't change revision since Windows ACPI implementation
> is mostly 1.0b based so we are stuck with it.
> Patch needs to be tested with Windows guests starting with XP.
>

Works fine with XP as long as you don't use q35, but i guess that's
unsupported by xp by default.


> related issue,
> adding fields without changing major version to a corresponding
> one doesn't look correct.
>

What do you suggest? saying we support 2.0a just because of introducing
reset_reg is not really valid is it?

[-- Attachment #2: Type: text/html, Size: 1278 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-30 13:27   ` Reza Jelveh
@ 2015-03-30 13:49     ` Igor Mammedov
  2015-03-30 13:59     ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Igor Mammedov @ 2015-03-30 13:49 UTC (permalink / raw)
  To: Reza Jelveh; +Cc: qemu-devel

On Mon, 30 Mar 2015 15:27:26 +0200
Reza Jelveh <fishman@saucelabs.com> wrote:

> On Mon, Mar 30, 2015 at 2:36 PM, Igor Mammedov <imammedo@redhat.com> wrote:
> 
> > you are extending structure beyond of what specified by ACPI 1.0b spec,
> > that might break guests.
> > We probably can't change revision since Windows ACPI implementation
> > is mostly 1.0b based so we are stuck with it.
> > Patch needs to be tested with Windows guests starting with XP.
> >
> 
> Works fine with XP as long as you don't use q35, but i guess that's
> unsupported by xp by default.
what about other windows versions?

> 
> 
> > related issue,
> > adding fields without changing major version to a corresponding
> > one doesn't look correct.
> >
> 
> What do you suggest? saying we support 2.0a just because of introducing
> reset_reg is not really valid is it?
Try to check whether windows works fine with a newer revision,
if it is, we can create revX FADT structure and use in with new machine types.
In that case we could consider implementing rev5 table so it could be reused
in ARM target.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-29 17:38 ` Marcel Apfelbaum
@ 2015-03-30 13:56   ` Paolo Bonzini
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2015-03-30 13:56 UTC (permalink / raw)
  To: marcel, Reza Jelveh, qemu-devel



On 29/03/2015 19:38, Marcel Apfelbaum wrote:
> On 03/28/2015 05:46 PM, Reza Jelveh wrote:
>> Some operating systems such as FreeBSD and Mac OSX need the
>> reset_register
>> section of the FADT filled to know which port to write to for a system
>> reset.
>>
>> What is the right way to set the reset_val and the reset addr in this
>> case?
>> ---
>>   hw/i386/acpi-build.c | 5 +++++
>>   hw/i386/acpi-defs.h  | 2 ++
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>> index d0a5c85..21c1453 100644
>> --- a/hw/i386/acpi-build.c
>> +++ b/hw/i386/acpi-build.c
>> @@ -361,6 +361,11 @@ static void fadt_setup(AcpiFadtDescriptorRev1
>> *fadt, AcpiPmInfo *pm)
>>                                 (1 << ACPI_FADT_F_SLP_BUTTON) |
>>                                 (1 << ACPI_FADT_F_RTC_S4));
>>       fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_USE_PLATFORM_CLOCK);
>> +    fadt->flags |= cpu_to_le32(1 << ACPI_FADT_F_RESET_REG_SUP);
>> +    fadt->reset_val = 0xf;
>> +    fadt->reset_reg.address_space_id   = aml_system_io;
>> +    fadt->reset_reg.register_bit_width = 8;
>> +    fadt->reset_reg.address            = ICH9_RST_CNT_IOPORT;
> Hi,
> 
> Is this for both PC and Q35? Because I don't think PC has
> ICH9_RST_CNT_IOPORT.

It does (see RCR_IOPORT).

Paolo

> Thanks,
> Marcel
> 
>>       /* APIC destination mode ("Flat Logical") has an upper limit of
>> 8 CPUs
>>        * For more than 8 CPUs, "Clustered Logical" mode has to be used
>>        */
>> diff --git a/hw/i386/acpi-defs.h b/hw/i386/acpi-defs.h
>> index c4468f8..960c833 100644
>> --- a/hw/i386/acpi-defs.h
>> +++ b/hw/i386/acpi-defs.h
>> @@ -132,6 +132,8 @@ struct AcpiFadtDescriptorRev1
>>       uint8_t  reserved4a;             /* Reserved */
>>       uint8_t  reserved4b;             /* Reserved */
>>       uint32_t flags;
>> +    Acpi20GenericAddress reset_reg;
>> +    uint8_t reset_val;
>>   } QEMU_PACKED;
>>   typedef struct AcpiFadtDescriptorRev1 AcpiFadtDescriptorRev1;
>>
>>
> 
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [RFC] acpi: add reset register to fadt
  2015-03-30 13:27   ` Reza Jelveh
  2015-03-30 13:49     ` Igor Mammedov
@ 2015-03-30 13:59     ` Paolo Bonzini
  1 sibling, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2015-03-30 13:59 UTC (permalink / raw)
  To: Reza Jelveh, Igor Mammedov; +Cc: qemu-devel



On 30/03/2015 15:27, Reza Jelveh wrote:
>     you are extending structure beyond of what specified by ACPI 1.0b spec,
>     that might break guests.
>     We probably can't change revision since Windows ACPI implementation
>     is mostly 1.0b based so we are stuck with it.
>     Patch needs to be tested with Windows guests starting with XP.
> 
> Works fine with XP as long as you don't use q35, but i guess that's
> unsupported by xp by default. 

Isn't that just because XP doesn't have an AHCI driver?  You should
still be able to use XP with q35 and virtio, by using a driver disk.  Or
add a PATA controller:

   -device piix4-ide,id=pata \
   -drive if=none,id=hd,file=... \
   -device ide-hd,drive=hd,bus=pata.0

Paolo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-30 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-28 14:46 [Qemu-devel] [RFC] acpi: add reset register to fadt Reza Jelveh
2015-03-29 17:38 ` Marcel Apfelbaum
2015-03-30 13:56   ` Paolo Bonzini
2015-03-30 12:36 ` Igor Mammedov
2015-03-30 13:27   ` Reza Jelveh
2015-03-30 13:49     ` Igor Mammedov
2015-03-30 13:59     ` Paolo Bonzini

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).