[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 38/44] target/arm: kvm: use RCU_READ_LOCK_GUARD() in kvm_arch_fixu
From: |
Peter Maydell |
Subject: |
[PULL 38/44] target/arm: kvm: use RCU_READ_LOCK_GUARD() in kvm_arch_fixup_msi_route() |
Date: |
Wed, 25 Aug 2021 11:35:28 +0100 |
From: Hamza Mahfooz <someguy@effective-light.com>
As per commit 5626f8c6d468 ("rcu: Add automatically released rcu_read_lock
variants"), RCU_READ_LOCK_GUARD() should be used instead of
rcu_read_{un}lock().
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20210727235201.11491-1-someguy@effective-light.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/kvm.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index d8381ba2245..5d55de1a493 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -998,7 +998,6 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry
*route,
hwaddr xlat, len, doorbell_gpa;
MemoryRegionSection mrs;
MemoryRegion *mr;
- int ret = 1;
if (as == &address_space_memory) {
return 0;
@@ -1006,15 +1005,19 @@ int kvm_arch_fixup_msi_route(struct
kvm_irq_routing_entry *route,
/* MSI doorbell address is translated by an IOMMU */
- rcu_read_lock();
+ RCU_READ_LOCK_GUARD();
+
mr = address_space_translate(as, address, &xlat, &len, true,
MEMTXATTRS_UNSPECIFIED);
+
if (!mr) {
- goto unlock;
+ return 1;
}
+
mrs = memory_region_find(mr, xlat, 1);
+
if (!mrs.mr) {
- goto unlock;
+ return 1;
}
doorbell_gpa = mrs.offset_within_address_space;
@@ -1025,11 +1028,7 @@ int kvm_arch_fixup_msi_route(struct
kvm_irq_routing_entry *route,
trace_kvm_arm_fixup_msi_route(address, doorbell_gpa);
- ret = 0;
-
-unlock:
- rcu_read_unlock();
- return ret;
+ return 0;
}
int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
--
2.20.1
- [PULL 31/44] target/arm: Implement MVE VPNOT, (continued)
- [PULL 31/44] target/arm: Implement MVE VPNOT, Peter Maydell, 2021/08/25
- [PULL 29/44] target/arm: Implement MVE VMAXA, VMINA, Peter Maydell, 2021/08/25
- [PULL 30/44] target/arm: Implement MVE VMOV to/from 2 general-purpose registers, Peter Maydell, 2021/08/25
- [PULL 28/44] target/arm: Implement MVE VQABS, VQNEG, Peter Maydell, 2021/08/25
- [PULL 33/44] target/arm: Implement MVE scatter-gather insns, Peter Maydell, 2021/08/25
- [PULL 36/44] target/arm: Re-indent sdiv and udiv helpers, Peter Maydell, 2021/08/25
- [PULL 34/44] target/arm: Implement MVE scatter-gather immediate forms, Peter Maydell, 2021/08/25
- [PULL 24/44] target/arm: Rename MVEGenDualAccOpFn to MVEGenLongDualAccOpFn, Peter Maydell, 2021/08/25
- [PULL 32/44] target/arm: Implement MVE VCTP, Peter Maydell, 2021/08/25
- [PULL 35/44] target/arm: Implement MVE interleaving loads/stores, Peter Maydell, 2021/08/25
- [PULL 38/44] target/arm: kvm: use RCU_READ_LOCK_GUARD() in kvm_arch_fixup_msi_route(),
Peter Maydell <=
- [PULL 37/44] target/arm: Implement M-profile trapping on division by zero, Peter Maydell, 2021/08/25
- [PULL 40/44] fsl-imx6ul: Instantiate SAI1/2/3 and ASRC as unimplemented devices, Peter Maydell, 2021/08/25
- [PULL 43/44] fsl-imx7: Instantiate SAI1/2/3 as unimplemented devices, Peter Maydell, 2021/08/25
- [PULL 39/44] hw/char/pl011: add support for sending break, Peter Maydell, 2021/08/25
- [PULL 44/44] docs: Document how to use gdb with unix sockets, Peter Maydell, 2021/08/25
- [PULL 41/44] hw/dma/pl330: Add memory region to replace default, Peter Maydell, 2021/08/25
- [PULL 42/44] sbsa-ref: Rename SBSA_GWDT enum value, Peter Maydell, 2021/08/25
- Re: [PULL 00/44] target-arm queue, Peter Maydell, 2021/08/25