-
Notifications
You must be signed in to change notification settings - Fork 109
dma: phytium: fix more bugs of pswiotlb #1522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-6.6.y
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,3 +106,4 @@ WORKAROUND_SPECULATIVE_SSBS | |
| WORKAROUND_SPECULATIVE_UNPRIV_LOAD | ||
| HAS_LS64 | ||
| HAS_LS64_V | ||
| WORKAROUND_PHYTIUM_FT3386 | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,6 +32,9 @@ | |||||||||||||||||||||
| #include <linux/suspend.h> | ||||||||||||||||||||||
| #include <linux/switchtec.h> | ||||||||||||||||||||||
| #include "pci.h" | ||||||||||||||||||||||
| #ifdef CONFIG_PSWIOTLB | ||||||||||||||||||||||
| #include <linux/pswiotlb.h> | ||||||||||||||||||||||
| #endif | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /* | ||||||||||||||||||||||
| * Retrain the link of a downstream PCIe port by hand if necessary. | ||||||||||||||||||||||
|
|
@@ -6470,6 +6473,17 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node); | |||||||||||||||||||||
| DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node); | ||||||||||||||||||||||
| DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| void pci_configure_pswiotlb(struct pci_dev *dev, struct pci_bus *bus) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| #ifdef CONFIG_PSWIOTLB | ||||||||||||||||||||||
| if ((pswiotlb_force_disable != true) && | ||||||||||||||||||||||
| is_phytium_ps_socs()) { | ||||||||||||||||||||||
| pswiotlb_store_local_node(dev, bus); | ||||||||||||||||||||||
| dma_set_seg_boundary(&dev->dev, 0xffffffffffff); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+6479
to
+6483
|
||||||||||||||||||||||
| if ((pswiotlb_force_disable != true) && | |
| is_phytium_ps_socs()) { | |
| pswiotlb_store_local_node(dev, bus); | |
| dma_set_seg_boundary(&dev->dev, 0xffffffffffff); | |
| } | |
| if ((pswiotlb_force_disable != true) && | |
| is_phytium_ps_socs()) { | |
| pswiotlb_store_local_node(dev, bus); | |
| dma_set_seg_boundary(&dev->dev, 0xffffffffffff); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,15 +18,11 @@ struct scatterlist; | |
| extern bool pswiotlb_force_disable; | ||
| struct p_io_tlb_pool; | ||
|
|
||
| #define SOC_ID_PS23064 0x8 | ||
| #define SOC_ID_PS24080 0x6 | ||
| #define MIDR_PS 0x700F8620 | ||
| #define SYS_AIDR_EL1 sys_reg(3, 1, 0, 0, 7) | ||
| #define PSWIOTLB_VERBOSE (1 << 0) /* verbose initialization */ | ||
| #define PSWIOTLB_FORCEOFF (1 << 1) /* force phytium bounce buffering off*/ | ||
| #define PSWIOTLB_ANY (1 << 2) /* allow any memory for the buffer */ | ||
| #define PSWIOTLB_FREE_THRESHOLD 30 | ||
| static bool is_ps_socs; | ||
| extern bool __read_mostly is_ps_socs; | ||
|
|
||
|
Comment on lines
+25
to
26
|
||
| /* | ||
| * Maximum allowable number of contiguous slabs to map, | ||
|
|
@@ -79,6 +75,7 @@ dma_addr_t pswiotlb_map(struct device *dev, int nid, phys_addr_t phys, | |
| void pswiotlb_store_local_node(struct pci_dev *dev, struct pci_bus *bus); | ||
| void iommu_dma_unmap_sg_pswiotlb(struct device *dev, struct scatterlist *sg, unsigned long iova, | ||
| size_t mapped, int nents, enum dma_data_direction dir, unsigned long attrs); | ||
| void pswiotlb_setup_dma_ops(struct device *dev); | ||
| #ifdef CONFIG_PSWIOTLB | ||
| struct pswiotlb_passthroughlist { | ||
| struct list_head node; | ||
|
|
@@ -211,19 +208,9 @@ struct p_io_tlb_pool *pswiotlb_find_pool(struct device *dev, int nid, phys_addr_ | |
|
|
||
| static inline bool is_phytium_ps_socs(void) | ||
| { | ||
| unsigned int soc_id; | ||
| unsigned int midr; | ||
|
|
||
| if (likely(is_ps_socs)) | ||
| return true; | ||
|
|
||
| soc_id = read_sysreg_s(SYS_AIDR_EL1); | ||
| midr = read_cpuid_id(); | ||
| if ((soc_id == SOC_ID_PS23064 || soc_id == SOC_ID_PS24080) | ||
| && midr == MIDR_PS) { | ||
| is_ps_socs = true; | ||
| return true; | ||
| } else | ||
| else | ||
| return false; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个应该单独拆分一个补丁出来