Virtualization support for Tegra ADMA
PATCH 1/2 dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
In reply to Sameer PujarFrom: Mohan Kumar <[email protected]>
For Non-Hypervisor mode, Tegra ADMA driver requires the register resource range to include both global and channel page in the reg entry. For Hypervisor more, Tegra ADMA driver requires only the channel page and global page range is not allowed for access.
Add reg-names DT binding for Hypervisor mode to help driver to differentiate the config between Hypervisor and Non-Hypervisor mode of execution.
--- .../devicetree/bindings/dma/nvidia,tegra210-adma.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml +10 -0
@@ -29,8 +29,18 @@ properties: - const: nvidia,tegra186-adma reg: + description: | + For hypervisor mode, the address range should include a + ADMA channel page address range, for non-hypervisor mode + it starts with ADMA base address covering Global and Channel + page address range. maxItems: 1 + reg-names: + description: only required for Hypervisor mode. + items: + - const: vm + interrupts: description: | Should contain all of the per-channel DMA interrupts in
Signature · 1 line
2.45.1
cover Virtualization support for Tegra ADMA
From: Mohan Kumar <[email protected]>
Tegra ADMA HW supports multiple PAGES for virtualization, to support virtualization
- reg-names property has been added to DT binding for the hypervisor mode.
- In hypervisor mode the ADMA global registers are not accessed by guest.
Mohan Kumar (2):
dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
dmaengine: tegra210-adma: Add support for ADMA virtualization
.../bindings/dma/nvidia,tegra210-adma.yaml | 10 +++++ drivers/dma/tegra210-adma.c | 44 +++++++++++++++---- 2 files changed, 46 insertions(+), 8 deletions(-)
Signature · 1 line
2.45.1
PATCH 2/2 dmaengine: tegra210-adma: Add support for ADMA virtualization
From: Mohan Kumar <[email protected]>
Tegra ADMA HW supports multiple PAGES for virtualization, to support virtualization support reg-names property has been added to DT binding to know the hypervisor mode. Also in hypervisor mode the ADMA global registers are not accessed by guest OS.
--- drivers/dma/tegra210-adma.c | 44 ++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-)
drivers/dma/tegra210-adma.c +36 -8
@@ -160,6 +160,8 @@ struct tegra_adma {/* Used to store global command register state when suspending */ unsigned int global_cmd; +bool is_virtualized; +const struct tegra_adma_chip_data *cdata;/* Last member of the structure */
@@ -222,8 +224,15 @@ static int tegra_adma_init(struct tegra_adma *tdma)u32 status;int ret; -/* Clear any interrupts */ -tdma_write (tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear,0x1 ); +if (!tdma->is_virtualized) { +/* Clear any interrupts */ +tdma_write (tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear,0x1 ); + }else { +/* For virtualized mode, ADMA global registers are not accessed */ +tdma_write (tdma, tdma->cdata->global_int_clear,0x1 ); + tdma->global_cmd =1 ; +return 0 ; + }/* Assert soft reset */ tdma_write (tdma,ADMA_GLOBAL_SOFT_RESET ,0x1 );
@@ -736,7 +745,9 @@ static int __maybe_unused tegra_adma_runtime_suspend(struct device *dev)struct tegra_adma_chan *tdc;int i; - tdma->global_cmd =tdma_read (tdma,ADMA_GLOBAL_CMD ); +if (!tdma->is_virtualized) + tdma->global_cmd =tdma_read (tdma,ADMA_GLOBAL_CMD ); +if (!tdma->global_cmd) goto clk_disable;
@@ -777,7 +788,9 @@ static int __maybe_unused tegra_adma_runtime_resume(struct device *dev)dev_err (dev,"ahub clk_enable failed: %d\n" , ret);return ret; } -tdma_write (tdma,ADMA_GLOBAL_CMD , tdma->global_cmd); + +if (!tdma->is_virtualized) +tdma_write (tdma,ADMA_GLOBAL_CMD , tdma->global_cmd);if (!tdma->global_cmd)return 0 ;
@@ -846,6 +859,8 @@ static int tegra_adma_probe(struct platform_device *pdev) {const struct tegra_adma_chip_data *cdata;struct tegra_adma *tdma; +unsigned int ch_base_offset; +struct resource *res;int ret, i; cdata =of_device_get_match_data (&pdev->dev);
@@ -865,9 +880,22 @@ static int tegra_adma_probe(struct platform_device *pdev) tdma->nr_channels = cdata->nr_channels;platform_set_drvdata (pdev, tdma); - tdma->base_addr =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (tdma->base_addr)) -return PTR_ERR (tdma->base_addr); + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"vm" ); +if (res) { + tdma->base_addr =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (tdma->base_addr)) +return PTR_ERR (tdma->base_addr); + + tdma->is_virtualized = true; + ch_base_offset =0 ; + }else { + tdma->base_addr =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (tdma->base_addr)) +return PTR_ERR (tdma->base_addr); + + tdma->is_virtualized = false; + ch_base_offset = cdata->ch_base_offset; + } tdma->ahub_clk =devm_clk_get (&pdev->dev,"d_audio" );if (IS_ERR (tdma->ahub_clk)) {
@@ -900,7 +928,7 @@ static int tegra_adma_probe(struct platform_device *pdev)if (!test_bit (i, tdma->dma_chan_mask))continue ; - tdc->chan_addr = tdma->base_addr + cdata->ch_base_offset + tdc->chan_addr = tdma->base_addr + ch_base_offset + (cdata->ch_reg_size * i); tdc->irq =of_irq_get (pdev->dev.of_node, i);
Signature · 1 line
2.45.1
Re: [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
In reply to Sameer PujarQuoted 7 lines · Sameer Pujar
From: Mohan Kumar <[email protected]>
For Non-Hypervisor mode, Tegra ADMA driver requires the register resource range to include both global and channel page in the reg entry. For Hypervisor more, Tegra ADMA driver requires only the channel page and global page range is not allowed for access.
Quoted 6 lines
Add reg-names DT binding for Hypervisor mode to help driver to differentiate the config between Hypervisor and Non-Hypervisor mode of execution.
Signed-off-by Mohan Kumar <[email protected]>Signed-off-by Sameer Pujar <[email protected]>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline), work on fork of kernel (don't, instead use mainline) or you ignore some maintainers (really don't). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: dma: Add reg-names to nvidia,tegra210-adma
Quoted 26 lines · Krzysztof Kozlowski
Quoted 7 lines · Sameer Pujar
From: Mohan Kumar <[email protected]>
For Non-Hypervisor mode, Tegra ADMA driver requires the register resource range to include both global and channel page in the reg entry. For Hypervisor more, Tegra ADMA driver requires only the channel page and global page range is not allowed for access.
Quoted 6 lines
Add reg-names DT binding for Hypervisor mode to help driver to differentiate the config between Hypervisor and Non-Hypervisor mode of execution.
Signed-off-by Mohan Kumar <[email protected]>Signed-off-by Sameer Pujar <[email protected]>Please use
scripts/get_maintainers.plto get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.Tools like b4 or
scripts/get_maintainer.plprovide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline), work on fork of kernel (don't, instead use mainline) or you ignore some maintainers (really don't). Just use b4 and everything should be fine, although remember aboutb4 prep --auto-to-ccif you added new patches to the patchset.
Quoted 6 lines
You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
Sorry about this, I will resend the series. Thanks.