Several FF-A paths log warnings for expected or recoverable conditions,
leading to noisy logs during normal operation.

Reduce log noise by:
- demoting unhandled FID warnings to debug
- ratelimiting notification and VM teardown failures
- printing the bit-15 convention warning once per boot
- adjusting log prefixes for hypervisor-only events
- adding debug diagnostics for RX/TX acquire failures, with busy cases
  ratelimited

No functional changes.

Signed-off-by: Bertrand Marquis <[email protected]>
---
 xen/arch/arm/tee/ffa.c          | 11 ++++++-----
 xen/arch/arm/tee/ffa_notif.c    | 11 ++++++-----
 xen/arch/arm/tee/ffa_partinfo.c | 15 ++++++++-------
 xen/arch/arm/tee/ffa_rxtx.c     | 21 +++++++++++++++++++--
 4 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index a46c6e5e67f1..d0b9c9f1ab2e 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -461,7 +461,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         break;
 
     default:
-        gprintk(XENLOG_ERR, "ffa: unhandled fid 0x%x\n", fid);
+        gdprintk(XENLOG_DEBUG, "ffa: unhandled fid 0x%x\n", fid);
         e = FFA_RET_NOT_SUPPORTED;
         break;
     }
@@ -581,7 +581,8 @@ static void ffa_domain_teardown_continue(struct ffa_ctx 
*ctx, bool first_time)
 
     if ( retry )
     {
-        printk(XENLOG_G_INFO "%pd: ffa: Remaining cleanup, retrying\n", 
ctx->teardown_d);
+        printk(XENLOG_G_DEBUG "%pd: ffa: Remaining cleanup, retrying\n",
+               ctx->teardown_d);
 
         ctx->teardown_expire = NOW() + FFA_CTX_TEARDOWN_DELAY;
 
@@ -622,7 +623,7 @@ static void ffa_teardown_timer_callback(void *arg)
     if ( ctx )
         ffa_domain_teardown_continue(ctx, false /* !first_time */);
     else
-        printk(XENLOG_G_ERR "%s: teardown list is empty\n", __func__);
+        printk(XENLOG_ERR "%s: teardown list is empty\n", __func__);
 }
 
 /* This function is supposed to undo what ffa_domain_init() has done */
@@ -684,7 +685,7 @@ static bool ffa_probe_fw(void)
 
     if ( !ffa_get_version(&vers) )
     {
-        gprintk(XENLOG_ERR, "Cannot retrieve the FFA version\n");
+        printk(XENLOG_ERR "ffa: Cannot retrieve the FFA version\n");
         goto err_no_fw;
     }
 
@@ -724,7 +725,7 @@ static bool ffa_probe_fw(void)
             set_bit(FFA_ABI_BITNUM(ffa_fw_abi_needed[i].id),
                     ffa_fw_abi_supported);
         else
-            printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
+            printk(XENLOG_WARNING "ARM FF-A Firmware does not support %s\n",
                    ffa_fw_abi_needed[i].name);
     }
 
diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 37b05747cd21..186e72641237 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -292,8 +292,9 @@ static void notif_vm_pend_intr(uint16_t vm_id)
             break;
         }
     }
-    if ( !v )
-        printk(XENLOG_ERR "ffa: can't inject NPI, all vCPUs offline\n");
+    if ( !v && printk_ratelimit() )
+        printk(XENLOG_G_DEBUG "%pd: ffa: can't inject NPI, all vCPUs 
offline\n",
+               d);
 
 out_unlock:
     rcu_unlock_domain(d);
@@ -316,9 +317,9 @@ static void notif_sri_action(void *unused)
         res = ffa_get_ret_code(&resp);
         if ( res )
         {
-            if ( res != FFA_RET_NO_DATA )
-                printk(XENLOG_ERR "ffa: notification info get failed: error 
%d\n",
-                       res);
+            if ( res != FFA_RET_NO_DATA && printk_ratelimit() )
+                printk(XENLOG_WARNING
+                       "ffa: notification info get failed: error %d\n", res);
             return;
         }
 
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 6b01c4abe915..c9f186b3720c 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -461,9 +461,11 @@ static bool init_subscribers(void *buf, uint16_t count, 
uint32_t fpi_size)
          */
         if ( !FFA_ID_IS_SECURE(fpi->id) )
         {
-            printk(XENLOG_ERR "ffa: Firmware is not using bit 15 convention 
for IDs !!\n"
-                              "ffa: Secure partition with id 0x%04x cannot be 
used\n",
-                              fpi->id);
+            printk_once(XENLOG_ERR
+                        "ffa: Firmware is not using bit 15 convention for IDs 
!!\n");
+            printk(XENLOG_ERR
+                   "ffa: Secure partition with id 0x%04x cannot be used\n",
+                   fpi->id);
         }
         else
         {
@@ -632,11 +634,10 @@ bool ffa_partinfo_domain_destroy(struct domain *d)
         res = ffa_direct_req_send_vm(subscr_vm_destroyed[n], ffa_get_vm_id(d),
                                      FFA_MSG_SEND_VM_DESTROYED);
 
-        if ( res )
-        {
-            printk(XENLOG_ERR "%pd: ffa: Failed to report destruction of vm_id 
%u to %u: res %d\n",
+        if ( res && printk_ratelimit() )
+            printk(XENLOG_WARNING
+                   "%pd: ffa: Failed to report destruction of vm_id %u to %u: 
res %d\n",
                    d, ffa_get_vm_id(d), subscr_vm_destroyed[n], res);
-        }
 
         /*
          * For these two error codes the hypervisor is expected to resend
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index 450ce102cbdc..3147aba21ddf 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -4,6 +4,7 @@
  */
 
 #include <xen/const.h>
+#include <xen/lib.h>
 #include <xen/domain_page.h>
 #include <xen/mm.h>
 #include <xen/sizes.h>
@@ -82,8 +83,9 @@ int32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
 
     if ( page_count > FFA_MAX_RXTX_PAGE_COUNT || !page_count )
     {
-        printk(XENLOG_ERR "ffa: RXTX_MAP: error: %u pages requested (limit 
%u)\n",
-               page_count, FFA_MAX_RXTX_PAGE_COUNT);
+        gdprintk(XENLOG_DEBUG,
+                 "ffa: RXTX_MAP: error: %u pages requested (limit %u)\n",
+                 page_count, FFA_MAX_RXTX_PAGE_COUNT);
         return FFA_RET_INVALID_PARAMETERS;
     }
 
@@ -303,12 +305,15 @@ int32_t ffa_rx_acquire(struct ffa_ctx *ctx, void **buf, 
size_t *buf_size)
     if ( !ctx->page_count )
     {
         ret = FFA_RET_DENIED;
+        gdprintk(XENLOG_DEBUG, "ffa: RX acquire denied, no RX/TX mapped\n");
         goto out;
     }
 
     if ( !ctx->rx_is_free )
     {
         ret = FFA_RET_BUSY;
+        if ( printk_ratelimit() )
+            gdprintk(XENLOG_DEBUG, "ffa: RX acquire busy\n");
         goto out;
     }
 
@@ -316,7 +321,10 @@ int32_t ffa_rx_acquire(struct ffa_ctx *ctx, void **buf, 
size_t *buf_size)
     {
         ret = ffa_simple_call(FFA_RX_ACQUIRE, ctx->ffa_id, 0, 0, 0);
         if ( ret != FFA_RET_OK )
+        {
+            gdprintk(XENLOG_DEBUG, "ffa: RX acquire failed: %d\n", ret);
             goto out;
+        }
     }
     ctx->rx_is_free = false;
     *buf = ctx->rx;
@@ -355,13 +363,22 @@ int32_t ffa_tx_acquire(struct ffa_ctx *ctx, const void 
**buf, size_t *buf_size)
     int32_t ret = FFA_RET_DENIED;
 
     if ( !spin_trylock(&ctx->tx_lock) )
+    {
+        gdprintk(XENLOG_DEBUG, "ffa: TX acquire busy\n");
         return FFA_RET_BUSY;
+    }
 
     if ( !ctx->page_count )
+    {
+        gdprintk(XENLOG_DEBUG, "ffa: TX acquire denied, no RX/TX mapped\n");
         goto err_unlock;
+    }
 
     if ( !ctx->tx )
+    {
+        gdprintk(XENLOG_DEBUG, "ffa: TX acquire denied, TX buffer missing\n");
         goto err_unlock;
+    }
 
     *buf = ctx->tx;
     *buf_size = ctx->page_count * FFA_PAGE_SIZE;
-- 
2.50.1 (Apple Git-155)


Reply via email to