[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/11] kvm-irqchip: introduce new API to support route change
From: |
Paolo Bonzini |
Subject: |
[PULL 08/11] kvm-irqchip: introduce new API to support route change |
Date: |
Wed, 2 Mar 2022 19:11:31 +0100 |
From: "Longpeng(Mike)" <longpeng2@huawei.com>
Paolo suggested adding the new API to support route changes [1]. We should
invoke
kvm_irqchip_begin_route_changes() before changing the routes, increasing the
KVMRouteChange.changes if the routes are changed, and commit the changes at
last.
[1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg02898.html
Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20220222141116.2091-2-longpeng2@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/sysemu/kvm.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 6eb39a088b..36e6d40191 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -224,6 +224,11 @@ DECLARE_INSTANCE_CHECKER(KVMState, KVM_STATE,
extern KVMState *kvm_state;
typedef struct Notifier Notifier;
+typedef struct KVMRouteChange {
+ KVMState *s;
+ int changes;
+} KVMRouteChange;
+
/* external API */
bool kvm_has_free_slot(MachineState *ms);
@@ -494,6 +499,20 @@ int kvm_irqchip_add_msi_route(KVMState *s, int vector,
PCIDevice *dev);
int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
PCIDevice *dev);
void kvm_irqchip_commit_routes(KVMState *s);
+
+static inline KVMRouteChange kvm_irqchip_begin_route_changes(KVMState *s)
+{
+ return (KVMRouteChange) { .s = s, .changes = 0 };
+}
+
+static inline void kvm_irqchip_commit_route_changes(KVMRouteChange *c)
+{
+ if (c->changes) {
+ kvm_irqchip_commit_routes(c->s);
+ c->changes = 0;
+ }
+}
+
void kvm_irqchip_release_virq(KVMState *s, int virq);
int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter);
--
2.34.1
- [PULL 00/11] QEMU changes for 2021-03-02, Paolo Bonzini, 2022/03/02
- [PULL 02/11] whpx: Fixed incorrect CR8/TPR synchronization, Paolo Bonzini, 2022/03/02
- [PULL 03/11] vmxcap: Add 5-level EPT bit, Paolo Bonzini, 2022/03/02
- [PULL 04/11] meson: fix generic location of vss headers, Paolo Bonzini, 2022/03/02
- [PULL 01/11] whpx: Fixed reporting of the CPU context to GDB for 64-bit, Paolo Bonzini, 2022/03/02
- [PULL 06/11] qga/vss: update informative message about MinGW, Paolo Bonzini, 2022/03/02
- [PULL 05/11] qga/vss-win32: check old VSS SDK headers, Paolo Bonzini, 2022/03/02
- [PULL 07/11] update meson-buildoptions.sh, Paolo Bonzini, 2022/03/02
- [PULL 08/11] kvm-irqchip: introduce new API to support route change,
Paolo Bonzini <=
- [PULL 09/11] kvm/msi: do explicit commit when adding msi routes, Paolo Bonzini, 2022/03/02
- [PULL 11/11] target/i386: Throw a #SS when loading a non-canonical IST, Paolo Bonzini, 2022/03/02
- [PULL 10/11] target/i386: only include bits in pg_mode if they are not ignored, Paolo Bonzini, 2022/03/02
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Peter Maydell, 2022/03/02
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Paolo Bonzini, 2022/03/04
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Peter Maydell, 2022/03/04
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Daniel P . Berrangé, 2022/03/04
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Peter Maydell, 2022/03/04
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Daniel P . Berrangé, 2022/03/04
- Re: [PULL 00/11] QEMU changes for 2021-03-02, Paolo Bonzini, 2022/03/04