All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: imammedo@redhat.com, agraf@suse.de, lersek@redhat.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] RFC: ACPI, HPET._CRS, MacOSX vs. WinXP
Date: Mon, 20 Jan 2014 13:58:50 +0200	[thread overview]
Message-ID: <20140120115850.GA29985@redhat.com> (raw)
In-Reply-To: <20140117211015.GB18752@ERROL.INI.CMU.EDU>

On Fri, Jan 17, 2014 at 04:10:16PM -0500, Gabriel L. Somlo wrote:
> On Fri, Jan 10, 2014 at 05:13:11PM +0100, Igor Mammedov wrote:
> > > On Fri, Jan 10, 2014 at 01:37:14PM +0100, Paolo Bonzini wrote:
> > > > Il 09/01/2014 22:44, Gabriel L. Somlo ha scritto:
> > > > > 1. hardcode "IRQNoFlags(){2, 8}" and require -no-hpet to prevent XP
> > > > >    from bluescreening. Basically, this means we don't support XP on
> > > > >    a VM where HPET is enabled.
> > > > > 
> > > > > 2. conditionally insert "IRQNoFlags(){2, 8}" if _OSI("Darwin") returns
> > > > >    0xFFFFFFFF, [...] if we want to run OS X on piix+smp
> > > > >    (all other combinations of (piix vs. q35) x (up vs.  smp) work fine
> ...
> > there is harder route to get a clue why XP BSODs,
> > one can use AMLI debugger to see what is happening in XP on boot
> > http://msdn.microsoft.com/en-us/library/windows/hardware/ff537808%28v=vs.85%29.aspx
> > that was how I found out about not supported ConcatenateResTemplate first.
> 
> After doing a bit of research, here's what I was able to find out:
> 
> 1. "IRQNoFlags {2, 8}" was a mistake/typo I made early on, real Apple
>    hardware (and *only* Apple hardware) has "IRQNoFlags {0, 8}" included
>    with HPET._CRS
> 
> 2. Both 0 and 8 are already spoken for, by the system timer (TMR), and
>    by the RTC, respectively.
> 
> 3. WinXP will also bluescreen on QEMU if HPET._CRS has "IRQNoFlags {0, 8}"
>    added; in fact, it will bluescreen if *any* IRQNoFlags statement is
>    included with the HPET DSDT node, as far as I was able to tell.
> 
> 4. I acpidump-ed the DSDT on a bunch of machines, including a MacPro5,1,
>    a MacBookPro2,2, a MacBookPro9,1, a Dell Latitude D630, and a Dell R410.
>    Here's what I found:
> 
>      - All Macs (and only Macs) have IRQNoFlags {0, 8} in HPET._CRS.
>      - my Dells (and I suspect most non-Apple machines) don't have
>        IRQNoFlags in HPET_CRS at all.
> 
>      - On Macs, there's no TMR DSDT node at all.
>      - My Latitude D630 laptop has a TMR node, with IRQNoFlags {2} in _CRS
>      - the R410 also has a TMR node, with IRQNoFlags {0} in _CRS.
> 
>      - On Macs, RTC has no IRQNoFlags in its _CRS
>      - Both my dells have IRQNoFlags {8} in RTC._CRS
> 
> 5. I was able to boot XPsp2 on the MacBookPro2,2 straight from the DVD
>    with a zeroed-out hard drive. It installs and works fine, and when
>    I pull up the Device Manager, neither the RTC or the TMR devices have
>    any IRQs listed under Properties/Resources.
>    What is even more interesting, the HPET does NOT show up in the device
>    tree *at all* !!!
> 
> 6. On the MacBookPro9,1, XP bluescreens during install, in a similar
>    mannner to how it bluescreens on QEMU if HPET._CRS contains IRQNoFlags.
>    Bootcamp doesn't support anything older than Windows 7 on those machines,
>    so I don't think there's anything I can do to get XP running and look
>    at the device tree on that machine.
> 
> 7. On QEMU, XP does indeed show the HPET alongside the TMR and RTC in
>    its device tree, obviously without any IRQ resources under properties,
>    since the only way it boots is if HPET._CRS doesn't include IRQNoFlags.
> 
> 8. Windows 7, while it boots and runs fine when HPET._CRS contains
>    IRQNoFlags, will show an unresolved IRQ conflict between the HPET and
>    the RTC in the device tree. Commenting out IRQNoFlags from the RTC
>    in QEMU does NOT solve that (still shows up as a conflict in the
>    device tree).
> 
> 9. I followed Igor's advice and ran a debug session, but unlike with
>    ConcatenateResTemplate, XP didn't choke on AML byte code itself, but
>    appears to die of a memory access violation:
> 
>      *** Fatal System Error: 0x0000007e (0x...)
>      ...
>      Probably caused by: ACPI.sys (ACPI!AcpiArbCrackPRT+113)
> 
>      80527bdc cc       int 3
> 
>    Poking around with various !amli debugger commands does not show
>    anything AML-related as abnormal, so I think the problem is that
>    either XP specifically expects the HPET._CRS buffer to be of a
>    certain hardcoded size (which doesn't include any extra room for
>    IRQNoFlags), or attempts to somehow process the values given via
>    IRQNoFlags (0 and 8) in ways that cause it to then kill itself.
> 
>    Hard to tell without knowing more about XP internals (e.g., without
>    XP kernel and/or acpi.sys source code).
> 
> At this point, conditionally inserting IRQNoFlags {0,8} only for OS X
> sounds less of a hack and more like the right thing to do. I would be
> comfortable using ConcatenateResTemplate since XP never gets a chance
> to attempt to interpret that bytecode, which gets exercised only by
> the _OSI("Darwin") branch. I tested this, and both XP and OSX seem
> happy with it.
> 
> Please let me know what you think.
> 
> Thanks,
> --Gabriel

I think at this point I agree.

I think the hack looking for the SMC device is safer than _OSI: OSPMs
are known to do crazy things when they see _OSI, such as assuming they
need to try and emulate the OS probed.


> diff --git a/hw/i386/acpi-dsdt-hpet.dsl b/hw/i386/acpi-dsdt-hpet.dsl
> index dfde174..0cf7fbf 100644
> --- a/hw/i386/acpi-dsdt-hpet.dsl
> +++ b/hw/i386/acpi-dsdt-hpet.dsl
> @@ -38,14 +38,21 @@ Scope(\_SB) {
>              }
>              Return (0x0F)
>          }
> -        Name(_CRS, ResourceTemplate() {
> -#if 0       /* This makes WinXP BSOD for not yet figured reasons. */
> -            IRQNoFlags() {2, 8}
> -#endif
> +        Name(RESP, ResourceTemplate() {
>              Memory32Fixed(ReadOnly,
>                  0xFED00000,         // Address Base
>                  0x00000400,         // Address Length
>                  )
>          })
> +        Name(RESI, ResourceTemplate() {
> +            IRQNoFlags() {0, 8}     // Mac OS X only
> +        })
> +        Method(_CRS, 0) {
> +            If (LEqual(\_OSI("Darwin"), 0xFFFFFFFF)) {
> +                Return (ConcatenateResTemplate(RESP, RESI, Local0))
> +            } else {
> +                Return (RESP)
> +            }
> +        }
>      }
>  }

  reply	other threads:[~2014-01-20 11:54 UTC|newest]

Thread overview: 155+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 20:02 [Qemu-devel] [PATCH] Add option to disable FDC from ISA bus and ACPI on i386 Gabriel L. Somlo
2014-01-08 20:38 ` Michael S. Tsirkin
2014-01-08 21:09   ` Gabriel L. Somlo
2014-01-15 11:13     ` Paolo Bonzini
2014-01-08 22:13 ` Paolo Bonzini
2014-01-08 23:39   ` Gabriel L. Somlo
2014-01-09  0:12     ` Alexander Graf
2014-01-09  1:51     ` Michael S. Tsirkin
2014-01-09 18:51       ` Gabriel L. Somlo
2014-01-09 20:12         ` Paolo Bonzini
2014-01-09 21:33           ` Michael S. Tsirkin
2014-01-09 21:58             ` Gabriel L. Somlo
2014-01-09 21:44           ` Gabriel L. Somlo
2014-01-10 12:37             ` Paolo Bonzini
2014-01-10 15:35               ` Gabriel L. Somlo
2014-01-10 16:13                 ` Igor Mammedov
2014-01-17 21:10                   ` [Qemu-devel] RFC: ACPI, HPET._CRS, MacOSX vs. WinXP Gabriel L. Somlo
2014-01-20 11:58                     ` Michael S. Tsirkin [this message]
2014-01-20 11:57                       ` Paolo Bonzini
2014-01-20 12:08                         ` Michael S. Tsirkin
2014-01-20 12:16                           ` Paolo Bonzini
2014-01-20 18:54                             ` Gabriel L. Somlo
2014-01-20 20:31                               ` Michael S. Tsirkin
2014-01-20 21:25                                 ` Gabriel L. Somlo
2014-01-21 10:33                                   ` Paolo Bonzini
2014-01-21 11:02                                     ` Michael S. Tsirkin
2014-01-21 11:05                                       ` Paolo Bonzini
2014-01-21 11:44                                         ` Michael S. Tsirkin
2014-01-21 18:11                                           ` [Qemu-devel] [PATCH] ACPI: Add IRQ resource to HPET._CRS on Mac OS X Gabriel L. Somlo
2014-01-21 18:38                                             ` Michael S. Tsirkin
2014-01-24 16:46                                               ` Gabriel L. Somlo
2014-01-24 21:18                                                 ` Alexander Graf
2014-01-25  0:09                                                   ` Gabriel L. Somlo
2014-01-25  9:08                                                     ` Alexander Graf
2014-01-27 22:51                                                       ` Gabriel L. Somlo
2014-01-27 23:51                                                         ` Alexander Graf
2014-01-28 16:45                                                           ` [Qemu-devel] OSX guest support review Gabriel L. Somlo
2014-01-28 16:57                                                             ` Michael S. Tsirkin
2014-01-29 14:17                                                             ` Alexander Graf
2014-01-29 21:36                                                               ` [Qemu-devel] OSX guest vs. kvm ioapic polarity Gabriel L. Somlo
2014-01-29 22:18                                                                 ` Michael S. Tsirkin
2014-01-30 14:18                                                                   ` Gabriel L. Somlo
2014-01-30 19:48                                                                     ` Michael S. Tsirkin
2014-01-30 20:21                                                                       ` Gabriel L. Somlo
2014-01-30 20:28                                                                         ` Michael S. Tsirkin
2014-01-30 20:33                                                                         ` Michael S. Tsirkin
2014-01-30 20:44                                                                           ` Gabriel L. Somlo
2014-02-11 18:23                                                                             ` RFC: ioapic polarity vs. qemu os-x guest Gabriel L. Somlo
2014-02-11 18:23                                                                               ` [Qemu-devel] " Gabriel L. Somlo
2014-02-11 19:54                                                                               ` Michael S. Tsirkin
2014-02-11 19:54                                                                                 ` [Qemu-devel] " Michael S. Tsirkin
2014-02-11 21:35                                                                                 ` Gabriel L. Somlo
2014-02-11 21:35                                                                                   ` [Qemu-devel] " Gabriel L. Somlo
2014-02-14 21:13                                                                                 ` Gabriel L. Somlo
2014-02-14 21:13                                                                                   ` [Qemu-devel] " Gabriel L. Somlo
2014-02-14 21:21                                                                                   ` Alexander Graf
2014-02-14 21:21                                                                                     ` [Qemu-devel] " Alexander Graf
2014-02-14 22:06                                                                                     ` Gabriel L. Somlo
2014-02-14 22:06                                                                                       ` [Qemu-devel] " Gabriel L. Somlo
2014-02-14 22:13                                                                                       ` Alexander Graf
2014-02-14 22:13                                                                                         ` [Qemu-devel] " Alexander Graf
2014-02-16 11:18                                                                                         ` Michael S. Tsirkin
2014-02-16 11:18                                                                                           ` [Qemu-devel] " Michael S. Tsirkin
2014-02-16 11:41                                                                                         ` Michael S. Tsirkin
2014-02-16 11:41                                                                                           ` [Qemu-devel] " Michael S. Tsirkin
2014-02-16 14:47                                                                                           ` Alex Williamson
2014-02-16 14:47                                                                                             ` [Qemu-devel] " Alex Williamson
2014-02-16 16:23                                                                                             ` Michael S. Tsirkin
2014-02-16 16:23                                                                                               ` [Qemu-devel] " Michael S. Tsirkin
2014-02-17 17:57                                                                                               ` Gabriel L. Somlo
2014-02-17 17:57                                                                                                 ` [Qemu-devel] " Gabriel L. Somlo
2014-02-17 18:01                                                                                                 ` Gabriel L. Somlo
2014-02-17 18:01                                                                                                   ` [Qemu-devel] " Gabriel L. Somlo
2014-02-17 18:06                                                                                                   ` Paolo Bonzini
2014-02-17 18:06                                                                                                     ` [Qemu-devel] " Paolo Bonzini
2014-02-17 19:38                                                                                                     ` Gabriel L. Somlo
2014-02-17 19:38                                                                                                       ` [Qemu-devel] " Gabriel L. Somlo
2014-02-18  0:58                                                                                                       ` Gabriel L. Somlo
2014-02-18  0:58                                                                                                         ` [Qemu-devel] " Gabriel L. Somlo
2014-02-27 17:05                                                                                               ` [PATCH RFC] kvm: ignore apic polarity Michael S. Tsirkin
2014-02-27 17:05                                                                                                 ` [Qemu-devel] " Michael S. Tsirkin
2014-02-27 21:41                                                                                                 ` Gabriel L. Somlo
2014-02-27 21:41                                                                                                   ` [Qemu-devel] " Gabriel L. Somlo
2014-02-27 22:30                                                                                                   ` Paolo Bonzini
2014-02-27 22:30                                                                                                     ` [Qemu-devel] " Paolo Bonzini
2014-02-27 23:13                                                                                                     ` Gabriel L. Somlo
2014-02-27 23:13                                                                                                       ` [Qemu-devel] " Gabriel L. Somlo
2014-02-27 23:31                                                                                                       ` Paolo Bonzini
2014-02-27 23:31                                                                                                         ` [Qemu-devel] " Paolo Bonzini
2014-02-28  4:06                                                                                                         ` [RFC PATCH v2] kvm: x86: ignore ioapic polarity Gabriel L. Somlo
2014-02-28  4:06                                                                                                           ` [Qemu-devel] " Gabriel L. Somlo
2014-02-28 17:23                                                                                                           ` [Qemu-devel] [RFC PATCH] qemu: " Gabriel L. Somlo
2014-02-28 18:57                                                                                                             ` [Qemu-devel] [RFC PATCH v2] " Gabriel L. Somlo
2014-02-28 19:14                                                                                                               ` [Qemu-devel] [PATCH] qemu: x86: report lapic version as 0x14 instead of 0x11 Gabriel L. Somlo
2014-03-01  3:44                                                                                                                 ` Alexander Graf
2014-03-01  4:25                                                                                                                   ` Gabriel L. Somlo
2014-03-01  5:45                                                                                                                     ` Alexander Graf
2014-03-01 14:46                                                                                                                 ` Paolo Bonzini
2014-03-02  0:17                                                                                                                   ` Gabriel L. Somlo
2014-03-02  8:56                                                                                                                     ` Paolo Bonzini
2014-03-02 14:31                                                                                                                       ` Michael S. Tsirkin
2014-03-02 16:02                                                                                                                         ` Michael S. Tsirkin
2014-03-06  7:50                                                                                                                     ` Michael S. Tsirkin
2014-03-02 14:52                                                                                                               ` [Qemu-devel] [RFC PATCH v2] qemu: x86: ignore ioapic polarity Michael S. Tsirkin
2014-03-02 16:15                                                                                                                 ` Gabriel L. Somlo
2014-03-02 17:09                                                                                                                   ` Michael S. Tsirkin
2014-03-06  7:45                                                                                                               ` Michael S. Tsirkin
2014-03-02 14:55                                                                                                           ` [RFC PATCH v2] kvm: " Michael S. Tsirkin
2014-03-02 14:55                                                                                                             ` [Qemu-devel] " Michael S. Tsirkin
2014-03-13 10:53                                                                                                           ` Paolo Bonzini
2014-03-13 10:53                                                                                                             ` [Qemu-devel] " Paolo Bonzini
2014-03-13 13:43                                                                                                             ` Gabriel L. Somlo
2014-03-13 13:43                                                                                                               ` [Qemu-devel] " Gabriel L. Somlo
2014-02-28  4:55                                                                                                     ` [PATCH RFC] kvm: ignore apic polarity Michael S. Tsirkin
2014-02-28  4:55                                                                                                       ` [Qemu-devel] " Michael S. Tsirkin
2014-02-28  8:10                                                                                                       ` Paolo Bonzini
2014-02-28  8:10                                                                                                         ` [Qemu-devel] " Paolo Bonzini
2014-02-28  8:11                                                                                                       ` Paolo Bonzini
2014-02-28  8:11                                                                                                         ` [Qemu-devel] " Paolo Bonzini
2014-03-01  5:03                                                                                                 ` Alex Williamson
2014-03-01  5:03                                                                                                   ` [Qemu-devel] " Alex Williamson
2014-02-16 11:34                                                                                   ` RFC: ioapic polarity vs. qemu os-x guest Michael S. Tsirkin
2014-02-16 11:34                                                                                     ` [Qemu-devel] " Michael S. Tsirkin
2014-02-16 15:12                                                                                     ` Peter Maydell
2014-02-16 11:37                                                                                   ` Michael S. Tsirkin
2014-02-16 11:37                                                                                     ` [Qemu-devel] " Michael S. Tsirkin
2014-01-29 23:13                                                                 ` [Qemu-devel] OSX guest vs. kvm ioapic polarity Alexander Graf
2014-01-30 15:56                                                                   ` Gabriel L. Somlo
2014-01-28 20:40                                                       ` [Qemu-devel] osx bootloader Gabriel L. Somlo
2014-01-28 22:51                                                         ` BALATON Zoltan
2014-01-29  3:07                                                           ` Gabriel L. Somlo
2014-01-29 11:29                                                             ` BALATON Zoltan
2014-01-29 14:53                                                               ` Gabriel L. Somlo
2014-01-29 15:00                                                                 ` Alexander Graf
2014-01-30  0:15                                                                   ` BALATON Zoltan
2014-02-01 17:43                                                                   ` BALATON Zoltan
2014-02-01  0:38                                                                 ` BALATON Zoltan
2014-02-01 10:07                                                                   ` Alexander Graf
2014-02-01 14:35                                                                     ` [Qemu-devel] OVMF with q35 (was: osx bootloader) BALATON Zoltan
2014-02-01 15:13                                                                       ` Alexander Graf
2014-02-01 17:38                                                                         ` BALATON Zoltan
2014-02-03  7:47                                                                       ` Gerd Hoffmann
2014-02-01 21:19                                                                   ` [Qemu-devel] osx bootloader Paolo Bonzini
2014-02-02  2:18                                                                     ` BALATON Zoltan
2014-01-29 12:10                                                             ` BALATON Zoltan
2014-01-29 14:20                                                             ` Alexander Graf
2014-01-21 11:38                                   ` [Qemu-devel] RFC: ACPI, HPET._CRS, MacOSX vs. WinXP Michael S. Tsirkin
2014-01-20 20:23                             ` Michael S. Tsirkin
2014-01-20 12:03                     ` Igor Mammedov
2014-01-09  8:46   ` [Qemu-devel] [PATCH] Add option to disable FDC from ISA bus and ACPI on i386 Markus Armbruster
2014-01-09 10:24     ` Paolo Bonzini
2014-01-31 19:03       ` [Qemu-devel] [RFC PATCH v2] Add option to switch off FDC Gabriel L. Somlo
2014-01-31 19:39         ` Eric Blake
2014-02-02 13:47           ` Michael S. Tsirkin
2014-02-10 14:10             ` Marcel Apfelbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140120115850.GA29985@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=gsomlo@gmail.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.