[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/iommu: arm: Use p2m_ipa_bits as stage2 input size



commit 3de112bcac21daecf42c2cdaaef7c5b8e21489d5
Author:     Edgar E. Iglesias <edgar.iglesias@xxxxxxxxxx>
AuthorDate: Fri May 8 17:10:10 2015 +1000
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed May 13 14:49:43 2015 +0100

    xen/iommu: arm: Use p2m_ipa_bits as stage2 input size
    
    The Stage2 input-size must match what the CPU uses because
    the SMMU and the CPU share page-tables.
    
    Test that the SMMU supports the P2M IPA bit size, use it if
    supported or bail out if not.
    
    Reviewed-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/drivers/passthrough/arm/smmu.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu.c 
b/xen/drivers/passthrough/arm/smmu.c
index 65de50b..6cc4394 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -2230,8 +2230,14 @@ static int arm_smmu_device_cfg_probe(struct 
arm_smmu_device *smmu)
        size = arm_smmu_id_size_to_bits((id >> ID2_IAS_SHIFT) & ID2_IAS_MASK);
        smmu->s1_output_size = min_t(unsigned long, PHYS_MASK_SHIFT, size);
 
-       /* Xen: Stage-2 input size is not restricted */
-       smmu->s2_input_size = size;
+       /* Xen: Stage-2 input size has to match p2m_ipa_bits.  */
+       if (size < p2m_ipa_bits) {
+               dev_err(smmu->dev,
+                       "P2M IPA size not supported (P2M=%u SMMU=%lu)!\n",
+                       p2m_ipa_bits, size);
+               return -ENODEV;
+       }
+       smmu->s2_input_size = p2m_ipa_bits;
 #if 0
        /* Stage-2 input size limited due to pgd allocation (PTRS_PER_PGD) */
 #ifdef CONFIG_64BIT
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.