~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/kvm/include/s390x/debug_print.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Definition for kernel virtual machines on s390x
  4  *
  5  * Copyright IBM Corp. 2024
  6  *
  7  * Authors:
  8  *  Christoph Schlameuss <schlameuss@linux.ibm.com>
  9  */
 10 
 11 #ifndef SELFTEST_KVM_DEBUG_PRINT_H
 12 #define SELFTEST_KVM_DEBUG_PRINT_H
 13 
 14 #include "asm/ptrace.h"
 15 #include "kvm_util.h"
 16 #include "sie.h"
 17 
 18 static inline void print_hex_bytes(const char *name, u64 addr, size_t len)
 19 {
 20         u64 pos;
 21 
 22         pr_debug("%s (%p)\n", name, (void *)addr);
 23         pr_debug("            0/0x00---------|");
 24         if (len > 8)
 25                 pr_debug(" 8/0x08---------|");
 26         if (len > 16)
 27                 pr_debug(" 16/0x10--------|");
 28         if (len > 24)
 29                 pr_debug(" 24/0x18--------|");
 30         for (pos = 0; pos < len; pos += 8) {
 31                 if ((pos % 32) == 0)
 32                         pr_debug("\n %3lu 0x%.3lx ", pos, pos);
 33                 pr_debug(" %16lx", *((u64 *)(addr + pos)));
 34         }
 35         pr_debug("\n");
 36 }
 37 
 38 static inline void print_hex(const char *name, u64 addr)
 39 {
 40         print_hex_bytes(name, addr, 512);
 41 }
 42 
 43 static inline void print_psw(struct kvm_run *run, struct kvm_s390_sie_block *sie_block)
 44 {
 45         pr_debug("flags:0x%x psw:0x%.16llx:0x%.16llx exit:%u %s\n",
 46                  run->flags,
 47                  run->psw_mask, run->psw_addr,
 48                  run->exit_reason, exit_reason_str(run->exit_reason));
 49         pr_debug("sie_block psw:0x%.16llx:0x%.16llx\n",
 50                  sie_block->psw_mask, sie_block->psw_addr);
 51 }
 52 
 53 static inline void print_run(struct kvm_run *run, struct kvm_s390_sie_block *sie_block)
 54 {
 55         print_hex_bytes("run", (u64)run, 0x150);
 56         print_hex("sie_block", (u64)sie_block);
 57         print_psw(run, sie_block);
 58 }
 59 
 60 static inline void print_regs(struct kvm_run *run)
 61 {
 62         struct kvm_sync_regs *sync_regs = &run->s.regs;
 63 
 64         print_hex_bytes("GPRS", (u64)sync_regs->gprs, 8 * NUM_GPRS);
 65         print_hex_bytes("ACRS", (u64)sync_regs->acrs, 4 * NUM_ACRS);
 66         print_hex_bytes("CRS", (u64)sync_regs->crs, 8 * NUM_CRS);
 67 }
 68 
 69 #endif /* SELFTEST_KVM_DEBUG_PRINT_H */
 70 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php