From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Sergio Lopez" <slp@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
kvm@vger.kernel.org, "Paul Durrant" <paul@xen.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
xen-devel@lists.xenproject.org,
"Anthony Perard" <anthony.perard@citrix.com>,
"Igor Mammedov" <imammedo@redhat.com>,
qemu-block@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Richard Henderson" <rth@twiddle.net>
Subject: [PATCH 11/12] hw/i386/pc: Move x86_machine_allocate_cpu_irq() to 'hw/i386/x86.c'
Date: Fri, 13 Dec 2019 17:17:52 +0100 [thread overview]
Message-ID: <20191213161753.8051-12-philmd@redhat.com> (raw)
In-Reply-To: <20191213161753.8051-1-philmd@redhat.com>
Keep 'pc.c' for PC-machine specific code, and use 'x86.c' for code
used by all the X86-based machines.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/hw/i386/pc.h | 1 -
include/hw/i386/x86.h | 2 ++
hw/i386/pc.c | 27 ---------------------------
hw/i386/x86.c | 30 ++++++++++++++++++++++++++++++
4 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 244dbf2ec0..2ef6e2cfff 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -198,7 +198,6 @@ void pc_memory_init(PCMachineState *pcms,
MemoryRegion *rom_memory,
MemoryRegion **ram_memory);
uint64_t pc_pci_hole64_start(void);
-qemu_irq x86_machine_allocate_cpu_irq(void);
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
ISADevice **rtc_state,
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 4b84917885..4c3dd6f33e 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -95,4 +95,6 @@ void x86_load_linux(X86MachineState *x86ms,
bool pvh_enabled,
bool linuxboot_dma_enabled);
+qemu_irq x86_machine_allocate_cpu_irq(void);
+
#endif
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 4defee274f..4c018735b0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -412,28 +412,6 @@ int cpu_get_pic_interrupt(CPUX86State *env)
return intno;
}
-static void pic_irq_request(void *opaque, int irq, int level)
-{
- CPUState *cs = first_cpu;
- X86CPU *cpu = X86_CPU(cs);
-
- trace_x86_pic_interrupt(irq, level);
- if (cpu->apic_state && !kvm_irqchip_in_kernel()) {
- CPU_FOREACH(cs) {
- cpu = X86_CPU(cs);
- if (apic_accept_pic_intr(cpu->apic_state)) {
- apic_deliver_pic_intr(cpu->apic_state, level);
- }
- }
- } else {
- if (level) {
- cpu_interrupt(cs, CPU_INTERRUPT_HARD);
- } else {
- cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
- }
- }
-}
-
/* PC cmos mappings */
#define REG_EQUIPMENT_BYTE 0x14
@@ -1282,11 +1260,6 @@ uint64_t pc_pci_hole64_start(void)
return ROUND_UP(hole64_start, 1 * GiB);
}
-qemu_irq x86_machine_allocate_cpu_irq(void)
-{
- return qemu_allocate_irq(pic_irq_request, NULL, 0);
-}
-
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
{
DeviceState *dev = NULL;
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 394edc2f72..a6a394ca36 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -34,6 +34,7 @@
#include "sysemu/numa.h"
#include "sysemu/replay.h"
#include "sysemu/sysemu.h"
+#include "sysemu/kvm.h"
#include "hw/i386/x86.h"
#include "target/i386/cpu.h"
@@ -41,11 +42,13 @@
#include "hw/i386/fw_cfg.h"
#include "hw/acpi/cpu_hotplug.h"
+#include "hw/irq.h"
#include "hw/nmi.h"
#include "hw/loader.h"
#include "multiboot.h"
#include "elf.h"
#include "standard-headers/asm-x86/bootparam.h"
+#include "trace.h"
#define BIOS_FILENAME "bios.bin"
@@ -206,6 +209,33 @@ static void x86_nmi(NMIState *n, int cpu_index, Error **errp)
}
}
+static void pic_irq_request(void *opaque, int irq, int level)
+{
+ CPUState *cs = first_cpu;
+ X86CPU *cpu = X86_CPU(cs);
+
+ trace_x86_pic_interrupt(irq, level);
+ if (cpu->apic_state && !kvm_irqchip_in_kernel()) {
+ CPU_FOREACH(cs) {
+ cpu = X86_CPU(cs);
+ if (apic_accept_pic_intr(cpu->apic_state)) {
+ apic_deliver_pic_intr(cpu->apic_state, level);
+ }
+ }
+ } else {
+ if (level) {
+ cpu_interrupt(cs, CPU_INTERRUPT_HARD);
+ } else {
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
+ }
+ }
+}
+
+qemu_irq x86_machine_allocate_cpu_irq(void)
+{
+ return qemu_allocate_irq(pic_irq_request, NULL, 0);
+}
+
static long get_file_size(FILE *f)
{
long where, size;
--
2.21.0
next prev parent reply other threads:[~2019-12-13 21:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 16:17 [PATCH 00/12] hw/i386/pc: Move PC-machine specific declarations to 'pc_internal.h' Philippe Mathieu-Daudé
2019-12-13 16:17 ` [PATCH 01/12] hw/i386/pc: Convert DPRINTF() to trace events Philippe Mathieu-Daudé
2019-12-13 16:17 ` [PATCH 02/12] hw/i386/pc: Move kvm_i8259_init() declaration to sysemu/kvm.h Philippe Mathieu-Daudé
2019-12-13 16:17 ` [PATCH 03/12] hw/i386/pc: Remove obsolete pc_pci_device_init() declaration Philippe Mathieu-Daudé
2019-12-16 13:08 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 04/12] hw/i386/pc: Remove obsolete cpu_set_smm_t typedef Philippe Mathieu-Daudé
2019-12-16 13:09 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 05/12] hw/i386/ich9: Remove unused include Philippe Mathieu-Daudé
2019-12-16 13:11 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 06/12] hw/i386/ich9: Move unnecessary "pci_bridge.h" include Philippe Mathieu-Daudé
2019-12-16 13:11 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 07/12] hw/ide/piix: Remove superfluous DEVICE() cast Philippe Mathieu-Daudé
2019-12-16 13:11 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 08/12] hw/ide/piix: Use ARRAY_SIZE() instead of magic numbers Philippe Mathieu-Daudé
2019-12-16 13:11 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 09/12] hw/intc/ioapic: Make ioapic_print_redtbl() static Philippe Mathieu-Daudé
2019-12-16 13:11 ` Paolo Bonzini
2019-12-13 16:17 ` [PATCH 10/12] hw/i386/pc: Rename allocate_cpu_irq from 'pc' to 'x86_machine' Philippe Mathieu-Daudé
2019-12-13 16:17 ` Philippe Mathieu-Daudé [this message]
2019-12-13 16:17 ` [PATCH 12/12] hw/i386/pc: Move PC-machine specific declarations to 'pc_internal.h' Philippe Mathieu-Daudé
2019-12-13 16:47 ` Philippe Mathieu-Daudé
2019-12-15 9:58 ` Michael S. Tsirkin
2019-12-16 15:37 ` Philippe Mathieu-Daudé
2019-12-16 15:41 ` Paolo Bonzini
2019-12-16 15:48 ` Philippe Mathieu-Daudé
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=20191213161753.8051-12-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=anthony.perard@citrix.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=jsnow@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=slp@redhat.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).