File xen.trc-ioreq_server_unmap_io_range.patch of Package xen

From: Olaf Hering <olaf@aepfle.de>
Date: Thu, 15 Jun 2023 08:43:20 +0000
Subject: trc ioreq_server_unmap_io_range

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 xen/common/ioreq.c | 10 +++++++++
 1 file changed, 10 insertions(+)

--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1079,24 +1079,31 @@ static int ioreq_server_map_io_range(struct domain *d, ioservid_t id,
         trc.rc = -rc;
     TRACE_trc(TRC_IOREQ_ioreq_server_map_io_range);
     return rc;
 }
 
 static int ioreq_server_unmap_io_range(struct domain *d, ioservid_t id,
                                        uint32_t type, uint64_t start,
                                        uint64_t end)
 {
     struct ioreq_server *s;
     struct rangeset *r;
     int rc;
+    trc_ioreq_server_unmap_io_range_t trc = {
+        .d = d->domain_id,
+        .id = id,
+        .type = type,
+        .start = start,
+        .end = end,
+    };
 
     if ( start > end )
         return -EINVAL;
 
     rspin_lock(&d->ioreq_server.lock);
 
     s = get_ioreq_server(d, id);
 
     rc = -ENOENT;
     if ( !s )
         goto out;
 
@@ -1121,24 +1128,27 @@ static int ioreq_server_unmap_io_range(struct domain *d, ioservid_t id,
     if ( !r )
         goto out;
 
     rc = -ENOENT;
     if ( !rangeset_contains_range(r, start, end) )
         goto out;
 
     rc = rangeset_remove_range(r, start, end);
 
  out:
     rspin_unlock(&d->ioreq_server.lock);
 
+    if (rc)
+        trc.rc = -rc;
+    TRACE_trc(TRC_IOREQ_ioreq_server_unmap_io_range);
     return rc;
 }
 
 /*
  * Map or unmap an ioreq server to specific memory type. For now, only
  * HVMMEM_ioreq_server is supported, and in the future new types can be
  * introduced, e.g. HVMMEM_ioreq_serverX mapped to ioreq server X. And
  * currently, only write operations are to be forwarded to an ioreq server.
  * Support for the emulation of read operations can be added when an ioreq
  * server has such requirement in the future.
  */
 int ioreq_server_map_mem_type(struct domain *d, ioservid_t id,
openSUSE Build Service is sponsored by