Re: [PATCH v3 04/15] target/arm: ensure KVM traps set appropriate MemTxAttrs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/9/22 16:14, Alex Bennée wrote:
Although most KVM users will use the in-kernel GIC emulation it is
perfectly possible not to. In this case we need to ensure the
MemTxAttrs are correctly populated so the GIC can divine the source
CPU of the operation.

Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx>

---
v3
   - new for v3
---
  target/arm/kvm.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)

  void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
@@ -1003,6 +1004,10 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
      hwaddr xlat, len, doorbell_gpa;
      MemoryRegionSection mrs;
      MemoryRegion *mr;
+    MemTxAttrs attrs = {
+        .requester_type = MTRT_PCI,
+        .requester_id = pci_requester_id(dev)
+    };

Can we add a MEMTXATTRS_PCI() macro similar to MEMTXATTRS_CPU()?

  #define MEMTXATTRS_PCI(pci_dev) ((MemTxAttrs) \
                            {.requester_type = MTRT_PCI, \
                             .requester_id = pci_requester_id(pci_dev)})

So here we can use:

  MemTxAttrs attrs = MEMTXATTRS_PCI(dev);

@@ -1012,8 +1017,7 @@ int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
RCU_READ_LOCK_GUARD(); - mr = address_space_translate(as, address, &xlat, &len, true,
-                                 MEMTXATTRS_UNSPECIFIED);
+    mr = address_space_translate(as, address, &xlat, &len, true, attrs);
if (!mr) {
          return 1;

Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux