From 9948be94b72fca028bc139370d6090bda15a73f8 Mon Sep 17 00:00:00 2001 From: Haiying Wang Date: Thu, 24 Oct 2013 15:14:56 -0400 Subject: fsl_qbman: remove the portal migration functions Because we only need to change the portal irq affinity and/or sdest for hotplug, we don't really migrate the portal. Also because the irq and sdest are updated via qm_portal_config object, as such, we move the code from *_high.c to *_driver.c. Signed-off-by: Haiying Wang Change-Id: I937e6b6195e6e701d03a8cf738e6fa8e6afa260c Reviewed-on: http://git.am.freescale.net:8181/6040 Tested-by: Review Code-CDREVIEW Reviewed-by: Geoff Thorpe Reviewed-by: Jose Rivera diff --git a/drivers/staging/fsl_qbman/bman_driver.c b/drivers/staging/fsl_qbman/bman_driver.c index 513c7f1..d71301c 100644 --- a/drivers/staging/fsl_qbman/bman_driver.c +++ b/drivers/staging/fsl_qbman/bman_driver.c @@ -296,18 +296,26 @@ __setup("bportals=", parse_bportals); static void bman_offline_cpu(unsigned int cpu) { struct bman_portal *p; + const struct bm_portal_config *pcfg; p = (struct bman_portal *)affine_bportals[cpu]; - if (p && (!bman_portal_is_sharing_redirect(p))) - bman_migrate_portal(p); + if (p) { + pcfg = bman_get_bm_portal_config(p); + if (pcfg) + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(0)); + } } #ifdef CONFIG_HOTPLUG_CPU static void bman_online_cpu(unsigned int cpu) { struct bman_portal *p; + const struct bm_portal_config *pcfg; p = (struct bman_portal *)affine_bportals[cpu]; - if (p && (!bman_portal_is_sharing_redirect(p))) - bman_migrate_portal_back(p, cpu); + if (p) { + pcfg = bman_get_bm_portal_config(p); + if (pcfg) + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + } } static int __cpuinit bman_hotplug_cpu_callback(struct notifier_block *nfb, diff --git a/drivers/staging/fsl_qbman/bman_high.c b/drivers/staging/fsl_qbman/bman_high.c index d070d34..da46a5a 100644 --- a/drivers/staging/fsl_qbman/bman_high.c +++ b/drivers/staging/fsl_qbman/bman_high.c @@ -1048,27 +1048,8 @@ int bman_shutdown_pool(u32 bpid) } EXPORT_SYMBOL(bman_shutdown_pool); -int bman_portal_is_sharing_redirect(struct bman_portal *portal) +const struct bm_portal_config *bman_get_bm_portal_config( + struct bman_portal *portal) { - return portal->sharing_redirect ? 1 : 0; + return portal->sharing_redirect ? NULL : portal->config; } - -/* Migrate the portal to the boot cpu(cpu0) for offline cpu */ -void bman_migrate_portal(struct bman_portal *portal) -{ - unsigned long irqflags __maybe_unused; - PORTAL_IRQ_LOCK(portal, irqflags); - irq_set_affinity(portal->config->public_cfg.irq, cpumask_of(0)); - PORTAL_IRQ_UNLOCK(portal, irqflags); -} - -#ifdef CONFIG_HOTPLUG_CPU -/* Migrate the portal back to the affined cpu once that cpu reappears.*/ -void bman_migrate_portal_back(struct bman_portal *portal, unsigned int cpu) -{ - unsigned long irqflags __maybe_unused; - PORTAL_IRQ_LOCK(portal, irqflags); - irq_set_affinity(portal->config->public_cfg.irq, cpumask_of(cpu)); - PORTAL_IRQ_UNLOCK(portal, irqflags); -} -#endif /* CONFIG_HOTPLUG_CPU */ diff --git a/drivers/staging/fsl_qbman/bman_private.h b/drivers/staging/fsl_qbman/bman_private.h index 22e4a8c..e24588b 100644 --- a/drivers/staging/fsl_qbman/bman_private.h +++ b/drivers/staging/fsl_qbman/bman_private.h @@ -156,10 +156,6 @@ u32 bm_pool_free_buffers(u32 bpid); __init int bman_init(void); __init int bman_resource_init(void); -/* Portal migration */ -int bman_portal_is_sharing_redirect(struct bman_portal *portal); -void bman_migrate_portal(struct bman_portal *portal); -#ifdef CONFIG_HOTPLUG_CPU -void bman_migrate_portal_back(struct bman_portal *portal, unsigned int cpu); -#endif /* CONFIG_HOTPLUG_CPU */ +const struct bm_portal_config *bman_get_bm_portal_config( + struct bman_portal *portal); #endif /* CONFIG_FSL_BMAN_CONFIG */ diff --git a/drivers/staging/fsl_qbman/qman_driver.c b/drivers/staging/fsl_qbman/qman_driver.c index fc5855c..cf1c3b3 100644 --- a/drivers/staging/fsl_qbman/qman_driver.c +++ b/drivers/staging/fsl_qbman/qman_driver.c @@ -639,21 +639,56 @@ static int __init parse_qportals(char *str) } __setup("qportals=", parse_qportals); +static void qman_portal_update_sdest(const struct qm_portal_config *pcfg, + unsigned int cpu) +{ + struct iommu_stash_attribute stash_attr; + int ret; + + if (pcfg->iommu_domain) { + stash_attr.cpu = cpu; + stash_attr.cache = IOMMU_ATTR_CACHE_L1; + stash_attr.window = ~(u32)0; + ret = iommu_domain_set_attr(pcfg->iommu_domain, + DOMAIN_ATTR_PAMU_STASH, &stash_attr); + if (ret < 0) { + pr_err("Failed to update pamu stash setting\n"); + return; + } + } +#ifdef CONFIG_FSL_QMAN_CONFIG + if (qman_set_sdest(pcfg->public_cfg.channel, cpu)) +#endif + pr_warning("Failed to update portal's stash request queue\n"); +} + static void qman_offline_cpu(unsigned int cpu) { struct qman_portal *p; + const struct qm_portal_config *pcfg; p = (struct qman_portal *)affine_portals[cpu]; - if (p && (!qman_portal_is_sharing_redirect(p))) - qman_migrate_portal(p); + if (p) { + pcfg = qman_get_qm_portal_config(p); + if (pcfg) { + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(0)); + qman_portal_update_sdest(pcfg, 0); + } + } } #ifdef CONFIG_HOTPLUG_CPU static void qman_online_cpu(unsigned int cpu) { struct qman_portal *p; + const struct qm_portal_config *pcfg; p = (struct qman_portal *)affine_portals[cpu]; - if (p && (!qman_portal_is_sharing_redirect(p))) - qman_migrate_portal_back(p, cpu); + if (p) { + pcfg = qman_get_qm_portal_config(p); + if (pcfg) { + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + qman_portal_update_sdest(pcfg, cpu); + } + } } static int __cpuinit qman_hotplug_cpu_callback(struct notifier_block *nfb, diff --git a/drivers/staging/fsl_qbman/qman_high.c b/drivers/staging/fsl_qbman/qman_high.c index 0d4305f..5fecfc1 100644 --- a/drivers/staging/fsl_qbman/qman_high.c +++ b/drivers/staging/fsl_qbman/qman_high.c @@ -4897,52 +4897,8 @@ int qman_shutdown_fq(u32 fqid) return ret; } -static void qman_portal_update_sdest(const struct qm_portal_config *pcfg, - unsigned int cpu) +const struct qm_portal_config *qman_get_qm_portal_config( + struct qman_portal *portal) { - struct iommu_stash_attribute stash_attr; - int ret; - - if (pcfg->iommu_domain) { - stash_attr.cpu = cpu; - stash_attr.cache = IOMMU_ATTR_CACHE_L1; - stash_attr.window = ~(u32)0; - ret = iommu_domain_set_attr(pcfg->iommu_domain, - DOMAIN_ATTR_PAMU_STASH, &stash_attr); - if (ret < 0) { - pr_err("Failed to update pamu stash setting\n"); - return; - } - } -#ifdef CONFIG_FSL_QMAN_CONFIG - if (qman_set_sdest(pcfg->public_cfg.channel, cpu)) -#endif - pr_warning("Failed to update portal's stash request queue\n"); -} - -int qman_portal_is_sharing_redirect(struct qman_portal *portal) -{ - return portal->sharing_redirect ? 1 : 0; -} - -/* Migrate the portal to the boot cpu(cpu0) for offline cpu */ -void qman_migrate_portal(struct qman_portal *portal) -{ - unsigned long irqflags __maybe_unused; - PORTAL_IRQ_LOCK(portal, irqflags); - irq_set_affinity(portal->config->public_cfg.irq, cpumask_of(0)); - qman_portal_update_sdest(portal->config, 0); - PORTAL_IRQ_UNLOCK(portal, irqflags); -} - -#ifdef CONFIG_HOTPLUG_CPU -/* Migrate the portal back to the affined cpu once that cpu appears.*/ -void qman_migrate_portal_back(struct qman_portal *portal, unsigned int cpu) -{ - unsigned long irqflags __maybe_unused; - PORTAL_IRQ_LOCK(portal, irqflags); - qman_portal_update_sdest(portal->config, cpu); - irq_set_affinity(portal->config->public_cfg.irq, cpumask_of(cpu)); - PORTAL_IRQ_UNLOCK(portal, irqflags); + return portal->sharing_redirect ? NULL : portal->config; } -#endif /* CONFIG_HOTPLUG_CPU */ diff --git a/drivers/staging/fsl_qbman/qman_private.h b/drivers/staging/fsl_qbman/qman_private.h index e7c77b6..7539032 100644 --- a/drivers/staging/fsl_qbman/qman_private.h +++ b/drivers/staging/fsl_qbman/qman_private.h @@ -390,10 +390,6 @@ int qman_ceetm_query_ccgr(struct qm_mcc_ceetm_ccgr_query *ccgr_query, struct qm_mcr_ceetm_ccgr_query *response); int qman_ceetm_get_xsfdr(enum qm_dc_portal portal, unsigned int *num); -/* Portal migration */ extern void *affine_portals[NR_CPUS]; -int qman_portal_is_sharing_redirect(struct qman_portal *portal); -void qman_migrate_portal(struct qman_portal *portal); -#ifdef CONFIG_HOTPLUG_CPU -void qman_migrate_portal_back(struct qman_portal *portal, unsigned int cpu); -#endif /* CONFIG_HOTPLUG_CPU */ +const struct qm_portal_config *qman_get_qm_portal_config( + struct qman_portal *portal); -- cgit v0.10.2