kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: "Kevin O'Connor" <kevin@koconnor.net>,
	seabios@seabios.org, Gleb Natapov <gleb@redhat.com>,
	kvm@vger.kernel.org, jasowang@redhat.com,
	alex williamson <alex.williamson@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: [PATCHv3 0/4] acpi: DSDT/SSDT runtime patching
Date: Tue, 4 Oct 2011 15:25:56 +0200	[thread overview]
Message-ID: <cover.1317734661.git.mst@redhat.com> (raw)

Here's an updated revision of acpi runtime patching patchset.
As promised, this revision replaces the hardcoded offsets
in the ssdt_proc table with ones generated dynamically
from the mixed asl/aml listing.

Changes in v3:
	- change ssdt generation code to get rid of hardcoded offsets
	- enhancements to acpi_extract: add more extract methods
		ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name()
		ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name()
		ACPI_EXTRACT_PROCESSOR_START - start of Processor() block
		ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor()
		ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1

Changes in v2:
	- tools rewritten in python
	- Original ASL retains _EJ0 methods, BIOS patches that to EJ0_
	- generic ACP_EXTRACT infrastructure that can match Method
          and Name Operators
	- instead of matching specific method name, insert tags
	  in original DSL source and match that to AML

-----

Here's a bug: guest thinks it can eject VGA device and ISA bridge.

[root@dhcp74-172 ~]#lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 PCI bridge: Red Hat, Inc. Device 0001
00:04.0 Ethernet controller: Qumranet, Inc. Virtio network device
00:05.0 SCSI storage controller: Qumranet, Inc. Virtio block device
01:00.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 03)

[root@dhcp74-172 ~]# ls /sys/bus/pci/slots/1/
adapter  address  attention  latch  module  power
[root@dhcp74-172 ~]# ls /sys/bus/pci/slots/2/
adapter  address  attention  latch  module  power

[root@dhcp74-172 ~]# echo 0 > /sys/bus/pci/slots/2/power 
[root@dhcp74-172 ~]# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:03.0 PCI bridge: Red Hat, Inc. Device 0001
00:04.0 Ethernet controller: Qumranet, Inc. Virtio network device
00:05.0 SCSI storage controller: Qumranet, Inc. Virtio block device
01:00.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 03)

This is wrong because slots 1 and 2 are marked as not hotpluggable
in qemu.

The reason is that our acpi tables declare both _RMV with value 0,
and _EJ0 method for these slots. What happens in this case
is undocumented by ACPI spec, so linux ignores _RMV,
and windows seems to ignore _EJ0.

The correct way to suppress hotplug is not to have _EJ0,
so this is what this patch does: it probes PIIX and
modifies DSDT to match.

With these patches applied, we get:

[root@dhcp74-172 ~]# ls /sys/bus/pci/slots/1/
address
[root@dhcp74-172 ~]# ls /sys/bus/pci/slots/2/
address



Michael S. Tsirkin (4):
  acpi: generate and parse mixed asl/aml listing
  acpi: EJ0 method name patching
  acpi: remove _RMV
  acpi: automatically generated ssdt proc

 Makefile                         |   12 +-
 src/acpi-dsdt.dsl                |   96 +++++--------
 src/acpi.c                       |   64 ++++++---
 src/ssdt-proc.dsl                |   19 +--
 tools/acpi_extract.py            |  278 ++++++++++++++++++++++++++++++++++++++
 tools/acpi_extract_preprocess.py |   37 +++++
 6 files changed, 411 insertions(+), 95 deletions(-)
 create mode 100755 tools/acpi_extract.py
 create mode 100755 tools/acpi_extract_preprocess.py

-- 
1.7.5.53.gc233e

             reply	other threads:[~2011-10-04 13:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 13:25 Michael S. Tsirkin [this message]
2011-10-04 13:26 ` [PATCHv3 1/4] acpi: generate and parse mixed asl/aml listing Michael S. Tsirkin
2011-10-04 13:26 ` [PATCHv3 2/4] acpi: EJ0 method name patching Michael S. Tsirkin
2011-10-04 13:26 ` [PATCHv3 3/4] acpi: remove _RMV Michael S. Tsirkin
2011-10-04 13:26 ` [PATCHv3 4/4] acpi: automatically generated ssdt proc Michael S. Tsirkin
2011-10-05  2:52   ` Kevin O'Connor
2011-10-05 10:35     ` Michael S. Tsirkin
2011-10-06  2:15       ` Kevin O'Connor
2011-10-17 17:47         ` [SeaBIOS] " Isaku Yamahata
2011-10-18  3:47           ` Kevin O'Connor
2011-10-17 18:16         ` Michael S. Tsirkin
2011-10-13  1:27   ` Kevin O'Connor

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=cover.1317734661.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=akong@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kevin@koconnor.net \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=seabios@seabios.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 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).