From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Milton Miller <miltonm@bga.com>
Cc: linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Will Schmidt <will_schmidt@vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 2/8] pseries/iommu: remove ddw property when destroying window
Date: Wed, 11 May 2011 15:24:58 -0700 [thread overview]
Message-ID: <1305152704-4864-3-git-send-email-nacc@us.ibm.com> (raw)
In-Reply-To: <1305152704-4864-1-git-send-email-nacc@us.ibm.com>
From: Milton Miller <miltonm@bga.com>
If we destroy the window, we need to remove the property recording that
we setup the window. Otherwise the next kernel we kexec will be
confused.
Also we should remove the property if even if we don't find the
ibm,ddw-applicable window or if one of the property sizes is unexpected;
presumably these came from a prior kernel via kexec, and we will not be
maintaining the window with respect to memory hotplug.
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
arch/powerpc/platforms/pseries/iommu.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 05c101e..a0421ac 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -665,9 +665,12 @@ static void remove_ddw(struct device_node *np)
ddr_avail = of_get_property(np, "ibm,ddw-applicable", &len);
win64 = of_find_property(np, DIRECT64_PROPNAME, NULL);
- if (!win64 || !ddr_avail || len < 3 * sizeof(u32))
+ if (!win64)
return;
+ if (!ddr_avail || len < 3 * sizeof(u32) || win64->length < sizeof(*dwp))
+ goto delprop;
+
dwp = win64->value;
liobn = (u64)be32_to_cpu(dwp->liobn);
@@ -690,8 +693,13 @@ static void remove_ddw(struct device_node *np)
pr_debug("%s: successfully removed direct window: rtas returned "
"%d to ibm,remove-pe-dma-window(%x) %llx\n",
np->full_name, ret, ddr_avail[2], liobn);
-}
+delprop:
+ ret = of_remove_property(np, win64);
+ if (ret)
+ pr_warning("%s: failed to remove direct window property: %d\n"
+ np->full_name, ret);
+}
static u64 dupe_ddw_if_already_created(struct pci_dev *dev, struct device_node *pdn)
{
--
1.7.4.1
next prev parent reply other threads:[~2011-05-11 22:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 22:24 [PATCH 0/8] pseries/iommu: bug-fixes and cleanups for dynamic dma windows Nishanth Aravamudan
2011-05-11 22:24 ` [PATCH 1/8] pseries/iommu: add additional checks when changing iommu mask Nishanth Aravamudan
2011-05-11 22:24 ` Nishanth Aravamudan [this message]
2011-05-11 22:24 ` [PATCH 3/8] pseries/iommu: find windows after kexec during boot Nishanth Aravamudan
2011-05-11 22:25 ` [PATCH 4/8] pseries/iommu: cleanup ddw naming Nishanth Aravamudan
2011-05-11 22:25 ` [PATCH 5/8] powerpc: override dma_get_required_mask by platform hook and ops Nishanth Aravamudan
2011-05-19 7:43 ` Benjamin Herrenschmidt
2011-05-19 17:46 ` Nishanth Aravamudan
2011-05-25 18:47 ` Nishanth Aravamudan
2011-05-11 22:25 ` [PATCH 7/8] powerpc: use the newly added get_required_mask dma_map_ops hook Nishanth Aravamudan
2011-05-12 5:51 ` Geert Uytterhoeven
2011-05-12 7:32 ` Milton Miller
2011-05-11 22:25 ` [PATCH 8/8] powerpc: tidy up dma_map_ops after adding new hook Nishanth Aravamudan
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=1305152704-4864-3-git-send-email-nacc@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miltonm@bga.com \
--cc=paulus@samba.org \
--cc=will_schmidt@vnet.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).