]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
iommu/amd: Move pt_root to struct amd_io_pgtable
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Tue, 15 Dec 2020 07:36:55 +0000 (01:36 -0600)
committerJoerg Roedel <jroedel@suse.de>
Thu, 28 Jan 2021 15:51:17 +0000 (16:51 +0100)
To better organize the data structure since it contains IO page table
related information.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20201215073705.123786-4-suravee.suthikulpanit@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/amd_iommu.h
drivers/iommu/amd/amd_iommu_types.h
drivers/iommu/amd/iommu.c

index 0817bc732d1ad77109dd72df525f9495c535b2bf..b8dae3941f0fd8765ca31006d4645a05ce5d31c2 100644 (file)
@@ -105,7 +105,7 @@ static inline void *iommu_phys_to_virt(unsigned long paddr)
 static inline
 void amd_iommu_domain_set_pt_root(struct protection_domain *domain, u64 root)
 {
-       atomic64_set(&domain->pt_root, root);
+       atomic64_set(&domain->iop.pt_root, root);
 }
 
 static inline
index b2365924d898ab9d3dc595b0cf9a45660537244e..a50f117879f2be2abbe9c29d63c746eba2156bd8 100644 (file)
@@ -498,6 +498,7 @@ struct amd_io_pgtable {
        struct io_pgtable       iop;
        int                     mode;
        u64                     *root;
+       atomic64_t              pt_root;    /* pgtable root and pgtable mode */
 };
 
 /*
@@ -511,7 +512,6 @@ struct protection_domain {
        struct amd_io_pgtable iop;
        spinlock_t lock;        /* mostly used to lock the page table*/
        u16 id;                 /* the domain id written to the device table */
-       atomic64_t pt_root;     /* pgtable root and pgtable mode */
        int glx;                /* Number of levels for GCR3 table */
        u64 *gcr3_tbl;          /* Guest CR3 table */
        unsigned long flags;    /* flags to find out type of domain */
index 18d8c97f681ea29cf51e9d2b8ad851fe7fbfb033..2a4730380462eeeb5234e3ea6edae3710c487ae8 100644 (file)
@@ -144,7 +144,7 @@ static struct protection_domain *to_pdomain(struct iommu_domain *dom)
 static void amd_iommu_domain_get_pgtable(struct protection_domain *domain,
                                         struct domain_pgtable *pgtable)
 {
-       u64 pt_root = atomic64_read(&domain->pt_root);
+       u64 pt_root = atomic64_read(&domain->iop.pt_root);
 
        pgtable->root = (u64 *)(pt_root & PAGE_MASK);
        pgtable->mode = pt_root & 7; /* lowest 3 bits encode pgtable mode */