Various i.MX7 fixes
cover Various i.MX7 fixes
Everyone:
I recently revisited my i.MX7 work and this series contains all of the fixes I had to make to get it to work with latest (5.1-rc1) Linux kernel again as well as fixes for genuine bugs that I somehow missed during original submission ("pci: designware" patches). Hopefully each patch is self-explanatory.
Feedback is welcome!
Thanks,
Andrey Smirnov
Andrey Smirnov (5):
i.mx7d: Add no-op/unimplemented APBH DMA module i.mx7d: Add no-op/unimplemented PCIE PHY IP block
pci: designware: Update MSI mapping unconditionally
pci: designware: Update MSI mapping when MSI address changes i.mx7d: pci: Update PCI IRQ mapping to match HW
include/hw/arm/fsl-imx7.h | 14 ++++++++++---- hw/arm/fsl-imx7.c | 11 +++++++++++ hw/pci-host/designware.c | 18 ++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/5 i.mx7d: Add no-op/unimplemented APBH DMA module
Instantiate no-op APBH DMA module. Needed to boot latest Linux kernel.
--- include/hw/arm/fsl-imx7.h | 3 +++ hw/arm/fsl-imx7.c | 6 ++++++ 2 files changed, 9 insertions(+)
include/hw/arm/fsl-imx7.h +3 -0
@@ -179,6 +179,9 @@ enum FslIMX7MemoryMap {FSL_IMX7_PCIE_REG_SIZE =16 *1024 ,FSL_IMX7_GPR_ADDR =0x30340000 , + +FSL_IMX7_DMA_APBH_ADDR =0x33000000 , + FSL_IMX7_DMA_APBH_SIZE = 0x2000, }; enum FslIMX7IRQs {
hw/arm/fsl-imx7.c +6 -0
@@ -526,6 +526,12 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)*/ create_unimplemented_device ("lcdif" ,FSL_IMX7_LCDIF_ADDR ,FSL_IMX7_LCDIF_SIZE ); + +/* +* DMA APBH +*/ +create_unimplemented_device ("dma-apbh" ,FSL_IMX7_DMA_APBH_ADDR , +FSL_IMX7_DMA_APBH_SIZE ); }static void fsl_imx7_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.20.1
Re: [Qemu-arm] [Qemu-devel] [PATCH 1/5] i.mx7d: Add no-op/unimplemented APBH DMA module
Quoted 17 lines · Andrey Smirnov
Instantiate no-op APBH DMA module. Needed to boot latest Linux kernel.
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>--- include/hw/arm/fsl-imx7.h | 3 +++ hw/arm/fsl-imx7.c | 6 ++++++ 2 files changed, 9 insertions(+)include/hw/arm/fsl-imx7.h +0
-0
include/hw/arm/fsl-imx7.h enum FslIMX7MemoryMap { · line 184
Quoted 6 lines
include/hw/arm/fsl-imx7.h +3
-0@@ -179,6 +179,9 @@ enum FslIMX7MemoryMap {FSL_IMX7_PCIE_REG_SIZE =16 *1024 ,FSL_IMX7_GPR_ADDR =0x30340000 , + +FSL_IMX7_DMA_APBH_ADDR =0x33000000 , + FSL_IMX7_DMA_APBH_SIZE = 0x2000,
0x8000?
Quoted 21 lines
include/hw/arm/fsl-imx7.h +0
-0};enum FslIMX7IRQs {hw/arm/fsl-imx7.c +6
-0@@ -526,6 +526,12 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)*/ create_unimplemented_device ("lcdif" ,FSL_IMX7_LCDIF_ADDR ,FSL_IMX7_LCDIF_SIZE ); + +/* +* DMA APBH +*/ +create_unimplemented_device ("dma-apbh" ,FSL_IMX7_DMA_APBH_ADDR , +FSL_IMX7_DMA_APBH_SIZE ); }static void fsl_imx7_class_init (ObjectClass *oc,void *data)
PATCH 2/5 i.mx7d: Add no-op/unimplemented PCIE PHY IP block
In reply to Andrey SmirnovAdd no-op/unimplemented PCIE PHY IP block. Needed by new kernels to use PCIE.
--- include/hw/arm/fsl-imx7.h | 3 +++ hw/arm/fsl-imx7.c | 5 +++++ 2 files changed, 8 insertions(+)
include/hw/arm/fsl-imx7.h +3 -0
@@ -125,6 +125,9 @@ enum FslIMX7MemoryMap {FSL_IMX7_ADC2_ADDR =0x30620000 , FSL_IMX7_ADCn_SIZE =0x1000 , +FSL_IMX7_PCIE_PHY_ADDR =0x306D0000 , +FSL_IMX7_PCIE_PHY_SIZE =0x10000 , +FSL_IMX7_GPC_ADDR =0x303A0000 , FSL_IMX7_I2C1_ADDR = 0x30A20000,
hw/arm/fsl-imx7.c +5 -0
@@ -532,6 +532,11 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)*/ create_unimplemented_device ("dma-apbh" ,FSL_IMX7_DMA_APBH_ADDR ,FSL_IMX7_DMA_APBH_SIZE ); +/* +* PCIe PHY +*/ +create_unimplemented_device ("pcie-phy" ,FSL_IMX7_PCIE_PHY_ADDR , +FSL_IMX7_PCIE_PHY_SIZE ); }static void fsl_imx7_class_init (ObjectClass *oc,void *data)
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH 2/5] i.mx7d: Add no-op/unimplemented PCIE PHY IP block
Quoted 34 lines · Andrey Smirnov
Add no-op/unimplemented PCIE PHY IP block. Needed by new kernels to use PCIE.
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>--- include/hw/arm/fsl-imx7.h | 3 +++ hw/arm/fsl-imx7.c | 5 +++++ 2 files changed, 8 insertions(+)include/hw/arm/fsl-imx7.h +3
-0@@ -125,6 +125,9 @@ enum FslIMX7MemoryMap {FSL_IMX7_ADC2_ADDR =0x30620000 , FSL_IMX7_ADCn_SIZE =0x1000 , +FSL_IMX7_PCIE_PHY_ADDR =0x306D0000 , +FSL_IMX7_PCIE_PHY_SIZE =0x10000 , +FSL_IMX7_GPC_ADDR =0x303A0000 , FSL_IMX7_I2C1_ADDR = 0x30A20000,hw/arm/fsl-imx7.c +0
-0@@ -532,6 +532,11 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)*/
hw/arm/fsl-imx7.c static void fsl_imx7_realize(DeviceState *dev, Error **errp) · line 542
Quoted 10 lines
hw/arm/fsl-imx7.c +5
-0create_unimplemented_device ("dma-apbh" ,FSL_IMX7_DMA_APBH_ADDR ,FSL_IMX7_DMA_APBH_SIZE ); +/* +* PCIe PHY +*/ +create_unimplemented_device ("pcie-phy" ,FSL_IMX7_PCIE_PHY_ADDR , +FSL_IMX7_PCIE_PHY_SIZE ); }static void fsl_imx7_class_init (ObjectClass *oc,void *data)
PATCH 3/5 pci: designware: Update MSI mapping unconditionally
In reply to Andrey SmirnovExpression to calculate update_msi_mapping in code handling writes to DESIGNWARE_PCIE_MSI_INTR0_ENABLE is missing an ! operator and should be:
!!root->msi.intr[0].enable ^ !!val;
so that MSI mapping is updated when enabled transitions from either "none" -> "any" or "any" -> "none". Since that register shouldn't be written to very often, change the code to update MSI mapping unconditionally instead of trying to fix the update_msi_mapping logic.
--- hw/pci-host/designware.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
hw/pci-host/designware.c +2 -8
@@ -296,16 +296,10 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address, root->msi.base |= (uint64_t )val <<32 ;break ; -case DESIGNWARE_PCIE_MSI_INTR0_ENABLE : { -const bool update_msi_mapping = !root->msi.intr[0 ].enable ^ !!val; - +case DESIGNWARE_PCIE_MSI_INTR0_ENABLE : root->msi.intr[0 ].enable = val; - -if (update_msi_mapping) { -designware_pcie_root_update_msi_mapping (root); - } +designware_pcie_root_update_msi_mapping (root);break ; - }case DESIGNWARE_PCIE_MSI_INTR0_MASK : root->msi.intr[0 ].mask = val;
Signature · 1 line
2.20.1
Re: [Qemu-arm] [PATCH 3/5] pci: designware: Update MSI mapping unconditionally
Quoted 11 lines · Andrey Smirnov
Expression to calculate
update_msi_mappingin code handling writes toDESIGNWARE_PCIE_MSI_INTR0_ENABLEis missing an ! operator and should be:!!root->msi.intr[0].enable ^ !!val;so that MSI mapping is updated when enabled transitions from either "none" -> "any" or "any" -> "none". Since that register shouldn't be written to very often, change the code to update MSI mapping unconditionally instead of trying to fix the
update_msi_mappinglogic.
Quoted 5 lines
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Quoted 29 lines
--- hw/pci-host/designware.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)hw/pci-host/designware.c +2
-8@@ -296,16 +296,10 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address, root->msi.base |= (uint64_t )val <<32 ;break ; -case DESIGNWARE_PCIE_MSI_INTR0_ENABLE : { -const bool update_msi_mapping = !root->msi.intr[0 ].enable ^ !!val; - +case DESIGNWARE_PCIE_MSI_INTR0_ENABLE : root->msi.intr[0 ].enable = val; - -if (update_msi_mapping) { -designware_pcie_root_update_msi_mapping (root); - } +designware_pcie_root_update_msi_mapping (root);break ; - }case DESIGNWARE_PCIE_MSI_INTR0_MASK : root->msi.intr[0 ].mask = val;Signature · 1 line
2.20.1
Re: [Qemu-arm] [PATCH 3/5] pci: designware: Update MSI mapping unconditionally
In reply to Andrey SmirnovQuoted 12 lines · Andrey Smirnov
Expression to calculate
update_msi_mappingin code handling writes toDESIGNWARE_PCIE_MSI_INTR0_ENABLEis missing an ! operator and should be:!!root->msi.intr[0].enable ^ !!val;so that MSI mapping is updated when enabled transitions from either "none" -> "any" or "any" -> "none". Since that register shouldn't be written to very often, change the code to update MSI mapping unconditionally instead of trying to fix the
update_msi_mappinglogic.
Quoted 6 lines
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>---
thanks
-- PMM
PATCH 4/5 pci: designware: Update MSI mapping when MSI address changes
In reply to Andrey SmirnovMSI mapping needs to be update when MSI address changes, so add the code to do so.
--- hw/pci-host/designware.c | 2 ++ 1 file changed, 2 insertions(+)
hw/pci-host/designware.c +2 -0
@@ -289,11 +289,13 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,case DESIGNWARE_PCIE_MSI_ADDR_LO : root->msi.base &=0xFFFFFFFF00000000ULL ; root->msi.base |= val; +designware_pcie_root_update_msi_mapping (root);break ;case DESIGNWARE_PCIE_MSI_ADDR_HI : root->msi.base &=0x00000000FFFFFFFFULL ; root->msi.base |= (uint64_t )val <<32 ; +designware_pcie_root_update_msi_mapping (root);break ;case DESIGNWARE_PCIE_MSI_INTR0_ENABLE :
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH 4/5] pci: designware: Update MSI mapping when MSI address changes
Quoted 8 lines · Andrey Smirnov
MSI mapping needs to be update when MSI address changes, so add the code to do so.
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Quoted 24 lines
--- hw/pci-host/designware.c | 2 ++ 1 file changed, 2 insertions(+)hw/pci-host/designware.c +2
-0@@ -289,11 +289,13 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,case DESIGNWARE_PCIE_MSI_ADDR_LO : root->msi.base &=0xFFFFFFFF00000000ULL ; root->msi.base |= val; +designware_pcie_root_update_msi_mapping (root);break ;case DESIGNWARE_PCIE_MSI_ADDR_HI : root->msi.base &=0x00000000FFFFFFFFULL ; root->msi.base |= (uint64_t )val <<32 ; +designware_pcie_root_update_msi_mapping (root);break ;case DESIGNWARE_PCIE_MSI_INTR0_ENABLE :Signature · 1 line
2.20.1
Re: [Qemu-arm] [PATCH 4/5] pci: designware: Update MSI mapping when MSI address changes
In reply to Andrey SmirnovQuoted 10 lines · Andrey Smirnov
MSI mapping needs to be update when MSI address changes, so add the code to do so.
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>---
thanks
-- PMM
PATCH 5/5 i.mx7d: pci: Update PCI IRQ mapping to match HW
In reply to Andrey SmirnovDatasheet for i.MX7 is incorrect and i.MX7's PCI IRQ mapping matches that of i.MX6:
* INTD/MSI 122
* INTC 123
* INTB 124
* INTA 125Fix all of the relevant code to reflect that fact. Needed by latest Linux kernels.
--- include/hw/arm/fsl-imx7.h | 8 ++++---- hw/pci-host/designware.c | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-)
include/hw/arm/fsl-imx7.h +4 -4
@@ -213,10 +213,10 @@ enum FslIMX7IRQs {FSL_IMX7_USB2_IRQ =42 ,FSL_IMX7_USB3_IRQ =40 , -FSL_IMX7_PCI_INTA_IRQ =122 , -FSL_IMX7_PCI_INTB_IRQ =123 , -FSL_IMX7_PCI_INTC_IRQ =124 , -FSL_IMX7_PCI_INTD_IRQ =125 , +FSL_IMX7_PCI_INTA_IRQ =125 , +FSL_IMX7_PCI_INTB_IRQ =124 , +FSL_IMX7_PCI_INTC_IRQ =123 , +FSL_IMX7_PCI_INTD_IRQ =122 , FSL_IMX7_UART7_IRQ = 126,
hw/pci-host/designware.c +4 -2
@@ -50,6 +50,8 @@#define DESIGNWARE_PCIE_ATU_DEVFN (x) (((x) >> 16) & 0xff)#define DESIGNWARE_PCIE_ATU_UPPER_TARGET 0x91C +#define DESIGNWARE_PCIE_IRQ_MSI 3 +static DesignwarePCIEHost *designware_pcie_root_to_host (DesignwarePCIERoot *root) {
@@ -66,7 +68,7 @@ static void designware_pcie_root_msi_write(void *opaque, hwaddr addr, root->msi.intr[0 ].status |=BIT (val) & root->msi.intr[0 ].enable;if (root->msi.intr[0 ].status & ~root->msi.intr[0 ].mask) { -qemu_set_irq (host->pci.irqs[0 ],1 ); +qemu_set_irq (host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI ],1 ); } }
@@ -310,7 +312,7 @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,case DESIGNWARE_PCIE_MSI_INTR0_STATUS : root->msi.intr[0 ].status ^= val;if (!root->msi.intr[0 ].status) { -qemu_set_irq (host->pci.irqs[0 ],0 ); +qemu_set_irq (host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI ],0 ); }break ;
Signature · 1 line
2.20.1
Re: [Qemu-devel] [PATCH 5/5] i.mx7d: pci: Update PCI IRQ mapping to match HW
Quoted 17 lines · Andrey Smirnov
Datasheet for i.MX7 is incorrect and i.MX7's PCI IRQ mapping matches that of i.MX6:
* INTD/MSI 122 * INTC 123 * INTB 124 * INTA 125Fix all of the relevant code to reflect that fact. Needed by latest Linux kernels.
Signed-off-by Andrey Smirnov <[email protected]>Cc Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>
Quoted 4 lines
--- include/hw/arm/fsl-imx7.h | 8 ++++---- hw/pci-host/designware.c | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-)
Compare Linux kernel commit 538d6e9d597584e805146 from an NXP employee confirming that the datasheet is incorrect and with a report of a test against real h/w.
thanks
-- PMM
Quoted 11 lines · Andrey Smirnov
Everyone:
I recently revisited my i.MX7 work and this series contains all of the fixes I had to make to get it to work with latest (5.1-rc1) Linux kernel again as well as fixes for genuine bugs that I somehow missed during original submission ("pci: designware" patches). Hopefully each patch is self-explanatory.
Feedback is welcome!
Is there any changes necessary for this to go in?
Thanks,
Andrey Smirnov
Quoted 11 lines · Andrey Smirnov
Quoted 9 lines · Andrey Smirnov
Everyone:
I recently revisited my i.MX7 work and this series contains all of the fixes I had to make to get it to work with latest (5.1-rc1) Linux kernel again as well as fixes for genuine bugs that I somehow missed during original submission ("pci: designware" patches). Hopefully each patch is self-explanatory.
Quoted 4 lines
Quoted 2 lines
Feedback is welcome!
Is there any changes necessary for this to go in?
Oops, sorry we missed this (for future patches you can feel free to ping them after a couple of weeks of no response).
If you could reply to Philippe's query on patch 1 about the correct value for FSL_IMX7_DMA_APBH_SIZE that would be great, but since that's a very minor issue and we have softfreeze for the next release tomorrow, I'm going to take these patches into target-arm.next as they stand. We can fix the size value with a followup patch if necessary.
thanks
-- PMM