qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jon Doron <arilou@gmail.com>
To: qemu-devel@nongnu.org
Cc: Evgeny Yakovlev <eyakovlev@virtuozzo.com>,
	ehabkost@redhat.com, Roman Kagan <rkagan@virtuozzo.com>,
	pbonzini@redhat.com, vkuznets@redhat.com,
	Jon Doron <arilou@gmail.com>
Subject: [PATCH v1 5/5] i386: Hyper-V VMBus ACPI DSDT entry
Date: Fri,  3 Apr 2020 17:23:08 +0300	[thread overview]
Message-ID: <20200403142308.82990-6-arilou@gmail.com> (raw)
In-Reply-To: <20200403142308.82990-1-arilou@gmail.com>

Guest OS uses ACPI to discover vmbus presence.  Add a corresponding
entry to DSDT in case vmbus has been enabled.

Experimentally Windows guests were found to require this entry to
include two IRQ resources, so this patch adds two semi-arbitrarily
chosen ones (7 and 13).  This results, in particular, in parallel port
conflicting with vmbus.

TODO: discover and use spare IRQs to avoid conflicts.

Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Jon Doron <arilou@gmail.com>
---
 hw/i386/acpi-build.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2a7e55bae7..6d7fdbbe9b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -43,6 +43,7 @@
 #include "hw/acpi/tpm.h"
 #include "hw/acpi/vmgenid.h"
 #include "hw/boards.h"
+#include "hw/vmbus/vmbus.h"
 #include "sysemu/tpm_backend.h"
 #include "hw/rtc/mc146818rtc_regs.h"
 #include "migration/vmstate.h"
@@ -1270,6 +1271,43 @@ static Aml *build_com_device_aml(uint8_t uid)
     return dev;
 }
 
+static Aml *build_vmbus_device_aml(void)
+{
+    Aml *dev;
+    Aml *method;
+    Aml *crs;
+
+    dev = aml_device("VMBS");
+    aml_append(dev, aml_name_decl("STA", aml_int(0xF)));
+    aml_append(dev, aml_name_decl("_HID", aml_string("VMBus")));
+    aml_append(dev, aml_name_decl("_UID", aml_int(0x0)));
+    aml_append(dev, aml_name_decl("_DDN", aml_string("VMBUS")));
+
+    method = aml_method("_DIS", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(aml_and(aml_name("STA"), aml_int(0xD), NULL),
+                                     aml_name("STA")));
+    aml_append(dev, method);
+
+    method = aml_method("_PS0", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(aml_or(aml_name("STA"), aml_int(0xF), NULL),
+                                     aml_name("STA")));
+    aml_append(dev, method);
+
+    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
+    aml_append(method, aml_store(aml_name("STA"), aml_local(0)));
+    aml_append(method, aml_return(aml_local(0)));
+    aml_append(dev, method);
+
+    aml_append(dev, aml_name_decl("_PS3", aml_int(0x0)));
+
+    crs = aml_resource_template();
+    aml_append(crs, aml_irq_no_flags(7));
+    aml_append(crs, aml_irq_no_flags(13));
+    aml_append(dev, aml_name_decl("_CRS", crs));
+
+    return dev;
+}
+
 static void build_isa_devices_aml(Aml *table)
 {
     ISADevice *fdc = pc_find_fdc0();
@@ -1296,6 +1334,10 @@ static void build_isa_devices_aml(Aml *table)
         build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA");
     }
 
+    if (vmbus_exists()) {
+        aml_append(scope, build_vmbus_device_aml());
+    }
+
     aml_append(table, scope);
 }
 
-- 
2.24.1



  parent reply	other threads:[~2020-04-03 14:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 14:23 [PATCH v1 0/5] hyperv: VMBus implementation Jon Doron
2020-04-03 14:23 ` [PATCH v1 1/5] hyperv: expose API to determine if synic is enabled Jon Doron
2020-04-03 14:23 ` [PATCH v1 2/5] hyperv: SControl is optional to enable SynIc Jon Doron
2020-04-03 14:23 ` [PATCH v1 3/5] vmbus: add vmbus protocol definitions Jon Doron
2020-04-03 14:23 ` [PATCH v1 4/5] vmbus: vmbus implementation Jon Doron
2020-04-03 14:23 ` Jon Doron [this message]
2020-04-03 14:56   ` [PATCH v1 5/5] i386: Hyper-V VMBus ACPI DSDT entry Maciej S. Szmigiero
2020-04-03 15:06     ` Jon Doron
2020-04-03 15:30       ` Jon Doron
2020-04-03 15:50         ` Maciej S. Szmigiero
2020-04-03 17:18         ` Maciej S. Szmigiero
2020-04-03 21:00           ` Maciej S. Szmigiero
2020-04-06  7:32             ` Roman Kagan
2020-04-06  8:20               ` Jon Doron
2020-04-07 18:56                 ` Roman Kagan
2020-04-07 19:03                   ` Maciej S. Szmigiero
2020-04-08  4:16                     ` Jon Doron
2020-04-08 20:47                       ` Roman Kagan
2020-04-09  3:35                         ` Jon Doron
2020-05-12 14:05                           ` Roman Kagan
2020-05-12 15:01                             ` Jon Doron
2020-05-12 15:05                               ` Jon Doron
2020-04-08 20:26                     ` Roman Kagan
2020-04-08 21:42                       ` Maciej S. Szmigiero
2020-04-06 10:14   ` Igor Mammedov
2020-04-03 22:48 ` [PATCH v1 0/5] hyperv: VMBus implementation no-reply

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=20200403142308.82990-6-arilou@gmail.com \
    --to=arilou@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=eyakovlev@virtuozzo.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.com \
    --cc=vkuznets@redhat.com \
    /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).