]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
xen/arm: check read handler behavior master staging
authorStewart Hildebrand <stewart.hildebrand@amd.com>
Fri, 18 Apr 2025 18:58:36 +0000 (14:58 -0400)
committerStefano Stabellini <stefano.stabellini@amd.com>
Mon, 5 May 2025 21:38:59 +0000 (14:38 -0700)
We expect mmio read handlers to leave the bits above the access size
zeroed. Add an ASSERT to check this aspect of read handler behavior.

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/io.c

index 653428e16c1f804e26fa0e69476a82ec3fca7dea..5a4b0e8f25c63ca1a41c27387e54d9d798ce9bf0 100644 (file)
@@ -37,6 +37,8 @@ static enum io_state handle_read(const struct mmio_handler *handler,
     if ( !handler->ops->read(v, info, &r, handler->priv) )
         return IO_ABORT;
 
+    ASSERT((r & ~GENMASK((1U << info->dabt.size) * 8 - 1, 0)) == 0);
+
     r = sign_extend(dabt, r);
 
     set_user_reg(regs, dabt.reg, r);