From owner-freebsd-xen@FreeBSD.ORG Fri Jan 17 13:45:33 2014 Return-Path: Delivered-To: freebsd-xen@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 358D87D5 for ; Fri, 17 Jan 2014 13:45:33 +0000 (UTC) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 92E6714C7 for ; Fri, 17 Jan 2014 13:45:32 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id ex4so705488wid.9 for ; Fri, 17 Jan 2014 05:45:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=o20v3u1W/AFMqlLmKwxjEwoJnXnNjVeiKZVFU838MHA=; b=a6HZQsQulsThNKH5rcBbWqDFpNjyVeHMRDAvPGitF9aCmr2YxYqM8+ZolKPlT/wxuD koA+PoX1RUwaIHG90HUpqPjpoWtzH9PO5O5dcmuQVt0JCqkPzVFDeQN+L+Kts9zF+3jn irucXizGtxqn82iMKFO+GB6+8dse4LnfHZImjLSO3vBYU1rYCDCNlv2szHkIMXRmbKdL QUVT0zdXOoEaCFbMsQAVeKmIWBBRDdt+kIrVSwRVqADNrWspFMI2wnoVUAD7jlaPTn8Z bMNOJ0JOqS3GuM9nJGHuoN5pfbjQNYrcEPXmgEMY4WwnC2BJoP5HseVhWATOaFbFQK4X RhxQ== X-Gm-Message-State: ALoCoQkCft3uuX75gR1yAiqDUaxYec8xkQke3Fk8BNqa+uvJzsX7m3UJxBKVv4UStDDsy6hDuUwr X-Received: by 10.180.160.166 with SMTP id xl6mr2472944wib.43.1389966324694; Fri, 17 Jan 2014 05:45:24 -0800 (PST) Received: from [192.168.0.2] (cpc8-cmbg15-2-0-cust169.5-4.cable.virginm.net. [86.30.140.170]) by mx.google.com with ESMTPSA id dm2sm3286200wib.8.2014.01.17.05.45.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 05:45:23 -0800 (PST) Message-ID: <52D933F2.8000101@linaro.org> Date: Fri, 17 Jan 2014 13:45:22 +0000 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Nathan Whitehorn , Warner Losh Subject: Re: [RFC] Add support for Xen ARM guest on FreeBSD References: <1389733267-20822-1-git-send-email-julien.grall@linaro.org> <24851B79-7EC7-4E3A-94DB-4B9B86FDFFFC@bsdimp.com> <52D6B62A.9000208@linaro.org> <52D73C4E.2080306@freebsd.org> <52D87B15.5090208@linaro.org> <52D89DC9.7050303@freebsd.org> In-Reply-To: <52D89DC9.7050303@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org, freebsd-xen@freebsd.org, freebsd-arm@FreeBSD.org, gibbs@freebsd.org X-BeenThere: freebsd-xen@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion of the freebsd port to xen - implementation and usage List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2014 13:45:33 -0000 On 01/17/2014 03:04 AM, Nathan Whitehorn wrote: > On 01/16/14 18:36, Julien Grall wrote: > > The specification is actually a little unclear on this point, but > FreeBSD follows the same rules as Linux in any case. Most, if not all, > FreeBSD code should check any ancestor at this point as well. In > particular fdt_intr_to_rl does this. What it *doesn't* do is allow > #interrupt-cells to be larger than 2. I'll fix this this weekend. Thanks, for working on this part. Another things to take into account: the first cell doesn't always contain the interrupt. With the Linux binding (#interrupt-cells == 3) - cell 1: 1 or 0 (PPI vs SPI) - cell 2: relative IRQ number to the start of PPI/SPI - cell 3: cpu mask + interrupt flags (edge/level...) >>> On the subject of simple-bus, they usually aren't necessary. For >>> example, all hypervisor devices on IBM hardware live under /vdevice, >>> which is attached to the device tree root. They don't use MMIO, so >>> simple-bus doesn't really make sense. How does Xen communicate with the >>> OS in these devices? >>> -Nathan >> >> As I understand, only the simple bus code (see simplebus_attach) is >> translating the interrupts in the device on a resource. >> So if you have a node directly attached to the root node with >> interrupts and MMIO, the driver won't be able to retrieve and >> translate the interrupts via bus_alloc_resources. > > Why not? nexus on ARM, MIPS, PowerPC, and sparc64 can do this. I have noticed at least one issue (which is not related to my problem): - When the OFW nexus translate IRQ (with #interrupt-cells > 1), the rid will be equal to 0, 0 + #interrupt-cells, ... So the number will be discontinued. Rather than on simple-bus for the same device, the rid will be 0, 1, 2... For my issue, I will look at it again this week-end. BTW when I look to the FDT (sys/dev/fdt_common.c) and the ofw (sys/dev/ofw_nexus.c) code, I have notice that lots of code are duplicated. It would be nice to have common helper to avoid duplicate code and issue for the future :). -- Julien Grall