All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richardw.yang@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: yang.zhong@intel.com, ehabkost@redhat.com, mst@redhat.com,
	Wei Yang <richardw.yang@linux.intel.com>,
	pbonzini@redhat.com, imammedo@redhat.com, rth@twiddle.net
Subject: [Qemu-devel] [RFC PATCH 5/9] hw/acpi: implement madt_sub[ACPI_APIC_XRUPT_OVERRIDE]
Date: Mon, 13 May 2019 14:19:09 +0800	[thread overview]
Message-ID: <20190513061913.9284-6-richardw.yang@linux.intel.com> (raw)
In-Reply-To: <20190513061913.9284-1-richardw.yang@linux.intel.com>

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 hw/i386/acpi-build.c | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a661fff51d..f48cc5b292 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -351,10 +351,31 @@ static void pc_madt_io_entry(GArray *entry, void *opaque)
     io_apic->interrupt = cpu_to_le32(0);
 }
 
+static void pc_madt_xrupt_override_entry(GArray *entry, void *opaque)
+{
+    AcpiMadtIntsrcovr *intsrcovr;
+    int *idx = opaque;
+
+    intsrcovr = acpi_data_push(entry, sizeof *intsrcovr);
+    intsrcovr->type   = ACPI_APIC_XRUPT_OVERRIDE;
+    intsrcovr->length = sizeof(*intsrcovr);
+    intsrcovr->source = *idx;
+    if (*idx == 0) {
+        intsrcovr->gsi    = cpu_to_le32(2);
+        /* conforms to bus specifications */
+        intsrcovr->flags = cpu_to_le16(0);
+    } else {
+        intsrcovr->gsi    = cpu_to_le32(*idx);
+        /* active high, level triggered */
+        intsrcovr->flags = cpu_to_le16(0xd);
+    }
+}
+
 madt_operations i386_madt_sub = {
     [ACPI_APIC_PROCESSOR] = pc_madt_apic_entry,
     [ACPI_APIC_LOCAL_X2APIC] = pc_madt_x2apic_entry,
     [ACPI_APIC_IO] = pc_madt_io_entry,
+    [ACPI_APIC_XRUPT_OVERRIDE] = pc_madt_xrupt_override_entry,
 };
 
 static void
@@ -368,7 +389,6 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
     bool x2apic_mode = false;
 
     AcpiMultipleApicTable *madt;
-    AcpiMadtIntsrcovr *intsrcovr;
     int i;
 
     madt = acpi_data_push(table_data, sizeof *madt);
@@ -391,12 +411,8 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
     adevc->madt_sub[ACPI_APIC_IO](table_data, NULL);
 
     if (pcms->apic_xrupt_override) {
-        intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
-        intsrcovr->type   = ACPI_APIC_XRUPT_OVERRIDE;
-        intsrcovr->length = sizeof(*intsrcovr);
-        intsrcovr->source = 0;
-        intsrcovr->gsi    = cpu_to_le32(2);
-        intsrcovr->flags  = cpu_to_le16(0); /* conforms to bus specifications */
+        i = 0;
+        adevc->madt_sub[ACPI_APIC_XRUPT_OVERRIDE](table_data, &i);
     }
     for (i = 1; i < 16; i++) {
 #define ACPI_BUILD_PCI_IRQS ((1<<5) | (1<<9) | (1<<10) | (1<<11))
@@ -404,12 +420,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, PCMachineState *pcms)
             /* No need for a INT source override structure. */
             continue;
         }
-        intsrcovr = acpi_data_push(table_data, sizeof *intsrcovr);
-        intsrcovr->type   = ACPI_APIC_XRUPT_OVERRIDE;
-        intsrcovr->length = sizeof(*intsrcovr);
-        intsrcovr->source = i;
-        intsrcovr->gsi    = cpu_to_le32(i);
-        intsrcovr->flags  = cpu_to_le16(0xd); /* active high, level triggered */
+        adevc->madt_sub[ACPI_APIC_XRUPT_OVERRIDE](table_data, &i);
     }
 
     if (x2apic_mode) {
-- 
2.19.1



  parent reply	other threads:[~2019-05-13  6:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13  6:19 [Qemu-devel] [RFC PATCH 0/9] hw/acpi: make build_madt arch agnostic Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 1/9] hw/acpi: expand pc_madt_cpu_entry in place Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 2/9] hw/acpi: implement madt_sub[ACPI_APIC_PROCESSOR] Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 3/9] hw/acpi: implement madt_sub[ACPI_APIC_LOCAL_X2APIC] Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 4/9] hw/acpi: implement madt_sub[ACPI_APIC_IO] Wei Yang
2019-05-13  6:19 ` Wei Yang [this message]
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 6/9] hw/acpi: implement madt_sub[ACPI_APIC_LOCAL_X2APIC_NMI] Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 7/9] hw/acpi: implement madt_sub[ACPI_APIC_LOCAL_NMI] Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 8/9] hw/acpi: factor build_madt with madt_input Wei Yang
2019-05-13  6:19 ` [Qemu-devel] [RFC PATCH 9/9] hw/acpi: implement madt_main to manipulate main madt table Wei Yang
2019-06-03  6:22 ` [Qemu-devel] [RFC PATCH 0/9] hw/acpi: make build_madt arch agnostic Wei Yang
2019-06-18 15:59 ` Igor Mammedov
2019-06-19  6:20   ` Wei Yang
2019-06-19  9:04     ` Igor Mammedov
2019-06-20 14:18       ` Wei Yang
2019-06-20 15:04         ` Igor Mammedov
2019-06-21  0:56           ` Wei Yang
2019-06-21  8:11             ` Igor Mammedov
2019-06-21 21:33               ` Wei Yang

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=20190513061913.9284-6-richardw.yang@linux.intel.com \
    --to=richardw.yang@linux.intel.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=yang.zhong@intel.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 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.