Re: [PATCH 08/23] mtd: rawnand: Pass a nand_chip object to ecc->read_xxx() hooks
Hi Boris, On 17.08.2018 18:09, Boris Brezillon wrote: > Let's make the raw NAND API consistent by patching all helpers and > hooks to take a nand_chip object instead of an mtd_info one or > remove the mtd_info object when both are passed. > > Let's tackle all ecc->read_xxx() hooks at once. > > Signed-off-by: Boris Brezillon > --- > drivers/mtd/nand/raw/atmel/nand-controller.c | 12 ++--- > drivers/mtd/nand/raw/brcmnand/brcmnand.c | 21 > drivers/mtd/nand/raw/cafe_nand.c | 10 ++-- > drivers/mtd/nand/raw/denali.c | 17 +++--- > drivers/mtd/nand/raw/docg4.c | 20 > drivers/mtd/nand/raw/fsl_elbc_nand.c | 5 +- > drivers/mtd/nand/raw/fsl_ifc_nand.c | 5 +- > drivers/mtd/nand/raw/fsmc_nand.c | 6 +-- > drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c| 23 - > drivers/mtd/nand/raw/hisi504_nand.c | 9 ++-- > drivers/mtd/nand/raw/lpc32xx_mlc.c| 10 ++-- > drivers/mtd/nand/raw/lpc32xx_slc.c| 14 ++--- > drivers/mtd/nand/raw/marvell_nand.c | 30 +-- > drivers/mtd/nand/raw/mtk_nand.c | 23 + > drivers/mtd/nand/raw/mxc_nand.c | 11 ++-- > drivers/mtd/nand/raw/nand_base.c | 74 > +-- > drivers/mtd/nand/raw/nand_micron.c| 6 +-- > drivers/mtd/nand/raw/omap2.c | 6 +-- > drivers/mtd/nand/raw/qcom_nandc.c | 11 ++-- > drivers/mtd/nand/raw/r852.c | 5 +- > drivers/mtd/nand/raw/sh_flctl.c | 6 ++- > drivers/mtd/nand/raw/sunxi_nand.c | 26 +- > drivers/mtd/nand/raw/tango_nand.c | 16 +++--- > drivers/mtd/nand/raw/tegra_nand.c | 15 +++--- > drivers/mtd/nand/raw/vf610_nfc.c | 18 +++ > drivers/staging/mt29f_spinand/mt29f_spinand.c | 5 +- > include/linux/mtd/rawnand.h | 30 +-- > 27 files changed, 216 insertions(+), 218 deletions(-) > [...] > diff --git a/drivers/mtd/nand/raw/tegra_nand.c > b/drivers/mtd/nand/raw/tegra_nand.c > index 5dcee20e2a8c..bcc3a2888c4f 100644 > --- a/drivers/mtd/nand/raw/tegra_nand.c > +++ b/drivers/mtd/nand/raw/tegra_nand.c > @@ -615,10 +615,10 @@ static int tegra_nand_page_xfer(struct mtd_info > *mtd, struct nand_chip *chip, > return ret; > } > > -static int tegra_nand_read_page_raw(struct mtd_info *mtd, > - struct nand_chip *chip, u8 *buf, > +static int tegra_nand_read_page_raw(struct nand_chip *chip, u8 *buf, > int oob_required, int page) > { > + struct mtd_info *mtd = nand_to_mtd(chip); > void *oob_buf = oob_required ? chip->oob_poi : NULL; > > return tegra_nand_page_xfer(mtd, chip, buf, oob_buf, Since mtd is only required to pass it to tegra_nand_page_xfer, it would be better to change tegra_nand_page_xfer to only take chip. -- Stefan > @@ -635,9 +635,10 @@ static int tegra_nand_write_page_raw(struct mtd_info > *mtd, >mtd->oobsize, page, false); > } > > -static int tegra_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, > -int page) > +static int tegra_nand_read_oob(struct nand_chip *chip, int page) > { > + struct mtd_info *mtd = nand_to_mtd(chip); > + > return tegra_nand_page_xfer(mtd, chip, NULL, chip->oob_poi, > mtd->oobsize, page, true); > } > @@ -649,10 +650,10 @@ static int tegra_nand_write_oob(struct mtd_info > *mtd, struct nand_chip *chip, > mtd->oobsize, page, false); > } > > -static int tegra_nand_read_page_hwecc(struct mtd_info *mtd, > - struct nand_chip *chip, u8 *buf, > +static int tegra_nand_read_page_hwecc(struct nand_chip *chip, u8 *buf, > int oob_required, int page) > { > + struct mtd_info *mtd = nand_to_mtd(chip); > struct tegra_nand_controller *ctrl = to_tegra_ctrl(chip->controller); > struct tegra_nand_chip *nand = to_tegra_chip(chip); > void *oob_buf = oob_required ? chip->oob_poi : NULL; > @@ -716,7 +717,7 @@ static int tegra_nand_read_page_hwecc(struct mtd_info > *mtd, >* erased or if error correction just failed for all sub- >* pages. >*/ > - ret = tegra_nand_read_oob(mtd, chip, page); > + ret = tegra_nand_read_oob(chip, page); > if (ret < 0) > return ret; > > diff --git a/drivers/mtd/nand/raw/vf610_nfc.c > b/drivers/mtd/nand/raw/vf610_nfc.c > index a73213c835a5..7cbcc41cea95 100644 > --- a/drivers/mtd/nand/raw/vf610_nfc.c > +++ b/drivers/mtd/nand/raw/vf610_nfc.c > @@ -557,9 +557,10 @@ static void vf610_nfc_fill_row(struct nand_chip > *chip, int page, u32 *code, > } > } > > -static int vf610_nfc_read_page(st
Re: [PATCH] staging: mt7621-mmc: Use __func__ instead of __FUNCTION__ in dbg.h
On Thu, Aug 16, 2018 at 01:07:41PM -0700, Joe Perches wrote: > On Fri, 2018-08-17 at 01:19 +0530, Nishad Kamdar wrote: > > Use the identifier __func__ instead of gcc specific __FUNCTION__ > > in dbg.h. Limit these lines to 80 characters. Issues found by > > checkpatch. > > It looks like there are 4 uses in -next > > drivers/staging/mt7621-mmc/dbg.h:110:host->id, ##args , > __FUNCTION__, __LINE__, current->comm, current->pid); \ > drivers/staging/mt7621-mmc/dbg.h:118: host->id, ##args, > __FUNCTION__, __LINE__, current->comm, current->pid); \ > drivers/staging/mt7621-mmc/dbg.h:129: host->id, ##args, > __FUNCTION__, __LINE__, current->comm, current->pid); \ > drivers/staging/mt7621-mmc/dbg.h:136: host->id, ##args, > __FUNCTION__, __LINE__); \ > > If you are going to fix this by substitution, > please fix all of them, even if commented out. > > And likely, all these uses should all be converted > to dev_ instead without __func__ or __LINE__ > or current->comm and current->pid. > > And relatedly, these are single statement macros and > don't need do while (0); > > And the ; after while (0) is unnecessary. > > > Signed-off-by: Nishad Kamdar > > --- > > drivers/staging/mt7621-mmc/dbg.h | 8 +--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/mt7621-mmc/dbg.h > > b/drivers/staging/mt7621-mmc/dbg.h > > index 2f2c56b73987..5da275239d7c 100644 > > --- a/drivers/staging/mt7621-mmc/dbg.h > > +++ b/drivers/staging/mt7621-mmc/dbg.h > > @@ -115,7 +115,8 @@ do {\ > > #define ERR_MSG(fmt, args...) \ > > do { \ > > printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ > > - host->id, ##args, __FUNCTION__, __LINE__, current->comm, > > current->pid); \ > > + host->id, ##args, __func__, __LINE__, current->comm, \ > > + current->pid); \ > > } while (0); > > > > #if 1 > > @@ -126,14 +127,15 @@ do { \ > > #define INIT_MSG(fmt, args...) \ > > do { \ > > printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ > > - host->id, ##args, __FUNCTION__, __LINE__, current->comm, > > current->pid); \ > > + host->id, ##args, __func__, __LINE__, current->comm, \ > > + current->pid); \ > > } while (0); > > > > /* PID in ISR in not corrent */ > > #define IRQ_MSG(fmt, args...) \ > > do { \ > > printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ > > - host->id, ##args, __FUNCTION__, __LINE__); \ > > + host->id, ##args, __func__, __LINE__); \ > > } while (0); > > #endif > > Ok, I'll include the changes in the next version. Thanks for the review. regards, nishad ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h
Fixed four debug macros by replacing printk with dev_ without __func__ or __LINE__ or current->comm and current->pid. Further removed the do {} while(0) loop for single statement macro. Issues found by checkpatch. Signed-off-by: Nishad Kamdar --- Changes in v2: - Replace printk with dev_. - Remove __func__, __LINE__, current->comm, current->pid from arguments. - Remove the do {} while(0) loop from these macros. - Modify commit message to include other changes. --- drivers/staging/mt7621-mmc/dbg.h | 26 +++--- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 2f2c56b73987..e8091db3c1d6 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -104,19 +104,13 @@ do { \ #define N_MSG(evt, fmt, args...) /* -do {\ -if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ -printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ -host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ -} \ -} while(0) -*/ + *if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ + *dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \ + *} + */ #define ERR_MSG(fmt, args...) \ -do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) #if 1 //defined CONFIG_MTK_MMC_CD_POLL @@ -124,17 +118,11 @@ do { \ #define IRQ_MSG(fmt, args...) #else #define INIT_MSG(fmt, args...) \ -do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) /* PID in ISR in not corrent */ #define IRQ_MSG(fmt, args...) \ -do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ - host->id, ##args, __FUNCTION__, __LINE__); \ -} while (0); +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) #endif void msdc_debug_proc_init(void); -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h
On Sat, Aug 18, 2018 at 05:13:17PM +0530, Nishad Kamdar wrote: > Fixed four debug macros by replacing printk with dev_ > without __func__ or __LINE__ or current->comm and current->pid. > Further removed the do {} while(0) loop for single statement > macro. Issues found by checkpatch. > > Signed-off-by: Nishad Kamdar > --- > Changes in v2: > - Replace printk with dev_. > - Remove __func__, __LINE__, current->comm, current->pid from arguments. > - Remove the do {} while(0) loop from these macros. > - Modify commit message to include other changes. > --- > drivers/staging/mt7621-mmc/dbg.h | 26 +++--- > 1 file changed, 7 insertions(+), 19 deletions(-) > > diff --git a/drivers/staging/mt7621-mmc/dbg.h > b/drivers/staging/mt7621-mmc/dbg.h > index 2f2c56b73987..e8091db3c1d6 100644 > --- a/drivers/staging/mt7621-mmc/dbg.h > +++ b/drivers/staging/mt7621-mmc/dbg.h > @@ -104,19 +104,13 @@ do { \ > > #define N_MSG(evt, fmt, args...) > /* > -do {\ > -if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ > -printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ > -host->id, ##args , __FUNCTION__, __LINE__, current->comm, > current->pid);\ > -} \ > -} while(0) > -*/ > + *if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ > + *dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \ > + *} > + */ This can just be deleted, just drop it. > > #define ERR_MSG(fmt, args...) \ > -do { \ > - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ > -host->id, ##args, __FUNCTION__, __LINE__, current->comm, > current->pid); \ > -} while (0); > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) No, please just replace all usages of ERR_MSG with dev_err() in the code itself, and then drop ERR_MSG. No driver/subsystem should have special macros just for it. > #if 1 > //defined CONFIG_MTK_MMC_CD_POLL > @@ -124,17 +118,11 @@ do { \ > #define IRQ_MSG(fmt, args...) > #else > #define INIT_MSG(fmt, args...) \ > -do { \ > - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ > -host->id, ##args, __FUNCTION__, __LINE__, current->comm, > current->pid); \ > -} while (0); > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) Same here. Actually I bet all INIT_MSG can just be removed :) > > /* PID in ISR in not corrent */ > #define IRQ_MSG(fmt, args...) \ > -do { \ > - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ > -host->id, ##args, __FUNCTION__, __LINE__); \ > -} while (0); > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) Same here, just replace the usage of these macros with the real thing. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 11/14] ARM: tegra: Enable VDE on Tegra124
On Monday, 13 August 2018 17:50:24 MSK Thierry Reding wrote: > From: Thierry Reding > > Signed-off-by: Thierry Reding > --- > arch/arm/boot/dts/tegra124.dtsi | 40 + > 1 file changed, 40 insertions(+) > > diff --git a/arch/arm/boot/dts/tegra124.dtsi > b/arch/arm/boot/dts/tegra124.dtsi index b113e47b2b2a..8fdca4723205 100644 > --- a/arch/arm/boot/dts/tegra124.dtsi > +++ b/arch/arm/boot/dts/tegra124.dtsi > @@ -83,6 +83,19 @@ > }; > }; > > + iram@4000 { > + compatible = "mmio-sram"; > + reg = <0x0 0x4000 0x0 0x4>; > + #address-cells = <1>; > + #size-cells = <1>; > + ranges = <0 0x0 0x4000 0x4>; > + > + vde_pool: pool@400 { > + reg = <0x400 0x3fc00>; > + pool; > + }; > + }; > + > host1x@5000 { > compatible = "nvidia,tegra124-host1x", "simple-bus"; > reg = <0x0 0x5000 0x0 0x00034000>; > @@ -283,6 +296,33 @@ > */ > }; > > + vde@6003 { > + compatible = "nvidia,tegra124-vde", "nvidia,tegra30-vde", > + "nvidia,tegra20-vde"; > + reg = <0x0 0x6003 0x0 0x1000 /* Syntax Engine */ > +0x0 0x60031000 0x0 0x1000 /* Video Bitstream Engine */ > +0x0 0x60032000 0x0 0x0100 /* Macroblock Engine */ > +0x0 0x60032200 0x0 0x0100 /* Post-processing Engine */ > +0x0 0x60032400 0x0 0x0100 /* Motion Compensation > Engine */ > +0x0 0x60032600 0x0 0x0100 /* Transform Engine */ > +0x0 0x60032800 0x0 0x0100 /* Pixel prediction block */ > +0x0 0x60032a00 0x0 0x0100 /* Video DMA */ > +0x0 0x60033800 0x0 0x0400>; /* Video frame controls */ > + reg-names = "sxe", "bsev", "mbe", "ppe", "mce", > + "tfe", "ppb", "vdma", "frameid"; > + iram = <&vde_pool>; /* IRAM region */ > + interrupts = , /* Sync token > + , /* BSE-V > interrupt */ > + ; /* SXE interrupt > */ > + interrupt-names = "sync-token", "bsev", "sxe"; > + clocks = <&tegra_car TEGRA124_CLK_VDE>, > + <&tegra_car TEGRA124_CLK_BSEV>; > + clock-names = "vde", "bsev"; > + resets = <&tegra_car 61>, > + <&tegra_car 63>; > + reset-names = "vde", "bsev"; Memory client reset missed? > + }; > + > apbdma: dma@6002 { > compatible = "nvidia,tegra124-apbdma", "nvidia,tegra148-apbdma"; > reg = <0x0 0x6002 0x0 0x1400>; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 05/14] staging: media: tegra-vde: Properly mark invalid entries
On Monday, 13 August 2018 17:50:18 MSK Thierry Reding wrote: > From: Thierry Reding > > Entries in the reference picture list are marked as invalid by setting > the frame ID to 0x3f. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 275884e745df..0ce30c7ccb75 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -296,7 +296,7 @@ static void tegra_vde_setup_iram_tables(struct tegra_vde > *vde, (frame->flags & FLAG_B_FRAME)); > } else { > aux_addr = 0x6ADEAD00; > - value = 0; > + value = 0x3f; > } > > tegra_vde_setup_iram_entry(vde, num_ref_pics, 0, i, value, Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 06/14] staging: media: tegra-vde: Print out invalid FD
On Monday, 13 August 2018 17:50:19 MSK Thierry Reding wrote: > From: Thierry Reding > > Include the invalid file descriptor when reporting an error message to > help diagnosing why importing the buffer failed. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 0ce30c7ccb75..0adc603fa437 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -643,7 +643,7 @@ static int tegra_vde_attach_dmabuf(struct device *dev, > > dmabuf = dma_buf_get(fd); > if (IS_ERR(dmabuf)) { > - dev_err(dev, "Invalid dmabuf FD\n"); > + dev_err(dev, "Invalid dmabuf FD: %d\n", fd); > return PTR_ERR(dmabuf); > } Reviewed-by: Dmitry Osipenko ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 14/14] ARM: tegra: Enable SMMU for VDE on Tegra124
On Monday, 13 August 2018 17:50:27 MSK Thierry Reding wrote: > From: Thierry Reding > > The video decode engine can use the SMMU to use buffers that are not > physically contiguous in memory. This allows better memory usage for > video decoding, since fragmentation may cause contiguous allocations > to fail. > > Signed-off-by: Thierry Reding > --- > arch/arm/boot/dts/tegra124.dtsi | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm/boot/dts/tegra124.dtsi > b/arch/arm/boot/dts/tegra124.dtsi index 8fdca4723205..0713e0ed5fef 100644 > --- a/arch/arm/boot/dts/tegra124.dtsi > +++ b/arch/arm/boot/dts/tegra124.dtsi > @@ -321,6 +321,8 @@ > resets = <&tegra_car 61>, ><&tegra_car 63>; > reset-names = "vde", "bsev"; > + > + iommus = <&mc TEGRA_SWGROUP_VDE>; > }; > > apbdma: dma@6002 { Reviewed-by: Dmitry Osipenko The same should be applied to Tegra30. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 03/14] staging: media: tegra-vde: Prepare for interlacing support
On Monday, 13 August 2018 17:50:16 MSK Thierry Reding wrote: > From: Thierry Reding > > The number of frames doubles when decoding interlaced content and the > structures describing the frames double in size. Take that into account > to prepare for interlacing support. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 73 - > 1 file changed, 58 insertions(+), 15 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 3027b11b11ae..1a40f6dff7c8 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -61,7 +61,9 @@ struct video_frame { > }; > > struct tegra_vde_soc { > + unsigned int num_ref_pics; > bool supports_ref_pic_marking; > + bool supports_interlacing; > }; > > struct tegra_vde { > @@ -205,8 +207,12 @@ static void tegra_vde_setup_frameid(struct tegra_vde > *vde, u32 cr_addr = frame ? frame->cr_addr : 0x6CDEAD00; > u32 value1 = frame ? ((mbs_width << 16) | mbs_height) : 0; > u32 value2 = frame ? mbs_width + 1) >> 1) << 6) | 1) : 0; > + u32 value = y_addr >> 8; Let's name it value0 for consistency. > > - VDE_WR(y_addr >> 8, vde->frameid + 0x000 + frameid * 4); > + if (vde->soc->supports_interlacing) > + value |= BIT(31); > + > + VDE_WR(value,vde->frameid + 0x000 + frameid * 4); > VDE_WR(cb_addr >> 8, vde->frameid + 0x100 + frameid * 4); > VDE_WR(cr_addr >> 8, vde->frameid + 0x180 + frameid * 4); > VDE_WR(value1, vde->frameid + 0x080 + frameid * 4); > @@ -229,20 +235,23 @@ static void tegra_setup_frameidx(struct tegra_vde > *vde, } > > static void tegra_vde_setup_iram_entry(struct tegra_vde *vde, > +unsigned int num_ref_pics, > unsigned int table, > unsigned int row, > u32 value1, u32 value2) > { > + unsigned int entries = num_ref_pics * 2; > u32 *iram_tables = vde->iram; > > dev_dbg(vde->miscdev.parent, "IRAM table %u: row %u: 0x%08X 0x%08X\n", > table, row, value1, value2); > > - iram_tables[0x20 * table + row * 2] = value1; > - iram_tables[0x20 * table + row * 2 + 1] = value2; > + iram_tables[entries * table + row * 2] = value1; > + iram_tables[entries * table + row * 2 + 1] = value2; > } > > static void tegra_vde_setup_iram_tables(struct tegra_vde *vde, > + unsigned int num_ref_pics, > struct video_frame *dpb_frames, > unsigned int ref_frames_nb, > unsigned int with_earlier_poc_nb) > @@ -251,13 +260,17 @@ static void tegra_vde_setup_iram_tables(struct > tegra_vde *vde, u32 value, aux_addr; > int with_later_poc_nb; > unsigned int i, k; > + size_t size; > + > + size = num_ref_pics * 4 * 8; > + memset(vde->iram, 0, size); Is this memset() really needed or it is just because you're feeling uncomfortable that something is kept uninitialized? > > dev_dbg(vde->miscdev.parent, "DPB: Frame 0: frame_num = %d\n", > dpb_frames[0].frame_num); > > dev_dbg(vde->miscdev.parent, "REF L0:\n"); > > - for (i = 0; i < 16; i++) { > + for (i = 0; i < num_ref_pics; i++) { > if (i < ref_frames_nb) { > frame = &dpb_frames[i + 1]; > > @@ -277,10 +290,14 @@ static void tegra_vde_setup_iram_tables(struct > tegra_vde *vde, value = 0; > } > > - tegra_vde_setup_iram_entry(vde, 0, i, value, aux_addr); > - tegra_vde_setup_iram_entry(vde, 1, i, value, aux_addr); > - tegra_vde_setup_iram_entry(vde, 2, i, value, aux_addr); > - tegra_vde_setup_iram_entry(vde, 3, i, value, aux_addr); > + tegra_vde_setup_iram_entry(vde, num_ref_pics, 0, i, value, > +aux_addr); > + tegra_vde_setup_iram_entry(vde, num_ref_pics, 1, i, value, > +aux_addr); > + tegra_vde_setup_iram_entry(vde, num_ref_pics, 2, i, value, > +aux_addr); > + tegra_vde_setup_iram_entry(vde, num_ref_pics, 3, i, value, > +aux_addr); > } > > if (!(dpb_frames[0].flags & FLAG_B_FRAME)) > @@ -309,7 +326,8 @@ static void tegra_vde_setup_iram_tables(struct tegra_vde > *vde, "\tFrame %d: frame_num = %d\n", > k + 1, frame->frame_num); > > - tegra_vde_setup_iram_entry(vde, 2, i, value, aux_addr); > + tegra_vde_setup_iram_entry(vde, num_ref_pics, 2, i, value, > +aux_addr); > } > > f
Re: [PATCH 02/14] staging: media: tegra-vde: Support reference picture marking
On Monday, 13 August 2018 17:50:15 MSK Thierry Reding wrote: > From: Thierry Reding > > Tegra114 and Tegra124 support reference picture marking, which will > cause BSEV to write picture marking data to SDRAM. Make sure there is > a valid destination address for that data to avoid error messages from > the memory controller. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 54 - > drivers/staging/media/tegra-vde/uapi.h | 3 ++ > 2 files changed, 55 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 9d8f833744db..3027b11b11ae 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -60,7 +60,12 @@ struct video_frame { > u32 flags; > }; > > +struct tegra_vde_soc { > + bool supports_ref_pic_marking; > +}; > + > struct tegra_vde { > + const struct tegra_vde_soc *soc; > void __iomem *sxe; > void __iomem *bsev; > void __iomem *mbe; > @@ -330,6 +335,7 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, struct video_frame *dpb_frames, > dma_addr_t bitstream_data_addr, > size_t bitstream_data_size, > + dma_addr_t secure_addr, > unsigned int macroblocks_nb) > { > struct device *dev = vde->miscdev.parent; > @@ -454,6 +460,9 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, > > VDE_WR(bitstream_data_addr, vde->sxe + 0x6C); > > + if (vde->soc->supports_ref_pic_marking) > + VDE_WR(secure_addr, vde->sxe + 0x7c); > + > value = 0x1005; > value |= ctx->pic_width_in_mbs << 11; > value |= ctx->pic_height_in_mbs << 3; > @@ -772,12 +781,15 @@ static int tegra_vde_ioctl_decode_h264(struct > tegra_vde *vde, struct tegra_vde_h264_frame __user *frames_user; > struct video_frame *dpb_frames; > struct dma_buf_attachment *bitstream_data_dmabuf_attachment; > - struct sg_table *bitstream_sgt; > + struct dma_buf_attachment *secure_attachment = NULL; > + struct sg_table *bitstream_sgt, *secure_sgt; > enum dma_data_direction dma_dir; > dma_addr_t bitstream_data_addr; > + dma_addr_t secure_addr; > dma_addr_t bsev_ptr; > size_t lsize, csize; > size_t bitstream_data_size; > + size_t secure_size; secure_size is unused, you could omit it and replace with NULL below. > unsigned int macroblocks_nb; > unsigned int read_bytes; > unsigned int cstride; > @@ -803,6 +815,18 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde > *vde, if (ret) > return ret; > > + if (vde->soc->supports_ref_pic_marking) { > + ret = tegra_vde_attach_dmabuf(dev, ctx.secure_fd, > + ctx.secure_offset, 0, SZ_256, Minimum buffer size? Since it's coming from userspace, you must specify it to validate buffers size correctly. > + &secure_attachment, > + &secure_addr, > + &secure_sgt, > + &secure_size, > + DMA_TO_DEVICE); > + if (ret) > + goto release_bitstream_dmabuf; > + } > + > dpb_frames = kcalloc(ctx.dpb_frames_nb, sizeof(*dpb_frames), >GFP_KERNEL); > if (!dpb_frames) { > @@ -876,6 +900,7 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde > *vde, ret = tegra_vde_setup_hw_context(vde, &ctx, dpb_frames, >bitstream_data_addr, >bitstream_data_size, > + secure_addr, >macroblocks_nb); > if (ret) > goto put_runtime_pm; > @@ -929,6 +954,10 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde > *vde, kfree(dpb_frames); > > release_bitstream_dmabuf: release_secure_dmabuf: > + if (secure_attachment) > + tegra_vde_detach_and_put_dmabuf(secure_attachment, secure_sgt, > + DMA_TO_DEVICE); > + > tegra_vde_detach_and_put_dmabuf(bitstream_data_dmabuf_attachment, > bitstream_sgt, DMA_TO_DEVICE); > > @@ -1029,6 +1058,8 @@ static int tegra_vde_probe(struct platform_device > *pdev) > > platform_set_drvdata(pdev, vde); > > + vde->soc = of_device_get_match_data(&pdev->dev); > + > regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sxe"); > if (!regs) > return -ENODEV; > @@ -1258,8 +1289,27 @@ static const struct dev_pm_ops tegra_vde_pm_ops = {
Re: [PATCH 08/14] staging: media: tegra-vde: Track struct device *
On Monday, 13 August 2018 17:50:21 MSK Thierry Reding wrote: > From: Thierry Reding > > The pointer to the struct device is frequently used, so store it in > struct tegra_vde. Also, pass around a pointer to a struct tegra_vde > instead of struct device in some cases to prepare for subsequent > patches referencing additional data from that structure. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 63 - > 1 file changed, 36 insertions(+), 27 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 41cf86dc5dbd..2496a03fd158 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -71,6 +71,7 @@ struct tegra_vde_soc { > }; > > struct tegra_vde { > + struct device *dev; > const struct tegra_vde_soc *soc; > void __iomem *sxe; > void __iomem *bsev; > @@ -644,7 +645,7 @@ static void tegra_vde_detach_and_put_dmabuf(struct > dma_buf_attachment *a, dma_buf_put(dmabuf); > } > > -static int tegra_vde_attach_dmabuf(struct device *dev, > +static int tegra_vde_attach_dmabuf(struct tegra_vde *vde, > int fd, > unsigned long offset, > size_t min_size, > @@ -662,38 +663,40 @@ static int tegra_vde_attach_dmabuf(struct device *dev, > > dmabuf = dma_buf_get(fd); > if (IS_ERR(dmabuf)) { > - dev_err(dev, "Invalid dmabuf FD: %d\n", fd); > + dev_err(vde->dev, "Invalid dmabuf FD: %d\n", fd); > return PTR_ERR(dmabuf); > } > > if (dmabuf->size & (align_size - 1)) { > - dev_err(dev, "Unaligned dmabuf 0x%zX, should be aligned to > 0x%zX\n", > + dev_err(vde->dev, > + "Unaligned dmabuf 0x%zX, should be aligned to 0x%zX\n", > dmabuf->size, align_size); > return -EINVAL; > } > > if ((u64)offset + min_size > dmabuf->size) { > - dev_err(dev, "Too small dmabuf size %zu @0x%lX, should be at > least > %zu\n", + dev_err(vde->dev, > + "Too small dmabuf size %zu @0x%lX, should be at least > %zu\n", > dmabuf->size, offset, min_size); > return -EINVAL; > } > > - attachment = dma_buf_attach(dmabuf, dev); > + attachment = dma_buf_attach(dmabuf, vde->dev); > if (IS_ERR(attachment)) { > - dev_err(dev, "Failed to attach dmabuf\n"); > + dev_err(vde->dev, "Failed to attach dmabuf\n"); > err = PTR_ERR(attachment); > goto err_put; > } > > sgt = dma_buf_map_attachment(attachment, dma_dir); > if (IS_ERR(sgt)) { > - dev_err(dev, "Failed to get dmabufs sg_table\n"); > + dev_err(vde->dev, "Failed to get dmabufs sg_table\n"); > err = PTR_ERR(sgt); > goto err_detach; > } > > if (sgt->nents != 1) { > - dev_err(dev, "Sparse DMA region is unsupported\n"); > + dev_err(vde->dev, "Sparse DMA region is unsupported\n"); > err = -EINVAL; > goto err_unmap; > } > @@ -717,7 +720,7 @@ static int tegra_vde_attach_dmabuf(struct device *dev, > return err; > } > > -static int tegra_vde_attach_dmabufs_to_frame(struct device *dev, > +static int tegra_vde_attach_dmabufs_to_frame(struct tegra_vde *vde, >struct video_frame *frame, >struct tegra_vde_h264_frame *src, >enum dma_data_direction dma_dir, > @@ -726,7 +729,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, { > int err; > > - err = tegra_vde_attach_dmabuf(dev, src->y_fd, > + err = tegra_vde_attach_dmabuf(vde, src->y_fd, > src->y_offset, lsize, SZ_256, > &frame->y_dmabuf_attachment, > &frame->y_addr, > @@ -735,7 +738,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, if (err) > return err; > > - err = tegra_vde_attach_dmabuf(dev, src->cb_fd, > + err = tegra_vde_attach_dmabuf(vde, src->cb_fd, > src->cb_offset, csize, SZ_256, > &frame->cb_dmabuf_attachment, > &frame->cb_addr, > @@ -744,7 +747,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, if (err) > goto err_release_y; > > - err = tegra_vde_attach_dmabuf(dev, src->cr_fd, > + err = tegra_vde_attach_dmabuf(vde, src->cr_fd, > src->cr_offset, csize, SZ_256, > &frame->cr_dmabuf
Re: [PATCH 07/14] staging: media: tegra-vde: Add some clarifying comments
On Monday, 13 August 2018 17:50:20 MSK Thierry Reding wrote: > From: Thierry Reding > > Add some comments specifying what tables are being set up in VRAM. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 0adc603fa437..41cf86dc5dbd 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -271,6 +271,7 @@ static void tegra_vde_setup_iram_tables(struct tegra_vde > *vde, unsigned int i, k; > size_t size; > > + /* clear H256RefPicList */ > size = num_ref_pics * 4 * 8; > memset(vde->iram, 0, size); H256? Is it a typo? > > @@ -453,6 +454,7 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, VDE_WR(0x, vde->bsev + 0x98); > VDE_WR(0x0060, vde->bsev + 0x9C); > > + /* clear H264MB2SliceGroupMap, assuming no FMO */ > memset(vde->iram + 1024, 0, macroblocks_nb / 2); > > tegra_setup_frameidx(vde, dpb_frames, ctx->dpb_frames_nb, > @@ -480,6 +482,8 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, if (err) > return err; > > + /* upload H264MB2SliceGroupMap */ > + /* XXX don't hardcode map size? */ > value = (0x20 << 26) | (0 << 25) | ((4096 >> 2) & 0x1fff); > err = tegra_vde_push_to_bsev_icmdqueue(vde, value, false); > if (err) > @@ -492,6 +496,7 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, if (err) > return err; > > + /* clear H264MBInfo XXX don't hardcode size */ > value = (0x21 << 26) | ((240 & 0x1fff) << 12) | (0x54c & 0xfff); > err = tegra_vde_push_to_bsev_icmdqueue(vde, 0x840F054C, false); > if (err) > @@ -499,6 +504,16 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, > > size = num_ref_pics * 4 * 8; > > + /* clear H264RefPicList */ #if 0 > + value = (0x21 << 26) | (((size >> 2) & 0x1fff) << 12) | 0xE34; > + > + err = tegra_vde_push_to_bsev_icmdqueue(vde, value, false); > + if (err) > + return err; #endif Is it supposed to do the same as "clear H256RefPicList -> memset(vde->iram, 0, size)" above? > + > + /* upload H264RefPicList */ > value = (0x20 << 26) | (0x0 << 25) | ((size >> 2) & 0x1fff); > err = tegra_vde_push_to_bsev_icmdqueue(vde, value, false); > if (err) > @@ -584,7 +599,11 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, > > tegra_vde_mbe_set_0xa_reg(vde, 0, 0x09FC); > tegra_vde_mbe_set_0xa_reg(vde, 2, 0x61DEAD00); > +#if 0 > + tegra_vde_mbe_set_0xa_reg(vde, 4, dpb_frames[0].aux_addr); /* 0x62DEAD00 > */ +#else > tegra_vde_mbe_set_0xa_reg(vde, 4, 0x62DEAD00); > +#endif This doesn't really clarify much, let's drop this chunk for now. > tegra_vde_mbe_set_0xa_reg(vde, 6, 0x63DEAD00); > tegra_vde_mbe_set_0xa_reg(vde, 8, dpb_frames[0].aux_addr); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 09/14] staging: media: tegra-vde: Add IOMMU support
On Monday, 13 August 2018 17:50:22 MSK Thierry Reding wrote: > From: Thierry Reding > > Implement support for using an IOMMU to map physically discontiguous > buffers into contiguous I/O virtual mappings that the VDE can use. This > allows importing arbitrary DMA-BUFs for use by the VDE. > > While at it, make sure that the device is detached from any DMA/IOMMU > mapping that it might have automatically been attached to at boot. If > using the IOMMU API explicitly, detaching from any existing mapping is > required to avoid double mapping of buffers. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 171 +--- > 1 file changed, 153 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 2496a03fd158..3bc0bfcfe34e 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -13,7 +13,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include > #include > @@ -22,6 +24,10 @@ > #include > #include > > +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) > +#include > +#endif > + > #include > > #include > @@ -61,6 +67,11 @@ struct video_frame { > u32 frame_num; > u32 flags; > u64 modifier; > + > + struct iova *y_iova; > + struct iova *cb_iova; > + struct iova *cr_iova; > + struct iova *aux_iova; > }; > > struct tegra_vde_soc { > @@ -93,6 +104,12 @@ struct tegra_vde { > struct clk *clk_bsev; > dma_addr_t iram_lists_addr; > u32 *iram; > + > + struct iommu_domain *domain; > + struct iommu_group *group; > + struct iova_domain iova; > + unsigned long limit; > + unsigned int shift; > }; > > static void tegra_vde_set_bits(struct tegra_vde *vde, > @@ -634,12 +651,22 @@ static void tegra_vde_decode_frame(struct tegra_vde > *vde, VDE_WR(0x2000 | (macroblocks_nb - 1), vde->sxe + 0x00); > } > > -static void tegra_vde_detach_and_put_dmabuf(struct dma_buf_attachment *a, > +static void tegra_vde_detach_and_put_dmabuf(struct tegra_vde *vde, > + struct dma_buf_attachment *a, > struct sg_table *sgt, > + struct iova *iova, > enum dma_data_direction dma_dir) > { > struct dma_buf *dmabuf = a->dmabuf; > > + if (vde->domain) { > + unsigned long size = iova_size(iova) << vde->shift; Let's make it "size = iova_align(&vde->iova, dmabuf->size)" for better readability. > + dma_addr_t addr = iova_dma_addr(&vde->iova, iova); > + > + iommu_unmap(vde->domain, addr, size); > + __free_iova(&vde->iova, iova); > + } > + > dma_buf_unmap_attachment(a, sgt, dma_dir); > dma_buf_detach(dmabuf, a); > dma_buf_put(dmabuf); > @@ -651,14 +678,16 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, size_t min_size, > size_t align_size, > struct dma_buf_attachment **a, > -dma_addr_t *addr, > +dma_addr_t *addrp, > struct sg_table **s, > -size_t *size, > +struct iova **iovap, > +size_t *sizep, > enum dma_data_direction dma_dir) > { > struct dma_buf_attachment *attachment; > struct dma_buf *dmabuf; > struct sg_table *sgt; > + size_t size; > int err; > > dmabuf = dma_buf_get(fd); > @@ -695,18 +724,47 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, goto err_detach; > } > > - if (sgt->nents != 1) { > + if (sgt->nents > 1 && !vde->domain) { > dev_err(vde->dev, "Sparse DMA region is unsupported\n"); > err = -EINVAL; > goto err_unmap; > } > > - *addr = sg_dma_address(sgt->sgl) + offset; > + if (vde->domain) { > + int prot = IOMMU_READ | IOMMU_WRITE; > + struct iova *iova; > + dma_addr_t addr; > + > + size = (dmabuf->size - offset) >> vde->shift; Offset shall not be subtracted and dmabuf size shall be rounded to IOVA granule. Also, let's not carry shift within the vde structure as it doesn't really worth it. shift = iova_shift(&vde->iova); size = iova_align(&vde->iova, dmabuf->size) >> shift; > + > + iova = alloc_iova(&vde->iova, size, vde->limit - 1, true); > + if (!iova) { > + err = -ENOMEM; > + goto err_unmap; > + } > + > + addr = iova_dma_addr(&vde->iova, iova); > + > + size = iommu_map_sg(vde->domain,
Re: [PATCH 10/14] staging: media: tegra-vde: Keep VDE in reset when unused
On Monday, 13 August 2018 17:50:23 MSK Thierry Reding wrote: > From: Thierry Reding > > There is no point in keeping the VDE module out of reset when it is not > in use. Reset it on runtime suspend. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 3bc0bfcfe34e..4b3c6ab3c77e 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -1226,6 +1226,7 @@ static int tegra_vde_runtime_suspend(struct device > *dev) } > > reset_control_assert(vde->rst_bsev); > + reset_control_assert(vde->rst); > > usleep_range(2000, 4000); There is also no point to reset VDE while it is powered off, then why do we that? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 04/14] staging: media: tegra-vde: Use DRM/KMS framebuffer modifiers
On Monday, 13 August 2018 17:50:17 MSK Thierry Reding wrote: > From: Thierry Reding > > VDE on Tegra20 through Tegra114 supports reading and writing frames in > 16x16 tiled layout. Similarily, the various block-linear layouts that > are supported by the GPU on Tegra124 can also be read from and written > to by the Tegra124 VDE. > > Enable userspace to specify the desired layout using the existing DRM > framebuffer modifiers. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 112 +--- > drivers/staging/media/tegra-vde/uapi.h | 3 +- > 2 files changed, 100 insertions(+), 15 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c index > 1a40f6dff7c8..275884e745df 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -24,6 +24,8 @@ > > #include > > +#include > + > #include "uapi.h" > > #define ICMDQUE_WR 0x00 > @@ -58,12 +60,14 @@ struct video_frame { > dma_addr_t aux_addr; > u32 frame_num; > u32 flags; > + u64 modifier; > }; > > struct tegra_vde_soc { > unsigned int num_ref_pics; > bool supports_ref_pic_marking; > bool supports_interlacing; > + bool supports_block_linear; > }; > > struct tegra_vde { > @@ -202,6 +206,7 @@ static void tegra_vde_setup_frameid(struct tegra_vde > *vde, unsigned int frameid, > u32 mbs_width, u32 mbs_height) > { > + u64 modifier = frame ? frame->modifier : DRM_FORMAT_MOD_LINEAR; > u32 y_addr = frame ? frame->y_addr : 0x6CDEAD00; > u32 cb_addr = frame ? frame->cb_addr : 0x6CDEAD00; > u32 cr_addr = frame ? frame->cr_addr : 0x6CDEAD00; > @@ -209,8 +214,12 @@ static void tegra_vde_setup_frameid(struct tegra_vde > *vde, u32 value2 = frame ? mbs_width + 1) >> 1) << 6) | 1) : 0; > u32 value = y_addr >> 8; > > - if (vde->soc->supports_interlacing) > + if (!vde->soc->supports_interlacing) { > + if (modifier == DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED) > + value |= BIT(31); > + } else { > value |= BIT(31); > + } > > VDE_WR(value,vde->frameid + 0x000 + frameid * 4); > VDE_WR(cb_addr >> 8, vde->frameid + 0x100 + frameid * 4); > @@ -349,6 +358,37 @@ static void tegra_vde_setup_iram_tables(struct > tegra_vde *vde, } > } > > +static int tegra_vde_get_block_height(u64 modifier, unsigned int > *block_height) +{ > + switch (modifier) { > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB: > + *block_height = 0; > + return 0; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB: > + *block_height = 1; > + return 0; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB: > + *block_height = 2; > + return 0; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB: > + *block_height = 3; > + return 0; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB: > + *block_height = 4; > + return 0; > + > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB: > + *block_height = 5; > + return 0; > + } > + > + return -EINVAL; > +} > + > static int tegra_vde_setup_hw_context(struct tegra_vde *vde, > struct tegra_vde_h264_decoder_ctx *ctx, > struct video_frame *dpb_frames, > @@ -383,7 +423,21 @@ static int tegra_vde_setup_hw_context(struct tegra_vde > *vde, tegra_vde_set_bits(vde, 0x0005, vde->vdma + 0x04); > > VDE_WR(0x, vde->vdma + 0x1C); > - VDE_WR(0x, vde->vdma + 0x00); > + > + value = 0x; > + > + if (vde->soc->supports_block_linear) { > + unsigned int block_height; > + > + err = tegra_vde_get_block_height(dpb_frames[0].modifier, > + &block_height); > + if (err < 0) > + return err; > + > + value |= block_height << 10; > + } > + > + VDE_WR(value, vde->vdma + 0x00); > VDE_WR(0x0007, vde->vdma + 0x04); > VDE_WR(0x0007, vde->frameid + 0x200); > VDE_WR(0x0005, vde->tfe + 0x04); > @@ -730,11 +784,37 @@ static void tegra_vde_release_frame_dmabufs(struct > video_frame *frame, static int tegra_vde_validate_frame(struct device *dev, > struct tegra_vde_h264_frame *frame) > { > + struct tegra_vde *vde = dev_get_drvdata(dev); > + > if (frame->frame_num > 0x7F) { > dev_err(dev, "Bad frame_num %u\n", frame->frame_num); > return -EINVAL; > } > > + if (vde->soc->supports_block_linear) { > + switch (frame->modifier) { > + case DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB
Re: [PATCH 09/14] staging: media: tegra-vde: Add IOMMU support
On 13.08.2018 17:50, Thierry Reding wrote: > From: Thierry Reding > > Implement support for using an IOMMU to map physically discontiguous > buffers into contiguous I/O virtual mappings that the VDE can use. This > allows importing arbitrary DMA-BUFs for use by the VDE. > > While at it, make sure that the device is detached from any DMA/IOMMU > mapping that it might have automatically been attached to at boot. If > using the IOMMU API explicitly, detaching from any existing mapping is > required to avoid double mapping of buffers. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 171 +--- > 1 file changed, 153 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c > index 2496a03fd158..3bc0bfcfe34e 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -13,7 +13,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include > #include > @@ -22,6 +24,10 @@ > #include > #include > > +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) > +#include > +#endif > + > #include > > #include > @@ -61,6 +67,11 @@ struct video_frame { > u32 frame_num; > u32 flags; > u64 modifier; > + > + struct iova *y_iova; > + struct iova *cb_iova; > + struct iova *cr_iova; > + struct iova *aux_iova; > }; > > struct tegra_vde_soc { > @@ -93,6 +104,12 @@ struct tegra_vde { > struct clk *clk_bsev; > dma_addr_t iram_lists_addr; > u32 *iram; > + > + struct iommu_domain *domain; > + struct iommu_group *group; > + struct iova_domain iova; > + unsigned long limit; > + unsigned int shift; > }; > > static void tegra_vde_set_bits(struct tegra_vde *vde, > @@ -634,12 +651,22 @@ static void tegra_vde_decode_frame(struct tegra_vde > *vde, > VDE_WR(0x2000 | (macroblocks_nb - 1), vde->sxe + 0x00); > } > > -static void tegra_vde_detach_and_put_dmabuf(struct dma_buf_attachment *a, > +static void tegra_vde_detach_and_put_dmabuf(struct tegra_vde *vde, > + struct dma_buf_attachment *a, > struct sg_table *sgt, > + struct iova *iova, > enum dma_data_direction dma_dir) > { > struct dma_buf *dmabuf = a->dmabuf; > > + if (vde->domain) { > + unsigned long size = iova_size(iova) << vde->shift; > + dma_addr_t addr = iova_dma_addr(&vde->iova, iova); > + > + iommu_unmap(vde->domain, addr, size); > + __free_iova(&vde->iova, iova); > + } > + > dma_buf_unmap_attachment(a, sgt, dma_dir); > dma_buf_detach(dmabuf, a); > dma_buf_put(dmabuf); > @@ -651,14 +678,16 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, > size_t min_size, > size_t align_size, > struct dma_buf_attachment **a, > -dma_addr_t *addr, > +dma_addr_t *addrp, > struct sg_table **s, > -size_t *size, > +struct iova **iovap, > +size_t *sizep, > enum dma_data_direction dma_dir) > { > struct dma_buf_attachment *attachment; > struct dma_buf *dmabuf; > struct sg_table *sgt; > + size_t size; > int err; > > dmabuf = dma_buf_get(fd); > @@ -695,18 +724,47 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, > goto err_detach; > } > > - if (sgt->nents != 1) { > + if (sgt->nents > 1 && !vde->domain) { > dev_err(vde->dev, "Sparse DMA region is unsupported\n"); > err = -EINVAL; > goto err_unmap; > } > > - *addr = sg_dma_address(sgt->sgl) + offset; > + if (vde->domain) { > + int prot = IOMMU_READ | IOMMU_WRITE; > + struct iova *iova; > + dma_addr_t addr; > + > + size = (dmabuf->size - offset) >> vde->shift; > + > + iova = alloc_iova(&vde->iova, size, vde->limit - 1, true); > + if (!iova) { > + err = -ENOMEM; > + goto err_unmap; > + } > + > + addr = iova_dma_addr(&vde->iova, iova); > + > + size = iommu_map_sg(vde->domain, addr, sgt->sgl, sgt->nents, > + prot); > + if (!size) { > + __free_iova(&vde->iova, iova); > + err = -ENXIO; > + goto err_unmap; > + } > + > + *addrp = addr; > + *io
Re: [PATCH 09/14] staging: media: tegra-vde: Add IOMMU support
On 13.08.2018 17:50, Thierry Reding wrote: > From: Thierry Reding > > Implement support for using an IOMMU to map physically discontiguous > buffers into contiguous I/O virtual mappings that the VDE can use. This > allows importing arbitrary DMA-BUFs for use by the VDE. > > While at it, make sure that the device is detached from any DMA/IOMMU > mapping that it might have automatically been attached to at boot. If > using the IOMMU API explicitly, detaching from any existing mapping is > required to avoid double mapping of buffers. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 171 +--- > 1 file changed, 153 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c > index 2496a03fd158..3bc0bfcfe34e 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -13,7 +13,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include > #include > @@ -22,6 +24,10 @@ > #include > #include > > +#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) > +#include > +#endif > + > #include > > #include > @@ -61,6 +67,11 @@ struct video_frame { > u32 frame_num; > u32 flags; > u64 modifier; > + > + struct iova *y_iova; > + struct iova *cb_iova; > + struct iova *cr_iova; > + struct iova *aux_iova; > }; > > struct tegra_vde_soc { > @@ -93,6 +104,12 @@ struct tegra_vde { > struct clk *clk_bsev; > dma_addr_t iram_lists_addr; > u32 *iram; > + > + struct iommu_domain *domain; > + struct iommu_group *group; > + struct iova_domain iova; > + unsigned long limit; > + unsigned int shift; > }; > > static void tegra_vde_set_bits(struct tegra_vde *vde, > @@ -634,12 +651,22 @@ static void tegra_vde_decode_frame(struct tegra_vde > *vde, > VDE_WR(0x2000 | (macroblocks_nb - 1), vde->sxe + 0x00); > } > > -static void tegra_vde_detach_and_put_dmabuf(struct dma_buf_attachment *a, > +static void tegra_vde_detach_and_put_dmabuf(struct tegra_vde *vde, > + struct dma_buf_attachment *a, > struct sg_table *sgt, > + struct iova *iova, > enum dma_data_direction dma_dir) > { > struct dma_buf *dmabuf = a->dmabuf; > > + if (vde->domain) { > + unsigned long size = iova_size(iova) << vde->shift; > + dma_addr_t addr = iova_dma_addr(&vde->iova, iova); > + > + iommu_unmap(vde->domain, addr, size); > + __free_iova(&vde->iova, iova); > + } > + > dma_buf_unmap_attachment(a, sgt, dma_dir); > dma_buf_detach(dmabuf, a); > dma_buf_put(dmabuf); > @@ -651,14 +678,16 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, > size_t min_size, > size_t align_size, > struct dma_buf_attachment **a, > -dma_addr_t *addr, > +dma_addr_t *addrp, > struct sg_table **s, > -size_t *size, > +struct iova **iovap, > +size_t *sizep, > enum dma_data_direction dma_dir) > { > struct dma_buf_attachment *attachment; > struct dma_buf *dmabuf; > struct sg_table *sgt; > + size_t size; > int err; > > dmabuf = dma_buf_get(fd); > @@ -695,18 +724,47 @@ static int tegra_vde_attach_dmabuf(struct tegra_vde > *vde, > goto err_detach; > } > > - if (sgt->nents != 1) { > + if (sgt->nents > 1 && !vde->domain) { > dev_err(vde->dev, "Sparse DMA region is unsupported\n"); > err = -EINVAL; > goto err_unmap; > } > > - *addr = sg_dma_address(sgt->sgl) + offset; > + if (vde->domain) { > + int prot = IOMMU_READ | IOMMU_WRITE; > + struct iova *iova; > + dma_addr_t addr; > + > + size = (dmabuf->size - offset) >> vde->shift; > + > + iova = alloc_iova(&vde->iova, size, vde->limit - 1, true); > + if (!iova) { > + err = -ENOMEM; > + goto err_unmap; > + } > + > + addr = iova_dma_addr(&vde->iova, iova); > + > + size = iommu_map_sg(vde->domain, addr, sgt->sgl, sgt->nents, > + prot); > + if (!size) { > + __free_iova(&vde->iova, iova); > + err = -ENXIO; > + goto err_unmap; > + } > + > + *addrp = addr; > + *io
[PATCH] staging: rtl8188eu: Type cast function argument
This patch might suppress some warrning. The function prototype of rtw_malloc2d is void *rtw_malloc2d(int h, int w, int size) This patch also resolves the checkpatch.pl warning WARNING: line over 80 characters Signed-off-by: Bhaskar Singh --- drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index 0fd306a808c4..735d654b2844 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -91,7 +91,8 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) if (!efuseTbl) return; - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); + eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, + EFUSE_MAX_WORD_UNIT, (int)sizeof(u16)); if (!eFuseWord) { DBG_88E("%s: alloc eFuseWord fail!\n", __func__); goto eFuseWord_failed; -- 2.16.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: Type cast function argument
On 2018/8/18 22:24, Bhaskar Singh wrote: > This patch might suppress some warrning. > > The function prototype of rtw_malloc2d is > > void *rtw_malloc2d(int h, int w, int size) > > This patch also resolves the checkpatch.pl warning > > WARNING: line over 80 characters > > Signed-off-by: Bhaskar Singh > --- > drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c > b/drivers/staging/rtl8188eu/core/rtw_efuse.c > index 0fd306a808c4..735d654b2844 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c > @@ -91,7 +91,8 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 > _size_byte, u8 *pbuf) > if (!efuseTbl) > return; > > - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > EFUSE_MAX_WORD_UNIT, sizeof(u16)); > + eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > + EFUSE_MAX_WORD_UNIT, (int)sizeof(u16)); > You should be align with left parenthesis. Thanks, zhong jiang > if (!eFuseWord) { > DBG_88E("%s: alloc eFuseWord fail!\n", __func__); > goto eFuseWord_failed; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: Type cast function argument
On Sat, Aug 18, 2018 at 10:33:31PM +0800, zhong jiang wrote: > On 2018/8/18 22:24, Bhaskar Singh wrote: > > This patch might suppress some warrning. > > > > The function prototype of rtw_malloc2d is > > > > void *rtw_malloc2d(int h, int w, int size) > > > > This patch also resolves the checkpatch.pl warning > > > > WARNING: line over 80 characters > > > > Signed-off-by: Bhaskar Singh > > --- > > drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c > > b/drivers/staging/rtl8188eu/core/rtw_efuse.c > > index 0fd306a808c4..735d654b2844 100644 > > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c > > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c > > @@ -91,7 +91,8 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 > > _size_byte, u8 *pbuf) > > if (!efuseTbl) > > return; > > > > - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > > EFUSE_MAX_WORD_UNIT, sizeof(u16)); > > + eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > > + EFUSE_MAX_WORD_UNIT, (int)sizeof(u16)); > > > You should be align with left parenthesis. > > Thanks, > zhong jiang > > if (!eFuseWord) { > > DBG_88E("%s: alloc eFuseWord fail!\n", __func__); > > goto eFuseWord_failed; > > why post-commit doesn't give some warrning about that (because commits are checked by post-commit script)? Do I need to resend the patch? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/rtl8723bs: fixed a style problem by removing else after return
Signed-off-by: Carmeli Tamir --- drivers/staging/rtl8723bs/hal/odm_CfoTracking.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c index a733046..6912276 100644 --- a/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c +++ b/drivers/staging/rtl8723bs/hal/odm_CfoTracking.c @@ -216,8 +216,8 @@ void ODM_CfoTracking(void *pDM_VOID) ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): first large CFO hit\n")); pCfoTrack->largeCFOHit = 1; return; - } else - pCfoTrack->largeCFOHit = 0; + } + pCfoTrack->largeCFOHit = 0; pCfoTrack->CFO_ave_pre = CFO_ave; /* 4 1.4 Dynamic Xtal threshold */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging/rtl8723bs: fixed a style problem by removing else after return
On Sat, Aug 18, 2018 at 11:00:25AM -0400, Carmeli Tamir wrote: > Signed-off-by: Carmeli Tamir > --- > drivers/staging/rtl8723bs/hal/odm_CfoTracking.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You did not specify a description of why the patch is needed, or possibly, any description at all, in the email body. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what is needed in order to properly describe the change. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8188eu: Type cast function argument
On Sat, 2018-08-18 at 20:28 +0530, Bhaskar Singh wrote: > On Sat, Aug 18, 2018 at 10:33:31PM +0800, zhong jiang wrote: > > On 2018/8/18 22:24, Bhaskar Singh wrote: > > > This patch might suppress some warrning. > > > > > > The function prototype of rtw_malloc2d is > > > > > > void *rtw_malloc2d(int h, int w, int size) > > > > > > This patch also resolves the checkpatch.pl warning > > > > > > WARNING: line over 80 characters Please look deeper at the code than checkpatch. This function is used exactly once and could likely be removed and coded inline instead to improve readability. > > > Signed-off-by: Bhaskar Singh > > > --- > > > drivers/staging/rtl8188eu/core/rtw_efuse.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c > > > b/drivers/staging/rtl8188eu/core/rtw_efuse.c > > > index 0fd306a808c4..735d654b2844 100644 > > > --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c > > > +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c > > > @@ -91,7 +91,8 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 > > > _size_byte, u8 *pbuf) > > > if (!efuseTbl) > > > return; > > > > > > - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > > > EFUSE_MAX_WORD_UNIT, sizeof(u16)); > > > + eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, > > > + EFUSE_MAX_WORD_UNIT, (int)sizeof(u16)); > > > > > > > You should be align with left parenthesis. > > > > Thanks, > > zhong jiang > > > if (!eFuseWord) { > > > DBG_88E("%s: alloc eFuseWord fail!\n", __func__); > > > goto eFuseWord_failed; > > > > > > why post-commit doesn't give some warrning about that (because commits are > checked by > post-commit script)? > Do I need to resend the patch? > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 08/14] staging: media: tegra-vde: Track struct device *
On 13.08.2018 17:50, Thierry Reding wrote: > From: Thierry Reding > > The pointer to the struct device is frequently used, so store it in > struct tegra_vde. Also, pass around a pointer to a struct tegra_vde > instead of struct device in some cases to prepare for subsequent > patches referencing additional data from that structure. > > Signed-off-by: Thierry Reding > --- > drivers/staging/media/tegra-vde/tegra-vde.c | 63 - > 1 file changed, 36 insertions(+), 27 deletions(-) > > diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c > b/drivers/staging/media/tegra-vde/tegra-vde.c > index 41cf86dc5dbd..2496a03fd158 100644 > --- a/drivers/staging/media/tegra-vde/tegra-vde.c > +++ b/drivers/staging/media/tegra-vde/tegra-vde.c > @@ -71,6 +71,7 @@ struct tegra_vde_soc { > }; > > struct tegra_vde { > + struct device *dev; > const struct tegra_vde_soc *soc; > void __iomem *sxe; > void __iomem *bsev; > @@ -644,7 +645,7 @@ static void tegra_vde_detach_and_put_dmabuf(struct > dma_buf_attachment *a, > dma_buf_put(dmabuf); > } > > -static int tegra_vde_attach_dmabuf(struct device *dev, > +static int tegra_vde_attach_dmabuf(struct tegra_vde *vde, > int fd, > unsigned long offset, > size_t min_size, > @@ -662,38 +663,40 @@ static int tegra_vde_attach_dmabuf(struct device *dev, > > dmabuf = dma_buf_get(fd); > if (IS_ERR(dmabuf)) { > - dev_err(dev, "Invalid dmabuf FD: %d\n", fd); > + dev_err(vde->dev, "Invalid dmabuf FD: %d\n", fd); > return PTR_ERR(dmabuf); > } > > if (dmabuf->size & (align_size - 1)) { > - dev_err(dev, "Unaligned dmabuf 0x%zX, should be aligned to > 0x%zX\n", > + dev_err(vde->dev, > + "Unaligned dmabuf 0x%zX, should be aligned to 0x%zX\n", > dmabuf->size, align_size); > return -EINVAL; > } > > if ((u64)offset + min_size > dmabuf->size) { > - dev_err(dev, "Too small dmabuf size %zu @0x%lX, should be at > least %zu\n", > + dev_err(vde->dev, > + "Too small dmabuf size %zu @0x%lX, should be at least > %zu\n", > dmabuf->size, offset, min_size); > return -EINVAL; > } > > - attachment = dma_buf_attach(dmabuf, dev); > + attachment = dma_buf_attach(dmabuf, vde->dev); > if (IS_ERR(attachment)) { > - dev_err(dev, "Failed to attach dmabuf\n"); > + dev_err(vde->dev, "Failed to attach dmabuf\n"); > err = PTR_ERR(attachment); > goto err_put; > } > > sgt = dma_buf_map_attachment(attachment, dma_dir); > if (IS_ERR(sgt)) { > - dev_err(dev, "Failed to get dmabufs sg_table\n"); > + dev_err(vde->dev, "Failed to get dmabufs sg_table\n"); > err = PTR_ERR(sgt); > goto err_detach; > } > > if (sgt->nents != 1) { > - dev_err(dev, "Sparse DMA region is unsupported\n"); > + dev_err(vde->dev, "Sparse DMA region is unsupported\n"); > err = -EINVAL; > goto err_unmap; > } > @@ -717,7 +720,7 @@ static int tegra_vde_attach_dmabuf(struct device *dev, > return err; > } > > -static int tegra_vde_attach_dmabufs_to_frame(struct device *dev, > +static int tegra_vde_attach_dmabufs_to_frame(struct tegra_vde *vde, >struct video_frame *frame, >struct tegra_vde_h264_frame *src, >enum dma_data_direction dma_dir, > @@ -726,7 +729,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, > { > int err; > > - err = tegra_vde_attach_dmabuf(dev, src->y_fd, > + err = tegra_vde_attach_dmabuf(vde, src->y_fd, > src->y_offset, lsize, SZ_256, > &frame->y_dmabuf_attachment, > &frame->y_addr, > @@ -735,7 +738,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, > if (err) > return err; > > - err = tegra_vde_attach_dmabuf(dev, src->cb_fd, > + err = tegra_vde_attach_dmabuf(vde, src->cb_fd, > src->cb_offset, csize, SZ_256, > &frame->cb_dmabuf_attachment, > &frame->cb_addr, > @@ -744,7 +747,7 @@ static int tegra_vde_attach_dmabufs_to_frame(struct > device *dev, > if (err) > goto err_release_y; > > - err = tegra_vde_attach_dmabuf(dev, src->cr_fd, > + err = tegra_vde_attach_dmabuf(vde, src->cr_fd, > src->cr_offset, csize, SZ_256, >
[GIT PULL] Staging/IIO driver patches for 4.19-rc1
The following changes since commit acb1872577b346bd15ab3a3f8dff780d6cca4b70: Linux 4.18-rc7 (2018-07-29 14:44:52 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git tags/staging-4.19-rc1 for you to fetch changes up to e4f6a44c4aeca9eda153302abb0c14d053914f72: staging:rtl8192u: Remove unused macro definitions - Style (2018-08-08 14:27:03 +0200) Staging/IIO patches for 4.19-rc1 Here are the big staging/iio patches for 4.19-rc1. Lots of churn here, with tons of cleanups happening in staging drivers, a removal of an old crypto driver that no one was using (skein), and the addition of some new IIO drivers. Also added was a "gasket" driver from Google that needs loads of work and the erofs filesystem. Even with adding all of the new drivers and a new filesystem, we are only adding about 1000 lines overall to the kernel linecount, which shows just how much cleanup happened, and how big the unused crypto driver was. All of these have been in the linux-next tree for a while now with no reported issues. Note, you will have a merge problem with a device tree IIO file and the MAINTAINERS file, both resolutions are easy, just take all changed. There will be a skein file merge issue as well, but that file got deleted so just drop that. Signed-off-by: Greg Kroah-Hartman Abdun Nihaal (1): staging: mt7621-pci: Fix coding style error Ajay Singh (56): staging: wilc1000: use list_head to maintain 'txq_entry_t' elements of tx queue staging: wilc1000: use list_head to maintain 'rxq_entry_t elements in rx queue staging: wilc1000: remove 'rxq_entries' from 'wilc' struct staging: wilc1000: move 'txq_spinlock_flags' from 'wilc' structure to local variable staging: wilc1000: remove host_if_work() to handle TODO list issue staging: wilc1000: remove unused marco related to HIF commands staging: wilc1000: move the allocation of cmd out of wilc_enqueue_cmd() staging: wilc1000: added 'work_comp' completion as part of host_if_msg staging: wilc1000: remove 'hif_thread_comp' completions staging: wilc1000: rename wilc_enqueue_cmd() to wilc_enqueue_work() staging: wilc1000: handle freeing of key data in wep add key staging: wilc1000: handle freeing of key data in wilc_add_ptk() staging: wilc1000: handle freeing of 'key' & 'seq' data in wilc_add_rx_gtk() staging: wilc1000: avoid use of static variable 'inactive_time' staging: wilc1000: avoid use of static variable 'rssi' staging: wilc1000: updated TODO file staging: wilc1000: fix static checker warning to unlock mutex in wilc_deinit() staging: wilc1000: remove unused enum declaration staging: wilc1000: remove enum connect_status instead use ieee80211_statuscode staging: wilc1000: remove extra enum defined for data rates staging: wilc1000: remove extra enums defined for ieee80211_eid staging: wilc1000: rename goto to avoid leading '_' in label name staging: wilc1000: rename enum CURRENT_TXRATE to use lowercase staging: wilc1000: rename enum SITESURVEY to use lowercase staging: wilc1000: rename enum AUTHTYPE to use lowercase staging: wilc1000: remove unused elements in 'wilc' struct staging: wilc1000: remove unnecessary elements from 'wilc_priv' struct staging: wilc1000: removed unused element from wilc_cfg_frame struct staging: wilc1000: remove the mutliple #define used for same macro staging: wilc1000: use lowercase for 'IFC_UP' struct element name staging: wilc1000: remove unnecessary blank line between variable declaration staging: wilc1000: use single space before opening brances '{' staging: wilc1000: remove unnecessary type used for wid id staging: wilc1000: avoid forward declaration for handle_scan_done() staging: wilc1000: avoid host_int_get_assoc_res_info() forward declaration staging: wilc1000: avoid forward declaration of host_int_parse_join_bss_param() staging: wilc1000: avoid setting default value for variable at declaration staging: wilc1000: use 'int' inplace of 's32' date type staging: wilc1000: remove unnecessary 'NULL' check from cfg80211_ops callbacks staging: wilc1000: move variable assignment along with its declaration staging: wilc1000: remove gpio parameter from wilc_netdev_init() staging: wilc1000: rename variable from 'gpio' to 'gpio_irq' staging: wilc1000: change compatible string from atmel to microchip staging: wilc1000: use descriptor-based interface for GPIO staging: wilc1000: fix TODO to compile spi and sdio components in single module staging: wilc1000: remove unnecessary comments and comments description staging: wilc1000: modified debug log messages descripti
Re: [GIT PULL] Staging/IIO driver patches for 4.19-rc1
On Sat, Aug 18, 2018 at 8:57 AM Greg KH wrote: > > Note, you will have a merge problem with a device tree IIO file and the > MAINTAINERS file, both resolutions are easy, just take all changed. Heh, no. In neither case should I take all changes: the IIO was "delete both sides"), and in the MAINTAINERS file, which was delete one side, add another, somebody can't even sort stuff alphabetically. > There will be a skein file merge issue as well, but that file got > deleted so just drop that. Yes indeed. Linus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
United Nations: SEEKING INTERNATIONAL AID FOR KERALA FLOODS FROM UNITED NATIONS
Hey, I just signed the petition "United Nations: SEEKING INTERNATIONAL AID FOR KERALA FLOODS FROM UNITED NATIONS" and wanted to see if you could help by adding your name. Our goal is to reach 141,538 signatures and we need more support. You can read more and sign the petition here: https://chn.ge/2N1pDhr Thanks! Harold ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: Removed a function and coded inline
This patch removed function named rtw_malloc2d. I removed this function because this function is used exactly once and function call have some overhead also. Maybe this will improve code runtime slightly. Signed-off-by: Bhaskar Singh --- drivers/staging/rtl8188eu/core/rtw_efuse.c| 10 +- drivers/staging/rtl8188eu/include/osdep_service.h | 2 -- drivers/staging/rtl8188eu/os_dep/osdep_service.c | 14 -- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index 0fd306a808c4..befc99c197b1 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c @@ -86,12 +86,20 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) u16 **eFuseWord = NULL; u16 efuse_utilized = 0; u8 u1temp = 0; + int z; + void **a = NULL; efuseTbl = kzalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL); if (!efuseTbl) return; - eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); + a = kzalloc(EFUSE_MAX_SECTION_88E * sizeof(void *) + EFUSE_MAX_SECTION_88E * EFUSE_MAX_WORD_UNIT * sizeof(u16), GFP_KERNEL); + if (!a) + goto out; + for (z = 0; z < EFUSE_MAX_SECTION_88E; z++) + a[z] = ((char *)(a + EFUSE_MAX_SECTION_88E)) + z * EFUSE_MAX_WORD_UNIT * sizeof(u16); +out: + eFuseWord = (u16 **)a; if (!eFuseWord) { DBG_88E("%s: alloc eFuseWord fail!\n", __func__); goto eFuseWord_failed; diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index fbcba79a0927..cfe5698fbbb1 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -64,8 +64,6 @@ static inline int rtw_netif_queue_stopped(struct net_device *pnetdev) u8 *_rtw_malloc(u32 sz); #define rtw_malloc(sz) _rtw_malloc((sz)) -void *rtw_malloc2d(int h, int w, int size); - void _rtw_init_queue(struct __queue *pqueue); struct rtw_netdev_priv_indicator { diff --git a/drivers/staging/rtl8188eu/os_dep/osdep_service.c b/drivers/staging/rtl8188eu/os_dep/osdep_service.c index 78daef6704ac..105f3f21bdea 100644 --- a/drivers/staging/rtl8188eu/os_dep/osdep_service.c +++ b/drivers/staging/rtl8188eu/os_dep/osdep_service.c @@ -18,20 +18,6 @@ u8 *_rtw_malloc(u32 sz) return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); } -void *rtw_malloc2d(int h, int w, int size) -{ - int j; - void **a = kzalloc(h * sizeof(void *) + h * w * size, GFP_KERNEL); - - if (!a) - goto out; - - for (j = 0; j < h; j++) - a[j] = ((char *)(a + h)) + j * w * size; -out: - return a; -} - void _rtw_init_queue(struct __queue *pqueue) { INIT_LIST_HEAD(&pqueue->queue); -- 2.16.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [GIT PULL] Staging/IIO driver patches for 4.19-rc1
On Sat, Aug 18, 2018 at 11:00:20AM -0700, Linus Torvalds wrote: > On Sat, Aug 18, 2018 at 8:57 AM Greg KH wrote: > > > > Note, you will have a merge problem with a device tree IIO file and the > > MAINTAINERS file, both resolutions are easy, just take all changed. > > Heh, no. In neither case should I take all changes: the IIO was > "delete both sides"), and in the MAINTAINERS file, which was delete > one side, add another, somebody can't even sort stuff alphabetically. Ah, wow, I totally read that diff backwards, you are right, thanks. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel