]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Move mmio_parse and struct mmio_instruction into arch header
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 1 Oct 2014 15:51:57 +0000 (17:51 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 6 Nov 2014 22:05:32 +0000 (23:05 +0100)
There will be no need for and implementation of this service outside of
x86 in the foreseeable future. So make it arch-private until we have
more users.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/arm/include/asm/mmio.h [new file with mode: 0644]
hypervisor/arch/x86/apic.c
hypervisor/arch/x86/include/asm/io.h
hypervisor/arch/x86/include/asm/mmio.h [new file with mode: 0644]
hypervisor/arch/x86/mmio.c
hypervisor/arch/x86/vcpu.c
hypervisor/include/jailhouse/mmio.h

diff --git a/hypervisor/arch/arm/include/asm/mmio.h b/hypervisor/arch/arm/include/asm/mmio.h
new file mode 100644 (file)
index 0000000..e69de29
index 775a6c57457e3cac8bc0b3893cada7bf5734b631..42fd921c95c0d7348def087a9f50f62c0a5d7bf3 100644 (file)
@@ -400,7 +400,7 @@ unsigned int apic_mmio_access(struct registers *guest_regs,
        struct mmio_instruction inst;
        u32 val;
 
-       inst = mmio_parse(rip, pg_structs, is_write);
+       inst = x86_mmio_parse(rip, pg_structs, is_write);
        if (inst.inst_len == 0)
                return 0;
        if (inst.access_size != 4) {
index 8b7fc03d2addcd10f5e2f5df274ee2d88a40ff46..2d33d88f2b9c820b5109c68d5f68bfad0c891a82 100644 (file)
@@ -14,7 +14,7 @@
 
 /**
  * @ingroup IO
- * @defgroup PIO x86 I/O Accessors
+ * @defgroup IO-X86 x86
  * @{
  */
 
diff --git a/hypervisor/arch/x86/include/asm/mmio.h b/hypervisor/arch/x86/include/asm/mmio.h
new file mode 100644 (file)
index 0000000..72aecab
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2014
+ *
+ * Authors:
+ *  Jan Kiszka <jan.kiszka@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/paging.h>
+
+/**
+ * @ingroup IO
+ * @addtogroup IO-X86 x86
+ * @{
+ */
+
+/** Information about MMIO instruction performing an access. */
+struct mmio_instruction {
+       /** Length of the MMIO access instruction, 0 for invalid or unsupported
+        * access. */
+       unsigned int inst_len;
+       /** Size of the access. */
+       unsigned int access_size;
+       /** Number of the register that holds the output value or should
+        * receive the input. */
+       unsigned int reg_num;
+};
+
+/**
+ * Parse instruction causing an intercepted MMIO access on a cell CPU.
+ * @param pc           Program counter of the access instruction.
+ * @param pg_structs   Currently active guest (cell) paging structures.
+ * @param is_write     True if write access, false for read.
+ *
+ * @return MMIO instruction information. mmio_instruction::inst_len is 0 on
+ *        invalid or unsupported access.
+ */
+struct mmio_instruction x86_mmio_parse(unsigned long pc,
+       const struct guest_paging_structures *pg_structs, bool is_write);
+
+/** @} */
index 3ae8714eaf3727fc2ed94a0e6dab2f339789b413..eb5f61e8de151734a7f2fe4ef8f9d97cfb7520e6 100644 (file)
@@ -72,9 +72,8 @@ static bool ctx_advance(struct parse_context *ctx,
        return ctx_maybe_get_bytes(ctx, pc, pg);
 }
 
-struct mmio_instruction
-mmio_parse(unsigned long pc, const struct guest_paging_structures *pg_structs,
-          bool is_write)
+struct mmio_instruction x86_mmio_parse(unsigned long pc,
+       const struct guest_paging_structures *pg_structs, bool is_write)
 {
        struct parse_context ctx = { .remaining = X86_MAX_INST_LEN };
        struct mmio_instruction inst = { .inst_len = 0 };
index e793a69a64cb6e27fade5abc88820890ede164c1..dab0746807c29861e462c5e23bfafaa778afb608 100644 (file)
@@ -204,7 +204,7 @@ bool vcpu_handle_pt_violation(struct registers *guest_regs,
        if (!vcpu_get_guest_paging_structs(&pg_structs))
                goto invalid_access;
 
-       inst = mmio_parse(x_state.rip, &pg_structs, pf->is_write);
+       inst = x86_mmio_parse(x_state.rip, &pg_structs, pf->is_write);
        if (!inst.inst_len || inst.access_size != 4)
                goto invalid_access;
 
index b2b935ba7fc685c888c69ae23afab9cf860f4a1b..4c828a20d77b365fc0595565e49b66a33774c107 100644 (file)
 #ifndef _JAILHOUSE_MMIO_H
 #define _JAILHOUSE_MMIO_H
 
-#include <jailhouse/paging.h>
+#include <jailhouse/types.h>
+#include <asm/mmio.h>
 
 /**
  * @defgroup IO I/O Access Subsystem
  *
- * This subsystem provides accessors to I/O and supports the interpretation of
- * intercepted I/O accesses of cells.
+ * This subsystem provides accessors to I/O and supports the interpretation and
+ * handling of intercepted I/O accesses performed by cells.
  *
  * @{
  */
 
-/** Information about MMIO instruction performing an access. */
-struct mmio_instruction {
-       /** Length of the MMIO access instruction, 0 for invalid or unsupported
-        * access. */
-       unsigned int inst_len;
-       /** Size of the access. */
-       unsigned int access_size;
-       /** Architecture-specific number of the register that holds the output
-        * value or should receive the input. */
-       unsigned int reg_num;
-};
-
 /**
  * Define MMIO read accessor.
  * @param size         Access size.
@@ -126,18 +115,5 @@ static inline void mmio_write64_field(void *address, u64 mask, u64 value)
 }
 /** @} */
 
-/**
- * Parse instruction causing an intercepted MMIO access on a cell CPU.
- * @param pc           Program counter of the access instruction.
- * @param pg_structs   Currently active guest (cell) paging structures.
- * @param is_write     True if write access, false for read.
- *
- * @return MMIO instruction information. mmio_instruction::inst_len is 0 on
- *        invalid or unsupported access.
- */
-struct mmio_instruction
-mmio_parse(unsigned long pc, const struct guest_paging_structures *pg_structs,
-          bool is_write);
-
 /** @} */
 #endif /* !_JAILHOUSE_MMIO_H */