Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/x86 Redo previous the correct way: Xen expects ...



details:   https://anonhg.NetBSD.org/src/rev/41222c2971e5
branches:  trunk
changeset: 781131:41222c2971e5
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Aug 21 09:06:02 2012 +0000

description:
Redo previous the correct way: Xen expects a u_long * for vcpumask,
so use 2 uint32_t on LP64.

diffstat:

 sys/arch/xen/x86/x86_xpmap.c |  29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diffs (79 lines):

diff -r 5e965bf0d022 -r 41222c2971e5 sys/arch/xen/x86/x86_xpmap.c
--- a/sys/arch/xen/x86/x86_xpmap.c      Tue Aug 21 08:25:21 2012 +0000
+++ b/sys/arch/xen/x86/x86_xpmap.c      Tue Aug 21 09:06:02 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_xpmap.c,v 1.47 2012/08/21 01:17:46 rmind Exp $     */
+/*     $NetBSD: x86_xpmap.c,v 1.48 2012/08/21 09:06:02 bouyer Exp $    */
 
 /*
  * Copyright (c) 2006 Mathieu Ropert <mro%adviseo.fr@localhost>
@@ -69,7 +69,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.47 2012/08/21 01:17:46 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.48 2012/08/21 09:06:02 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -118,6 +118,19 @@
 #define HYPERVISOR_mmu_update_self(req, count, success_count) \
        HYPERVISOR_mmu_update((req), (count), (success_count), DOMID_SELF)
 
+/*
+ * kcpuset internally uses an array of uint32_t while xen uses an array of
+ * u_long. As we're little-endian we can cast one to the other.
+ */
+typedef union {
+#ifdef _LP64
+       uint32_t xcpum_km[2];
+#else
+       uint32_t xcpum_km[1];
+#endif 
+       u_long   xcpum_xm;
+} xcpumask_t;
+
 void
 xen_failsafe_handler(void)
 {
@@ -364,17 +377,17 @@
 void
 xen_mcast_invlpg(vaddr_t va, kcpuset_t *kc)
 {
-       uint32_t xcpumask = 0;
+       xcpumask_t xcpumask;
        mmuext_op_t op;
 
-       kcpuset_copybits(kc, &xcpumask, sizeof(xcpumask));
+       kcpuset_copybits(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask));
 
        /* Flush pending page updates */
        xpq_flush_queue();
 
        op.cmd = MMUEXT_INVLPG_MULTI;
        op.arg1.linear_addr = va;
-       op.arg2.vcpumask = &xcpumask;
+       op.arg2.vcpumask = &xcpumask.xcpum_xm;
 
        if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) {
                panic("xpq_queue_invlpg_all");
@@ -405,16 +418,16 @@
 void
 xen_mcast_tlbflush(kcpuset_t *kc)
 {
-       uint32_t xcpumask = 0;
+       xcpumask_t xcpumask;
        mmuext_op_t op;
 
-       kcpuset_copybits(kc, &xcpumask, sizeof(xcpumask));
+       kcpuset_copybits(kc, &xcpumask.xcpum_km[0], sizeof(xcpumask));
 
        /* Flush pending page updates */
        xpq_flush_queue();
 
        op.cmd = MMUEXT_TLB_FLUSH_MULTI;
-       op.arg2.vcpumask = &xcpumask;
+       op.arg2.vcpumask = &xcpumask.xcpum_xm;
 
        if (HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0) {
                panic("xpq_queue_invlpg_all");



Home | Main Index | Thread Index | Old Index