WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] One more fix for the forward port

To: Hollis Blanchard <hollisb@xxxxxxxxxx>
Subject: Re: [XenPPC] One more fix for the forward port
From: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Jun 2007 15:53:32 +0200
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 21 Jun 2007 06:51:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1182280864.9062.71.camel@basalt>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4677C2DE.8040703@xxxxxxxxxxxxxxxxxx> <1182280864.9062.71.camel@basalt>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070301)
Additionally to my last mail following "updates_to_1bf85f927393" patch is needed to be compatible to the source of http://xenbits.xensource.com/linux-2.6.18-xen.hg as it is today (our forward port base is now ~3.5 weeks old). I made this patch quickly and would be happy if someone would take a short review (I'm not very experienced in powerpc dma implementations and that's where the patch takes place).

Everyone who wants to play with our patchset before we commit it will also need some xen changes. I stripped all the debug code from our latest changes and made a patch that will just enable the needed functionality - it' called xen_powerpc_2.6.18.diff



Hollis Blanchard wrote:
On Tue, 2007-06-19 at 13:49 +0200, Christian Ehrhardt wrote:
The DomU now boots without visible issues, but at least on my system
networking in DomU does not yet work - the DomU tihnk its working, but
I can't get a connection from/to Dom0.
@Hollis - currently you are the only one except me who has an
up-to-date forward port patch queue - could you please verify if this
is only an issue of my local setup by applying all my latest patches
and see what works in your environment.

Networking seems to be OK here. I'm using a very stripped down disk
image for domU (actually I'm using
http://xm-test.xensource.com/ramdisks/initrd-1.1-powerpc.img), so I
haven't tested it heavily, but I can manually assign an unused IP
address and ping both into and out of the domU. My domain profile
contains "vif = [ '' ]", and so xend automatically creates a vif and
bridges it to the physical network.

I'm attaching the full MQ patch series to this mail. To use it, clone
http://xenbits.xensource.com/linux-2.6.18-xen.hg , extract the tarball
inside that directory (it creates .hg/patches), and hg qpush -a. If
you're not already an MQ user, see
http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension or just
patch by hand.

I haven't figured out how to effectively share this queue, but since I
think it's pretty much done at this point, we'll be able to commit and
send upstream soon (but I will be traveling until July, so not too
soon).


--

Grüsse / regards, Christian Ehrhardt

IBM Linux Technology Center, Open Virtualization
+49 7031/16-3385
Ehrhardt@xxxxxxxxxxxxxxxxxx
Ehrhardt@xxxxxxxxxx

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

diff -r 1bf85f927393 include/asm-powerpc/io.h
--- a/include/asm-powerpc/io.h  Thu Jun 21 08:04:49 2007 +0200
+++ b/include/asm-powerpc/io.h  Thu Jun 21 10:31:39 2007 +0200
@@ -248,11 +248,13 @@ static inline void * phys_to_virt(unsign
 {
        return (void *)__va(address);
 }
+#define bus_to_virt phys_to_virt
 
 /*
  * Change "struct page" to physical address.
  */
 #define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
+#define page_to_bus page_to_phys
 
 /* We do NOT want virtual merging, it would put too much pressure on
  * our iommu allocator. Instead, we want drivers to be smart enough
diff -r 1bf85f927393 include/asm-powerpc/xen/asm/hypercall.h
--- a/include/asm-powerpc/xen/asm/hypercall.h   Thu Jun 21 08:04:49 2007 +0200
+++ b/include/asm-powerpc/xen/asm/hypercall.h   Thu Jun 21 09:56:55 2007 +0200
@@ -72,6 +72,9 @@ static inline unsigned long HYPERVISOR_h
        return -ENOSYS;
 }
 
+/* to compile gnttab_copy_grant_page() in drivers/xen/core/gnttab.c */
+#define HYPERVISOR_mmu_update(req, count, success_count, domid) ({BUG();0;})
+
 struct privcmd_hypercall;
 extern int privcmd_hypercall(struct privcmd_hypercall *hypercall);
 
diff -r 1bf85f927393 include/asm-powerpc/xen/asm/hypervisor.h
--- a/include/asm-powerpc/xen/asm/hypervisor.h  Thu Jun 21 08:04:49 2007 +0200
+++ b/include/asm-powerpc/xen/asm/hypervisor.h  Thu Jun 21 08:26:48 2007 +0200
@@ -131,6 +131,7 @@ int direct_remap_pfn_range(struct vm_are
 #define        pfn_to_mfn(x)   (x)
 #define        mfn_to_pfn(x)   (x)
 #define phys_to_machine(phys) ((maddr_t)(phys))
+#define phys_to_machine_mapping_valid(pfn) (1)
 
 /* VIRT <-> MACHINE conversion */
 #define virt_to_machine(v)     (phys_to_machine(__pa(v)))
@@ -239,6 +240,7 @@ static inline void set_phys_to_machine(u
 #define pfn_pte_ma(pfn, prot)  __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 
 typedef unsigned long maddr_t;
+typedef unsigned long paddr_t;
 
 #ifdef CONFIG_XEN_SCRUB_PAGES
 
diff -r 005dd6b1cf8e xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/domain.c Thu Jun 21 10:57:02 2007 +0200
@@ -88,7 +88,7 @@ int arch_domain_create(struct domain *d)
     d->arch.large_page_sizes = cpu_large_page_orders(
         d->arch.large_page_order, ARRAY_SIZE(d->arch.large_page_order));
 
-    d->arch.foreign_mfn_count = 1024;
+    d->arch.foreign_mfn_count = 2048;
     d->arch.foreign_mfns = xmalloc_array(uint, d->arch.foreign_mfn_count);
     BUG_ON(d->arch.foreign_mfns == NULL);
 
diff -r 005dd6b1cf8e xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c       Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/external.c       Thu Jun 21 10:57:02 2007 +0200
@@ -43,8 +43,6 @@ unsigned long io_apic_irqs;
 unsigned long io_apic_irqs;
 int ioapic_ack_new = 1;
 
-static struct hw_interrupt_type *hc_irq;
-
 /* deliver_ee: called with interrupts off when resuming every vcpu */
 void deliver_ee(struct cpu_user_regs *regs)
 {
@@ -69,7 +67,7 @@ void deliver_ee(struct cpu_user_regs *re
     regs->msr &= srr_mask;
     regs->msr |= MSR_SF | MSR_ME;
 
-    DBG("<HV: pc=0x%lx, msr=0x%lx\n", regs->pc, regs->msr);
+    //DBG("<HV: pc=0x%lx, msr=0x%lx\n", regs->pc, regs->msr);
 }
 
 void do_external(struct cpu_user_regs *regs)
@@ -83,6 +81,8 @@ void do_external(struct cpu_user_regs *r
     vec = xen_mpic_get_irq(regs);
 
     if (irq_desc[vec].status & IRQ_PER_CPU) {
+               if (vec < 128)
+                       DBG("EE: %d (percpu)\n", vec);
         /* x86 do_IRQ does not respect the per cpu flag.  */
         irq_desc_t *desc = &irq_desc[vec];
         regs->entry_vector = vec;
@@ -90,7 +90,7 @@ void do_external(struct cpu_user_regs *r
         desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs);
         desc->handler->end(vec);
     } else if (vec != -1) {
-        DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
+        DBG("EE: %d\n", vec);
         regs->entry_vector = vec;
         do_IRQ(regs);
 
@@ -106,87 +106,9 @@ void do_external(struct cpu_user_regs *r
     }
 }
 
-static int xen_local_irq(unsigned int irq)
-{
-    irq_desc_t *desc;
-    unsigned int vector;
-
-    vector = irq_to_vector(irq);
-    desc = &irq_desc[vector];
-
-    return !(desc->status & IRQ_GUEST);
-}
-
-static unsigned int xen_startup_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        return hc_irq->startup(irq);
-    }
-    return 0;
-}
-
-static void xen_shutdown_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        hc_irq->shutdown(irq);
-    }
-}
-
-static void xen_enable_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        hc_irq->enable(irq);
-    }
-}
-
-static void xen_disable_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        hc_irq->disable(irq);
-    }
-}
-    
-static void xen_ack_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        if (hc_irq->ack) hc_irq->ack(irq);
-    }
-}
-
-static void xen_end_irq(unsigned int irq)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        hc_irq->end(irq);
-    }
-}
-
-static void xen_set_affinity(unsigned int irq, cpumask_t mask)
-{
-    DBG("%s(%d)\n", __func__, irq);
-    if (xen_local_irq(irq)) {
-        if (hc_irq->set_affinity) hc_irq->set_affinity(irq, mask);
-    }
-}
-
-static struct hw_interrupt_type xen_irq = {
-    .startup = xen_startup_irq,
-    .enable = xen_enable_irq,
-    .disable = xen_disable_irq,
-    .shutdown = xen_shutdown_irq,
-    .ack = xen_ack_irq,
-    .end = xen_end_irq,
-    .set_affinity = xen_set_affinity,
-};
-
 void init_IRQ(void)
 {
-    hc_irq = xen_mpic_init(&xen_irq);
+    xen_mpic_init();
 }
 
 void ack_APIC_irq(void)
diff -r 005dd6b1cf8e xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/mm.c     Thu Jun 21 10:59:52 2007 +0200
@@ -187,7 +187,7 @@ int replace_grant_host_mapping(
     unsigned long addr, unsigned long frame, unsigned long new_addr,
     unsigned int flags)
 {
-    if (new_addr)
+    if (new_addr) {
         printk("%s: new_addr not supported\n", __func__);
         BUG();
         return GNTST_general_error;
diff -r 005dd6b1cf8e xen/arch/powerpc/mpic.c
--- a/xen/arch/powerpc/mpic.c   Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/mpic.c   Thu Jun 21 10:57:02 2007 +0200
@@ -1098,3 +1098,20 @@ void smp_mpic_message_pass(int target, i
        }
 }
 #endif /* CONFIG_SMP */
+
+void dump_openpic(unsigned char key);
+void dump_openpic(unsigned char key)
+{
+       int irq;
+
+       printk("MPIC state:\n");
+       printk("CPU priority %x\n", mpic_cpu_get_priority());
+
+       for (irq = 0; irq < 128; irq++) {
+               struct mpic *mpic = mpic_from_irq(irq);
+               u32 vec = mpic_irq_read(irq, MPIC_IRQ_VECTOR_PRI);
+               if ((vec & MPIC_VECPRI_ACTIVITY) || !(vec & MPIC_VECPRI_MASK))
+                       printk("  %d: %x\n", irq, vec);
+       }
+}
+
diff -r 005dd6b1cf8e xen/arch/powerpc/mpic_init.c
--- a/xen/arch/powerpc/mpic_init.c      Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/mpic_init.c      Thu Jun 21 10:57:02 2007 +0200
@@ -322,43 +322,6 @@ static int find_mpic(void)
     return rc;
 }
 
-#ifdef CONFIG_SHARE_MPIC
-static struct hw_interrupt_type hc_irq;
-
-static struct hw_interrupt_type *share_mpic(
-    struct hw_interrupt_type *mpic_irq,
-    struct hw_interrupt_type *xen_irq)
-{
-    hc_irq.startup = mpic_irq->startup;
-    mpic_irq->startup = xen_irq->startup;
-
-    hc_irq.enable = mpic_irq->enable;
-    mpic_irq->enable = xen_irq->enable;
-
-    hc_irq.disable = mpic_irq->disable;
-    mpic_irq->disable = xen_irq->disable;
-
-    hc_irq.shutdown = mpic_irq->shutdown;
-    mpic_irq->shutdown = xen_irq->shutdown;
-
-    hc_irq.ack = mpic_irq->ack;
-    mpic_irq->ack = xen_irq->ack;
-
-    hc_irq.end = mpic_irq->end;
-    mpic_irq->end = xen_irq->end;
-
-    hc_irq.set_affinity = mpic_irq->set_affinity;
-    mpic_irq->set_affinity = xen_irq->set_affinity;
-
-    return &hc_irq;
-}
-
-#else  /* CONFIG_SHARE_MPIC */
-
-#define share_mpic(M,X) (M)
-
-#endif
-
 static unsigned int mpic_startup_ipi(unsigned int irq)
 {
     mpic->hc_ipi.enable(irq);
@@ -395,7 +358,11 @@ int request_irq(unsigned int irq,
     return retval;
 }
 
-struct hw_interrupt_type *xen_mpic_init(struct hw_interrupt_type *xen_irq)
+static void dummy_ack(unsigned int irq)
+{
+}
+
+void xen_mpic_init(void)
 {
     unsigned int isu_size;
     unsigned int irq_offset;
@@ -403,7 +370,6 @@ struct hw_interrupt_type *xen_mpic_init(
     unsigned int ipi_offset;
     unsigned char *senses;
     unsigned int senses_count;
-    struct hw_interrupt_type *hit;
 
     printk("%s: start\n", __func__);
 
@@ -420,7 +386,7 @@ struct hw_interrupt_type *xen_mpic_init(
 
     if (find_mpic()) {
         printk("%s: ERROR: Could not find open pic.\n", __func__);
-        return NULL;
+        return;
     }
 
     mpic = mpic_alloc(opic_addr,
@@ -431,17 +397,15 @@ struct hw_interrupt_type *xen_mpic_init(
     BUG_ON(mpic == NULL);
     mpic_init(mpic);
 
-    hit = share_mpic(&mpic->hc_irq, xen_irq);
-
     printk("%s: success\n", __func__);
 
-    mpic->hc_ipi.ack = xen_irq->ack;
+    mpic->hc_irq.ack = dummy_ack;
+    mpic->hc_ipi.ack = dummy_ack;
     mpic->hc_ipi.startup = mpic_startup_ipi;
     mpic_request_ipis();
-
-    return hit;
-}
-
+}
+
+/* Note: reading the vector implicitly ACKs it in hardware. */
 int xen_mpic_get_irq(struct cpu_user_regs *regs)
 {
     BUG_ON(mpic == NULL);
diff -r 005dd6b1cf8e xen/arch/powerpc/mpic_init.h
--- a/xen/arch/powerpc/mpic_init.h      Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/mpic_init.h      Thu Jun 21 10:57:02 2007 +0200
@@ -21,9 +21,7 @@
 #ifndef _MPIC_INIT_H
 #define _MPIC_INIT_H
 
-extern struct hw_interrupt_type *xen_mpic_init(
-    struct hw_interrupt_type *xen_irq);
-
+extern void xen_mpic_init(void);
 extern int xen_mpic_get_irq(struct cpu_user_regs *regs);
 
 #endif  /* #ifndef _MPIC_INIT_H */
diff -r 005dd6b1cf8e xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/setup.c  Thu Jun 21 10:57:02 2007 +0200
@@ -125,6 +125,8 @@ static void key_ofdump(unsigned char key
              ofd_dump_props, OFD_DUMP_ALL);
 }
 
+extern void dump_openpic(unsigned char key);
+
 static void percpu_init_areas(void)
 {
     unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
@@ -176,6 +178,8 @@ static void __init start_of_day(void)
 
     /* allow the dumping of the devtree */
     register_keyhandler('D', key_ofdump , "Dump OF Devtree");
+
+    register_keyhandler('*', dump_openpic, "Dump OpenPIC state");
 
     timer_init();
     rcu_init();
diff -r 005dd6b1cf8e xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Wed Jun 20 15:33:14 2007 +0100
+++ b/xen/arch/powerpc/time.c   Thu Jun 21 10:57:02 2007 +0200
@@ -27,7 +27,7 @@
 #include <asm/current.h>
 #include <asm/debugger.h>
 
-#define Dprintk(x...) printk(x)
+#define Dprintk(x...)
 
 static int cpu_has_hdec = 1;
 ulong ticks_per_usec;
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
<Prev in Thread] Current Thread [Next in Thread>