All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>,
	Clark Laughlin <clark.laughlin@linaro.org>,
	tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v2 for-4.5 5/5] xen: arm: Support the other 4 PCI buses on Xgene
Date: Thu, 20 Nov 2014 11:26:36 +0000	[thread overview]
Message-ID: <546DCFEC.9030200@linaro.org> (raw)
In-Reply-To: <1416410895-20461-5-git-send-email-ian.campbell@citrix.com>

Hi Ian,

On 11/19/2014 03:28 PM, Ian Campbell wrote:
> Currently we only establish specific mappings for pcie0, which is
> used on the Mustang platform. However at least McDivitt uses pcie3.
> So wire up all the others, based on whether the corresponding DT node
> is marked as available.
> 
> This results in no change for Mustang.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> ---
> v2: - Didn't constify dt node pointer -- dt_find_compatible_node needs a
>       non-const

Oh right. A bit annoying, I will look at it to see if we can constify
the parameter in Xen 4.6.

Reviewed-by: Julien Grall <julien.grall@linaro.org>

Regards,

>     - Print a message when ignoring an unknown bus
>     - Log with dt node full anme instead of CFG space address.
>     - Log at start of xgene_storm_pcie_specific_mapping instead of in the
>       caller after the fact.
> ---
>  xen/arch/arm/platforms/xgene-storm.c |   89 +++++++++++++++++++++++++++++-----
>  1 file changed, 76 insertions(+), 13 deletions(-)
> 
> diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
> index 8c27f24..0b3492d 100644
> --- a/xen/arch/arm/platforms/xgene-storm.c
> +++ b/xen/arch/arm/platforms/xgene-storm.c
> @@ -78,35 +78,35 @@ static int map_one_spi(struct domain *d, const char *what,
>      return ret;
>  }
>  
> -/*
> - * Xen does not currently support mapping MMIO regions and interrupt
> - * for bus child devices (referenced via the "ranges" and
> - * "interrupt-map" properties to domain 0). Instead for now map the
> - * necessary resources manually.
> - */
> -static int xgene_storm_specific_mapping(struct domain *d)
> +/* Creates MMIO mappings base..end as well as 4 SPIs from the given base. */
> +static int xgene_storm_pcie_specific_mapping(struct domain *d,
> +                                             const struct dt_device_node *node,
> +                                             paddr_t base, paddr_t end,
> +                                             int base_spi)
>  {
>      int ret;
>  
> +    printk("Mapping additional regions for PCIe device %s\n",
> +           dt_node_full_name(node));
> +
>      /* Map the PCIe bus resources */
> -    ret = map_one_mmio(d, "PCI MEMORY", paddr_to_pfn(0x0e000000000UL),
> -                                        paddr_to_pfn(0x01000000000UL));
> +    ret = map_one_mmio(d, "PCI MEMORY", paddr_to_pfn(base), paddr_to_pfn(end));
>      if ( ret )
>          goto err;
>  
> -    ret = map_one_spi(d, "PCI#INTA", 0xc2, DT_IRQ_TYPE_LEVEL_HIGH);
> +    ret = map_one_spi(d, "PCI#INTA", base_spi+0, DT_IRQ_TYPE_LEVEL_HIGH);
>      if ( ret )
>          goto err;
>  
> -    ret = map_one_spi(d, "PCI#INTB", 0xc3, DT_IRQ_TYPE_LEVEL_HIGH);
> +    ret = map_one_spi(d, "PCI#INTB", base_spi+1, DT_IRQ_TYPE_LEVEL_HIGH);
>      if ( ret )
>          goto err;
>  
> -    ret = map_one_spi(d, "PCI#INTC", 0xc4, DT_IRQ_TYPE_LEVEL_HIGH);
> +    ret = map_one_spi(d, "PCI#INTC", base_spi+2, DT_IRQ_TYPE_LEVEL_HIGH);
>      if ( ret )
>          goto err;
>  
> -    ret = map_one_spi(d, "PCI#INTD", 0xc5, DT_IRQ_TYPE_LEVEL_HIGH);
> +    ret = map_one_spi(d, "PCI#INTD", base_spi+3, DT_IRQ_TYPE_LEVEL_HIGH);
>      if ( ret )
>          goto err;
>  
> @@ -115,6 +115,69 @@ err:
>      return ret;
>  }
>  
> +/*
> + * Xen does not currently support mapping MMIO regions and interrupt
> + * for bus child devices (referenced via the "ranges" and
> + * "interrupt-map" properties to domain 0). Instead for now map the
> + * necessary resources manually.
> + */
> +static int xgene_storm_specific_mapping(struct domain *d)
> +{
> +    struct dt_device_node *node = NULL;
> +    int ret;
> +
> +    while ( (node = dt_find_compatible_node(node, "pci", "apm,xgene-pcie")) )
> +    {
> +        u64 addr;
> +
> +        /* Identify the bus via it's control register address */
> +        ret = dt_device_get_address(node, 0, &addr, NULL);
> +        if ( ret < 0 )
> +            return ret;
> +
> +        if ( !dt_device_is_available(node) )
> +            continue;
> +
> +       switch ( addr )
> +        {
> +        case 0x1f2b0000: /* PCIe0 */
> +            ret = xgene_storm_pcie_specific_mapping(d,
> +                node,
> +                0x0e000000000UL, 0x10000000000UL, 0xc2);
> +            break;
> +        case 0x1f2c0000: /* PCIe1 */
> +            ret = xgene_storm_pcie_specific_mapping(d,
> +                node,
> +                0x0d000000000UL, 0x0e000000000UL, 0xc8);
> +            break;
> +        case 0x1f2d0000: /* PCIe2 */
> +            ret = xgene_storm_pcie_specific_mapping(d,
> +                node,
> +                0x09000000000UL, 0x0a000000000UL, 0xce);
> +            break;
> +        case 0x1f500000: /* PCIe3 */
> +            ret = xgene_storm_pcie_specific_mapping(d,
> +                node,
> +                0x0a000000000UL, 0x0c000000000UL, 0xd4);
> +            break;
> +        case 0x1f510000: /* PCIe4 */
> +            ret = xgene_storm_pcie_specific_mapping(d,
> +                node,
> +                0x0c000000000UL, 0x0d000000000UL, 0xda);
> +            break;
> +
> +        default:
> +            printk("Ignoring unknown PCI bus %s\n", dt_node_full_name(node));
> +            continue;
> +        }
> +
> +        if ( ret < 0 )
> +            return ret;
> +    }
> +
> +    return 0;
> +}
> +
>  static void xgene_storm_reset(void)
>  {
>      void __iomem *addr;
> 


-- 
Julien Grall

  reply	other threads:[~2014-11-20 11:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 15:27 [PATCH 0/5 v2 for-4.5] xen: arm: xgene bug fixes + support for McDivitt Ian Campbell
2014-11-19 15:28 ` [PATCH v2 for-4.5 1/5] xen: arm: Add earlyprintk " Ian Campbell
2014-11-20 11:18   ` Julien Grall
2014-11-19 15:28 ` [PATCH v2 for-4.5 2/5] xen: arm: Drop EARLY_PRINTK_BAUD from entries which don't set ..._INIT_UART Ian Campbell
2014-11-20 11:20   ` Julien Grall
2014-11-19 15:28 ` [PATCH v2 for-4.5 3/5] xen: arm: correct off by one in xgene-storm's map_one_mmio Ian Campbell
2014-11-20 11:23   ` Julien Grall
2014-11-19 15:28 ` [PATCH v2 for-4.5 4/5] xen: arm: correct specific mappings for PCIE0 on X-Gene Ian Campbell
2014-11-19 15:28 ` [PATCH v2 for-4.5 5/5] xen: arm: Support the other 4 PCI buses on Xgene Ian Campbell
2014-11-20 11:26   ` Julien Grall [this message]
2014-11-25 15:01   ` Pranavkumar Sawargaonkar
2014-11-25 15:07     ` Ian Campbell
2014-11-19 21:27 ` [PATCH 0/5 v2 for-4.5] xen: arm: xgene bug fixes + support for McDivitt Konrad Rzeszutek Wilk
2014-11-20 15:58   ` Ian Campbell
2014-11-20 19:45     ` Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546DCFEC.9030200@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=clark.laughlin@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=pranavkumar@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.