qemu-arm
[Top][All Lists]
Advanced

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

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


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 04/15] target/arm: ensure KVM traps set appropriate MemTxAttrs
Date: Wed, 19 Oct 2022 12:44:15 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2

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@linaro.org>

---
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@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]